From 8bccb2c9a8b2fab7396520823ac76d84fe460438 Mon Sep 17 00:00:00 2001 From: Forstride Date: Thu, 4 Jan 2024 15:55:46 -0500 Subject: [PATCH] Allowed Thermoregulators to be rotated horizontally --- .../9dc2e1bbb6dbc88d629e62ed955e4c156b6652a3 | 4 +- .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 4 +- .../toughasnails/recipes/thermoregulator.json | 7 +-- .../items/thermoregulator_heating_fuel.json | 1 + .../block/ThermoregulatorBlock.java | 26 +++++++- .../blockstates/thermoregulator.json | 56 ++++++++++++++++-- .../models/block/thermoregulator_active.json | 12 ++-- .../block/thermoregulator_cooling_active.json | 12 ++-- .../block/thermoregulator_heating_active.json | 12 ++-- .../block/thermoregulator_inactive.json | 12 ++-- .../block/thermoregulator_side_inactive.png | Bin 256 -> 256 bytes .../block/thermoregulator_top_active.png | Bin 366 -> 356 bytes .../thermoregulator_top_active.png.mcmeta | 2 +- .../block/thermoregulator_top_inactive.png | Bin 325 -> 342 bytes .../datagen/provider/TANItemTagsProvider.java | 2 +- .../datagen/provider/TANRecipeProvider.java | 2 +- 16 files changed, 110 insertions(+), 42 deletions(-) diff --git a/common/src/generated/resources/.cache/9dc2e1bbb6dbc88d629e62ed955e4c156b6652a3 b/common/src/generated/resources/.cache/9dc2e1bbb6dbc88d629e62ed955e4c156b6652a3 index b4539dbe..f4909aad 100644 --- a/common/src/generated/resources/.cache/9dc2e1bbb6dbc88d629e62ed955e4c156b6652a3 +++ b/common/src/generated/resources/.cache/9dc2e1bbb6dbc88d629e62ed955e4c156b6652a3 @@ -1,4 +1,4 @@ -// 1.20.4 2024-01-04T08:50:20.0019248 Tags for minecraft:item mod id toughasnails +// 1.20.4 2024-01-04T15:02:33.4878204 Tags for minecraft:item mod id toughasnails f05342856fe99891fa5e94bbe8db82a4f75ac41e data/toughasnails/tags/items/cooling_armor.json 572f6d0748095755aeef0ca7d602f4ebba9bfd76 data/toughasnails/tags/items/cooling_consumed_items.json 7c304628a9c17ca3ba6cd13e199fcf73ad9c974f data/toughasnails/tags/items/cooling_held_items.json @@ -21,7 +21,7 @@ f87a1c4dc42b16f1628cfca591895d987e5dc6ca data/toughasnails/tags/items/poison_cha 35133e95f1c8fdd7a1c21afcc231fc0bffefb9a8 data/toughasnails/tags/items/poison_chance/50_poison_chance_drinks.json cc0aa3bf437ed849deda4e4b64aff3665160dae6 data/toughasnails/tags/items/poison_chance/75_poison_chance_drinks.json 6f524ffe3a9819336fb57316d3245695a9601368 data/toughasnails/tags/items/thermoregulator_cooling_fuel.json -3d80c1a95b23a8f6e2e0350454fc36e0743ee45a data/toughasnails/tags/items/thermoregulator_heating_fuel.json +0a899c9faf8d9ae947deb0268aa08dbcff8ecdf1 data/toughasnails/tags/items/thermoregulator_heating_fuel.json 0395ed7d6e3d7510a25d2f4ef8b498b0d8c6c9eb data/toughasnails/tags/items/thirst/10_thirst_drinks.json 35133e95f1c8fdd7a1c21afcc231fc0bffefb9a8 data/toughasnails/tags/items/thirst/11_thirst_drinks.json 35133e95f1c8fdd7a1c21afcc231fc0bffefb9a8 data/toughasnails/tags/items/thirst/12_thirst_drinks.json diff --git a/common/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e b/common/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e index f65a987f..c7a388bb 100644 --- a/common/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/common/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,4 @@ -// 1.20.4 2024-01-04T10:16:03.4651007 Recipes +// 1.20.4 2024-01-04T15:52:05.5413549 Recipes 09252bd5a872203de304820e8d5c5493afe96cf4 data/toughasnails/advancements/recipes/combat/leaf_boots.json 2da825265e95f5dfc0dd4026e0dafee70c17512c data/toughasnails/advancements/recipes/combat/leaf_chestplate.json 6d96cd4baff66d426c9405852ceed3aa8a3cde8f data/toughasnails/advancements/recipes/combat/leaf_helmet.json @@ -69,7 +69,7 @@ fb03395b2b66dc861d110435b0d5c63a351123cd data/toughasnails/recipes/rain_collecto 2512026dc3a027f39db7e77e023a7017de386b9c data/toughasnails/recipes/sweet_berry_juice.json e636bfd4fab8d516083454e872c8115f5c15cf27 data/toughasnails/recipes/temperature_gauge.json b75d1caa0b1dcb9ae14dc02e47bba2a3c4b4a4dc data/toughasnails/recipes/thermometer.json -ec555eb461e41d183f1663ce4f9be35d3036d72d data/toughasnails/recipes/thermoregulator.json +354e18f4a33f2c769bc2063667cd1369a354f119 data/toughasnails/recipes/thermoregulator.json cbfb7c82bd9547a1a134e3814136fbdbcdd5dc79 data/toughasnails/recipes/water_purifier.json 30229579a58927cae7011781b0936f7ca87888a4 data/toughasnails/recipes/wool_boots.json 25ff54ef0230fd94b0f881f7866b571f4729d254 data/toughasnails/recipes/wool_chestplate.json diff --git a/common/src/generated/resources/data/toughasnails/recipes/thermoregulator.json b/common/src/generated/resources/data/toughasnails/recipes/thermoregulator.json index a275aa76..d250c6ed 100644 --- a/common/src/generated/resources/data/toughasnails/recipes/thermoregulator.json +++ b/common/src/generated/resources/data/toughasnails/recipes/thermoregulator.json @@ -2,9 +2,6 @@ "type": "minecraft:crafting_shaped", "category": "misc", "key": { - "G": { - "item": "minecraft:glass" - }, "I": { "item": "minecraft:iron_ingot" }, @@ -16,9 +13,9 @@ } }, "pattern": [ - "SGS", + "SIS", "ITI", - "SGS" + "SIS" ], "result": { "item": "toughasnails:thermoregulator" diff --git a/common/src/generated/resources/data/toughasnails/tags/items/thermoregulator_heating_fuel.json b/common/src/generated/resources/data/toughasnails/tags/items/thermoregulator_heating_fuel.json index e27b0b45..874247c6 100644 --- a/common/src/generated/resources/data/toughasnails/tags/items/thermoregulator_heating_fuel.json +++ b/common/src/generated/resources/data/toughasnails/tags/items/thermoregulator_heating_fuel.json @@ -4,6 +4,7 @@ "minecraft:magma_cream", "minecraft:blaze_powder", "minecraft:blaze_rod", + "minecraft:fire_charge", "minecraft:coal", "minecraft:charcoal", "minecraft:coal_block", diff --git a/common/src/main/java/toughasnails/block/ThermoregulatorBlock.java b/common/src/main/java/toughasnails/block/ThermoregulatorBlock.java index 9eff4f1b..f9514737 100644 --- a/common/src/main/java/toughasnails/block/ThermoregulatorBlock.java +++ b/common/src/main/java/toughasnails/block/ThermoregulatorBlock.java @@ -4,22 +4,29 @@ ******************************************************************************/ package toughasnails.block; +import net.minecraft.core.Direction; +import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.HorizontalDirectionalBlock; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.DirectionProperty; import java.util.function.ToIntFunction; public class ThermoregulatorBlock extends Block { + public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; public static final BooleanProperty COOLING = BooleanProperty.create("cooling"); public static final BooleanProperty HEATING = BooleanProperty.create("heating"); public ThermoregulatorBlock(Properties properties) { super(properties); - this.registerDefaultState(this.stateDefinition.any().setValue(COOLING, false).setValue(HEATING, false)); + this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(COOLING, false).setValue(HEATING, false)); } public static ToIntFunction lightLevel(int level) @@ -32,9 +39,24 @@ public static ToIntFunction lightLevel(int level) }; } + @Override + public BlockState getStateForPlacement(BlockPlaceContext $$0) { + return (BlockState)this.defaultBlockState().setValue(FACING, $$0.getHorizontalDirection().getOpposite()); + } + + @Override + public BlockState rotate(BlockState $$0, Rotation $$1) { + return (BlockState)$$0.setValue(FACING, $$1.rotate((Direction)$$0.getValue(FACING))); + } + + @Override + public BlockState mirror(BlockState $$0, Mirror $$1) { + return $$0.rotate($$1.getRotation((Direction)$$0.getValue(FACING))); + } + @Override protected void createBlockStateDefinition(StateDefinition.Builder builder) { - builder.add(COOLING, HEATING); + builder.add(FACING, COOLING, HEATING); } } diff --git a/common/src/main/resources/assets/toughasnails/blockstates/thermoregulator.json b/common/src/main/resources/assets/toughasnails/blockstates/thermoregulator.json index d7158a9f..e22b49ee 100644 --- a/common/src/main/resources/assets/toughasnails/blockstates/thermoregulator.json +++ b/common/src/main/resources/assets/toughasnails/blockstates/thermoregulator.json @@ -1,16 +1,64 @@ { "variants": { - "cooling=false,heating=false": { + "facing=east,cooling=false,heating=false": { + "model": "toughasnails:block/thermoregulator_inactive", + "y": 90 + }, + "facing=east,cooling=true,heating=false": { + "model": "toughasnails:block/thermoregulator_cooling_active", + "y": 90 + }, + "facing=east,cooling=false,heating=true": { + "model": "toughasnails:block/thermoregulator_heating_active", + "y": 90 + }, + "facing=east,cooling=true,heating=true": { + "model": "toughasnails:block/thermoregulator_active", + "y": 90 + }, + "facing=north,cooling=false,heating=false": { "model": "toughasnails:block/thermoregulator_inactive" }, - "cooling=true,heating=false": { + "facing=north,cooling=true,heating=false": { "model": "toughasnails:block/thermoregulator_cooling_active" }, - "cooling=false,heating=true": { + "facing=north,cooling=false,heating=true": { "model": "toughasnails:block/thermoregulator_heating_active" }, - "cooling=true,heating=true": { + "facing=north,cooling=true,heating=true": { "model": "toughasnails:block/thermoregulator_active" + }, + "facing=south,cooling=false,heating=false": { + "model": "toughasnails:block/thermoregulator_inactive", + "y": 180 + }, + "facing=south,cooling=true,heating=false": { + "model": "toughasnails:block/thermoregulator_cooling_active", + "y": 180 + }, + "facing=south,cooling=false,heating=true": { + "model": "toughasnails:block/thermoregulator_heating_active", + "y": 180 + }, + "facing=south,cooling=true,heating=true": { + "model": "toughasnails:block/thermoregulator_active", + "y": 180 + }, + "facing=west,cooling=false,heating=false": { + "model": "toughasnails:block/thermoregulator_inactive", + "y": 270 + }, + "facing=west,cooling=true,heating=false": { + "model": "toughasnails:block/thermoregulator_cooling_active", + "y": 270 + }, + "facing=west,cooling=false,heating=true": { + "model": "toughasnails:block/thermoregulator_heating_active", + "y": 270 + }, + "facing=west,cooling=true,heating=true": { + "model": "toughasnails:block/thermoregulator_active", + "y": 270 } } } \ No newline at end of file diff --git a/common/src/main/resources/assets/toughasnails/models/block/thermoregulator_active.json b/common/src/main/resources/assets/toughasnails/models/block/thermoregulator_active.json index 12f0c2df..e62a9b0c 100644 --- a/common/src/main/resources/assets/toughasnails/models/block/thermoregulator_active.json +++ b/common/src/main/resources/assets/toughasnails/models/block/thermoregulator_active.json @@ -8,17 +8,17 @@ }, "elements": [ { - "from": [0, 16, 0], - "to": [8, 16, 16], + "from": [8, 16, 0], + "to": [16, 16, 16], "faces": { - "up": {"uv": [0, 0, 8, 16], "texture": "#top"} + "up": {"uv": [0, 0, 8, 16], "rotation": 180, "texture": "#top"} } }, { - "from": [8, 16, 0], - "to": [16, 16, 16], + "from": [0, 16, 0], + "to": [8, 16, 16], "faces": { - "up": {"uv": [8, 0, 16, 16], "texture": "#top"} + "up": {"uv": [8, 0, 16, 16], "rotation": 180, "texture": "#top"} } }, { diff --git a/common/src/main/resources/assets/toughasnails/models/block/thermoregulator_cooling_active.json b/common/src/main/resources/assets/toughasnails/models/block/thermoregulator_cooling_active.json index eb5f026b..8dde443d 100644 --- a/common/src/main/resources/assets/toughasnails/models/block/thermoregulator_cooling_active.json +++ b/common/src/main/resources/assets/toughasnails/models/block/thermoregulator_cooling_active.json @@ -10,17 +10,17 @@ }, "elements": [ { - "from": [0, 16, 0], - "to": [8, 16, 16], + "from": [8, 16, 0], + "to": [16, 16, 16], "faces": { - "up": {"uv": [0, 0, 8, 16], "texture": "#top"} + "up": {"uv": [0, 0, 8, 16], "rotation": 180, "texture": "#top"} } }, { - "from": [8, 16, 0], - "to": [16, 16, 16], + "from": [0, 16, 0], + "to": [8, 16, 16], "faces": { - "up": {"uv": [8, 0, 16, 16], "texture": "#top_active"} + "up": {"uv": [8, 0, 16, 16], "rotation": 180, "texture": "#top_active"} } }, { diff --git a/common/src/main/resources/assets/toughasnails/models/block/thermoregulator_heating_active.json b/common/src/main/resources/assets/toughasnails/models/block/thermoregulator_heating_active.json index f587a943..66eec983 100644 --- a/common/src/main/resources/assets/toughasnails/models/block/thermoregulator_heating_active.json +++ b/common/src/main/resources/assets/toughasnails/models/block/thermoregulator_heating_active.json @@ -10,17 +10,17 @@ }, "elements": [ { - "from": [0, 16, 0], - "to": [8, 16, 16], + "from": [8, 16, 0], + "to": [16, 16, 16], "faces": { - "up": {"uv": [0, 0, 8, 16], "texture": "#top_active"} + "up": {"uv": [0, 0, 8, 16], "rotation": 180, "texture": "#top_active"} } }, { - "from": [8, 16, 0], - "to": [16, 16, 16], + "from": [0, 16, 0], + "to": [8, 16, 16], "faces": { - "up": {"uv": [8, 0, 16, 16], "texture": "#top"} + "up": {"uv": [8, 0, 16, 16], "rotation": 180, "texture": "#top"} } }, { diff --git a/common/src/main/resources/assets/toughasnails/models/block/thermoregulator_inactive.json b/common/src/main/resources/assets/toughasnails/models/block/thermoregulator_inactive.json index 5396b43d..e0debe5a 100644 --- a/common/src/main/resources/assets/toughasnails/models/block/thermoregulator_inactive.json +++ b/common/src/main/resources/assets/toughasnails/models/block/thermoregulator_inactive.json @@ -8,17 +8,17 @@ }, "elements": [ { - "from": [0, 16, 0], - "to": [8, 16, 16], + "from": [8, 16, 0], + "to": [16, 16, 16], "faces": { - "up": {"uv": [0, 0, 8, 16], "texture": "#top"} + "up": {"uv": [0, 0, 8, 16], "rotation": 180, "texture": "#top"} } }, { - "from": [8, 16, 0], - "to": [16, 16, 16], + "from": [0, 16, 0], + "to": [8, 16, 16], "faces": { - "up": {"uv": [8, 0, 16, 16], "texture": "#top"} + "up": {"uv": [8, 0, 16, 16], "rotation": 180, "texture": "#top"} } }, { diff --git a/common/src/main/resources/assets/toughasnails/textures/block/thermoregulator_side_inactive.png b/common/src/main/resources/assets/toughasnails/textures/block/thermoregulator_side_inactive.png index bf57824fa58611e409341bb54d835934141bcb6b..382ce13e862e3e87c3eac2afa1f18453b0e8a72c 100644 GIT binary patch delta 71 zcmZo*YG9fWYU|_Ula`j&*w{E}(xjzJmu}m(Eixjaq@<+2zTVWt#MZ{f&B>`!@a_S=b*@&NGP8!rF= delta 71 zcmZo*YG9fWYU@{4lQMB;^}6ld2hXm!aPz{emyr<>B_$>G_4TGECbl*Fr%o3SHr|fc>r1{8)X0h diff --git a/common/src/main/resources/assets/toughasnails/textures/block/thermoregulator_top_active.png b/common/src/main/resources/assets/toughasnails/textures/block/thermoregulator_top_active.png index 92841dc1663c134efb72e5b6b6c4ed72747801fc..363f68d3dfd61b79f3d9d986ddadf872cebca73f 100644 GIT binary patch delta 248 zcmV0^|aaK><#YLN|YihlotN*nfY2JUcrfAt6ssPZ1FjU0YkLtgCON!J+^F z010qNS#tmY4!-~Z4!;371ydvd005s!L_t(2Q`L}L62c%1Me_iSt%wLV?fy6FrR^|o zzzx}pk8Ud&lYT>rAItE{V%tgZ+E000SaNLh0L01m?d01m?e z$8V@)0002ENklYgi^Ll*xap9!hNNBR8pmOHY`XIUH276Y0ol*FBW!9(zszkqVtz& ziH6}KjuVd2!;s!bAIX=%@Sd%jN`I_C@am{`U^a^FVX%zDZc9FPI}L@gTSr$}vcg5M zh=}@8dU$VsM*lA!)pGDC_Pjif2?+5gAn>>W2s};z`hf?_7kwiOee-9H{{R3007*qo IM6N<$f+G%dDgXcg diff --git a/common/src/main/resources/assets/toughasnails/textures/block/thermoregulator_top_active.png.mcmeta b/common/src/main/resources/assets/toughasnails/textures/block/thermoregulator_top_active.png.mcmeta index 50183878..c929a1e2 100644 --- a/common/src/main/resources/assets/toughasnails/textures/block/thermoregulator_top_active.png.mcmeta +++ b/common/src/main/resources/assets/toughasnails/textures/block/thermoregulator_top_active.png.mcmeta @@ -1,6 +1,6 @@ { "animation": { - "frametime": 15, + "frametime": 30, "interpolate": true } } diff --git a/common/src/main/resources/assets/toughasnails/textures/block/thermoregulator_top_inactive.png b/common/src/main/resources/assets/toughasnails/textures/block/thermoregulator_top_inactive.png index 3304a72fa7a4fc0aa6a528c7825fdd89d284b468..603d99b77d84c60e11c9f05c073f0c5aa2677dd5 100644 GIT binary patch delta 286 zcmV+(0pb3|0@ebML4QtAOjJc^XlQhFbXizfKR!Z9NJx*5kF~Y6u5nVFoSd)L+LFY{ z$CzE(uzEyYZRYdzb44}p;(~~Wh;OB|e}8{GJ3ApEAx}?F5fKqxTU)EFtNE+J4*&oF z32;bRa{vGi!2kdb!2!6DYwZ940Fg;VK~yMHO^=NZ!XONU`+ozjZXzPMj`x32kIfK2 zTEZP|(h@Nf$;o&#F=uK5L4QI}OjJc^XlQhFbXizfKR!Z9NJx*5kF~Y6%TW@XoSdll|A6K1 z>Wmftsy`!Db>aN~f+Pj>*%?f_*iTPS#l^*|tg8_b5js0OIRF3v32;bRa{vGi!vFvd z!vV){sAK>D0E|gQK~yMHEl&#;!ypI?pSG@@>xS+9uewmgCw~bMl>j1uK9O7?FgG)2 z;s(Q(bzK*mzz)OKHt_J(b~x`Fj`smG^iO92b)4Tbg}whuP&q}-wM%CKwdYGOuoOZy z*b&T;f{t;G%cFoojJw^