Skip to content

Commit

Permalink
BlockStates and misc updates and changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Direwolf20-MC committed Feb 25, 2024
1 parent 246a641 commit cbe5b03
Show file tree
Hide file tree
Showing 40 changed files with 248 additions and 89 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
// 1.20.4 2024-02-24T23:19:21.1579408 Block States: justdirethings
// 1.20.4 2024-02-25T13:40:56.8616305 Block States: justdirethings
920cb18580ea999cb4670bf40b25ba5c2a914032 assets/justdirethings/blockstates/dire_iron_block.json
5a4cd222f3bde8915594a1363e2758ee5208517c assets/justdirethings/blockstates/gooblock_tier1.json
c7729d4e41b5ab3c651235a397de2bf7853c6aa9 assets/justdirethings/blockstates/goopatternblock.json
0e90b0292111bda368dcb2e65e210415d4d69f96 assets/justdirethings/blockstates/goopatternblock.json
cffdbed997636075f20d3cdcd18712085357f847 assets/justdirethings/models/block/dire_iron_block.json
42066c831f2979ed0f605a673e9b7cbdcb5e3f87 assets/justdirethings/models/block/gooblock_tier1.json
ceedc7d14dd60fc6bbce216fa9fca00031083688 assets/justdirethings/models/block/goopatternblock.json
ba31542d1e6b668b4fe7707dacd8ac2f42e8be94 assets/justdirethings/models/block/goopatternblock0.json
de99198085ba7892b69b20c7fba7574aa387c99b assets/justdirethings/models/block/goopatternblock1.json
1c444e45105c008e6d57c6c0de0ea182503a6b5f assets/justdirethings/models/block/goopatternblock2.json
38b940c647452206dde2310c1bae82cf63f6c16f assets/justdirethings/models/block/goopatternblock3.json
54f2f008f7b73eae0998da4317b5e390b73f85d7 assets/justdirethings/models/block/goopatternblock4.json
3497fed256f6010cc726e408e2ac5e3447d98906 assets/justdirethings/models/block/goopatternblock5.json
4708929c3909d531442f918d57f97588f63a7f61 assets/justdirethings/models/block/goopatternblock6.json
1017892293e8c2c1fbd6668493696513da801921 assets/justdirethings/models/block/goopatternblock7.json
7c4b15daa716408edd217af3bdd5f4d40a507116 assets/justdirethings/models/block/goopatternblock8.json
a8285d4ea09e26951b3019b6e96a43d3d4654269 assets/justdirethings/models/block/goopatternblock9.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
{
"variants": {
"facing=down": {
"model": "justdirethings:block/goopatternblock",
"x": 180
},
"facing=east": {
"model": "justdirethings:block/goopatternblock",
"x": 90,
"y": 90
},
"facing=north": {
"model": "justdirethings:block/goopatternblock",
"x": 90
},
"facing=south": {
"model": "justdirethings:block/goopatternblock",
"x": 90,
"y": 180
},
"facing=up": {
"model": "justdirethings:block/goopatternblock"
},
"facing=west": {
"model": "justdirethings:block/goopatternblock",
"x": 90,
"y": 270
"goostage=0": {
"model": "justdirethings:block/goopatternblock0"
},
"goostage=1": {
"model": "justdirethings:block/goopatternblock1"
},
"goostage=2": {
"model": "justdirethings:block/goopatternblock2"
},
"goostage=3": {
"model": "justdirethings:block/goopatternblock3"
},
"goostage=4": {
"model": "justdirethings:block/goopatternblock4"
},
"goostage=5": {
"model": "justdirethings:block/goopatternblock5"
},
"goostage=6": {
"model": "justdirethings:block/goopatternblock6"
},
"goostage=7": {
"model": "justdirethings:block/goopatternblock7"
},
"goostage=8": {
"model": "justdirethings:block/goopatternblock8"
},
"goostage=9": {
"model": "justdirethings:block/goopatternblock9"
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"parent": "minecraft:block/orientable_with_bottom",
"render_type": "minecraft:cutout",
"textures": {
"bottom": "justdirethings:block/goopatterns/goorender_full",
"front": "justdirethings:block/goopatterns/goorender_side0",
"side": "justdirethings:block/goopatterns/goorender_side0",
"top": "justdirethings:block/goopatterns/goorender_blank"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"parent": "minecraft:block/orientable_with_bottom",
"render_type": "minecraft:cutout",
"textures": {
"bottom": "justdirethings:block/goopatterns/goorender_full",
"front": "justdirethings:block/goopatterns/goorender_side1",
"side": "justdirethings:block/goopatterns/goorender_side1",
"top": "justdirethings:block/goopatterns/goorender_blank"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"parent": "minecraft:block/orientable_with_bottom",
"render_type": "minecraft:cutout",
"textures": {
"bottom": "justdirethings:block/goopatterns/goorender_full",
"front": "justdirethings:block/goopatterns/goorender_side2",
"side": "justdirethings:block/goopatterns/goorender_side2",
"top": "justdirethings:block/goopatterns/goorender_blank"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"parent": "minecraft:block/orientable_with_bottom",
"render_type": "minecraft:cutout",
"textures": {
"bottom": "justdirethings:block/goopatterns/goorender_full",
"front": "justdirethings:block/goopatterns/goorender_side3",
"side": "justdirethings:block/goopatterns/goorender_side3",
"top": "justdirethings:block/goopatterns/goorender_blank"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"parent": "minecraft:block/orientable_with_bottom",
"render_type": "minecraft:cutout",
"textures": {
"bottom": "justdirethings:block/goopatterns/goorender_full",
"front": "justdirethings:block/goopatterns/goorender_side4",
"side": "justdirethings:block/goopatterns/goorender_side4",
"top": "justdirethings:block/goopatterns/goorender_blank"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"parent": "minecraft:block/orientable_with_bottom",
"render_type": "minecraft:cutout",
"textures": {
"bottom": "justdirethings:block/goopatterns/goorender_full",
"front": "justdirethings:block/goopatterns/goorender_side5",
"side": "justdirethings:block/goopatterns/goorender_side5",
"top": "justdirethings:block/goopatterns/goorender_blank"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"parent": "minecraft:block/orientable_with_bottom",
"render_type": "minecraft:cutout",
"textures": {
"bottom": "justdirethings:block/goopatterns/goorender_full",
"front": "justdirethings:block/goopatterns/goorender_side6",
"side": "justdirethings:block/goopatterns/goorender_side6",
"top": "justdirethings:block/goopatterns/goorender_blank"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"parent": "minecraft:block/orientable_with_bottom",
"render_type": "minecraft:cutout",
"textures": {
"bottom": "justdirethings:block/goopatterns/goorender_full",
"front": "justdirethings:block/goopatterns/goorender_side7",
"side": "justdirethings:block/goopatterns/goorender_side7",
"top": "justdirethings:block/goopatterns/goorender_blank"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"parent": "minecraft:block/orientable_with_bottom",
"render_type": "minecraft:cutout",
"textures": {
"bottom": "justdirethings:block/goopatterns/goorender_full",
"front": "justdirethings:block/goopatterns/goorender_side8",
"side": "justdirethings:block/goopatterns/goorender_side8",
"top": "justdirethings:block/goopatterns/goorender_blank"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"parent": "minecraft:block/orientable_with_bottom",
"render_type": "minecraft:cutout",
"textures": {
"bottom": "justdirethings:block/goopatterns/goorender_full",
"front": "justdirethings:block/goopatterns/goorender_full",
"side": "justdirethings:block/goopatterns/goorender_full",
"top": "justdirethings:block/goopatterns/goopatterblock_top"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.direwolf20.justdirethings.client.renderers.DireVertexConsumer;
import com.direwolf20.justdirethings.client.renderers.OurRenderTypes;
import com.direwolf20.justdirethings.common.blockentities.gooblocks.GooBlockBE_Base;
import com.direwolf20.justdirethings.common.blocks.gooblocks.GooPatternBlock;
import com.direwolf20.justdirethings.setup.Registration;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
Expand Down Expand Up @@ -53,7 +54,7 @@ public GooBlockRender_Base(BlockEntityRendererProvider.Context p_173636_) {
public void render(T blockentity, float partialTicks, PoseStack matrixStackIn, MultiBufferSource bufferIn, int combinedLightsIn, int combinedOverlayIn) {
Level level = blockentity.getLevel();
BlockPos pos = blockentity.getBlockPos().above(0);
BlockState renderState = Registration.GooPatternBlock.get().defaultBlockState().setValue(BlockStateProperties.FACING, Direction.UP);
BlockState renderState = Registration.GooPatternBlock.get().defaultBlockState().setValue(BlockStateProperties.FACING, Direction.UP).setValue(GooPatternBlock.GOOSTAGE, 2);
BlockRenderDispatcher blockrendererdispatcher = Minecraft.getInstance().getBlockRenderer();
BakedModel ibakedmodel = blockrendererdispatcher.getBlockModel(renderState);
BlockColors blockColors = Minecraft.getInstance().getBlockColors();
Expand Down Expand Up @@ -84,7 +85,7 @@ public void renderTextures(Direction direction, Level level, BlockPos pos, PoseS
}

public void renderTexturePattern(Direction direction, Level level, BlockPos pos, PoseStack matrixStackIn, MultiBufferSource bufferIn, int combinedOverlayIn, float transparency, ResourceLocation pattern, BlockState renderState, BakedModel ibakedmodel, ModelBlockRenderer modelBlockRenderer) {
OurRenderTypes.updateRenders();
//OurRenderTypes.updateRenders();
BlockRenderDispatcher blockrendererdispatcher = Minecraft.getInstance().getBlockRenderer();

matrixStackIn.pushPose();
Expand Down Expand Up @@ -112,7 +113,7 @@ public void renderTexturePattern(Direction direction, Level level, BlockPos pos,
//renderQuad(matrix4f2, matrix3f2, vertexconsumer, 1f, 1f, 1f, 1f, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1);*/

VertexConsumer builder = bufferIn.getBuffer(OurRenderTypes.gooPatternAlpha(pattern));
VertexConsumer builder = bufferIn.getBuffer(OurRenderTypes.GooPattern);
DireVertexConsumer chunksConsumer = new DireVertexConsumer(builder, transparency);

float[] afloat = new float[Direction.values().length * 2];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,38 @@

import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.VertexFormat;
import net.minecraft.Util;
import net.minecraft.client.renderer.RenderStateShard;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.resources.ResourceLocation;

import java.util.function.Function;

public class OurRenderTypes extends RenderType {
public static RenderType RenderBlockBackface = create("GadgetRenderBlockBackface",
public static final RenderType RenderBlockBackface = create("GadgetRenderBlockBackface",
DefaultVertexFormat.BLOCK, VertexFormat.Mode.QUADS, 256, false, false,
RenderType.CompositeState.builder()
.setShaderState(RenderStateShard.RENDERTYPE_TRANSLUCENT_SHADER)
.setLightmapState(LIGHTMAP)
.setTextureState(BLOCK_SHEET)
.setTransparencyState(TRANSLUCENT_TRANSPARENCY)
.setDepthTestState(GREATER_DEPTH_TEST)
.setCullState(CULL)
.setDepthTestState(EQUAL_DEPTH_TEST)
.setCullState(NO_CULL)
.setOverlayState(RenderStateShard.OVERLAY)
.createCompositeState(false));

private static Function<ResourceLocation, RenderType> GooPattern = Util.memoize(
public static final RenderType GooPattern = create("GadgetRenderBlockBackface",
DefaultVertexFormat.BLOCK, VertexFormat.Mode.QUADS, 256, false, false,
RenderType.CompositeState.builder()
.setShaderState(RenderStateShard.RENDERTYPE_ENTITY_ALPHA_SHADER)
.setLightmapState(LIGHTMAP)
.setTextureState(BLOCK_SHEET)
.setCullState(NO_CULL)
.setWriteMaskState(RenderStateShard.DEPTH_WRITE)
.createCompositeState(true));

/*private static final Function<ResourceLocation, RenderType> GooPattern = Util.memoize(
p_286150_ -> {
RenderType.CompositeState overlay = RenderType.CompositeState.builder()
.setShaderState(RenderStateShard.RENDERTYPE_ENTITY_ALPHA_SHADER)
.setLightmapState(LIGHTMAP)
.setTextureState(new RenderStateShard.TextureStateShard(p_286150_, false, false))
.setTextureState(BLOCK_SHEET)
.setCullState(NO_CULL)
.setWriteMaskState(RenderStateShard.DEPTH_WRITE)
.createCompositeState(true);
Expand All @@ -36,30 +42,13 @@ public class OurRenderTypes extends RenderType {
public static RenderType gooPatternAlpha(ResourceLocation pId) {
return GooPattern.apply(pId);
}

private static Function<ResourceLocation, RenderType> GooTexture = Util.memoize(
p_286150_ -> {
RenderType.CompositeState overlay = RenderType.CompositeState.builder()
.setShaderState(RenderStateShard.RENDERTYPE_ENTITY_ALPHA_SHADER)
.setLightmapState(LIGHTMAP)
.setTextureState(new RenderStateShard.TextureStateShard(p_286150_, false, false))
.setCullState(NO_CULL)
.setWriteMaskState(RenderStateShard.DEPTH_WRITE)
.createCompositeState(true);
return create("GooTexture", DefaultVertexFormat.BLOCK, VertexFormat.Mode.QUADS, 1536, false, false, overlay);
});

public static RenderType gooPatternColor(ResourceLocation pId) {
return GooTexture.apply(pId);
}

}*/

public OurRenderTypes(String p_173178_, VertexFormat p_173179_, VertexFormat.Mode p_173180_, int p_173181_, boolean p_173182_, boolean p_173183_, Runnable p_173184_, Runnable p_173185_) {
super(p_173178_, p_173179_, p_173180_, p_173181_, p_173182_, p_173183_, p_173184_, p_173185_);
}

public static void updateRenders() { //Only used when testing
/*public static void updateRenders() { //Only used when testing
GooPattern = Util.memoize(
p_286150_ -> {
RenderType.CompositeState overlay = RenderType.CompositeState.builder()
Expand All @@ -80,23 +69,8 @@ public static void updateRenders() { //Only used when testing
.setTextureState(BLOCK_SHEET)
.setTransparencyState(TRANSLUCENT_TRANSPARENCY)
.setDepthTestState(EQUAL_DEPTH_TEST)
.setCullState(CULL)
.setCullState(NO_CULL)
.setOverlayState(RenderStateShard.OVERLAY)
.createCompositeState(false));

GooTexture = Util.memoize(
p_286150_ -> {
RenderType.CompositeState overlay = RenderType.CompositeState.builder()
.setShaderState(RenderStateShard.RENDERTYPE_TRANSLUCENT_SHADER)
.setLightmapState(LIGHTMAP)
.setTransparencyState(NO_TRANSPARENCY)
.setDepthTestState(RenderStateShard.EQUAL_DEPTH_TEST)
.setTextureState(new RenderStateShard.TextureStateShard(p_286150_, false, false))
.setCullState(NO_CULL)
.setWriteMaskState(RenderStateShard.COLOR_DEPTH_WRITE)
.setOverlayState(RenderStateShard.OVERLAY)
.createCompositeState(false);
return create("GooTexture", DefaultVertexFormat.BLOCK, VertexFormat.Mode.QUADS, 1536, false, false, overlay);
});
}
}*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,28 @@
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.IntegerProperty;

public class GooPatternBlock extends Block {
public static final IntegerProperty GOOSTAGE = IntegerProperty.create("goostage", 0, 9);

public GooPatternBlock() {
super(Properties.of()
.sound(SoundType.FUNGUS)
.strength(2.0f)
.noOcclusion()
);
}

@Override
public BlockState getStateForPlacement(BlockPlaceContext context) {
return this.defaultBlockState().setValue(BlockStateProperties.FACING, context.getClickedFace().getOpposite());
return this.defaultBlockState()
.setValue(BlockStateProperties.FACING, context.getClickedFace().getOpposite())
.setValue(GOOSTAGE, 0);
}

@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(BlockStateProperties.FACING);
builder.add(BlockStateProperties.FACING, GOOSTAGE);
}
}
Loading

0 comments on commit cbe5b03

Please sign in to comment.