diff --git a/patches/minecraft/net/minecraft/client/renderer/block/ModelBlockRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/ModelBlockRenderer.java.patch index 358043063a..1643f267fa 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/ModelBlockRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/ModelBlockRenderer.java.patch @@ -111,6 +111,14 @@ } } +@@ -113,6 +_,7 @@ + private void m_111012_(BlockAndTintGetter p_111013_, BlockState p_111014_, BlockPos p_111015_, PoseStack p_111016_, VertexConsumer p_111017_, List p_111018_, float[] p_111019_, BitSet p_111020_, ModelBlockRenderer.AmbientOcclusionFace p_111021_, int p_111022_) { + for(BakedQuad bakedquad : p_111018_) { + this.m_111039_(p_111013_, p_111014_, p_111015_, bakedquad.m_111303_(), bakedquad.m_111306_(), p_111019_, p_111020_); ++ if (!net.minecraftforge.client.ForgeHooksClient.calculateFaceWithoutAO(p_111013_, p_111014_, p_111015_, bakedquad, p_111020_.get(0), p_111021_.f_111149_, p_111021_.f_111150_)) + p_111021_.m_111167_(p_111013_, p_111014_, p_111015_, bakedquad.m_111306_(), p_111019_, p_111020_, bakedquad.m_111307_()); + this.m_111023_(p_111013_, p_111014_, p_111015_, p_111017_, p_111016_.m_85850_(), bakedquad, p_111021_.f_111149_[0], p_111021_.f_111149_[1], p_111021_.f_111149_[2], p_111021_.f_111149_[3], p_111021_.f_111150_[0], p_111021_.f_111150_[1], p_111021_.f_111150_[2], p_111021_.f_111150_[3], p_111022_); + } @@ -217,17 +_,21 @@ } diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch new file mode 100644 index 0000000000..0586d173e7 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch @@ -0,0 +1,32 @@ +--- a/net/minecraft/client/renderer/block/model/BakedQuad.java ++++ b/net/minecraft/client/renderer/block/model/BakedQuad.java +@@ -12,13 +_,19 @@ + protected final Direction f_111294_; + protected final TextureAtlasSprite f_111295_; + private final boolean f_111296_; ++ private final boolean hasAmbientOcclusion; + + public BakedQuad(int[] p_111298_, int p_111299_, Direction p_111300_, TextureAtlasSprite p_111301_, boolean p_111302_) { ++ this(p_111298_, p_111299_, p_111300_, p_111301_, p_111302_, true); ++ } ++ ++ public BakedQuad(int[] p_111298_, int p_111299_, Direction p_111300_, TextureAtlasSprite p_111301_, boolean p_111302_, boolean hasAmbientOcclusion) { + this.f_111292_ = p_111298_; + this.f_111293_ = p_111299_; + this.f_111294_ = p_111300_; + this.f_111295_ = p_111301_; + this.f_111296_ = p_111302_; ++ this.hasAmbientOcclusion = hasAmbientOcclusion; + } + + public TextureAtlasSprite m_173410_() { +@@ -43,5 +_,9 @@ + + public boolean m_111307_() { + return this.f_111296_; ++ } ++ ++ public boolean hasAmbientOcclusion() { ++ return this.hasAmbientOcclusion; + } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/BlockElementFace.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/BlockElementFace.java.patch index 2ace5597ed..d9f7684e44 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/BlockElementFace.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/BlockElementFace.java.patch @@ -1,25 +1,31 @@ --- a/net/minecraft/client/renderer/block/model/BlockElementFace.java +++ b/net/minecraft/client/renderer/block/model/BlockElementFace.java -@@ -19,12 +_,18 @@ +@@ -19,12 +_,24 @@ public final int f_111355_; public final String f_111356_; public final BlockFaceUV f_111357_; + public final int emissivity; ++ public final boolean hasAmbientOcclusion; public BlockElementFace(@Nullable Direction p_111359_, int p_111360_, String p_111361_, BlockFaceUV p_111362_) { -+ this(p_111359_, p_111360_, p_111361_, p_111362_, 0); ++ this(p_111359_, p_111360_, p_111361_, p_111362_, 0, true); + } + + public BlockElementFace(@Nullable Direction p_111359_, int p_111360_, String p_111361_, BlockFaceUV p_111362_, int emissivity) { ++ this(p_111359_, p_111360_, p_111361_, p_111362_, emissivity, true); ++ } ++ ++ public BlockElementFace(@Nullable Direction p_111359_, int p_111360_, String p_111361_, BlockFaceUV p_111362_, int emissivity, boolean hasAmbientOcclusion) { this.f_111354_ = p_111359_; this.f_111355_ = p_111360_; this.f_111356_ = p_111361_; this.f_111357_ = p_111362_; + this.emissivity = emissivity; ++ this.hasAmbientOcclusion = hasAmbientOcclusion; } @OnlyIn(Dist.CLIENT) -@@ -37,7 +_,10 @@ +@@ -37,7 +_,11 @@ int i = this.m_111368_(jsonobject); String s = this.m_111370_(jsonobject); BlockFaceUV blockfaceuv = p_111367_.deserialize(jsonobject, BlockFaceUV.class); @@ -27,7 +33,8 @@ + int emissivity = GsonHelper.m_13824_(jsonobject, "emissivity", 0); + if (emissivity != net.minecraft.util.Mth.m_14045_(emissivity, 0, 15)) + throw new JsonParseException("The emissivity value must be between 0 and 15. Found: " + emissivity); -+ return new BlockElementFace(direction, i, s, blockfaceuv, emissivity); ++ boolean hasAmbientOcclusion = GsonHelper.m_13855_(jsonobject, "ambientocclusion", true); ++ return new BlockElementFace(direction, i, s, blockfaceuv, emissivity, hasAmbientOcclusion); } protected int m_111368_(JsonObject p_111369_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch index 86fcd70264..68967343cd 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch @@ -6,7 +6,7 @@ - return new BakedQuad(aint, p_111603_.f_111355_, direction, p_111604_, p_111608_); + net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, direction); -+ var quad = new BakedQuad(aint, p_111603_.f_111355_, direction, p_111604_, p_111608_); ++ var quad = new BakedQuad(aint, p_111603_.f_111355_, direction, p_111604_, p_111608_, p_111603_.hasAmbientOcclusion); + net.minecraftforge.client.model.QuadTransformers.settingEmissivity(p_111603_.emissivity).processInPlace(quad); + return quad; } diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 432dd98181..b735b85394 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -55,6 +55,7 @@ import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.ShaderInstance; import net.minecraft.client.renderer.Sheets; import net.minecraft.client.renderer.block.BlockRenderDispatcher; +import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.renderer.culling.Frustum; import net.minecraft.client.renderer.texture.TextureAtlas; @@ -561,6 +562,18 @@ public class ForgeHooksClient return new Vector3f(x, y, z); } + public static boolean calculateFaceWithoutAO(BlockAndTintGetter getter, BlockState state, BlockPos pos, BakedQuad quad, boolean isFaceCubic, float[] brightness, int[] lightmap) + { + if (quad.hasAmbientOcclusion()) + return false; + + BlockPos lightmapPos = isFaceCubic ? pos.relative(quad.getDirection()) : pos; + + brightness[0] = brightness[1] = brightness[2] = brightness[3] = getter.getShade(quad.getDirection(), quad.isShade()); + lightmap[0] = lightmap[1] = lightmap[2] = lightmap[3] = LevelRenderer.getLightColor(getter, state, lightmapPos); + return true; + } + public static void loadEntityShader(Entity entity, GameRenderer entityRenderer) { if (entity != null) diff --git a/src/main/java/net/minecraftforge/client/model/IQuadTransformer.java b/src/main/java/net/minecraftforge/client/model/IQuadTransformer.java index 4579c0b8d7..8b2b0ca487 100644 --- a/src/main/java/net/minecraftforge/client/model/IQuadTransformer.java +++ b/src/main/java/net/minecraftforge/client/model/IQuadTransformer.java @@ -92,7 +92,7 @@ public interface IQuadTransformer private static BakedQuad copy(BakedQuad quad) { var vertices = quad.getVertices(); - return new BakedQuad(Arrays.copyOf(vertices, vertices.length), quad.getTintIndex(), quad.getDirection(), quad.getSprite(), quad.isShade()); + return new BakedQuad(Arrays.copyOf(vertices, vertices.length), quad.getTintIndex(), quad.getDirection(), quad.getSprite(), quad.isShade(), quad.hasAmbientOcclusion()); } private static int findOffset(VertexFormatElement element) diff --git a/src/main/java/net/minecraftforge/client/model/generators/ModelBuilder.java b/src/main/java/net/minecraftforge/client/model/generators/ModelBuilder.java index a4771da8e0..bbd9e564bf 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/ModelBuilder.java +++ b/src/main/java/net/minecraftforge/client/model/generators/ModelBuilder.java @@ -320,6 +320,9 @@ public class ModelBuilder> extends ModelFile { if (face.emissivity > 0) { faceObj.addProperty("emissivity", face.emissivity); } + if (!face.hasAmbientOcclusion) { + faceObj.addProperty("ambientocclusion", face.hasAmbientOcclusion); + } faces.add(dir.getSerializedName(), faceObj); } if (!part.faces.isEmpty()) { @@ -517,6 +520,7 @@ public class ModelBuilder> extends ModelFile { private float[] uvs; private FaceRotation rotation = FaceRotation.ZERO; private int emissivity = 0; + private boolean hasAmbientOcclusion = true; FaceBuilder(Direction dir) { // param unused for functional match @@ -583,11 +587,22 @@ public class ModelBuilder> extends ModelFile { return emissivity(15); } + /** + * Set the ambient occlusion of the face. + * + * @param ao the ambient occlusion + * @return this builder + */ + public FaceBuilder ao(boolean ao) { + this.hasAmbientOcclusion = ao; + return this; + } + BlockElementFace build() { if (this.texture == null) { throw new IllegalStateException("A model face must have a texture"); } - return new BlockElementFace(cullface, tintindex, texture, new BlockFaceUV(uvs, rotation.rotation), emissivity); + return new BlockElementFace(cullface, tintindex, texture, new BlockFaceUV(uvs, rotation.rotation), emissivity, hasAmbientOcclusion); } public ElementBuilder end() { return ElementBuilder.this; } diff --git a/src/main/java/net/minecraftforge/client/model/lighting/ForgeModelBlockRenderer.java b/src/main/java/net/minecraftforge/client/model/lighting/ForgeModelBlockRenderer.java index 9ff7906934..e801ee02de 100644 --- a/src/main/java/net/minecraftforge/client/model/lighting/ForgeModelBlockRenderer.java +++ b/src/main/java/net/minecraftforge/client/model/lighting/ForgeModelBlockRenderer.java @@ -7,6 +7,7 @@ package net.minecraftforge.client.model.lighting; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.Minecraft; import net.minecraft.client.color.block.BlockColors; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.block.ModelBlockRenderer; @@ -67,8 +68,11 @@ public class ForgeModelBlockRenderer extends ModelBlockRenderer public static boolean render(VertexConsumer vertexConsumer, QuadLighter lighter, BlockAndTintGetter level, BakedModel model, BlockState state, BlockPos pos, PoseStack poseStack, boolean checkSides, RandomSource rand, long seed, int packedOverlay, ModelData modelData, RenderType renderType) { + ForgeModelBlockRenderer renderer = (ForgeModelBlockRenderer)Minecraft.getInstance().getBlockRenderer().getModelRenderer(); var pose = poseStack.last(); var empty = true; + var smoothLighter = lighter instanceof SmoothQuadLighter; + QuadLighter flatLighter = null; rand.setSeed(seed); List quads = model.getQuads(state, null, rand, modelData, renderType); @@ -78,7 +82,19 @@ public class ForgeModelBlockRenderer extends ModelBlockRenderer lighter.setup(level, pos, state); for (BakedQuad quad : quads) { - lighter.process(vertexConsumer, pose, quad, packedOverlay); + if (smoothLighter && !quad.hasAmbientOcclusion()) + { + if (flatLighter == null) + { + flatLighter = renderer.flatLighter.get(); + flatLighter.setup(level, pos, state); + } + flatLighter.process(vertexConsumer, pose, quad, packedOverlay); + } + else + { + lighter.process(vertexConsumer, pose, quad, packedOverlay); + } } } @@ -99,11 +115,25 @@ public class ForgeModelBlockRenderer extends ModelBlockRenderer } for (BakedQuad quad : quads) { - lighter.process(vertexConsumer, pose, quad, packedOverlay); + if (smoothLighter && !quad.hasAmbientOcclusion()) + { + if (flatLighter == null) + { + flatLighter = renderer.flatLighter.get(); + flatLighter.setup(level, pos, state); + } + flatLighter.process(vertexConsumer, pose, quad, packedOverlay); + } + else + { + lighter.process(vertexConsumer, pose, quad, packedOverlay); + } } } } lighter.reset(); + if (flatLighter != null) + flatLighter.reset(); return !empty; } } diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/QuadBakingVertexConsumer.java b/src/main/java/net/minecraftforge/client/model/pipeline/QuadBakingVertexConsumer.java index 08fcc503b4..cb6018f761 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/QuadBakingVertexConsumer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/QuadBakingVertexConsumer.java @@ -44,6 +44,7 @@ public class QuadBakingVertexConsumer implements VertexConsumer private Direction direction = Direction.DOWN; private TextureAtlasSprite sprite = UnitTextureAtlasSprite.INSTANCE; private boolean shade; + private boolean hasAmbientOcclusion; public QuadBakingVertexConsumer(Consumer quadConsumer) { @@ -127,7 +128,7 @@ public class QuadBakingVertexConsumer implements VertexConsumer if (++vertexIndex != 4) return; // We have a full quad, pass it to the consumer and reset - quadConsumer.accept(new BakedQuad(quadData, tintIndex, direction, sprite, shade)); + quadConsumer.accept(new BakedQuad(quadData, tintIndex, direction, sprite, shade, hasAmbientOcclusion)); vertexIndex = 0; quadData = new int[QUAD_DATA_SIZE]; } @@ -161,4 +162,9 @@ public class QuadBakingVertexConsumer implements VertexConsumer { this.shade = shade; } + + public void setHasAmbientOcclusion(boolean hasAmbientOcclusion) + { + this.hasAmbientOcclusion = hasAmbientOcclusion; + } } diff --git a/src/main/resources/forge.exc b/src/main/resources/forge.exc index 2f71a11166..dfc06a7a44 100644 --- a/src/main/resources/forge.exc +++ b/src/main/resources/forge.exc @@ -15,7 +15,8 @@ net/minecraft/client/renderer/block/ModelBlockRenderer.renderModel(Lcom/mojang/b net/minecraft/client/renderer/block/ModelBlockRenderer.tesselateBlock(Lnet/minecraft/world/level/BlockAndTintGetter;Lnet/minecraft/client/resources/model/BakedModel;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/BlockPos;Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;ZLnet/minecraft/util/RandomSource;JILnet/minecraftforge/client/model/data/ModelData;Lnet/minecraft/client/renderer/RenderType;)V=|p_111048_,p_111049_,p_111050_,p_111051_,p_111052_,p_111053_,p_111054_,p_111055_,p_111056_,p_111057_,modelData,renderType net/minecraft/client/renderer/block/ModelBlockRenderer.tesselateWithAO(Lnet/minecraft/world/level/BlockAndTintGetter;Lnet/minecraft/client/resources/model/BakedModel;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/BlockPos;Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;ZLnet/minecraft/util/RandomSource;JILnet/minecraftforge/client/model/data/ModelData;Lnet/minecraft/client/renderer/RenderType;)V=|p_111079_,p_111080_,p_111081_,p_111082_,p_111083_,p_111084_,p_111085_,p_111086_,p_111087_,p_111088_,modelData,renderType net/minecraft/client/renderer/block/ModelBlockRenderer.tesselateWithoutAO(Lnet/minecraft/world/level/BlockAndTintGetter;Lnet/minecraft/client/resources/model/BakedModel;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/BlockPos;Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;ZLnet/minecraft/util/RandomSource;JILnet/minecraftforge/client/model/data/ModelData;Lnet/minecraft/client/renderer/RenderType;)V=|p_111091_,p_111092_,p_111093_,p_111094_,p_111095_,p_111096_,p_111097_,p_111098_,p_111099_,p_111100_,modelData,renderType -net/minecraft/client/renderer/block/model/BlockElementFace.(Lnet/minecraft/core/Direction;ILjava/lang/String;Lnet/minecraft/client/renderer/block/model/BlockFaceUV;I)V=|p_111359_,p_111360_,p_111361_,p_111362_,emissivity +net/minecraft/client/renderer/block/model/BakedQuad.([IILnet/minecraft/core/Direction;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;ZZ)V=|p_111298_,p_111299_,p_111300_,p_111301_,p_111302_,hasAmbientOcclusion +net/minecraft/client/renderer/block/model/BlockElementFace.(Lnet/minecraft/core/Direction;ILjava/lang/String;Lnet/minecraft/client/renderer/block/model/BlockFaceUV;IZ)V=|p_111359_,p_111360_,p_111361_,p_111362_,emissivity,hasAmbientOcclusion net/minecraft/client/renderer/block/model/BlockModel.bakeVanilla(Lnet/minecraft/client/resources/model/ModelBakery;Lnet/minecraft/client/renderer/block/model/BlockModel;Ljava/util/function/Function;Lnet/minecraft/client/resources/model/ModelState;Lnet/minecraft/resources/ResourceLocation;ZLnet/minecraftforge/client/RenderTypeGroup;)Lnet/minecraft/client/resources/model/BakedModel;=|p_111450_,p_111451_,p_111452_,p_111453_,p_111454_,p_111455_,renderTypes net/minecraft/client/renderer/block/model/ItemTransform.(Lcom/mojang/math/Vector3f;Lcom/mojang/math/Vector3f;Lcom/mojang/math/Vector3f;Lcom/mojang/math/Vector3f;)V=|p_111760_,p_111761_,p_111762_,rightRotation net/minecraft/client/renderer/block/model/ItemTransforms.(Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lcom/google/common/collect/ImmutableMap;)V=|p_111798_,p_111799_,p_111800_,p_111801_,p_111802_,p_111803_,p_111804_,p_111805_,moddedTransforms diff --git a/src/test/java/net/minecraftforge/debug/client/AmbientOcclusionElementsTest.java b/src/test/java/net/minecraftforge/debug/client/AmbientOcclusionElementsTest.java new file mode 100644 index 0000000000..1c1ec981e3 --- /dev/null +++ b/src/test/java/net/minecraftforge/debug/client/AmbientOcclusionElementsTest.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.debug.client; + +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.material.Material; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; + +/** + * Test mod that demos disabling ambient occlusion on specific faces of "elements" models. + */ +@Mod(AmbientOcclusionElementsTest.MOD_ID) +public class AmbientOcclusionElementsTest +{ + public static final String MOD_ID = "ambient_occlusion_elements_test"; + private static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MOD_ID); + private static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MOD_ID); + + public static final RegistryObject AO_BLOCK_SHADE = BLOCKS.register("ambient_occlusion_shade", () -> new Block(BlockBehaviour.Properties.of(Material.STONE))); + public static final RegistryObject AO_BLOCK_NO_SHADE = BLOCKS.register("ambient_occlusion_no_shade", () -> new Block(BlockBehaviour.Properties.of(Material.STONE))); + public static final RegistryObject NO_AO_BLOCK_SHADE = BLOCKS.register("no_ambient_occlusion_shade", () -> new Block(BlockBehaviour.Properties.of(Material.STONE))); + public static final RegistryObject NO_AO_BLOCK_NO_SHADE = BLOCKS.register("no_ambient_occlusion_no_shade", () -> new Block(BlockBehaviour.Properties.of(Material.STONE))); + public static final RegistryObject AO_BLOCK_SHADE_ITEM = ITEMS.register("ambient_occlusion_shade", () -> new BlockItem(AO_BLOCK_SHADE.get(), new Item.Properties().tab(CreativeModeTab.TAB_DECORATIONS))); + public static final RegistryObject AO_BLOCK_NO_SHADE_ITEM = ITEMS.register("ambient_occlusion_no_shade", () -> new BlockItem(AO_BLOCK_NO_SHADE.get(), new Item.Properties().tab(CreativeModeTab.TAB_DECORATIONS))); + public static final RegistryObject NO_AO_BLOCK_SHADE_ITEM = ITEMS.register("no_ambient_occlusion_shade", () -> new BlockItem(NO_AO_BLOCK_SHADE.get(), new Item.Properties().tab(CreativeModeTab.TAB_DECORATIONS))); + public static final RegistryObject NO_AO_BLOCK_NO_SHADE_ITEM = ITEMS.register("no_ambient_occlusion_no_shade", () -> new BlockItem(NO_AO_BLOCK_NO_SHADE.get(), new Item.Properties().tab(CreativeModeTab.TAB_DECORATIONS))); + + public AmbientOcclusionElementsTest() + { + IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); + BLOCKS.register(modEventBus); + ITEMS.register(modEventBus); + } +} diff --git a/src/test/resources/META-INF/mods.toml b/src/test/resources/META-INF/mods.toml index bdc66472f7..578d584685 100644 --- a/src/test/resources/META-INF/mods.toml +++ b/src/test/resources/META-INF/mods.toml @@ -262,6 +262,8 @@ modId="item_use_animation_test" modId="custom_color_resolver_test" [[mods]] modId="custom_item_decorations_test" +[[mods]] +modId="ambient_occlusion_elements_test" # ADD ABOVE THIS LINE diff --git a/src/test/resources/assets/ambient_occlusion_elements_test/blockstates/ambient_occlusion_no_shade.json b/src/test/resources/assets/ambient_occlusion_elements_test/blockstates/ambient_occlusion_no_shade.json new file mode 100644 index 0000000000..6c780b42c6 --- /dev/null +++ b/src/test/resources/assets/ambient_occlusion_elements_test/blockstates/ambient_occlusion_no_shade.json @@ -0,0 +1,5 @@ +{ + "variants": { + "": { "model": "ambient_occlusion_elements_test:block/ambient_occlusion_no_shade" } + } +} \ No newline at end of file diff --git a/src/test/resources/assets/ambient_occlusion_elements_test/blockstates/ambient_occlusion_shade.json b/src/test/resources/assets/ambient_occlusion_elements_test/blockstates/ambient_occlusion_shade.json new file mode 100644 index 0000000000..3d2f609b9d --- /dev/null +++ b/src/test/resources/assets/ambient_occlusion_elements_test/blockstates/ambient_occlusion_shade.json @@ -0,0 +1,5 @@ +{ + "variants": { + "": { "model": "ambient_occlusion_elements_test:block/ambient_occlusion_shade" } + } +} \ No newline at end of file diff --git a/src/test/resources/assets/ambient_occlusion_elements_test/blockstates/no_ambient_occlusion_no_shade.json b/src/test/resources/assets/ambient_occlusion_elements_test/blockstates/no_ambient_occlusion_no_shade.json new file mode 100644 index 0000000000..5d85defe51 --- /dev/null +++ b/src/test/resources/assets/ambient_occlusion_elements_test/blockstates/no_ambient_occlusion_no_shade.json @@ -0,0 +1,5 @@ +{ + "variants": { + "": { "model": "ambient_occlusion_elements_test:block/no_ambient_occlusion_no_shade" } + } +} \ No newline at end of file diff --git a/src/test/resources/assets/ambient_occlusion_elements_test/blockstates/no_ambient_occlusion_shade.json b/src/test/resources/assets/ambient_occlusion_elements_test/blockstates/no_ambient_occlusion_shade.json new file mode 100644 index 0000000000..c922f381d4 --- /dev/null +++ b/src/test/resources/assets/ambient_occlusion_elements_test/blockstates/no_ambient_occlusion_shade.json @@ -0,0 +1,5 @@ +{ + "variants": { + "": { "model": "ambient_occlusion_elements_test:block/no_ambient_occlusion_shade" } + } +} \ No newline at end of file diff --git a/src/test/resources/assets/ambient_occlusion_elements_test/models/block/ambient_occlusion_no_shade.json b/src/test/resources/assets/ambient_occlusion_elements_test/models/block/ambient_occlusion_no_shade.json new file mode 100644 index 0000000000..c7af1ad1ad --- /dev/null +++ b/src/test/resources/assets/ambient_occlusion_elements_test/models/block/ambient_occlusion_no_shade.json @@ -0,0 +1,35 @@ +{ + "parent": "block/block", + "render_type": "cutout", + "textures": { + "all": "ambient_occlusion_elements_test:block/solid", + "overlay": "minecraft:block/glass" + }, + "elements": [ + { + "from": [ 0, 0, 0 ], + "to": [ 16, 16, 16 ], + "shade": false, + "faces": { + "down": { "texture": "#all", "emissivity": 15, "cullface": "down" }, + "up": { "texture": "#all", "emissivity": 15, "cullface": "up" }, + "north": { "texture": "#all", "emissivity": 15, "cullface": "north" }, + "south": { "texture": "#all", "emissivity": 15, "cullface": "south" }, + "west": { "texture": "#all", "emissivity": 15, "cullface": "west" }, + "east": { "texture": "#all", "emissivity": 15, "cullface": "east" } + } + }, + { + "from": [ 0, 0, 0 ], + "to": [ 16, 16, 16 ], + "faces": { + "down": { "texture": "#overlay", "cullface": "down" }, + "up": { "texture": "#overlay", "cullface": "up" }, + "north": { "texture": "#overlay", "cullface": "north" }, + "south": { "texture": "#overlay", "cullface": "south" }, + "west": { "texture": "#overlay", "cullface": "west" }, + "east": { "texture": "#overlay", "cullface": "east" } + } + } + ] +} diff --git a/src/test/resources/assets/ambient_occlusion_elements_test/models/block/ambient_occlusion_shade.json b/src/test/resources/assets/ambient_occlusion_elements_test/models/block/ambient_occlusion_shade.json new file mode 100644 index 0000000000..1085c62e0d --- /dev/null +++ b/src/test/resources/assets/ambient_occlusion_elements_test/models/block/ambient_occlusion_shade.json @@ -0,0 +1,34 @@ +{ + "parent": "block/block", + "render_type": "cutout", + "textures": { + "all": "ambient_occlusion_elements_test:block/solid", + "overlay": "minecraft:block/glass" + }, + "elements": [ + { + "from": [ 0, 0, 0 ], + "to": [ 16, 16, 16 ], + "faces": { + "down": { "texture": "#all", "emissivity": 15, "cullface": "down" }, + "up": { "texture": "#all", "emissivity": 15, "cullface": "up" }, + "north": { "texture": "#all", "emissivity": 15, "cullface": "north" }, + "south": { "texture": "#all", "emissivity": 15, "cullface": "south" }, + "west": { "texture": "#all", "emissivity": 15, "cullface": "west" }, + "east": { "texture": "#all", "emissivity": 15, "cullface": "east" } + } + }, + { + "from": [ 0, 0, 0 ], + "to": [ 16, 16, 16 ], + "faces": { + "down": { "texture": "#overlay", "cullface": "down" }, + "up": { "texture": "#overlay", "cullface": "up" }, + "north": { "texture": "#overlay", "cullface": "north" }, + "south": { "texture": "#overlay", "cullface": "south" }, + "west": { "texture": "#overlay", "cullface": "west" }, + "east": { "texture": "#overlay", "cullface": "east" } + } + } + ] +} diff --git a/src/test/resources/assets/ambient_occlusion_elements_test/models/block/no_ambient_occlusion_no_shade.json b/src/test/resources/assets/ambient_occlusion_elements_test/models/block/no_ambient_occlusion_no_shade.json new file mode 100644 index 0000000000..6a70d48512 --- /dev/null +++ b/src/test/resources/assets/ambient_occlusion_elements_test/models/block/no_ambient_occlusion_no_shade.json @@ -0,0 +1,35 @@ +{ + "parent": "block/block", + "render_type": "cutout", + "textures": { + "all": "ambient_occlusion_elements_test:block/solid", + "overlay": "minecraft:block/glass" + }, + "elements": [ + { + "from": [ 0, 0, 0 ], + "to": [ 16, 16, 16 ], + "shade": false, + "faces": { + "down": { "texture": "#all", "emissivity": 15, "cullface": "down", "ambientocclusion": false }, + "up": { "texture": "#all", "emissivity": 15, "cullface": "up", "ambientocclusion": false }, + "north": { "texture": "#all", "emissivity": 15, "cullface": "north", "ambientocclusion": false }, + "south": { "texture": "#all", "emissivity": 15, "cullface": "south", "ambientocclusion": false }, + "west": { "texture": "#all", "emissivity": 15, "cullface": "west", "ambientocclusion": false }, + "east": { "texture": "#all", "emissivity": 15, "cullface": "east", "ambientocclusion": false } + } + }, + { + "from": [ 0, 0, 0 ], + "to": [ 16, 16, 16 ], + "faces": { + "down": { "texture": "#overlay", "cullface": "down" }, + "up": { "texture": "#overlay", "cullface": "up" }, + "north": { "texture": "#overlay", "cullface": "north" }, + "south": { "texture": "#overlay", "cullface": "south" }, + "west": { "texture": "#overlay", "cullface": "west" }, + "east": { "texture": "#overlay", "cullface": "east" } + } + } + ] +} diff --git a/src/test/resources/assets/ambient_occlusion_elements_test/models/block/no_ambient_occlusion_shade.json b/src/test/resources/assets/ambient_occlusion_elements_test/models/block/no_ambient_occlusion_shade.json new file mode 100644 index 0000000000..0a54beabac --- /dev/null +++ b/src/test/resources/assets/ambient_occlusion_elements_test/models/block/no_ambient_occlusion_shade.json @@ -0,0 +1,34 @@ +{ + "parent": "block/block", + "render_type": "cutout", + "textures": { + "all": "ambient_occlusion_elements_test:block/solid", + "overlay": "minecraft:block/glass" + }, + "elements": [ + { + "from": [ 0, 0, 0 ], + "to": [ 16, 16, 16 ], + "faces": { + "down": { "texture": "#all", "emissivity": 15, "cullface": "down", "ambientocclusion": false }, + "up": { "texture": "#all", "emissivity": 15, "cullface": "up", "ambientocclusion": false }, + "north": { "texture": "#all", "emissivity": 15, "cullface": "north", "ambientocclusion": false }, + "south": { "texture": "#all", "emissivity": 15, "cullface": "south", "ambientocclusion": false }, + "west": { "texture": "#all", "emissivity": 15, "cullface": "west", "ambientocclusion": false }, + "east": { "texture": "#all", "emissivity": 15, "cullface": "east", "ambientocclusion": false } + } + }, + { + "from": [ 0, 0, 0 ], + "to": [ 16, 16, 16 ], + "faces": { + "down": { "texture": "#overlay", "cullface": "down" }, + "up": { "texture": "#overlay", "cullface": "up" }, + "north": { "texture": "#overlay", "cullface": "north" }, + "south": { "texture": "#overlay", "cullface": "south" }, + "west": { "texture": "#overlay", "cullface": "west" }, + "east": { "texture": "#overlay", "cullface": "east" } + } + } + ] +} diff --git a/src/test/resources/assets/ambient_occlusion_elements_test/models/item/ambient_occlusion_no_shade.json b/src/test/resources/assets/ambient_occlusion_elements_test/models/item/ambient_occlusion_no_shade.json new file mode 100644 index 0000000000..de2b1d86ed --- /dev/null +++ b/src/test/resources/assets/ambient_occlusion_elements_test/models/item/ambient_occlusion_no_shade.json @@ -0,0 +1,3 @@ +{ + "parent": "ambient_occlusion_elements_test:block/ambient_occlusion_no_shade" +} \ No newline at end of file diff --git a/src/test/resources/assets/ambient_occlusion_elements_test/models/item/ambient_occlusion_shade.json b/src/test/resources/assets/ambient_occlusion_elements_test/models/item/ambient_occlusion_shade.json new file mode 100644 index 0000000000..9446f23680 --- /dev/null +++ b/src/test/resources/assets/ambient_occlusion_elements_test/models/item/ambient_occlusion_shade.json @@ -0,0 +1,3 @@ +{ + "parent": "ambient_occlusion_elements_test:block/ambient_occlusion_shade" +} \ No newline at end of file diff --git a/src/test/resources/assets/ambient_occlusion_elements_test/models/item/no_ambient_occlusion_no_shade.json b/src/test/resources/assets/ambient_occlusion_elements_test/models/item/no_ambient_occlusion_no_shade.json new file mode 100644 index 0000000000..b122f86e25 --- /dev/null +++ b/src/test/resources/assets/ambient_occlusion_elements_test/models/item/no_ambient_occlusion_no_shade.json @@ -0,0 +1,3 @@ +{ + "parent": "ambient_occlusion_elements_test:block/no_ambient_occlusion_no_shade" +} \ No newline at end of file diff --git a/src/test/resources/assets/ambient_occlusion_elements_test/models/item/no_ambient_occlusion_shade.json b/src/test/resources/assets/ambient_occlusion_elements_test/models/item/no_ambient_occlusion_shade.json new file mode 100644 index 0000000000..40969122d3 --- /dev/null +++ b/src/test/resources/assets/ambient_occlusion_elements_test/models/item/no_ambient_occlusion_shade.json @@ -0,0 +1,3 @@ +{ + "parent": "ambient_occlusion_elements_test:block/no_ambient_occlusion_shade" +} \ No newline at end of file diff --git a/src/test/resources/assets/ambient_occlusion_elements_test/textures/block/solid.png b/src/test/resources/assets/ambient_occlusion_elements_test/textures/block/solid.png new file mode 100644 index 0000000000..dee54f46bf Binary files /dev/null and b/src/test/resources/assets/ambient_occlusion_elements_test/textures/block/solid.png differ