forked from FabricMC/fabric
19w41a
This commit is contained in:
parent
da5bc0bb05
commit
ccd269cfad
40 changed files with 156 additions and 153 deletions
|
@ -12,8 +12,8 @@ plugins {
|
|||
def ENV = System.getenv()
|
||||
|
||||
class Globals {
|
||||
static def baseVersion = "0.4.3"
|
||||
static def mcVersion = "19w40a"
|
||||
static def baseVersion = "0.4.4"
|
||||
static def mcVersion = "19w41a"
|
||||
static def yarnVersion = "+build.1"
|
||||
}
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
archivesBaseName = "fabric-biomes-v1"
|
||||
version = getSubprojectVersion(project, "0.1.1")
|
||||
version = getSubprojectVersion(project, "0.1.2")
|
||||
|
|
|
@ -40,16 +40,16 @@ public class MixinVanillaLayeredBiomeSource {
|
|||
@Shadow
|
||||
@Final
|
||||
@Mutable
|
||||
private static Set<Biome> biomes;
|
||||
private static Set<Biome> BIOMES;
|
||||
|
||||
@Inject(method = "<clinit>", at = @At("RETURN"))
|
||||
private static void cinit(CallbackInfo info){
|
||||
biomes = new HashSet<>(biomes);
|
||||
BIOMES = new HashSet<>(BIOMES);
|
||||
}
|
||||
|
||||
//Called via reflection
|
||||
private static void fabric_injectBiome(Biome biome) {
|
||||
biomes.add(biome);
|
||||
BIOMES.add(biome);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
archivesBaseName = "fabric-blockrenderlayer-v1"
|
||||
version = getSubprojectVersion(project, "1.0.1")
|
||||
version = getSubprojectVersion(project, "1.0.2")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
|
|
|
@ -18,7 +18,7 @@ package net.fabricmc.fabric.api.blockrenderlayer.v1;
|
|||
|
||||
import net.fabricmc.fabric.impl.blockrenderlayer.BlockRenderLayerMapImpl;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRenderLayer;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
|
||||
/**
|
||||
|
@ -43,7 +43,7 @@ public interface BlockRenderLayerMap {
|
|||
* @param block Identifies block to be mapped.
|
||||
* @param renderLayer Render layer. Should be one of the layers used for terrain rendering.
|
||||
*/
|
||||
void putBlock(Block block, BlockRenderLayer renderLayer);
|
||||
void putBlock(Block block, RenderLayer renderLayer);
|
||||
|
||||
/**
|
||||
* Map (or re-map) a fluid state with a render layer. Re-mapping is not recommended but if done, last one in wins.
|
||||
|
@ -52,5 +52,5 @@ public interface BlockRenderLayerMap {
|
|||
* @param fluid Identifies fluid to be mapped.
|
||||
* @param renderLayer Render layer. Should be one of the layers used for terrain rendering.
|
||||
*/
|
||||
void putFluid(Fluid fluid, BlockRenderLayer renderLayer);
|
||||
void putFluid(Fluid fluid, RenderLayer renderLayer);
|
||||
}
|
||||
|
|
|
@ -18,19 +18,19 @@ package net.fabricmc.fabric.impl.blockrenderlayer;
|
|||
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRenderLayer;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
|
||||
public class BlockRenderLayerMapImpl implements BlockRenderLayerMap {
|
||||
private BlockRenderLayerMapImpl() {}
|
||||
|
||||
@Override
|
||||
public void putBlock(Block block, BlockRenderLayer renderLayer) {
|
||||
public void putBlock(Block block, RenderLayer renderLayer) {
|
||||
if (block == null) {
|
||||
LOG.warn("Ignoring request to map null block to BlockRenderLayer");
|
||||
} else if (renderLayer == null) {
|
||||
|
@ -41,7 +41,7 @@ public class BlockRenderLayerMapImpl implements BlockRenderLayerMap {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void putFluid(Fluid fluid, BlockRenderLayer renderLayer) {
|
||||
public void putFluid(Fluid fluid, RenderLayer renderLayer) {
|
||||
if (fluid == null) {
|
||||
LOG.warn("Ignoring request to map null fluid to BlockRenderLayer");
|
||||
} else if (renderLayer == null) {
|
||||
|
@ -59,15 +59,15 @@ public class BlockRenderLayerMapImpl implements BlockRenderLayerMap {
|
|||
// a required parameter of our methods. They are given dummy consumers that log
|
||||
// warnings in case something goes wrong.
|
||||
|
||||
private static BiConsumer<Block, BlockRenderLayer> blockHandler = (b, l) -> {
|
||||
private static BiConsumer<Block, RenderLayer> blockHandler = (b, l) -> {
|
||||
LOG.warn("Unable to map Block {} to BlockRenderLayer. Mapping handler not ready.", b);
|
||||
};
|
||||
|
||||
private static BiConsumer<Fluid, BlockRenderLayer> fluidHandler = (f, b) -> {
|
||||
private static BiConsumer<Fluid, RenderLayer> fluidHandler = (f, b) -> {
|
||||
LOG.warn("Unable to map Fluid {} to BlockRenderLayer. Mapping handler not ready.", f);
|
||||
};
|
||||
|
||||
public static void initialize(BiConsumer<Block, BlockRenderLayer> blockHandlerIn, BiConsumer<Fluid, BlockRenderLayer> fluidHandlerIn) {
|
||||
public static void initialize(BiConsumer<Block, RenderLayer> blockHandlerIn, BiConsumer<Fluid, RenderLayer> fluidHandlerIn) {
|
||||
blockHandler = blockHandlerIn;
|
||||
fluidHandler = fluidHandlerIn;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ package net.fabricmc.fabric.mixin.blockrenderlayer;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
@ -26,13 +27,12 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
|
||||
import net.fabricmc.fabric.impl.blockrenderlayer.BlockRenderLayerMapImpl;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRenderLayer;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
|
||||
@Mixin(BlockRenderLayer.class)
|
||||
@Mixin(RenderLayer.class)
|
||||
public class MixinBlockRenderLayer {
|
||||
@Shadow private static Map<Block, BlockRenderLayer> field_20803;
|
||||
@Shadow private static Map<Fluid, BlockRenderLayer> field_20804;
|
||||
@Shadow private static Map<Block, RenderLayer> field_20803;
|
||||
@Shadow private static Map<Fluid, RenderLayer> field_20804;
|
||||
|
||||
@Inject(method = "<clinit>*", at = @At("RETURN"))
|
||||
private static void onInitialize(CallbackInfo info) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
archivesBaseName = "fabric-dimensions-v1"
|
||||
version = getSubprojectVersion(project, "0.2.0")
|
||||
version = getSubprojectVersion(project, "0.2.1")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
|
|
|
@ -18,14 +18,14 @@ package net.fabricmc.fabric.api.dimension.v1;
|
|||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.class_4545;
|
||||
import net.minecraft.class_4546;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeAccessType;
|
||||
import net.minecraft.world.biome.VoronoiBiomeAccessType;
|
||||
import net.minecraft.world.dimension.Dimension;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
|
||||
|
@ -122,7 +122,7 @@ public final class FabricDimensionType extends DimensionType {
|
|||
private BiFunction<World, DimensionType, ? extends Dimension> factory;
|
||||
private int desiredRawId = 0;
|
||||
private boolean skyLight = true;
|
||||
private class_4545 biomeAccessStrategy = class_4546.INSTANCE;
|
||||
private BiomeAccessType biomeAccessStrategy = VoronoiBiomeAccessType.INSTANCE;
|
||||
|
||||
private Builder() {
|
||||
}
|
||||
|
@ -179,10 +179,10 @@ public final class FabricDimensionType extends DimensionType {
|
|||
* If this method is not called, value defaults to the three-dimensional strategy
|
||||
* used by the End and Nether dimensions.
|
||||
*
|
||||
* @param biomeFunction Function to be used for biome generation.
|
||||
* @param biomeAccessStrategy Function to be used for biome generation.
|
||||
* @return this {@code Builder} object
|
||||
*/
|
||||
public Builder biomeAccessStrategy(class_4545 biomeAccessStrategy) {
|
||||
public Builder biomeAccessStrategy(BiomeAccessType biomeAccessStrategy) {
|
||||
Preconditions.checkNotNull(biomeAccessStrategy);
|
||||
|
||||
this.biomeAccessStrategy = biomeAccessStrategy;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
archivesBaseName = "fabric-events-interaction-v0"
|
||||
version = getSubprojectVersion(project, "0.2.2")
|
||||
version = getSubprojectVersion(project, "0.2.3")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
|
|
|
@ -117,7 +117,7 @@ public class MixinClientPlayerInteractionManager {
|
|||
ActionResult result = UseEntityCallback.EVENT.invoker().interact(player, player.getEntityWorld(), hand, entity, hitResult);
|
||||
if (result != ActionResult.PASS) {
|
||||
if (result == ActionResult.SUCCESS) {
|
||||
Vec3d hitVec = hitResult.getPos().subtract(entity.x, entity.y, entity.z);
|
||||
Vec3d hitVec = hitResult.getPos().subtract(entity.method_23317(), entity.method_23318(), entity.method_23321());
|
||||
this.networkHandler.sendPacket(new PlayerInteractEntityC2SPacket(entity, hand, hitVec));
|
||||
}
|
||||
info.setReturnValue(result);
|
||||
|
|
|
@ -40,7 +40,7 @@ public class MixinServerPlayNetworkHandler {
|
|||
World world = player.getEntityWorld();
|
||||
Entity entity = packet.getEntity(world);
|
||||
if (entity != null) {
|
||||
EntityHitResult hitResult = new EntityHitResult(entity, packet.getHitPosition().add(entity.x, entity.y, entity.z));
|
||||
EntityHitResult hitResult = new EntityHitResult(entity, packet.getHitPosition().add(entity.method_23317(), entity.method_23318(), entity.method_23321()));
|
||||
|
||||
ActionResult result = UseEntityCallback.EVENT.invoker().interact(player, world, packet.getHand(), entity, hitResult);
|
||||
if (result != ActionResult.PASS) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
archivesBaseName = "fabric-networking-v0"
|
||||
version = getSubprojectVersion(project, "0.1.3")
|
||||
version = getSubprojectVersion(project, "0.1.4")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
|
|
|
@ -88,7 +88,7 @@ public final class PlayerStream {
|
|||
}
|
||||
|
||||
// fallback
|
||||
return watching(entity.getEntityWorld(), new ChunkPos((int) (entity.x / 16.0D), (int) (entity.z / 16.0D)));
|
||||
return watching(entity.getEntityWorld(), new ChunkPos((int) (entity.method_23317() / 16.0D), (int) (entity.method_23318() / 16.0D)));
|
||||
}
|
||||
|
||||
public static Stream<PlayerEntity> watching(BlockEntity entity) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
archivesBaseName = "fabric-renderer-api-v1"
|
||||
version = getSubprojectVersion(project, "0.2.3")
|
||||
version = getSubprojectVersion(project, "0.2.4")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package net.fabricmc.fabric.api.renderer.v1.material;
|
||||
|
||||
import net.minecraft.block.BlockRenderLayer;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
|
||||
/**
|
||||
* Defines how sprite pixels will be blended with the scene.
|
||||
|
@ -30,40 +30,40 @@ public enum BlendMode {
|
|||
/**
|
||||
* Fully opaque with depth test, no blending. Used for most normal blocks.
|
||||
*/
|
||||
SOLID(BlockRenderLayer.SOLID),
|
||||
SOLID(RenderLayer.method_23577()),
|
||||
|
||||
/**
|
||||
* Pixels with alpha > 0.5 are rendered as if {@code SOLID}. Other pixels are not rendered.
|
||||
* Texture mip-map enabled. Used for leaves.
|
||||
*/
|
||||
CUTOUT_MIPPED(BlockRenderLayer.CUTOUT_MIPPED),
|
||||
CUTOUT_MIPPED(RenderLayer.method_23579()),
|
||||
|
||||
/**
|
||||
* Pixels with alpha > 0.5 are rendered as if {@code SOLID}. Other pixels are not rendered.
|
||||
* Texture mip-map disabled. Used for iron bars, glass and other cutout sprites with hard edges.
|
||||
*/
|
||||
CUTOUT(BlockRenderLayer.CUTOUT),
|
||||
CUTOUT(RenderLayer.method_23581()),
|
||||
|
||||
/**
|
||||
* Pixels are blended with the background according to alpha color values. Some performance cost,
|
||||
* use in moderation. Texture mip-map enabled. Used for stained glass.
|
||||
*/
|
||||
TRANSLUCENT(BlockRenderLayer.TRANSLUCENT);
|
||||
TRANSLUCENT(RenderLayer.method_23583());
|
||||
|
||||
public final BlockRenderLayer blockRenderLayer;
|
||||
public final RenderLayer blockRenderLayer;
|
||||
|
||||
private BlendMode(BlockRenderLayer blockRenderLayer) {
|
||||
private BlendMode(RenderLayer blockRenderLayer) {
|
||||
this.blockRenderLayer = blockRenderLayer;
|
||||
}
|
||||
|
||||
public static BlendMode fromRenderLayer(BlockRenderLayer renderLayer) {
|
||||
if (renderLayer == BlockRenderLayer.SOLID) {
|
||||
public static BlendMode fromRenderLayer(RenderLayer renderLayer) {
|
||||
if (renderLayer == RenderLayer.method_23577()) {
|
||||
return SOLID;
|
||||
} else if (renderLayer == BlockRenderLayer.CUTOUT_MIPPED) {
|
||||
} else if (renderLayer == RenderLayer.method_23579()) {
|
||||
return CUTOUT_MIPPED;
|
||||
} else if (renderLayer == BlockRenderLayer.CUTOUT) {
|
||||
} else if (renderLayer == RenderLayer.method_23581()) {
|
||||
return CUTOUT;
|
||||
} else if (renderLayer == BlockRenderLayer.TRANSLUCENT) {
|
||||
} else if (renderLayer == RenderLayer.method_23583()) {
|
||||
return TRANSLUCENT;
|
||||
} else {
|
||||
return DEFAULT;
|
||||
|
|
|
@ -19,7 +19,7 @@ package net.fabricmc.fabric.api.renderer.v1.material;
|
|||
import net.fabricmc.fabric.api.renderer.v1.Renderer;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.QuadEmitter;
|
||||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
||||
import net.minecraft.block.BlockRenderLayer;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
|
||||
/**
|
||||
* Finds standard {@link RenderMaterial} instances used to communicate
|
||||
|
@ -65,7 +65,7 @@ public interface MaterialFinder {
|
|||
* @deprecated Use {@code BlendMode} version instead.
|
||||
*/
|
||||
@Deprecated
|
||||
default MaterialFinder blendMode(int spriteIndex, BlockRenderLayer renderLayer) {
|
||||
default MaterialFinder blendMode(int spriteIndex, RenderLayer renderLayer) {
|
||||
return blendMode(spriteIndex, BlendMode.fromRenderLayer(renderLayer));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
archivesBaseName = "fabric-renderer-indigo"
|
||||
version = getSubprojectVersion(project, "0.2.4")
|
||||
version = getSubprojectVersion(project, "0.2.5")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package net.fabricmc.indigo.renderer.accessor;
|
||||
|
||||
import net.minecraft.block.BlockRenderLayer;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
|
||||
public interface AccessChunkRendererData {
|
||||
/**
|
||||
|
@ -25,12 +25,12 @@ public interface AccessChunkRendererData {
|
|||
* @param renderLayer Layer to be initialized.
|
||||
* @return {@code true} if layer was not already initialized.
|
||||
*/
|
||||
boolean fabric_markInitialized(BlockRenderLayer renderLayer);
|
||||
boolean fabric_markInitialized(RenderLayer renderLayer);
|
||||
|
||||
/**
|
||||
* Mark internal tracking set that buffer has content.
|
||||
*
|
||||
* @param renderLayer Layer with content.
|
||||
*/
|
||||
void fabric_markPopulated(BlockRenderLayer renderLayer);
|
||||
void fabric_markPopulated(RenderLayer renderLayer);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@ package net.fabricmc.indigo.renderer.mixin;
|
|||
import java.util.BitSet;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.util.math.MatrixStack;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
@ -30,8 +32,6 @@ import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel;
|
|||
import net.fabricmc.indigo.renderer.accessor.AccessBlockModelRenderer;
|
||||
import net.fabricmc.indigo.renderer.aocalc.VanillaAoHelper;
|
||||
import net.fabricmc.indigo.renderer.render.BlockRenderContext;
|
||||
import net.minecraft.class_4587;
|
||||
import net.minecraft.class_4588;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.color.block.BlockColors;
|
||||
import net.minecraft.client.render.block.BlockModelRenderer;
|
||||
|
@ -51,12 +51,12 @@ public abstract class MixinBlockModelRenderer implements AccessBlockModelRendere
|
|||
private final ThreadLocal<BlockRenderContext> CONTEXTS = ThreadLocal.withInitial(BlockRenderContext::new);
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "tesselate", cancellable = true)
|
||||
private void hookTesselate(BlockRenderView blockView, BakedModel model, BlockState state, BlockPos pos, class_4587 matrix, class_4588 buffer, boolean checkSides, Random rand, long seed, CallbackInfoReturnable<Boolean> ci) {
|
||||
private void hookTesselate(BlockRenderView blockView, BakedModel model, BlockState state, BlockPos pos, MatrixStack matrix, VertexConsumer buffer, boolean checkSides, Random rand, long seed, int overlay, CallbackInfoReturnable<Boolean> ci) {
|
||||
if (!((FabricBakedModel) model).isVanillaAdapter()) {
|
||||
BlockRenderContext context = CONTEXTS.get();
|
||||
|
||||
if (!context.isCallingVanilla()) {
|
||||
ci.setReturnValue(CONTEXTS.get().tesselate((BlockModelRenderer)(Object) this, blockView, model, state, pos, matrix, buffer, checkSides, seed));
|
||||
ci.setReturnValue(CONTEXTS.get().tesselate((BlockModelRenderer)(Object) this, blockView, model, state, pos, matrix, buffer, checkSides, seed, overlay));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,9 @@ package net.fabricmc.indigo.renderer.mixin;
|
|||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.render.chunk.BlockLayeredBufferBuilderStorage;
|
||||
import net.minecraft.util.math.MatrixStack;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
@ -30,14 +33,11 @@ import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel;
|
|||
import net.fabricmc.indigo.Indigo;
|
||||
import net.fabricmc.indigo.renderer.accessor.AccessChunkRendererRegion;
|
||||
import net.fabricmc.indigo.renderer.render.TerrainRenderContext;
|
||||
import net.minecraft.class_4587;
|
||||
import net.minecraft.class_4588;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.client.render.BufferBuilder;
|
||||
import net.minecraft.client.render.block.BlockRenderManager;
|
||||
import net.minecraft.client.render.chunk.BlockLayeredBufferBuilder;
|
||||
import net.minecraft.client.render.chunk.ChunkBatcher;
|
||||
import net.minecraft.client.render.chunk.ChunkBatcher.ChunkRenderer;
|
||||
import net.minecraft.client.render.chunk.ChunkRendererRegion;
|
||||
|
@ -69,7 +69,7 @@ public class MixinChunkRebuildTask {
|
|||
protected ChunkRenderer field_20839;
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "method_22785")
|
||||
private void hookChunkBuild(float float_1, float float_2, float float_3, ChunkBatcher.ChunkRenderData renderData, BlockLayeredBufferBuilder builder, CallbackInfoReturnable<Set<BlockEntity>> ci) {
|
||||
private void hookChunkBuild(float float_1, float float_2, float float_3, ChunkBatcher.ChunkRenderData renderData, BlockLayeredBufferBuilderStorage builder, CallbackInfoReturnable<Set<BlockEntity>> ci) {
|
||||
if (field_20838 != null) {
|
||||
TerrainRenderContext renderer = TerrainRenderContext.POOL.get();
|
||||
renderer.prepare(field_20838, field_20839, renderData, builder);
|
||||
|
@ -94,8 +94,8 @@ public class MixinChunkRebuildTask {
|
|||
* driven off of render type. (Not recommended or encouraged, but also not prevented.)
|
||||
*/
|
||||
@Redirect(method = "method_22785", require = 1, at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/render/block/BlockRenderManager;tesselateBlock(Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/class_4587;Lnet/minecraft/class_4588;ZLjava/util/Random;)Z"))
|
||||
private boolean hookChunkBuildTesselate(BlockRenderManager renderManager, BlockState blockState, BlockPos blockPos, BlockRenderView blockView, class_4587 matrix, class_4588 bufferBuilder, boolean checkSides, Random random) {
|
||||
target = "Lnet/minecraft/client/render/block/BlockRenderManager;tesselateBlock(Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLjava/util/Random;)Z"))
|
||||
private boolean 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);
|
||||
|
||||
|
|
|
@ -18,29 +18,29 @@ package net.fabricmc.indigo.renderer.mixin;
|
|||
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import net.fabricmc.indigo.renderer.accessor.AccessChunkRendererData;
|
||||
import net.minecraft.block.BlockRenderLayer;
|
||||
import net.minecraft.client.render.chunk.ChunkBatcher.ChunkRenderData;
|
||||
|
||||
@Mixin(ChunkRenderData.class)
|
||||
public class MixinChunkRenderData implements AccessChunkRendererData {
|
||||
@Shadow
|
||||
private Set<BlockRenderLayer> initialized;
|
||||
private Set<RenderLayer> initialized;
|
||||
@Shadow
|
||||
private Set<BlockRenderLayer> nonEmpty;
|
||||
private Set<RenderLayer> nonEmpty;
|
||||
@Shadow
|
||||
private boolean empty;
|
||||
|
||||
@Override
|
||||
public boolean fabric_markInitialized(BlockRenderLayer renderLayer) {
|
||||
public boolean fabric_markInitialized(RenderLayer renderLayer) {
|
||||
return initialized.add(renderLayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fabric_markPopulated(BlockRenderLayer renderLayer) {
|
||||
public void fabric_markPopulated(RenderLayer renderLayer) {
|
||||
empty = false;
|
||||
nonEmpty.add(renderLayer);
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package net.fabricmc.indigo.renderer.mixin;
|
||||
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.util.math.MatrixStack;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
@ -25,8 +27,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel;
|
||||
import net.fabricmc.indigo.renderer.render.ItemRenderContext;
|
||||
import net.fabricmc.indigo.renderer.render.ItemRenderContext.VanillaQuadHandler;
|
||||
import net.minecraft.class_4587;
|
||||
import net.minecraft.class_4588;
|
||||
import net.minecraft.client.color.item.ItemColors;
|
||||
import net.minecraft.client.render.item.ItemRenderer;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
|
@ -35,7 +35,7 @@ import net.minecraft.item.ItemStack;
|
|||
@Mixin(ItemRenderer.class)
|
||||
public abstract class MixinItemRenderer {
|
||||
@Shadow
|
||||
protected abstract void method_23182(BakedModel model, ItemStack stack, int color, class_4587 matrixStack, class_4588 buffer);
|
||||
protected abstract void method_23182(BakedModel model, ItemStack stack, int color, int overlay, MatrixStack matrixStack, VertexConsumer buffer);
|
||||
|
||||
@Shadow
|
||||
protected ItemColors colorMap;
|
||||
|
@ -45,11 +45,11 @@ public abstract class MixinItemRenderer {
|
|||
private final ThreadLocal<ItemRenderContext> CONTEXTS = ThreadLocal.withInitial(() -> new ItemRenderContext(colorMap));
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "method_23182", cancellable = true)
|
||||
private void hook_method_23182(BakedModel model, ItemStack stack, int lightmap, class_4587 matrixStack, class_4588 buffer, CallbackInfo ci) {
|
||||
private void hook_method_23182(BakedModel model, ItemStack stack, int lightmap, int overlay, MatrixStack matrixStack, VertexConsumer buffer, CallbackInfo ci) {
|
||||
final FabricBakedModel fabricModel = (FabricBakedModel) model;
|
||||
|
||||
if (!fabricModel.isVanillaAdapter()) {
|
||||
CONTEXTS.get().renderModel(fabricModel, stack, lightmap, matrixStack, buffer, vanillaHandler);
|
||||
CONTEXTS.get().renderModel(fabricModel, stack, lightmap, overlay, matrixStack, buffer, vanillaHandler);
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,16 +30,16 @@ import net.fabricmc.indigo.renderer.helper.GeometryHelper;
|
|||
import net.fabricmc.indigo.renderer.mesh.EncodingFormat;
|
||||
import net.fabricmc.indigo.renderer.mesh.MeshImpl;
|
||||
import net.fabricmc.indigo.renderer.mesh.MutableQuadViewImpl;
|
||||
import net.minecraft.class_4588;
|
||||
import net.minecraft.block.BlockRenderLayer;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
|
||||
/**
|
||||
* Consumer for pre-baked meshes. Works by copying the mesh data to a
|
||||
* "editor" quad held in the instance, where all transformations are applied before buffering.
|
||||
*/
|
||||
public abstract class AbstractMeshConsumer extends AbstractQuadRenderer implements Consumer<Mesh> {
|
||||
protected AbstractMeshConsumer(BlockRenderInfo blockInfo, Function<BlockRenderLayer, class_4588> bufferFunc, AoCalculator aoCalc, QuadTransform transform) {
|
||||
protected AbstractMeshConsumer(BlockRenderInfo blockInfo, Function<RenderLayer, VertexConsumer> bufferFunc, AoCalculator aoCalc, QuadTransform transform) {
|
||||
super(blockInfo, bufferFunc, aoCalc, transform);
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ public abstract class AbstractMeshConsumer extends AbstractQuadRenderer implemen
|
|||
*/
|
||||
private void tesselateQuad(MutableQuadViewImpl quad, RenderMaterialImpl.Value mat, int textureIndex) {
|
||||
final int colorIndex = mat.disableColorIndex(textureIndex) ? -1 : quad.colorIndex();
|
||||
final BlockRenderLayer renderLayer = blockInfo.effectiveRenderLayer(mat.blendMode(textureIndex));
|
||||
final RenderLayer renderLayer = blockInfo.effectiveRenderLayer(mat.blendMode(textureIndex));
|
||||
|
||||
if (blockInfo.defaultAo && !mat.disableAo(textureIndex)) {
|
||||
if (mat.emissive(textureIndex)) {
|
||||
|
|
|
@ -24,10 +24,10 @@ import net.fabricmc.fabric.api.renderer.v1.render.RenderContext.QuadTransform;
|
|||
import net.fabricmc.indigo.renderer.aocalc.AoCalculator;
|
||||
import net.fabricmc.indigo.renderer.helper.ColorHelper;
|
||||
import net.fabricmc.indigo.renderer.mesh.MutableQuadViewImpl;
|
||||
import net.minecraft.class_4588;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRenderLayer;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.util.math.Matrix4f;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
|
@ -38,14 +38,14 @@ import net.minecraft.util.math.BlockPos;
|
|||
public abstract class AbstractQuadRenderer {
|
||||
static final int FULL_BRIGHTNESS = 0xF000F0;
|
||||
|
||||
protected final Function<BlockRenderLayer, class_4588> bufferFunc;
|
||||
protected final Function<RenderLayer, VertexConsumer> bufferFunc;
|
||||
protected final BlockRenderInfo blockInfo;
|
||||
protected final AoCalculator aoCalc;
|
||||
protected final QuadTransform transform;
|
||||
|
||||
protected abstract Matrix4f matrix();
|
||||
|
||||
AbstractQuadRenderer(BlockRenderInfo blockInfo, Function<BlockRenderLayer, class_4588> bufferFunc, AoCalculator aoCalc, QuadTransform transform) {
|
||||
AbstractQuadRenderer(BlockRenderInfo blockInfo, Function<RenderLayer, VertexConsumer> bufferFunc, AoCalculator aoCalc, QuadTransform transform) {
|
||||
this.blockInfo = blockInfo;
|
||||
this.bufferFunc = bufferFunc;
|
||||
this.aoCalc = aoCalc;
|
||||
|
@ -68,18 +68,18 @@ public abstract class AbstractQuadRenderer {
|
|||
}
|
||||
|
||||
/** final output step, common to all renders */
|
||||
private void bufferQuad(MutableQuadViewImpl quad, BlockRenderLayer renderLayer) {
|
||||
private void bufferQuad(MutableQuadViewImpl quad, RenderLayer renderLayer) {
|
||||
bufferQuad(bufferFunc.apply(renderLayer), quad, matrix());
|
||||
}
|
||||
|
||||
public static void bufferQuad(class_4588 buff, MutableQuadViewImpl quad, Matrix4f matrix) {
|
||||
public static void bufferQuad(VertexConsumer buff, MutableQuadViewImpl quad, Matrix4f matrix) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
buff.method_22918(matrix, quad.x(i), quad.y(i), quad.z(i));
|
||||
buff.vertex(matrix, quad.x(i), quad.y(i), quad.z(i));
|
||||
final int color = quad.spriteColor(i, 0);
|
||||
buff.color(color & 0xFF, (color >> 8) & 0xFF, (color >> 16) & 0xFF, (color >> 24) & 0xFF);
|
||||
buff.texture(quad.spriteU(i, 0), quad.spriteV(i, 0));
|
||||
buff.method_22916(quad.lightmap(i));
|
||||
buff.method_22914(quad.normalX(i), quad.normalY(i), quad.normalZ(i));
|
||||
buff.light(quad.lightmap(i));
|
||||
buff.normal(quad.normalX(i), quad.normalY(i), quad.normalZ(i));
|
||||
buff.next();
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ public abstract class AbstractQuadRenderer {
|
|||
// routines below have a bit of copy-paste code reuse to avoid conditional execution inside a hot loop
|
||||
|
||||
/** for non-emissive mesh quads and all fallback quads with smooth lighting*/
|
||||
protected void tesselateSmooth(MutableQuadViewImpl q, BlockRenderLayer renderLayer, int blockColorIndex) {
|
||||
protected void tesselateSmooth(MutableQuadViewImpl q, RenderLayer renderLayer, int blockColorIndex) {
|
||||
colorizeQuad(q, blockColorIndex);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
|
@ -99,7 +99,7 @@ public abstract class AbstractQuadRenderer {
|
|||
}
|
||||
|
||||
/** for emissive mesh quads with smooth lighting*/
|
||||
protected void tesselateSmoothEmissive(MutableQuadViewImpl q, BlockRenderLayer renderLayer, int blockColorIndex) {
|
||||
protected void tesselateSmoothEmissive(MutableQuadViewImpl q, RenderLayer renderLayer, int blockColorIndex) {
|
||||
colorizeQuad(q, blockColorIndex);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
|
@ -111,7 +111,7 @@ public abstract class AbstractQuadRenderer {
|
|||
}
|
||||
|
||||
/** for non-emissive mesh quads and all fallback quads with flat lighting*/
|
||||
protected void tesselateFlat(MutableQuadViewImpl quad, BlockRenderLayer renderLayer, int blockColorIndex) {
|
||||
protected void tesselateFlat(MutableQuadViewImpl quad, RenderLayer renderLayer, int blockColorIndex) {
|
||||
colorizeQuad(quad, blockColorIndex);
|
||||
final int brightness = flatBrightness(quad, blockInfo.blockState, blockInfo.blockPos);
|
||||
|
||||
|
@ -123,7 +123,7 @@ public abstract class AbstractQuadRenderer {
|
|||
}
|
||||
|
||||
/** for emissive mesh quads with flat lighting*/
|
||||
protected void tesselateFlatEmissive(MutableQuadViewImpl quad, BlockRenderLayer renderLayer, int blockColorIndex) {
|
||||
protected void tesselateFlatEmissive(MutableQuadViewImpl quad, RenderLayer renderLayer, int blockColorIndex) {
|
||||
colorizeQuad(quad, blockColorIndex);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
|
@ -147,6 +147,6 @@ public abstract class AbstractQuadRenderer {
|
|||
}
|
||||
|
||||
// Unfortunately cannot use brightness cache here unless we implement one specifically for flat lighting. See #329
|
||||
return blockInfo.blockView.getLightmapIndex(blockState, mpos);
|
||||
return blockInfo.blockView.getLightmapCoordinates(blockState, mpos);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,25 +19,25 @@ package net.fabricmc.indigo.renderer.render;
|
|||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.MutableQuadView;
|
||||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
||||
import net.minecraft.class_4587;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.util.math.Matrix4f;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
|
||||
abstract class AbstractRenderContext implements RenderContext {
|
||||
private final ObjectArrayList<QuadTransform> transformStack = new ObjectArrayList<>();
|
||||
private static final QuadTransform NO_TRANSFORM = (q) -> true;
|
||||
protected class_4587 matrixStack;
|
||||
protected MatrixStack matrixStack;
|
||||
protected Matrix4f matrix;
|
||||
|
||||
protected void prepareMatrix(BlockState blockState, BlockPos blockPos, BlockRenderView blockView, class_4587 matrixStack) {
|
||||
protected void prepareMatrix(BlockState blockState, BlockPos blockPos, BlockRenderView blockView, MatrixStack matrixStack) {
|
||||
this.matrixStack = matrixStack;
|
||||
Vec3d vec = blockState.getOffsetPos(blockView, blockPos);
|
||||
matrixStack.method_22903();
|
||||
matrixStack.method_22904((double)(blockPos.getX() & 15) + vec.x, (double)(blockPos.getY() & 15) + vec.y, (double)(blockPos.getZ() & 15) + vec.z);
|
||||
matrix = matrixStack.method_22910();
|
||||
matrixStack.push();
|
||||
matrixStack.translate((double)(blockPos.getX() & 15) + vec.x, (double)(blockPos.getY() & 15) + vec.y, (double)(blockPos.getZ() & 15) + vec.z);
|
||||
matrix = matrixStack.peek();
|
||||
}
|
||||
|
||||
private final QuadTransform stackTransform = (q) -> {
|
||||
|
|
|
@ -26,14 +26,14 @@ import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel;
|
|||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
||||
import net.fabricmc.indigo.renderer.aocalc.AoCalculator;
|
||||
import net.fabricmc.indigo.renderer.aocalc.AoLuminanceFix;
|
||||
import net.minecraft.class_4587;
|
||||
import net.minecraft.class_4588;
|
||||
import net.minecraft.block.BlockRenderLayer;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.render.block.BlockModelRenderer;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.util.math.Matrix4f;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MatrixStack;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
|
||||
/**
|
||||
|
@ -45,8 +45,9 @@ public class BlockRenderContext extends AbstractRenderContext implements RenderC
|
|||
private final MeshConsumer meshConsumer = new MeshConsumer(blockInfo, this::outputBuffer, aoCalc, this::transform);
|
||||
private final Random random = new Random();
|
||||
private BlockModelRenderer vanillaRenderer;
|
||||
private class_4588 bufferBuilder;
|
||||
private VertexConsumer bufferBuilder;
|
||||
private long seed;
|
||||
private int overlay;
|
||||
private boolean isCallingVanilla = false;
|
||||
private boolean didOutput = false;
|
||||
|
||||
|
@ -59,7 +60,7 @@ public class BlockRenderContext extends AbstractRenderContext implements RenderC
|
|||
return 15 << 20 | 15 << 4;
|
||||
}
|
||||
|
||||
return blockInfo.blockView.getLightmapIndex(blockInfo.blockView.getBlockState(pos), pos);
|
||||
return blockInfo.blockView.getLightmapCoordinates(blockInfo.blockView.getBlockState(pos), pos);
|
||||
}
|
||||
|
||||
private float aoLevel(BlockPos pos) {
|
||||
|
@ -67,17 +68,18 @@ public class BlockRenderContext extends AbstractRenderContext implements RenderC
|
|||
return blockView == null ? 1f : AoLuminanceFix.INSTANCE.apply(blockView, pos);
|
||||
}
|
||||
|
||||
private class_4588 outputBuffer(BlockRenderLayer renderLayer) {
|
||||
private VertexConsumer outputBuffer(RenderLayer renderLayer) {
|
||||
didOutput = true;
|
||||
return bufferBuilder;
|
||||
}
|
||||
|
||||
public boolean tesselate(BlockModelRenderer vanillaRenderer, BlockRenderView blockView, BakedModel model, BlockState state, BlockPos pos, class_4587 matrixStack, class_4588 buffer, boolean checkSides, long seed) {
|
||||
public boolean tesselate(BlockModelRenderer vanillaRenderer, BlockRenderView blockView, BakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, VertexConsumer buffer, boolean checkSides, long seed, int overlay) {
|
||||
this.vanillaRenderer = vanillaRenderer;
|
||||
this.bufferBuilder = buffer;
|
||||
this.prepareMatrix(state, pos, blockView, matrixStack);
|
||||
|
||||
this.seed = seed;
|
||||
this.overlay = overlay;
|
||||
this.didOutput = false;
|
||||
aoCalc.clear();
|
||||
blockInfo.setBlockView(blockView);
|
||||
|
@ -89,19 +91,19 @@ public class BlockRenderContext extends AbstractRenderContext implements RenderC
|
|||
blockInfo.release();
|
||||
this.bufferBuilder = null;
|
||||
|
||||
matrixStack.method_22909();
|
||||
matrixStack.pop();
|
||||
|
||||
return didOutput;
|
||||
}
|
||||
|
||||
protected void acceptVanillaModel(BakedModel model) {
|
||||
isCallingVanilla = true;
|
||||
didOutput = didOutput && vanillaRenderer.tesselate(blockInfo.blockView, model, blockInfo.blockState, blockInfo.blockPos, matrixStack, bufferBuilder, false, random, seed);
|
||||
didOutput = didOutput && vanillaRenderer.tesselate(blockInfo.blockView, model, blockInfo.blockState, blockInfo.blockPos, matrixStack, bufferBuilder, false, random, seed, overlay);
|
||||
isCallingVanilla = false;
|
||||
}
|
||||
|
||||
private class MeshConsumer extends AbstractMeshConsumer {
|
||||
MeshConsumer(BlockRenderInfo blockInfo, Function<BlockRenderLayer, class_4588> bufferFunc, AoCalculator aoCalc, QuadTransform transform) {
|
||||
MeshConsumer(BlockRenderInfo blockInfo, Function<RenderLayer, VertexConsumer> bufferFunc, AoCalculator aoCalc, QuadTransform transform) {
|
||||
super(blockInfo, bufferFunc, aoCalc, transform);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,10 +20,10 @@ import java.util.Random;
|
|||
import java.util.function.Supplier;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.material.BlendMode;
|
||||
import net.minecraft.block.BlockRenderLayer;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.color.block.BlockColors;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
|
@ -43,7 +43,7 @@ public class BlockRenderInfo {
|
|||
public BlockState blockState;
|
||||
public long seed;
|
||||
boolean defaultAo;
|
||||
BlockRenderLayer defaultLayer;
|
||||
RenderLayer defaultLayer;
|
||||
|
||||
public final Supplier<Random> randomSupplier = () -> {
|
||||
final Random result = random;
|
||||
|
@ -69,7 +69,7 @@ public class BlockRenderInfo {
|
|||
seed = -1L;
|
||||
defaultAo = modelAO && MinecraftClient.isAmbientOcclusionEnabled() && blockState.getLuminance() == 0;
|
||||
|
||||
defaultLayer = BlockRenderLayer.method_22715(blockState);
|
||||
defaultLayer = RenderLayer.method_22715(blockState);
|
||||
}
|
||||
|
||||
public void release() {
|
||||
|
@ -85,7 +85,7 @@ public class BlockRenderInfo {
|
|||
return true;
|
||||
}
|
||||
|
||||
BlockRenderLayer effectiveRenderLayer(BlendMode blendMode) {
|
||||
RenderLayer effectiveRenderLayer(BlendMode blendMode) {
|
||||
return blendMode == BlendMode.DEFAULT ? this.defaultLayer : blendMode.blockRenderLayer;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,10 +22,10 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
|||
import net.fabricmc.indigo.renderer.accessor.AccessChunkRenderer;
|
||||
import net.fabricmc.indigo.renderer.accessor.AccessChunkRendererData;
|
||||
import net.fabricmc.indigo.renderer.aocalc.AoLuminanceFix;
|
||||
import net.minecraft.block.BlockRenderLayer;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.render.BufferBuilder;
|
||||
import net.minecraft.client.render.chunk.BlockLayeredBufferBuilder;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.chunk.BlockLayeredBufferBuilderStorage;
|
||||
import net.minecraft.client.render.chunk.ChunkBatcher.ChunkRenderData;
|
||||
import net.minecraft.client.render.chunk.ChunkBatcher.ChunkRenderer;
|
||||
import net.minecraft.client.render.chunk.ChunkRendererRegion;
|
||||
|
@ -68,10 +68,10 @@ public class ChunkRenderInfo {
|
|||
private final BlockPos.Mutable chunkOrigin = new BlockPos.Mutable();
|
||||
AccessChunkRendererData chunkData;
|
||||
ChunkRenderer chunkRenderer;
|
||||
BlockLayeredBufferBuilder builders;
|
||||
BlockLayeredBufferBuilderStorage builders;
|
||||
BlockRenderView blockView;
|
||||
|
||||
private final Object2ObjectOpenHashMap<BlockRenderLayer, BufferBuilder> buffers = new Object2ObjectOpenHashMap<>();
|
||||
private final Object2ObjectOpenHashMap<RenderLayer, BufferBuilder> buffers = new Object2ObjectOpenHashMap<>();
|
||||
|
||||
ChunkRenderInfo() {
|
||||
brightnessCache = new Long2IntOpenHashMap();
|
||||
|
@ -80,7 +80,7 @@ public class ChunkRenderInfo {
|
|||
aoLevelCache.defaultReturnValue(Float.MAX_VALUE);
|
||||
}
|
||||
|
||||
void prepare(ChunkRendererRegion blockView, ChunkRenderer chunkRenderer, ChunkRenderData chunkData, BlockLayeredBufferBuilder builders) {
|
||||
void prepare(ChunkRendererRegion blockView, ChunkRenderer chunkRenderer, ChunkRenderData chunkData, BlockLayeredBufferBuilderStorage builders) {
|
||||
this.blockView = blockView;
|
||||
this.chunkOrigin.set(chunkRenderer.getOrigin());
|
||||
this.chunkData = (AccessChunkRendererData) chunkData;
|
||||
|
@ -98,7 +98,7 @@ public class ChunkRenderInfo {
|
|||
}
|
||||
|
||||
/** Lazily retrieves output buffer for given layer, initializing as needed. */
|
||||
public BufferBuilder getInitializedBuffer(BlockRenderLayer renderLayer) {
|
||||
public BufferBuilder getInitializedBuffer(RenderLayer renderLayer) {
|
||||
BufferBuilder result = buffers.get(renderLayer);
|
||||
|
||||
if (result == null) {
|
||||
|
@ -123,7 +123,7 @@ public class ChunkRenderInfo {
|
|||
int result = brightnessCache.get(key);
|
||||
|
||||
if (result == Integer.MAX_VALUE) {
|
||||
result = blockView.getLightmapIndex(blockView.getBlockState(pos), pos);
|
||||
result = blockView.getLightmapCoordinates(blockView.getBlockState(pos), pos);
|
||||
brightnessCache.put(key, result);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,15 +32,15 @@ import net.fabricmc.indigo.renderer.helper.GeometryHelper;
|
|||
import net.fabricmc.indigo.renderer.mesh.EncodingFormat;
|
||||
import net.fabricmc.indigo.renderer.mesh.MeshImpl;
|
||||
import net.fabricmc.indigo.renderer.mesh.MutableQuadViewImpl;
|
||||
import net.minecraft.class_4587;
|
||||
import net.minecraft.class_4588;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.color.item.ItemColors;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.BakedQuad;
|
||||
import net.minecraft.client.util.math.Matrix4f;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.MatrixStack;
|
||||
|
||||
/**
|
||||
* The render context used for item rendering.
|
||||
|
@ -54,16 +54,17 @@ public class ItemRenderContext extends AbstractRenderContext implements RenderCo
|
|||
/** used to accept a method reference from the ItemRenderer */
|
||||
@FunctionalInterface
|
||||
public static interface VanillaQuadHandler {
|
||||
void accept(BakedModel model, ItemStack stack, int color, class_4587 matrixStack, class_4588 buffer);
|
||||
void accept(BakedModel model, ItemStack stack, int color, int overlay, MatrixStack matrixStack, VertexConsumer buffer);
|
||||
}
|
||||
|
||||
private final ItemColors colorMap;
|
||||
private final Random random = new Random();
|
||||
private final Consumer<BakedModel> fallbackConsumer;
|
||||
class_4588 bufferBuilder;
|
||||
class_4587 matrixStack;
|
||||
VertexConsumer bufferBuilder;
|
||||
MatrixStack matrixStack;
|
||||
Matrix4f matrix;
|
||||
private int lightmap;
|
||||
private int overlay;
|
||||
private ItemStack itemStack;
|
||||
private VanillaQuadHandler vanillaHandler;
|
||||
|
||||
|
@ -80,12 +81,13 @@ public class ItemRenderContext extends AbstractRenderContext implements RenderCo
|
|||
this.fallbackConsumer = this::fallbackConsumer;
|
||||
}
|
||||
|
||||
public void renderModel(FabricBakedModel model, ItemStack stack, int lightmap, class_4587 matrixStack, class_4588 buffer, VanillaQuadHandler vanillaHandler) {
|
||||
public void renderModel(FabricBakedModel model, ItemStack stack, int lightmap, int overlay, MatrixStack matrixStack, VertexConsumer buffer, VanillaQuadHandler vanillaHandler) {
|
||||
this.lightmap = lightmap;
|
||||
this.overlay = overlay;
|
||||
this.itemStack = stack;
|
||||
this.bufferBuilder = buffer;
|
||||
this.matrixStack = matrixStack;
|
||||
this.matrix = matrixStack.method_22910();
|
||||
this.matrix = matrixStack.peek();
|
||||
|
||||
this.vanillaHandler = vanillaHandler;
|
||||
model.emitItemQuads(stack, randomSupplier, this);
|
||||
|
@ -171,12 +173,12 @@ public class ItemRenderContext extends AbstractRenderContext implements RenderCo
|
|||
}
|
||||
} else {
|
||||
for (int i = 0; i <= ModelHelper.NULL_FACE_ID; i++) {
|
||||
vanillaHandler.accept(model, itemStack, lightmap, matrixStack, bufferBuilder);
|
||||
vanillaHandler.accept(model, itemStack, lightmap, overlay, matrixStack, bufferBuilder);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private void renderFallbackWithTransform(class_4588 bufferBuilder, List<BakedQuad> quads, int color, ItemStack stack, Direction cullFace) {
|
||||
private void renderFallbackWithTransform(VertexConsumer bufferBuilder, List<BakedQuad> quads, int color, ItemStack stack, Direction cullFace) {
|
||||
if (quads.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -23,9 +23,8 @@ import net.fabricmc.fabric.api.renderer.v1.mesh.QuadEmitter;
|
|||
import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel;
|
||||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
||||
import net.fabricmc.indigo.renderer.aocalc.AoCalculator;
|
||||
import net.minecraft.class_4587;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.render.chunk.BlockLayeredBufferBuilder;
|
||||
import net.minecraft.client.render.chunk.BlockLayeredBufferBuilderStorage;
|
||||
import net.minecraft.client.render.chunk.ChunkBatcher.ChunkRenderData;
|
||||
import net.minecraft.client.render.chunk.ChunkBatcher.ChunkRenderer;
|
||||
import net.minecraft.client.render.chunk.ChunkRendererRegion;
|
||||
|
@ -35,6 +34,7 @@ import net.minecraft.util.crash.CrashException;
|
|||
import net.minecraft.util.crash.CrashReport;
|
||||
import net.minecraft.util.crash.CrashReportSection;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MatrixStack;
|
||||
|
||||
/**
|
||||
* Implementation of {@link RenderContext} used during terrain rendering.
|
||||
|
@ -49,7 +49,7 @@ public class TerrainRenderContext extends AbstractRenderContext implements Rende
|
|||
private final TerrainMeshConsumer meshConsumer = new TerrainMeshConsumer(blockInfo, chunkInfo, aoCalc, this::transform, this::matrix);
|
||||
private final TerrainFallbackConsumer fallbackConsumer = new TerrainFallbackConsumer(blockInfo, chunkInfo, aoCalc, this::transform, this::matrix);
|
||||
|
||||
public TerrainRenderContext prepare(ChunkRendererRegion blockView, ChunkRenderer chunkRenderer, ChunkRenderData chunkData, BlockLayeredBufferBuilder builders) {
|
||||
public TerrainRenderContext prepare(ChunkRendererRegion blockView, ChunkRenderer chunkRenderer, ChunkRenderData chunkData, BlockLayeredBufferBuilderStorage builders) {
|
||||
blockInfo.setBlockView(blockView);
|
||||
chunkInfo.prepare(blockView, chunkRenderer, chunkData, builders);
|
||||
return this;
|
||||
|
@ -65,7 +65,7 @@ public class TerrainRenderContext extends AbstractRenderContext implements Rende
|
|||
}
|
||||
|
||||
/** Called from chunk renderer hook. */
|
||||
public boolean tesselateBlock(BlockState blockState, BlockPos blockPos, final BakedModel model, class_4587 matrixStack) {
|
||||
public boolean tesselateBlock(BlockState blockState, BlockPos blockPos, final BakedModel model, MatrixStack matrixStack) {
|
||||
prepareMatrix(blockState, blockPos, blockInfo.blockView, matrixStack);
|
||||
try {
|
||||
aoCalc.clear();
|
||||
|
@ -77,7 +77,7 @@ public class TerrainRenderContext extends AbstractRenderContext implements Rende
|
|||
CrashReportSection.addBlockInfo(crashReportElement_1, blockPos, blockState);
|
||||
throw new CrashException(crashReport_1);
|
||||
}
|
||||
matrixStack.method_22909();
|
||||
matrixStack.pop();
|
||||
// false because we've already marked the chunk as populated - caller doesn't need to
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
archivesBaseName = "fabric-rendering-data-attachment-v1"
|
||||
version = getSubprojectVersion(project, "0.1.1")
|
||||
version = getSubprojectVersion(project, "0.1.2")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
package net.fabricmc.fabric.mixin.rendering.data;
|
||||
|
||||
import net.fabricmc.fabric.api.rendering.data.v1.RenderAttachedBlockView;
|
||||
import net.minecraft.class_4538;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
import net.minecraft.world.WorldView;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
/** Make {@link BlockRenderView} implement {@link RenderAttachedBlockView}. */
|
||||
@Mixin(class_4538.class)
|
||||
@Mixin(WorldView.class)
|
||||
public interface MixinViewableWorld extends RenderAttachedBlockView {
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
archivesBaseName = "fabric-rendering-fluids-v1"
|
||||
version = getSubprojectVersion(project, "0.1.3")
|
||||
version = getSubprojectVersion(project, "0.1.4")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
|
|
|
@ -19,8 +19,7 @@ package net.fabricmc.fabric.mixin.client.render.fluid;
|
|||
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandler;
|
||||
import net.fabricmc.fabric.impl.client.render.fluid.FluidRendererHookContainer;
|
||||
import net.fabricmc.fabric.impl.client.render.fluid.FluidRenderHandlerRegistryImpl;
|
||||
import net.minecraft.class_4588;
|
||||
import net.minecraft.client.render.BufferBuilder;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.render.block.FluidRenderer;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
|
@ -50,7 +49,7 @@ public class MixinFluidRenderer {
|
|||
}
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "tesselate", cancellable = true)
|
||||
public void tesselate(BlockRenderView view, BlockPos pos, class_4588 class_4588, FluidState state, CallbackInfoReturnable<Boolean> info) {
|
||||
public void tesselate(BlockRenderView view, BlockPos pos, VertexConsumer vertexConsumer, FluidState state, CallbackInfoReturnable<Boolean> info) {
|
||||
FluidRendererHookContainer ctr = fabric_renderHandler.get();
|
||||
FluidRenderHandler handler = FluidRenderHandlerRegistryImpl.INSTANCE.getOverride(state.getFluid());
|
||||
|
||||
|
@ -71,7 +70,7 @@ public class MixinFluidRenderer {
|
|||
}
|
||||
|
||||
@Inject(at = @At("RETURN"), method = "tesselate")
|
||||
public void tesselateReturn(BlockRenderView view, BlockPos pos, class_4588 class_4588, FluidState state, CallbackInfoReturnable<Boolean> info) {
|
||||
public void tesselateReturn(BlockRenderView view, BlockPos pos, VertexConsumer vertexConsumer, FluidState state, CallbackInfoReturnable<Boolean> info) {
|
||||
fabric_renderHandler.get().clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
archivesBaseName = "fabric-resource-loader-v0"
|
||||
version = getSubprojectVersion(project, "0.1.4")
|
||||
version = getSubprojectVersion(project, "0.1.5")
|
||||
|
|
|
@ -122,7 +122,7 @@ public class ModNioResourcePack extends AbstractFileResourcePack implements ModR
|
|||
String nioPath = path.replace("/", separator);
|
||||
|
||||
for (String namespace : getNamespaces(type)) {
|
||||
Path namespacePath = getPath(type.getName() + "/" + namespace);
|
||||
Path namespacePath = getPath(type.getDirectory() + "/" + namespace);
|
||||
if (namespacePath != null) {
|
||||
Path searchPath = namespacePath.resolve(nioPath).toAbsolutePath().normalize();
|
||||
|
||||
|
@ -166,7 +166,7 @@ public class ModNioResourcePack extends AbstractFileResourcePack implements ModR
|
|||
}
|
||||
|
||||
try {
|
||||
Path typePath = getPath(type.getName());
|
||||
Path typePath = getPath(type.getDirectory());
|
||||
if (typePath == null || !(Files.isDirectory(typePath))) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
|
|
@ -18,15 +18,15 @@ package net.fabricmc.fabric.impl.resources;
|
|||
|
||||
import net.fabricmc.fabric.api.resource.ModResourcePack;
|
||||
import net.minecraft.resource.ResourcePack;
|
||||
import net.minecraft.resource.ResourcePackContainer;
|
||||
import net.minecraft.resource.ResourcePackCreator;
|
||||
import net.minecraft.resource.ResourcePackProfile;
|
||||
import net.minecraft.resource.ResourcePackProvider;
|
||||
import net.minecraft.resource.ResourceType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ModResourcePackCreator implements ResourcePackCreator {
|
||||
public class ModResourcePackCreator implements ResourcePackProvider {
|
||||
private final ResourceType type;
|
||||
|
||||
public ModResourcePackCreator(ResourceType type) {
|
||||
|
@ -34,7 +34,7 @@ public class ModResourcePackCreator implements ResourcePackCreator {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T extends ResourcePackContainer> void registerContainer(Map<String, T> map, ResourcePackContainer.Factory<T> factory) {
|
||||
public <T extends ResourcePackProfile> void register(Map<String, T> map, ResourcePackProfile.Factory<T> factory) {
|
||||
// TODO: "vanilla" does not emit a message; neither should a modded datapack
|
||||
List<ResourcePack> packs = new ArrayList<>();
|
||||
ModResourcePackUtil.appendModResourcePacks(packs, type);
|
||||
|
@ -43,8 +43,8 @@ public class ModResourcePackCreator implements ResourcePackCreator {
|
|||
throw new RuntimeException("Not a ModResourcePack!");
|
||||
}
|
||||
|
||||
T var3 = ResourcePackContainer.of("fabric/" + ((ModResourcePack) pack).getFabricModMetadata().getId(),
|
||||
false, () -> pack, factory, ResourcePackContainer.InsertionPosition.TOP);
|
||||
T var3 = ResourcePackProfile.of("fabric/" + ((ModResourcePack) pack).getFabricModMetadata().getId(),
|
||||
false, () -> pack, factory, ResourcePackProfile.InsertionPosition.TOP);
|
||||
|
||||
if (var3 != null) {
|
||||
map.put(var3.getName(), var3);
|
||||
|
|
|
@ -36,12 +36,12 @@ public class MixinDefaultResourcePack {
|
|||
|
||||
@Inject(method = "findInputStream", at = @At("HEAD"), cancellable = true)
|
||||
protected void onFindInputStream(ResourceType resourceType, Identifier identifier, CallbackInfoReturnable<InputStream> callback) {
|
||||
if(DefaultResourcePack.RESOURCE_PATH != null) {
|
||||
if(DefaultResourcePack.resourcePath != null) {
|
||||
// Fall through to Vanilla logic, they have a special case here.
|
||||
return;
|
||||
}
|
||||
|
||||
String path = resourceType.getName() + "/" + identifier.getNamespace() + "/" + identifier.getPath();
|
||||
String path = resourceType.getDirectory() + "/" + identifier.getNamespace() + "/" + identifier.getPath();
|
||||
URL found = null;
|
||||
|
||||
try {
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
package net.fabricmc.fabric.mixin.resources;
|
||||
|
||||
import net.fabricmc.fabric.impl.resources.ModResourcePackCreator;
|
||||
import net.minecraft.resource.ResourcePackContainer;
|
||||
import net.minecraft.resource.ResourcePackContainerManager;
|
||||
import net.minecraft.resource.ResourcePackProfile;
|
||||
import net.minecraft.resource.ResourcePackManager;
|
||||
import net.minecraft.resource.ResourceType;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.level.LevelProperties;
|
||||
|
@ -33,10 +33,10 @@ import java.io.File;
|
|||
@Mixin(MinecraftServer.class)
|
||||
public class MixinMinecraftServer {
|
||||
@Shadow
|
||||
private ResourcePackContainerManager<ResourcePackContainer> dataPackContainerManager;
|
||||
private ResourcePackManager<ResourcePackProfile> dataPackManager;
|
||||
|
||||
@Inject(method = "loadWorldDataPacks", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/ResourcePackContainerManager;addCreator(Lnet/minecraft/resource/ResourcePackCreator;)V", ordinal = 1))
|
||||
@Inject(method = "loadWorldDataPacks", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/ResourcePackManager;registerProvider(Lnet/minecraft/resource/ResourcePackProvider;)V", ordinal = 1))
|
||||
public void appendFabricDataPacks(File file, LevelProperties properties, CallbackInfo info) {
|
||||
dataPackContainerManager.addCreator(new ModResourcePackCreator(ResourceType.SERVER_DATA));
|
||||
dataPackManager.registerProvider(new ModResourcePackCreator(ResourceType.SERVER_DATA));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue