mirror of
https://github.com/FabricMC/fabric.git
synced 2025-04-21 03:10:54 -04:00
Update mappings.
This commit is contained in:
parent
f71b366fb1
commit
23acfcd6a1
24 changed files with 67 additions and 65 deletions
fabric-biome-api-v1/src
main/java/net/fabricmc/fabric/impl/biome
testmod/java/net/fabricmc/fabric/test/biome
fabric-dimensions-v1/src/testmod
java/net/fabricmc/fabric/test/dimension
resources/data/fabric_dimension/dimension_type
fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item
fabric-models-v0/src/testmod/java/net/fabricmc/fabric/test/model
fabric-object-builder-api-v1/src
main/java/net/fabricmc/fabric/mixin/object/builder
testmod/java/net/fabricmc/fabric/test/object/builder
fabric-particles-v1/src/main/java/net/fabricmc/fabric/impl/client/particle
fabric-renderer-api-v1/src
main/java/net/fabricmc/fabric
api/renderer/v1/model
mixin/renderer/client
testmod/java/net/fabricmc/fabric/test/renderer/simple/client
fabric-renderer-indigo/src/main/java/net/fabricmc/fabric
impl/client/indigo/renderer/render
mixin/client/indigo/renderer
fabric-screen-api-v1/src/testmod/java/net/fabricmc/fabric/test/screen
gradle.properties
|
@ -26,6 +26,8 @@ import com.google.common.base.Preconditions;
|
|||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import net.minecraft.util.math.noise.PerlinNoiseSampler;
|
||||
import net.minecraft.util.math.random.CheckedRandom;
|
||||
import net.minecraft.util.math.random.ChunkRandom;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryEntry;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
|
@ -33,8 +35,6 @@ import net.minecraft.world.biome.Biome;
|
|||
import net.minecraft.world.biome.BiomeKeys;
|
||||
import net.minecraft.world.biome.source.TheEndBiomeSource;
|
||||
import net.minecraft.world.biome.source.util.MultiNoiseUtil;
|
||||
import net.minecraft.util.math.random.AtomicSimpleRandom;
|
||||
import net.minecraft.util.math.random.ChunkRandom;
|
||||
|
||||
/**
|
||||
* Internal data for modding Vanilla's {@link TheEndBiomeSource}.
|
||||
|
@ -162,7 +162,7 @@ public final class TheEndBiomeData {
|
|||
Long seed = Overrides.seed.get();
|
||||
if (seed == null) throw new IllegalStateException("seed isn't set, ChunkGenerator hook not working?");
|
||||
|
||||
ret = new PerlinNoiseSampler(new ChunkRandom(new AtomicSimpleRandom(seed)));
|
||||
ret = new PerlinNoiseSampler(new ChunkRandom(new CheckedRandom(seed)));
|
||||
samplers.put(noise, ret);
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ public class FabricBiomeTest implements ModInitializer {
|
|||
|
||||
ConfiguredFeature<?, ?> COMMON_DESERT_WELL = new ConfiguredFeature<>(Feature.DESERT_WELL, DefaultFeatureConfig.INSTANCE);
|
||||
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, new Identifier(MOD_ID, "fab_desert_well"), COMMON_DESERT_WELL);
|
||||
RegistryEntry<ConfiguredFeature<?, ?>> featureEntry = BuiltinRegistries.CONFIGURED_FEATURE.method_44298(BuiltinRegistries.CONFIGURED_FEATURE.getKey(COMMON_DESERT_WELL).orElseThrow());
|
||||
RegistryEntry<ConfiguredFeature<?, ?>> featureEntry = BuiltinRegistries.CONFIGURED_FEATURE.getOrCreateEntry(BuiltinRegistries.CONFIGURED_FEATURE.getKey(COMMON_DESERT_WELL).orElseThrow());
|
||||
|
||||
// The placement config is taken from the vanilla desert well, but no randomness
|
||||
PlacedFeature PLACED_COMMON_DESERT_WELL = new PlacedFeature(featureEntry, List.of(SquarePlacementModifier.of(), PlacedFeatures.MOTION_BLOCKING_HEIGHTMAP, BiomePlacementModifier.of()));
|
||||
|
|
|
@ -52,7 +52,7 @@ public class VoidChunkGenerator extends ChunkGenerator {
|
|||
private final Registry<Biome> biomeRegistry;
|
||||
|
||||
public VoidChunkGenerator(Registry<StructureSet> registry, Registry<Biome> biomeRegistry) {
|
||||
super(registry, Optional.empty(), new FixedBiomeSource(biomeRegistry.method_44298(BiomeKeys.PLAINS)));
|
||||
super(registry, Optional.empty(), new FixedBiomeSource(biomeRegistry.getOrCreateEntry(BiomeKeys.PLAINS)));
|
||||
this.biomeRegistry = biomeRegistry;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,5 +13,7 @@
|
|||
"piglin_safe" : false,
|
||||
"height": 256,
|
||||
"min_y": 0,
|
||||
"effects": "fabric_dimension:void"
|
||||
"effects": "fabric_dimension:void",
|
||||
"monster_spawn_block_light_limit": 15,
|
||||
"monster_spawn_light_level": 15
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public abstract class ItemStackMixin {
|
|||
this.fabric_breakCallback = breakCallback;
|
||||
}
|
||||
|
||||
@ModifyArg(method = "damage(ILnet/minecraft/entity/LivingEntity;Ljava/util/function/Consumer;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;damage(ILnet/minecraft/util/math/random/AbstractRandom;Lnet/minecraft/server/network/ServerPlayerEntity;)Z"), index = 0)
|
||||
@ModifyArg(method = "damage(ILnet/minecraft/entity/LivingEntity;Ljava/util/function/Consumer;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;damage(ILnet/minecraft/util/math/random/Random;Lnet/minecraft/server/network/ServerPlayerEntity;)Z"), index = 0)
|
||||
private int hookDamage(int amount) {
|
||||
CustomDamageHandler handler = ((ItemExtensions) getItem()).fabric_getCustomDamageHandler();
|
||||
|
||||
|
|
|
@ -24,11 +24,11 @@ import net.minecraft.client.render.model.BakedModel;
|
|||
import net.minecraft.client.render.model.BakedQuad;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.random.AbstractRandom;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
|
||||
public class BakedModelRenderer {
|
||||
private static final Direction[] CULL_FACES = ArrayUtils.add(Direction.values(), null);
|
||||
private static final AbstractRandom RANDOM = AbstractRandom.createAtomic();
|
||||
private static final Random RANDOM = Random.create();
|
||||
|
||||
public static void renderBakedModel(BakedModel model, VertexConsumer vertices, MatrixStack.Entry entry, int light) {
|
||||
for (Direction cullFace : CULL_FACES) {
|
||||
|
|
|
@ -29,7 +29,7 @@ import net.minecraft.entity.Entity;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.registry.DefaultedRegistry;
|
||||
import net.minecraft.village.TradeOffer;
|
||||
import net.minecraft.util.math.random.AbstractRandom;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
|
||||
@Mixin(targets = "net/minecraft/village/TradeOffers$TypeAwareBuyForOneEmeraldFactory")
|
||||
public abstract class TypeAwareTradeMixin {
|
||||
|
@ -48,7 +48,7 @@ public abstract class TypeAwareTradeMixin {
|
|||
* To prevent "item" -> "air" trades, if the result of a type aware trade is air, make sure no offer is created.
|
||||
*/
|
||||
@Inject(method = "create", at = @At(value = "NEW", target = "net/minecraft/village/TradeOffer"), locals = LocalCapture.CAPTURE_FAILEXCEPTION, cancellable = true)
|
||||
private void failOnNullItem(Entity entity, AbstractRandom random, CallbackInfoReturnable<TradeOffer> cir, ItemStack buyingItem) {
|
||||
private void failOnNullItem(Entity entity, Random random, CallbackInfoReturnable<TradeOffer> cir, ItemStack buyingItem) {
|
||||
if (buyingItem.isEmpty()) { // Will return true for an "empty" item stack that had null passed in the ctor
|
||||
cir.setReturnValue(null); // Return null to prevent creation of empty trades
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ package net.fabricmc.fabric.test.object.builder;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.village.TradeOffer;
|
||||
import net.minecraft.village.TradeOffers;
|
||||
import net.minecraft.util.math.random.AbstractRandom;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
|
||||
class SimpleTradeFactory implements TradeOffers.Factory {
|
||||
private final TradeOffer offer;
|
||||
|
@ -29,7 +29,7 @@ class SimpleTradeFactory implements TradeOffers.Factory {
|
|||
}
|
||||
|
||||
@Override
|
||||
public TradeOffer create(Entity entity, AbstractRandom random) {
|
||||
public TradeOffer create(Entity entity, Random random) {
|
||||
// ALWAYS supply a copy of the offer.
|
||||
return new TradeOffer(this.offer.toNbt());
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import net.minecraft.entity.passive.WanderingTraderEntity;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.math.random.AbstractRandom;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
import net.minecraft.village.TradeOffer;
|
||||
import net.minecraft.village.TradeOffers;
|
||||
import net.minecraft.village.VillagerProfession;
|
||||
|
@ -68,7 +68,7 @@ public class VillagerTypeTest1 implements ModInitializer {
|
|||
|
||||
for (TradeOffers.Factory[] value : TradeOffers.WANDERING_TRADER_TRADES.values()) {
|
||||
for (TradeOffers.Factory factory : value) {
|
||||
final TradeOffer result = factory.create(trader, AbstractRandom.createAtomic());
|
||||
final TradeOffer result = factory.create(trader, Random.create());
|
||||
|
||||
if (result == null) {
|
||||
continue;
|
||||
|
|
|
@ -22,7 +22,7 @@ import net.minecraft.client.particle.ParticleManager;
|
|||
import net.minecraft.client.particle.SpriteProvider;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||
import net.minecraft.util.math.random.AbstractRandom;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
|
||||
import net.fabricmc.fabric.api.client.particle.v1.FabricSpriteProvider;
|
||||
import net.fabricmc.fabric.mixin.client.particle.ParticleManagerAccessor;
|
||||
|
@ -52,7 +52,7 @@ public class FabricSpriteProviderImpl implements FabricSpriteProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Sprite getSprite(AbstractRandom random) {
|
||||
public Sprite getSprite(Random random) {
|
||||
return delegate.getSprite(random);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
import net.minecraft.util.math.random.AbstractRandom;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.Renderer;
|
||||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
||||
|
@ -42,7 +42,7 @@ import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
|||
*/
|
||||
public interface FabricBakedModel {
|
||||
/**
|
||||
* When true, signals renderer this producer is implemented through {@link BakedModel#getQuads(BlockState, net.minecraft.util.math.Direction, AbstractRandom)}.
|
||||
* When true, signals renderer this producer is implemented through {@link BakedModel#getQuads(BlockState, net.minecraft.util.math.Direction, Random)}.
|
||||
* Also means the model does not rely on any non-vanilla features.
|
||||
* Allows the renderer to optimize or route vanilla models through the unmodified vanilla pipeline if desired.
|
||||
*
|
||||
|
@ -64,7 +64,7 @@ public interface FabricBakedModel {
|
|||
* <p>Also called to render block models outside of chunk rebuild or block entity rendering.
|
||||
* Typically this happens when the block is being rendered as an entity, not as a block placed in the world.
|
||||
* Currently this happens for falling blocks and blocks being pushed by a piston, but renderers
|
||||
* should invoke this for all calls to {@link BlockModelRenderer#render(BlockRenderView, BakedModel, BlockState, BlockPos, MatrixStack, VertexConsumer, boolean, AbstractRandom, long, int)}
|
||||
* should invoke this for all calls to {@link BlockModelRenderer#render(BlockRenderView, BakedModel, BlockState, BlockPos, MatrixStack, VertexConsumer, boolean, Random, long, int)}
|
||||
* that occur outside of chunk rebuilds to allow for features added by mods, unless
|
||||
* {@link #isVanillaAdapter()} returns true.
|
||||
*
|
||||
|
@ -78,7 +78,7 @@ public interface FabricBakedModel {
|
|||
* neighboring blocks (if appropriate). Models only need to consider "sides" to the
|
||||
* extent the model is driven by connection with neighbor blocks or other world state.
|
||||
*
|
||||
* <p>Note: with {@link BakedModel#getQuads(BlockState, net.minecraft.util.math.Direction, AbstractRandom)}, the random
|
||||
* <p>Note: with {@link BakedModel#getQuads(BlockState, net.minecraft.util.math.Direction, Random)}, the random
|
||||
* parameter is normally initialized with the same seed prior to each face layer.
|
||||
* Model authors should note this method is called only once per block, and call the provided
|
||||
* Random supplier multiple times if re-seeding is necessary. For wrapped vanilla baked models,
|
||||
|
@ -94,7 +94,7 @@ public interface FabricBakedModel {
|
|||
* Will not be thread-safe. Do not cache or retain a reference.
|
||||
* @param context Accepts model output.
|
||||
*/
|
||||
void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<AbstractRandom> randomSupplier, RenderContext context);
|
||||
void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context);
|
||||
|
||||
/**
|
||||
* This method will be called during item rendering to generate both the static and
|
||||
|
@ -123,5 +123,5 @@ public interface FabricBakedModel {
|
|||
* logic here, instead of returning every possible shape from {@link BakedModel#getOverrides}
|
||||
* as vanilla baked models.
|
||||
*/
|
||||
void emitItemQuads(ItemStack stack, Supplier<AbstractRandom> randomSupplier, RenderContext context);
|
||||
void emitItemQuads(ItemStack stack, Supplier<Random> randomSupplier, RenderContext context);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
import net.minecraft.util.math.random.AbstractRandom;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
||||
|
||||
|
@ -42,7 +42,7 @@ public abstract class ForwardingBakedModel implements BakedModel, FabricBakedMod
|
|||
protected BakedModel wrapped;
|
||||
|
||||
@Override
|
||||
public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<AbstractRandom> randomSupplier, RenderContext context) {
|
||||
public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context) {
|
||||
((FabricBakedModel) wrapped).emitBlockQuads(blockView, state, pos, randomSupplier, context);
|
||||
}
|
||||
|
||||
|
@ -52,12 +52,12 @@ public abstract class ForwardingBakedModel implements BakedModel, FabricBakedMod
|
|||
}
|
||||
|
||||
@Override
|
||||
public void emitItemQuads(ItemStack stack, Supplier<AbstractRandom> randomSupplier, RenderContext context) {
|
||||
public void emitItemQuads(ItemStack stack, Supplier<Random> randomSupplier, RenderContext context) {
|
||||
((FabricBakedModel) wrapped).emitItemQuads(stack, randomSupplier, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(BlockState blockState, Direction face, AbstractRandom rand) {
|
||||
public List<BakedQuad> getQuads(BlockState blockState, Direction face, Random rand) {
|
||||
return wrapped.getQuads(blockState, face, rand);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import net.minecraft.client.render.model.BakedModel;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
import net.minecraft.util.math.random.AbstractRandom;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel;
|
||||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
||||
|
@ -41,12 +41,12 @@ public interface MixinBakedModel extends FabricBakedModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
default void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<AbstractRandom> randomSupplier, RenderContext context) {
|
||||
default void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context) {
|
||||
context.fallbackConsumer().accept((BakedModel) this);
|
||||
}
|
||||
|
||||
@Override
|
||||
default void emitItemQuads(ItemStack stack, Supplier<AbstractRandom> randomSupplier, RenderContext context) {
|
||||
default void emitItemQuads(ItemStack stack, Supplier<Random> randomSupplier, RenderContext context) {
|
||||
context.fallbackConsumer().accept((BakedModel) this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ import net.minecraft.client.render.model.MultipartBakedModel;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
import net.minecraft.util.math.random.AbstractRandom;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel;
|
||||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
||||
|
@ -71,7 +71,7 @@ public class MixinMultipartBakedModel implements FabricBakedModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<AbstractRandom> randomSupplier, RenderContext context) {
|
||||
public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context) {
|
||||
BitSet bitSet = this.stateCache.get(state);
|
||||
|
||||
if (bitSet == null) {
|
||||
|
@ -95,7 +95,7 @@ public class MixinMultipartBakedModel implements FabricBakedModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void emitItemQuads(ItemStack stack, Supplier<AbstractRandom> randomSupplier, RenderContext context) {
|
||||
public void emitItemQuads(ItemStack stack, Supplier<Random> randomSupplier, RenderContext context) {
|
||||
// Vanilla doesn't use MultipartBakedModel for items.
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ import net.minecraft.util.collection.Weighted;
|
|||
import net.minecraft.util.collection.Weighting;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
import net.minecraft.util.math.random.AbstractRandom;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel;
|
||||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
||||
|
@ -67,7 +67,7 @@ public class MixinWeightedBakedModel implements FabricBakedModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<AbstractRandom> randomSupplier, RenderContext context) {
|
||||
public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context) {
|
||||
Weighted.Present<BakedModel> selected = Weighting.getAt(this.models, Math.abs((int) randomSupplier.get().nextLong()) % this.totalWeight).orElse(null);
|
||||
|
||||
if (selected != null) {
|
||||
|
@ -76,7 +76,7 @@ public class MixinWeightedBakedModel implements FabricBakedModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void emitItemQuads(ItemStack stack, Supplier<AbstractRandom> randomSupplier, RenderContext context) {
|
||||
public void emitItemQuads(ItemStack stack, Supplier<Random> randomSupplier, RenderContext context) {
|
||||
Weighted.Present<BakedModel> selected = Weighting.getAt(this.models, Math.abs((int) randomSupplier.get().nextLong()) % this.totalWeight).orElse(null);
|
||||
|
||||
if (selected != null) {
|
||||
|
|
|
@ -34,7 +34,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
import net.minecraft.util.math.random.AbstractRandom;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.MutableQuadView;
|
||||
|
@ -53,7 +53,7 @@ final class FrameBakedModel implements BakedModel, FabricBakedModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction face, AbstractRandom random) {
|
||||
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction face, Random random) {
|
||||
return Collections.emptyList(); // Renderer API makes this obsolete, so return no quads
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ final class FrameBakedModel implements BakedModel, FabricBakedModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<AbstractRandom> randomSupplier, RenderContext context) {
|
||||
public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context) {
|
||||
// Emit our frame mesh
|
||||
context.meshConsumer().accept(this.frameMesh);
|
||||
|
||||
|
@ -131,7 +131,7 @@ final class FrameBakedModel implements BakedModel, FabricBakedModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void emitItemQuads(ItemStack stack, Supplier<AbstractRandom> randomSupplier, RenderContext context) {
|
||||
public void emitItemQuads(ItemStack stack, Supplier<Random> randomSupplier, RenderContext context) {
|
||||
// TODO: Implement an item test.
|
||||
// For now we will just leave this as I have not added a block item yet
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.math.Matrix3f;
|
||||
import net.minecraft.util.math.Matrix4f;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
import net.minecraft.util.math.random.AbstractRandom;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.QuadEmitter;
|
||||
|
@ -49,9 +49,9 @@ public class BlockRenderContext extends AbstractRenderContext {
|
|||
private boolean didOutput = false;
|
||||
// These are kept as fields to avoid the heap allocation for a supplier.
|
||||
// BlockModelRenderer allows the caller to supply both the random object and seed.
|
||||
private AbstractRandom random;
|
||||
private Random random;
|
||||
private long seed;
|
||||
private final Supplier<AbstractRandom> randomSupplier = () -> {
|
||||
private final Supplier<Random> randomSupplier = () -> {
|
||||
random.setSeed(seed);
|
||||
return random;
|
||||
};
|
||||
|
@ -112,7 +112,7 @@ public class BlockRenderContext extends AbstractRenderContext {
|
|||
return bufferBuilder;
|
||||
}
|
||||
|
||||
public boolean render(BlockRenderView blockView, BakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, VertexConsumer buffer, AbstractRandom random, long seed, int overlay) {
|
||||
public boolean render(BlockRenderView blockView, BakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, VertexConsumer buffer, Random random, long seed, int overlay) {
|
||||
this.bufferBuilder = buffer;
|
||||
this.matrix = matrixStack.peek().getPositionMatrix();
|
||||
this.normalMatrix = matrixStack.peek().getNormalMatrix();
|
||||
|
|
|
@ -26,7 +26,7 @@ import net.minecraft.client.render.RenderLayers;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
import net.minecraft.util.math.random.AbstractRandom;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.material.BlendMode;
|
||||
|
||||
|
@ -39,7 +39,7 @@ import net.fabricmc.fabric.api.renderer.v1.material.BlendMode;
|
|||
*/
|
||||
public class BlockRenderInfo {
|
||||
private final BlockColors blockColorMap = MinecraftClient.getInstance().getBlockColors();
|
||||
private final AbstractRandom random = AbstractRandom.createAtomic();
|
||||
private final Random random = Random.create();
|
||||
public BlockRenderView blockView;
|
||||
public BlockPos blockPos;
|
||||
public BlockState blockState;
|
||||
|
@ -47,8 +47,8 @@ public class BlockRenderInfo {
|
|||
boolean defaultAo;
|
||||
RenderLayer defaultLayer;
|
||||
|
||||
public final Supplier<AbstractRandom> randomSupplier = () -> {
|
||||
final AbstractRandom result = random;
|
||||
public final Supplier<Random> randomSupplier = () -> {
|
||||
final Random result = random;
|
||||
long seed = this.seed;
|
||||
|
||||
if (seed == -1L) {
|
||||
|
|
|
@ -39,7 +39,7 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.util.math.random.AbstractRandom;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.material.BlendMode;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
|
||||
|
@ -67,10 +67,10 @@ public class ItemRenderContext extends AbstractRenderContext {
|
|||
}
|
||||
|
||||
private final ItemColors colorMap;
|
||||
private final AbstractRandom random = AbstractRandom.createAtomic();
|
||||
private final Random random = Random.create();
|
||||
private final Vec3f normalVec = new Vec3f();
|
||||
|
||||
private final Supplier<AbstractRandom> randomSupplier = () -> {
|
||||
private final Supplier<Random> randomSupplier = () -> {
|
||||
random.setSeed(ITEM_RANDOM_SEED);
|
||||
return random;
|
||||
};
|
||||
|
|
|
@ -27,7 +27,7 @@ import net.minecraft.client.render.VertexConsumer;
|
|||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.BakedQuad;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.random.AbstractRandom;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.QuadEmitter;
|
||||
import net.fabricmc.fabric.api.renderer.v1.model.ModelHelper;
|
||||
|
@ -80,7 +80,7 @@ public abstract class TerrainFallbackConsumer extends AbstractQuadRenderer imple
|
|||
|
||||
@Override
|
||||
public void accept(BakedModel model) {
|
||||
final Supplier<AbstractRandom> random = blockInfo.randomSupplier;
|
||||
final Supplier<Random> random = blockInfo.randomSupplier;
|
||||
final Value defaultMaterial = blockInfo.defaultAo && model.useAmbientOcclusion() ? MATERIAL_SHADED : MATERIAL_FLAT;
|
||||
final BlockState blockState = blockInfo.blockState;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import net.minecraft.client.render.block.BlockModelRenderer;
|
|||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.random.AbstractRandom;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel;
|
||||
|
@ -40,8 +40,8 @@ public abstract class MixinBlockModelRenderer {
|
|||
@Unique
|
||||
private final ThreadLocal<BlockRenderContext> fabric_contexts = ThreadLocal.withInitial(BlockRenderContext::new);
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "render(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLnet/minecraft/util/math/random/AbstractRandom;JI)V", cancellable = true)
|
||||
private void hookRender(BlockRenderView blockView, BakedModel model, BlockState state, BlockPos pos, MatrixStack matrix, VertexConsumer buffer, boolean checkSides, AbstractRandom rand, long seed, int overlay, CallbackInfo ci) {
|
||||
@Inject(at = @At("HEAD"), method = "render(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLnet/minecraft/util/math/random/Random;JI)V", cancellable = true)
|
||||
private void hookRender(BlockRenderView blockView, BakedModel model, BlockState state, BlockPos pos, MatrixStack matrix, VertexConsumer buffer, boolean checkSides, Random rand, long seed, int overlay, CallbackInfo ci) {
|
||||
if (!((FabricBakedModel) model).isVanillaAdapter()) {
|
||||
BlockRenderContext context = fabric_contexts.get();
|
||||
// Note that we do not support face-culling here (so checkSides is ignored)
|
||||
|
|
|
@ -41,7 +41,7 @@ import net.minecraft.client.render.model.BakedModel;
|
|||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.random.AbstractRandom;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel;
|
||||
|
@ -77,7 +77,7 @@ public abstract class MixinChunkRebuildTask {
|
|||
private void hookChunkBuild(float cameraX, float cameraY, float cameraZ,
|
||||
BlockBufferBuilderStorage builder,
|
||||
CallbackInfoReturnable<BuiltChunk.RebuildTask.RenderData> ci,
|
||||
BuiltChunk.RebuildTask.RenderData renderData, int i, BlockPos blockPos, BlockPos blockPos2, ChunkOcclusionDataBuilder chunkOcclusionDataBuilder, ChunkRendererRegion region, MatrixStack matrixStack, Set<RenderLayer> initializedLayers, AbstractRandom abstractRandom, BlockRenderManager blockRenderManager) {
|
||||
BuiltChunk.RebuildTask.RenderData renderData, int i, BlockPos blockPos, BlockPos blockPos2, ChunkOcclusionDataBuilder chunkOcclusionDataBuilder, ChunkRendererRegion region, MatrixStack matrixStack, Set<RenderLayer> initializedLayers, Random abstractRandom, BlockRenderManager blockRenderManager) {
|
||||
// hook just before iterating over the render chunk's chunks blocks, captures the used renderlayer set
|
||||
// accessing this.region is unsafe due to potential async cancellation, the LV has to be used!
|
||||
|
||||
|
@ -90,21 +90,21 @@ public abstract class MixinChunkRebuildTask {
|
|||
* This is the hook that actually implements the rendering API for terrain rendering.
|
||||
*
|
||||
* <p>It's unusual to have a @Redirect in a Fabric library, but in this case
|
||||
* it is our explicit intention that {@link BlockRenderManager#renderBlock(BlockState, BlockPos, BlockRenderView, MatrixStack, VertexConsumer, boolean, AbstractRandom)}
|
||||
* it is our explicit intention that {@link BlockRenderManager#renderBlock(BlockState, BlockPos, BlockRenderView, MatrixStack, VertexConsumer, boolean, Random)}
|
||||
* does not execute for models that will be rendered by our renderer.
|
||||
*
|
||||
* <p>Any mod that wants to redirect this specific call is likely also a renderer, in which case this
|
||||
* renderer should not be present, or the mod should probably instead be relying on the renderer API
|
||||
* which was specifically created to provide for enhanced terrain rendering.
|
||||
*
|
||||
* <p>Note also that {@link BlockRenderManager#renderBlock(BlockState, BlockPos, BlockRenderView, MatrixStack, VertexConsumer, boolean, AbstractRandom)}
|
||||
* <p>Note also that {@link BlockRenderManager#renderBlock(BlockState, BlockPos, BlockRenderView, MatrixStack, VertexConsumer, boolean, Random)}
|
||||
* IS called if the block render type is something other than {@link BlockRenderType#MODEL}.
|
||||
* Normally this does nothing but will allow mods to create rendering hooks that are
|
||||
* driven off of render type. (Not recommended or encouraged, but also not prevented.)
|
||||
*/
|
||||
@Redirect(method = "render", require = 1, at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/render/block/BlockRenderManager;renderBlock(Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLnet/minecraft/util/math/random/AbstractRandom;)V"))
|
||||
private void hookChunkBuildTesselate(BlockRenderManager renderManager, BlockState blockState, BlockPos blockPos, BlockRenderView blockView, MatrixStack matrix, VertexConsumer bufferBuilder, boolean checkSides, AbstractRandom random) {
|
||||
target = "Lnet/minecraft/client/render/block/BlockRenderManager;renderBlock(Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLnet/minecraft/util/math/random/Random;)V"))
|
||||
private void hookChunkBuildTesselate(BlockRenderManager renderManager, BlockState blockState, BlockPos blockPos, BlockRenderView blockView, MatrixStack matrix, VertexConsumer bufferBuilder, boolean checkSides, Random random) {
|
||||
if (blockState.getRenderType() == BlockRenderType.MODEL) {
|
||||
final BakedModel model = renderManager.getModel(blockState);
|
||||
|
||||
|
|
|
@ -25,10 +25,10 @@ import net.minecraft.sound.SoundEvents;
|
|||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryEntry;
|
||||
import net.minecraft.util.math.random.AbstractRandom;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
|
||||
class SoundButton extends PressableWidget {
|
||||
private static final AbstractRandom RANDOM = AbstractRandom.createAtomic();
|
||||
private static final Random RANDOM = Random.create();
|
||||
|
||||
SoundButton(int x, int y, int width, int height) {
|
||||
super(x, y, width, height, Text.of("Sound Button"));
|
||||
|
|
|
@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx2560M
|
|||
|
||||
version=0.52.4
|
||||
minecraft_version=1.19-pre1
|
||||
yarn_version=+build.1
|
||||
yarn_version=+build.4
|
||||
loader_version=0.14.5
|
||||
|
||||
prerelease=true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue