diff --git a/changelog.md b/changelog.md index a8156a7c..20bdaccb 100644 --- a/changelog.md +++ b/changelog.md @@ -6,10 +6,10 @@ * Added support for block generation parameters * Added support for all plant generation types and parameters * Added new world procedure blocks: get logic game rule, get number game rule, set logic game rule and set number game rule -* Added complete support for Tick randomly +* Added complete support for Tick randomly * Added a new block trigger: Update tick * Updated the tag mod element to support entities -* [#104] Added full support for the stair block base +* Added new block bases: [#104] Stairs, door,fence, fence gate * [Bugfix #110] GROUND and PLANT step sounds had the wrong sound. * [Bugfix] Transparency on custom plants was black. * [Bugfix] Update tick trigger for plants caused a build error. diff --git a/src/fabric-1.16.5/block.definition.yaml b/src/fabric-1.16.5/block.definition.yaml index 2c4f223a..7f476582 100644 --- a/src/fabric-1.16.5/block.definition.yaml +++ b/src/fabric-1.16.5/block.definition.yaml @@ -230,6 +230,61 @@ templates: writer: json name: "@MODASSETSROOT/models/block/@registryname_noside_alt.json" + # TX: Door templates + - template: json/txblock/pane_item.json.ftl + condition: "blockBase %= Door" + writer: json + name: "@MODASSETSROOT/models/item/@registryname.json" + - template: json/txblock/door_states.json.ftl + condition: "blockBase %= Door" + writer: json + name: "@MODASSETSROOT/blockstates/@registryname.json" + - template: json/txblock/door_top.json.ftl + condition: "blockBase %= Door" + writer: json + name: "@MODASSETSROOT/models/block/@registryname_top.json" + - template: json/txblock/door_top_hinge.json.ftl + condition: "blockBase %= Door" + writer: json + name: "@MODASSETSROOT/models/block/@registryname_top_hinge.json" + - template: json/txblock/door_bottom.json.ftl + condition: "blockBase %= Door" + writer: json + name: "@MODASSETSROOT/models/block/@registryname_bottom.json" + - template: json/txblock/door_bottom_hinge.json.ftl + condition: "blockBase %= Door" + writer: json + name: "@MODASSETSROOT/models/block/@registryname_bottom_hinge.json" + + # TX: FenceGate templates + - template: json/txblock/fence_gate_item.json.ftl + condition: "blockBase %= FenceGate" + writer: json + name: "@MODASSETSROOT/models/item/@registryname.json" + - template: json/txblock/fence_gate_states.json.ftl + condition: "blockBase %= FenceGate" + writer: json + name: "@MODASSETSROOT/blockstates/@registryname.json" + - template: json/txblock/fence_gate.json.ftl + condition: "blockBase %= FenceGate" + writer: json + name: "@MODASSETSROOT/models/block/@registryname.json" + - template: json/txblock/fence_gate_open.json.ftl + deleteWhenConditionFalse: true + condition: "blockBase %= FenceGate" + writer: json + name: "@MODASSETSROOT/models/block/@registryname_open.json" + - template: json/txblock/fence_gate_wall.json.ftl + deleteWhenConditionFalse: true + condition: "blockBase %= FenceGate" + writer: json + name: "@MODASSETSROOT/models/block/@registryname_wall.json" + - template: json/txblock/fence_gate_wall_open.json.ftl + deleteWhenConditionFalse: true + condition: "blockBase %= FenceGate" + writer: json + name: "@MODASSETSROOT/models/block/@registryname_wall_open.json" + localizationkeys: - key: block.@modid.@registryname mapto: name diff --git a/src/fabric-1.16.5/templates/block.java.ftl b/src/fabric-1.16.5/templates/block.java.ftl index d430e119..b75afa67 100644 --- a/src/fabric-1.16.5/templates/block.java.ftl +++ b/src/fabric-1.16.5/templates/block.java.ftl @@ -35,7 +35,11 @@ public class ${name}Block extends <#if data.hasGravity> FallingBlock <#elseif data.blockBase?has_content> + <#if data.blockBase == "TrapDoor"> + TrapdoorBlock + <#else> ${data.blockBase}Block + <#else> Block { @@ -113,6 +117,14 @@ public class ${name}Block extends } + <#if data.blockBase?has_content && data.blockBase == "Fence"> + @Override public boolean canConnect(BlockState state, boolean checkattach, Direction face) { + boolean flag = state.getBlock() instanceof FenceBlock && state.getMaterial() == this.material; + boolean flag1 = state.getBlock() instanceof FenceGateBlock && FenceGateBlock.canWallConnect(state, face); + return !cannotConnect(state.getBlock()) && checkattach || flag || flag1; + } + + <#if data.specialInfo?has_content> @Override @Environment(EnvType.CLIENT) @@ -242,6 +254,11 @@ public class ${name}Block extends <#elseif data.customDrop?? && !data.customDrop.isEmpty()> @Override public List getDroppedStacks(BlockState state, LootContext.Builder builder) { + <#if data.blockBase?has_content && data.blockBase == "Door"> + if(state.get(Properties.DOUBLE_BLOCK_HALF) != DoubleBlockHalf.LOWER) + return Collections.emptyList(); + + List dropsOriginal = super.getDroppedStacks(state, builder); if(!dropsOriginal.isEmpty()) return dropsOriginal; @@ -259,6 +276,11 @@ public class ${name}Block extends <#else> @Override public List getDroppedStacks(BlockState state, LootContext.Builder builder){ + <#if data.blockBase?has_content && data.blockBase == "Door"> + if(state.get(Properties.DOUBLE_BLOCK_HALF) != DoubleBlockHalf.LOWER) + return Collections.emptyList(); + + List dropsOriginal = super.getDroppedStacks(state, builder); if(!dropsOriginal.isEmpty()) return dropsOriginal; @@ -267,10 +289,10 @@ public class ${name}Block extends - <#if (hasProcedure(data.onTickUpdate) && !data.tickRandomly) || hasProcedure(data.onBlockAdded) ) > + <#if (hasProcedure(data.onTickUpdate) && !data.tickRandomly) || hasProcedure(data.onBlockAdded)> @Override public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify) { - super.onBlockAdded(state, world, pos, oldState, moving); + super.onBlockAdded(state, world, pos, oldState, notify); int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); diff --git a/src/fabric-1.16.5/templates/json/txblock/door_bottom.json.ftl b/src/fabric-1.16.5/templates/json/txblock/door_bottom.json.ftl new file mode 100644 index 00000000..38c48624 --- /dev/null +++ b/src/fabric-1.16.5/templates/json/txblock/door_bottom.json.ftl @@ -0,0 +1,8 @@ +{ + "parent": "block/door_bottom", + "textures": { + <#if data.particleTexture?has_content>"particle": "${modid}:blocks/${data.particleTexture}", + "bottom": "${modid}:blocks/${data.texture}", + "top": "${modid}:blocks/${data.textureTop?has_content?then(data.textureTop, data.texture)}" + } +} diff --git a/src/fabric-1.16.5/templates/json/txblock/door_bottom_hinge.json.ftl b/src/fabric-1.16.5/templates/json/txblock/door_bottom_hinge.json.ftl new file mode 100644 index 00000000..79b867be --- /dev/null +++ b/src/fabric-1.16.5/templates/json/txblock/door_bottom_hinge.json.ftl @@ -0,0 +1,8 @@ +{ + "parent": "block/door_bottom_rh", + "textures": { + <#if data.particleTexture?has_content>"particle": "${modid}:blocks/${data.particleTexture}", + "bottom": "${modid}:blocks/${data.texture}", + "top": "${modid}:blocks/${data.textureTop?has_content?then(data.textureTop, data.texture)}" + } +} diff --git a/src/fabric-1.16.5/templates/json/txblock/door_states.json.ftl b/src/fabric-1.16.5/templates/json/txblock/door_states.json.ftl new file mode 100644 index 00000000..7fb0b7fb --- /dev/null +++ b/src/fabric-1.16.5/templates/json/txblock/door_states.json.ftl @@ -0,0 +1,124 @@ +{ + "variants": { + "facing=east,half=lower,hinge=left,open=false": { + "model": "${modid}:block/${registryname}_bottom" + }, + "facing=south,half=lower,hinge=left,open=false": { + "model": "${modid}:block/${registryname}_bottom", + "y": 90 + }, + "facing=west,half=lower,hinge=left,open=false": { + "model": "${modid}:block/${registryname}_bottom", + "y": 180 + }, + "facing=north,half=lower,hinge=left,open=false": { + "model": "${modid}:block/${registryname}_bottom", + "y": 270 + }, + "facing=east,half=lower,hinge=right,open=false": { + "model": "${modid}:block/${registryname}_bottom_hinge" + }, + "facing=south,half=lower,hinge=right,open=false": { + "model": "${modid}:block/${registryname}_bottom_hinge", + "y": 90 + }, + "facing=west,half=lower,hinge=right,open=false": { + "model": "${modid}:block/${registryname}_bottom_hinge", + "y": 180 + }, + "facing=north,half=lower,hinge=right,open=false": { + "model": "${modid}:block/${registryname}_bottom_hinge", + "y": 270 + }, + "facing=east,half=lower,hinge=left,open=true": { + "model": "${modid}:block/${registryname}_bottom_hinge", + "y": 90 + }, + "facing=south,half=lower,hinge=left,open=true": { + "model": "${modid}:block/${registryname}_bottom_hinge", + "y": 180 + }, + "facing=west,half=lower,hinge=left,open=true": { + "model": "${modid}:block/${registryname}_bottom_hinge", + "y": 270 + }, + "facing=north,half=lower,hinge=left,open=true": { + "model": "${modid}:block/${registryname}_bottom_hinge" + }, + "facing=east,half=lower,hinge=right,open=true": { + "model": "${modid}:block/${registryname}_bottom", + "y": 270 + }, + "facing=south,half=lower,hinge=right,open=true": { + "model": "${modid}:block/${registryname}_bottom" + }, + "facing=west,half=lower,hinge=right,open=true": { + "model": "${modid}:block/${registryname}_bottom", + "y": 90 + }, + "facing=north,half=lower,hinge=right,open=true": { + "model": "${modid}:block/${registryname}_bottom", + "y": 180 + }, + "facing=east,half=upper,hinge=left,open=false": { + "model": "${modid}:block/${registryname}_top" + }, + "facing=south,half=upper,hinge=left,open=false": { + "model": "${modid}:block/${registryname}_top", + "y": 90 + }, + "facing=west,half=upper,hinge=left,open=false": { + "model": "${modid}:block/${registryname}_top", + "y": 180 + }, + "facing=north,half=upper,hinge=left,open=false": { + "model": "${modid}:block/${registryname}_top", + "y": 270 + }, + "facing=east,half=upper,hinge=right,open=false": { + "model": "${modid}:block/${registryname}_top_hinge" + }, + "facing=south,half=upper,hinge=right,open=false": { + "model": "${modid}:block/${registryname}_top_hinge", + "y": 90 + }, + "facing=west,half=upper,hinge=right,open=false": { + "model": "${modid}:block/${registryname}_top_hinge", + "y": 180 + }, + "facing=north,half=upper,hinge=right,open=false": { + "model": "${modid}:block/${registryname}_top_hinge", + "y": 270 + }, + "facing=east,half=upper,hinge=left,open=true": { + "model": "${modid}:block/${registryname}_top_hinge", + "y": 90 + }, + "facing=south,half=upper,hinge=left,open=true": { + "model": "${modid}:block/${registryname}_top_hinge", + "y": 180 + }, + "facing=west,half=upper,hinge=left,open=true": { + "model": "${modid}:block/${registryname}_top_hinge", + "y": 270 + }, + "facing=north,half=upper,hinge=left,open=true": { + "model": "${modid}:block/${registryname}_top_hinge" + }, + "facing=east,half=upper,hinge=right,open=true": { + "model": "${modid}:block/${registryname}_top", + "y": 270 + }, + "facing=south,half=upper,hinge=right,open=true": { + "model": "${modid}:block/${registryname}_top" + }, + "facing=west,half=upper,hinge=right,open=true": { + "model": "${modid}:block/${registryname}_top", + "y": 90 + }, + "facing=north,half=upper,hinge=right,open=true": { + "model": "${modid}:block/${registryname}_top", + "y": 180 + } + } +} diff --git a/src/fabric-1.16.5/templates/json/txblock/door_top.json.ftl b/src/fabric-1.16.5/templates/json/txblock/door_top.json.ftl new file mode 100644 index 00000000..34d3ff24 --- /dev/null +++ b/src/fabric-1.16.5/templates/json/txblock/door_top.json.ftl @@ -0,0 +1,8 @@ +{ + "parent": "block/door_top", + "textures": { + <#if data.particleTexture?has_content>"particle": "${modid}:blocks/${data.particleTexture}", + "bottom": "${modid}:blocks/${data.texture}", + "top": "${modid}:blocks/${data.textureTop?has_content?then(data.textureTop, data.texture)}" + } +} diff --git a/src/fabric-1.16.5/templates/json/txblock/door_top_hinge.json.ftl b/src/fabric-1.16.5/templates/json/txblock/door_top_hinge.json.ftl new file mode 100644 index 00000000..bff33408 --- /dev/null +++ b/src/fabric-1.16.5/templates/json/txblock/door_top_hinge.json.ftl @@ -0,0 +1,8 @@ +{ + "parent": "block/door_top_rh", + "textures": { + <#if data.particleTexture?has_content>"particle": "${modid}:blocks/${data.particleTexture}", + "bottom": "${modid}:blocks/${data.texture}", + "top": "${modid}:blocks/${data.textureTop?has_content?then(data.textureTop, data.texture)}" + } +} diff --git a/src/fabric-1.16.5/templates/json/txblock/fence_gate.json.ftl b/src/fabric-1.16.5/templates/json/txblock/fence_gate.json.ftl new file mode 100644 index 00000000..dbb27663 --- /dev/null +++ b/src/fabric-1.16.5/templates/json/txblock/fence_gate.json.ftl @@ -0,0 +1,7 @@ +{ + "parent": "block/template_fence_gate", + "textures": { + <#if data.particleTexture?has_content>"particle": "${modid}:blocks/${data.particleTexture}", + "texture": "${modid}:blocks/${data.texture}" + } +} \ No newline at end of file diff --git a/src/fabric-1.16.5/templates/json/txblock/fence_gate_item.json.ftl b/src/fabric-1.16.5/templates/json/txblock/fence_gate_item.json.ftl new file mode 100644 index 00000000..69b51068 --- /dev/null +++ b/src/fabric-1.16.5/templates/json/txblock/fence_gate_item.json.ftl @@ -0,0 +1,14 @@ +<#-- @formatter:off --> +<#if data.itemTexture?has_content> +{ + "parent": "item/generated", + "textures": { + "layer0": "${modid}:items/${data.itemTexture}" + } +} +<#else> +{ + "parent": "${modid}:block/${registryname}" +} + +<#-- @formatter:on --> \ No newline at end of file diff --git a/src/fabric-1.16.5/templates/json/txblock/fence_gate_open.json.ftl b/src/fabric-1.16.5/templates/json/txblock/fence_gate_open.json.ftl new file mode 100644 index 00000000..cbbf1dfc --- /dev/null +++ b/src/fabric-1.16.5/templates/json/txblock/fence_gate_open.json.ftl @@ -0,0 +1,7 @@ +{ + "parent": "block/template_fence_gate_open", + "textures": { + <#if data.particleTexture?has_content>"particle": "${modid}:blocks/${data.particleTexture}", + "texture": "${modid}:blocks/${data.texture}" + } +} \ No newline at end of file diff --git a/src/fabric-1.16.5/templates/json/txblock/fence_gate_states.json.ftl b/src/fabric-1.16.5/templates/json/txblock/fence_gate_states.json.ftl new file mode 100644 index 00000000..2abb1530 --- /dev/null +++ b/src/fabric-1.16.5/templates/json/txblock/fence_gate_states.json.ftl @@ -0,0 +1,80 @@ +{ + "variants": { + "facing=south,in_wall=false,open=false": { + "model": "${modid}:block/${registryname}", + "uvlock": true + }, + "facing=west,in_wall=false,open=false": { + "model": "${modid}:block/${registryname}", + "uvlock": true, + "y": 90 + }, + "facing=north,in_wall=false,open=false": { + "model": "${modid}:block/${registryname}", + "uvlock": true, + "y": 180 + }, + "facing=east,in_wall=false,open=false": { + "model": "${modid}:block/${registryname}", + "uvlock": true, + "y": 270 + }, + "facing=south,in_wall=false,open=true": { + "model": "${modid}:block/${registryname}_open", + "uvlock": true + }, + "facing=west,in_wall=false,open=true": { + "model": "${modid}:block/${registryname}_open", + "uvlock": true, + "y": 90 + }, + "facing=north,in_wall=false,open=true": { + "model": "${modid}:block/${registryname}_open", + "uvlock": true, + "y": 180 + }, + "facing=east,in_wall=false,open=true": { + "model": "${modid}:block/${registryname}_open", + "uvlock": true, + "y": 270 + }, + "facing=south,in_wall=true,open=false": { + "model": "${modid}:block/${registryname}_wall", + "uvlock": true + }, + "facing=west,in_wall=true,open=false": { + "model": "${modid}:block/${registryname}_wall", + "uvlock": true, + "y": 90 + }, + "facing=north,in_wall=true,open=false": { + "model": "${modid}:block/${registryname}_wall", + "uvlock": true, + "y": 180 + }, + "facing=east,in_wall=true,open=false": { + "model": "${modid}:block/${registryname}_wall", + "uvlock": true, + "y": 270 + }, + "facing=south,in_wall=true,open=true": { + "model": "${modid}:block/${registryname}_wall_open", + "uvlock": true + }, + "facing=west,in_wall=true,open=true": { + "model": "${modid}:block/${registryname}_wall_open", + "uvlock": true, + "y": 90 + }, + "facing=north,in_wall=true,open=true": { + "model": "${modid}:block/${registryname}_wall_open", + "uvlock": true, + "y": 180 + }, + "facing=east,in_wall=true,open=true": { + "model": "${modid}:block/${registryname}_wall_open", + "uvlock": true, + "y": 270 + } + } +} diff --git a/src/fabric-1.16.5/templates/json/txblock/fence_gate_wall.json.ftl b/src/fabric-1.16.5/templates/json/txblock/fence_gate_wall.json.ftl new file mode 100644 index 00000000..dfdce39f --- /dev/null +++ b/src/fabric-1.16.5/templates/json/txblock/fence_gate_wall.json.ftl @@ -0,0 +1,7 @@ +{ + "parent": "block/template_fence_gate_wall", + "textures": { + <#if data.particleTexture?has_content>"particle": "${modid}:blocks/${data.particleTexture}", + "texture": "${modid}:blocks/${data.texture}" + } +} \ No newline at end of file diff --git a/src/fabric-1.16.5/templates/json/txblock/fence_gate_wall_open.json.ftl b/src/fabric-1.16.5/templates/json/txblock/fence_gate_wall_open.json.ftl new file mode 100644 index 00000000..dd0e7549 --- /dev/null +++ b/src/fabric-1.16.5/templates/json/txblock/fence_gate_wall_open.json.ftl @@ -0,0 +1,7 @@ +{ + "parent": "block/template_fence_gate_wall_open", + "textures": { + <#if data.particleTexture?has_content>"particle": "${modid}:blocks/${data.particleTexture}", + "texture": "${modid}:blocks/${data.texture}" + } +} \ No newline at end of file