diff --git a/gradle.properties b/gradle.properties index 0a1cbee..7ad2919 100644 --- a/gradle.properties +++ b/gradle.properties @@ -34,7 +34,7 @@ mod_name=Power Tool # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=GPL-3.0 # The mod version. See https://semver.org/ -mod_version=1.4.13 +mod_version=1.4.14 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html diff --git a/src/generated/resources/.cache/86465dcd1331b21a960f3496f736ce9922bfa9ba b/src/generated/resources/.cache/86465dcd1331b21a960f3496f736ce9922bfa9ba index e09b815..fe85cd6 100644 --- a/src/generated/resources/.cache/86465dcd1331b21a960f3496f736ce9922bfa9ba +++ b/src/generated/resources/.cache/86465dcd1331b21a960f3496f736ce9922bfa9ba @@ -1,16 +1,24 @@ -// 1.21.1 2024-09-28T14:16:00.3767043 Block States: powertool +// 1.21.1 2024-10-05T16:36:45.6046984 Block States: powertool ae6ddabd13bd84907c7fc7fdb01186954fc13502 assets/powertool/blockstates/cosmetic_barrel.json +f2ba93d02d22c027abeeea15860c72a3e6a46cb6 assets/powertool/blockstates/cosmetic_beacon.json 05b788f1ac0190925f20bbc680cb68c445d80223 assets/powertool/blockstates/cosmetic_beehive.json e771ba4339b87af1e3d3af179b69b99b0221f4f6 assets/powertool/blockstates/cosmetic_blast_furnace.json b967eaee066e68a6d96ab5c8fb5f9f75dfab8f86 assets/powertool/blockstates/cosmetic_brain_coral_block.json f4b5c6779e5abc63a237d9cd8bf873d8baf6106c assets/powertool/blockstates/cosmetic_bubble_coral_block.json +58d540b705bebe6eeac65cbbb9a1bc2df7fa1bc6 assets/powertool/blockstates/cosmetic_cartography_table.json +73d337b16e2c9e9f6da8c89b9b04a7922dee3a7e assets/powertool/blockstates/cosmetic_crafting_table.json +b825aff79fdf08fe701998ba56536cf1f106603a assets/powertool/blockstates/cosmetic_enchanting_table.json 0c1c987cced2e39340414af7e894e64745146116 assets/powertool/blockstates/cosmetic_fire_coral_block.json +6f41528406fec589da84008d2e1859c87acce433 assets/powertool/blockstates/cosmetic_fletching_table.json bc3d25275ab66ee6de97cc3f7a46bc192d6e9861 assets/powertool/blockstates/cosmetic_furnace.json f37e3dfe4acc540146d7d4ce599fb508ef16650e assets/powertool/blockstates/cosmetic_gravel.json 2b25a59d11e5f2af7f6b9882f6b4b5b490e25c3a assets/powertool/blockstates/cosmetic_horn_coral_block.json 82ce04089243c18fcc378c68c15690bc5c7d1484 assets/powertool/blockstates/cosmetic_redstone_block.json 59eb8dd5b7ffb922c678282ad4a98e1e5ae23f67 assets/powertool/blockstates/cosmetic_red_sand.json 49a234a2bae6b4887904b3149f03838c3b488928 assets/powertool/blockstates/cosmetic_sand.json +e01d538de9ee2f12215bb211c0788f5493a3d863 assets/powertool/blockstates/cosmetic_smithing_table.json +88e2d563c03f93042e995a101bb092cbb7b5abb9 assets/powertool/blockstates/cosmetic_smoker.json +e7af329147e693d304482e605f84838e0e640fee assets/powertool/blockstates/cosmetic_stonecutter.json 7d416e6e49bae0cf46ac11c9b2a85bca567c4ef0 assets/powertool/blockstates/cosmetic_tube_coral_block.json 38eb9c4431dd893f9b6a19659bf14c7dacf8a47d assets/powertool/blockstates/gray_trash_can.json a8239321f2713befc6b352461dd0ddfc0731ae04 assets/powertool/blockstates/green_trash_can.json @@ -18,18 +26,27 @@ a8239321f2713befc6b352461dd0ddfc0731ae04 assets/powertool/blockstates/green_tras 73e34f2417a5c4eef6cecd3fb144d7498e3c0730 assets/powertool/blockstates/temple.json 72358d0b2db425861fdcbe0e22e92b9405895c88 assets/powertool/blockstates/white_trash_can.json cd29f633a654dfdb0c65433112a02d9269f7a24e assets/powertool/blockstates/white_trash_can_cap.json +5ba92d5de29d707f0cce235504a8170bd5a4d2e0 assets/powertool/models/block/cosmetic_beacon.json 3a87aba93140e66ff5772eb5fb355054be7f5236 assets/powertool/models/item/cosmetic_barrel.json +fc424e967be5eeee755df8ebf05243c68dcdb0e3 assets/powertool/models/item/cosmetic_beacon.json db77b806b2be1fcdb0081b214fd264d048911a43 assets/powertool/models/item/cosmetic_beehive.json 9db8ff6b8f62a90066f9ec6f113f30579ef147b4 assets/powertool/models/item/cosmetic_blast_furnace.json 09534ca2a8e9cdd11e946a3e69b56bbc68ac448c assets/powertool/models/item/cosmetic_brain_coral_block.json aa0a4f2563510784290b3a9bd67849aa1a1d83c0 assets/powertool/models/item/cosmetic_bubble_coral_block.json +ffc9aca15acd4879cacd93452b9bfbc5ced87c9e assets/powertool/models/item/cosmetic_cartography_table.json +f36fa54bdee70580abfce02e1255eefca84974e6 assets/powertool/models/item/cosmetic_crafting_table.json +eeb8902113ed70e7881f713ef7fe4573524a32d7 assets/powertool/models/item/cosmetic_enchanting_table.json 9b72bc2e6e4bb294d9b0c95cf119c7b5a18b5c87 assets/powertool/models/item/cosmetic_fire_coral_block.json +ccb572d42f2347546027eb372e80b12955aa1256 assets/powertool/models/item/cosmetic_fletching_table.json 60287266a73cc75aea724a679eef047886e30aa3 assets/powertool/models/item/cosmetic_furnace.json c6e080a1706f251ee859af248d69f6a3b4c34dc3 assets/powertool/models/item/cosmetic_gravel.json cd46fb64b9fa15c031746f3b79df8c7d386d4eb9 assets/powertool/models/item/cosmetic_horn_coral_block.json 4749967c4d9cf2a0f0d9c422051f3b86f15c2783 assets/powertool/models/item/cosmetic_redstone_block.json 45fccb0be21da6968a6c93247b969b22df5895c5 assets/powertool/models/item/cosmetic_red_sand.json 976371ded304bf028cd5462a3568320aedc8085c assets/powertool/models/item/cosmetic_sand.json +e7f5580926bba0bbcefc0ad45fca6417f698cbe4 assets/powertool/models/item/cosmetic_smithing_table.json +e1d94ad1dd05c29f6208458328189cab4c326d58 assets/powertool/models/item/cosmetic_smoker.json +aac50ef69b31feae6f21e3acfc9fc98327266ad7 assets/powertool/models/item/cosmetic_stonecutter.json b0141832911b272755538b29b60e23038bf58a6f assets/powertool/models/item/cosmetic_tube_coral_block.json 6b3d3a1333f9b9ec7176e51af29476ccf52002f2 assets/powertool/models/item/gray_trash_can.json 1fe5241a345d5d17219bb128a8246aed214d0ee2 assets/powertool/models/item/green_trash_can.json diff --git a/src/generated/resources/assets/powertool/blockstates/cosmetic_beacon.json b/src/generated/resources/assets/powertool/blockstates/cosmetic_beacon.json new file mode 100644 index 0000000..f07f295 --- /dev/null +++ b/src/generated/resources/assets/powertool/blockstates/cosmetic_beacon.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "powertool:block/cosmetic_beacon" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/powertool/blockstates/cosmetic_cartography_table.json b/src/generated/resources/assets/powertool/blockstates/cosmetic_cartography_table.json new file mode 100644 index 0000000..6feb401 --- /dev/null +++ b/src/generated/resources/assets/powertool/blockstates/cosmetic_cartography_table.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "minecraft:block/cartography_table" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/powertool/blockstates/cosmetic_crafting_table.json b/src/generated/resources/assets/powertool/blockstates/cosmetic_crafting_table.json new file mode 100644 index 0000000..46adc79 --- /dev/null +++ b/src/generated/resources/assets/powertool/blockstates/cosmetic_crafting_table.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "minecraft:block/crafting_table" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/powertool/blockstates/cosmetic_enchanting_table.json b/src/generated/resources/assets/powertool/blockstates/cosmetic_enchanting_table.json new file mode 100644 index 0000000..85aeab3 --- /dev/null +++ b/src/generated/resources/assets/powertool/blockstates/cosmetic_enchanting_table.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "minecraft:block/enchanting_table" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/powertool/blockstates/cosmetic_fletching_table.json b/src/generated/resources/assets/powertool/blockstates/cosmetic_fletching_table.json new file mode 100644 index 0000000..941b4fd --- /dev/null +++ b/src/generated/resources/assets/powertool/blockstates/cosmetic_fletching_table.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "minecraft:block/fletching_table" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/powertool/blockstates/cosmetic_smithing_table.json b/src/generated/resources/assets/powertool/blockstates/cosmetic_smithing_table.json new file mode 100644 index 0000000..627ae90 --- /dev/null +++ b/src/generated/resources/assets/powertool/blockstates/cosmetic_smithing_table.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "minecraft:block/smithing_table" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/powertool/blockstates/cosmetic_smoker.json b/src/generated/resources/assets/powertool/blockstates/cosmetic_smoker.json new file mode 100644 index 0000000..41ab8d8 --- /dev/null +++ b/src/generated/resources/assets/powertool/blockstates/cosmetic_smoker.json @@ -0,0 +1,36 @@ +{ + "variants": { + "facing=east,lit=false": { + "model": "minecraft:block/smoker", + "y": 450 + }, + "facing=east,lit=true": { + "model": "minecraft:block/smoker_on", + "y": 450 + }, + "facing=north,lit=false": { + "model": "minecraft:block/smoker", + "y": 360 + }, + "facing=north,lit=true": { + "model": "minecraft:block/smoker_on", + "y": 360 + }, + "facing=south,lit=false": { + "model": "minecraft:block/smoker", + "y": 180 + }, + "facing=south,lit=true": { + "model": "minecraft:block/smoker_on", + "y": 180 + }, + "facing=west,lit=false": { + "model": "minecraft:block/smoker", + "y": 270 + }, + "facing=west,lit=true": { + "model": "minecraft:block/smoker_on", + "y": 270 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/powertool/blockstates/cosmetic_stonecutter.json b/src/generated/resources/assets/powertool/blockstates/cosmetic_stonecutter.json new file mode 100644 index 0000000..c50b85f --- /dev/null +++ b/src/generated/resources/assets/powertool/blockstates/cosmetic_stonecutter.json @@ -0,0 +1,19 @@ +{ + "variants": { + "facing=east": { + "model": "minecraft:block/stonecutter", + "y": 90 + }, + "facing=north": { + "model": "minecraft:block/stonecutter" + }, + "facing=south": { + "model": "minecraft:block/stonecutter", + "y": 180 + }, + "facing=west": { + "model": "minecraft:block/stonecutter", + "y": 270 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/powertool/models/block/cosmetic_beacon.json b/src/generated/resources/assets/powertool/models/block/cosmetic_beacon.json new file mode 100644 index 0000000..2170b45 --- /dev/null +++ b/src/generated/resources/assets/powertool/models/block/cosmetic_beacon.json @@ -0,0 +1,4 @@ +{ + "parent": "minecraft:block/beacon", + "render_type": "cutout" +} \ No newline at end of file diff --git a/src/generated/resources/assets/powertool/models/item/cosmetic_beacon.json b/src/generated/resources/assets/powertool/models/item/cosmetic_beacon.json new file mode 100644 index 0000000..e4c8aae --- /dev/null +++ b/src/generated/resources/assets/powertool/models/item/cosmetic_beacon.json @@ -0,0 +1,3 @@ +{ + "parent": "powertool:block/cosmetic_beacon" +} \ No newline at end of file diff --git a/src/generated/resources/assets/powertool/models/item/cosmetic_cartography_table.json b/src/generated/resources/assets/powertool/models/item/cosmetic_cartography_table.json new file mode 100644 index 0000000..b7fe4e4 --- /dev/null +++ b/src/generated/resources/assets/powertool/models/item/cosmetic_cartography_table.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:block/cartography_table" +} \ No newline at end of file diff --git a/src/generated/resources/assets/powertool/models/item/cosmetic_crafting_table.json b/src/generated/resources/assets/powertool/models/item/cosmetic_crafting_table.json new file mode 100644 index 0000000..323e84b --- /dev/null +++ b/src/generated/resources/assets/powertool/models/item/cosmetic_crafting_table.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:block/crafting_table" +} \ No newline at end of file diff --git a/src/generated/resources/assets/powertool/models/item/cosmetic_enchanting_table.json b/src/generated/resources/assets/powertool/models/item/cosmetic_enchanting_table.json new file mode 100644 index 0000000..9f76fca --- /dev/null +++ b/src/generated/resources/assets/powertool/models/item/cosmetic_enchanting_table.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:block/enchanting_table" +} \ No newline at end of file diff --git a/src/generated/resources/assets/powertool/models/item/cosmetic_fletching_table.json b/src/generated/resources/assets/powertool/models/item/cosmetic_fletching_table.json new file mode 100644 index 0000000..bc2b1bd --- /dev/null +++ b/src/generated/resources/assets/powertool/models/item/cosmetic_fletching_table.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:block/fletching_table" +} \ No newline at end of file diff --git a/src/generated/resources/assets/powertool/models/item/cosmetic_smithing_table.json b/src/generated/resources/assets/powertool/models/item/cosmetic_smithing_table.json new file mode 100644 index 0000000..3028d70 --- /dev/null +++ b/src/generated/resources/assets/powertool/models/item/cosmetic_smithing_table.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:block/smithing_table" +} \ No newline at end of file diff --git a/src/generated/resources/assets/powertool/models/item/cosmetic_smoker.json b/src/generated/resources/assets/powertool/models/item/cosmetic_smoker.json new file mode 100644 index 0000000..7d27401 --- /dev/null +++ b/src/generated/resources/assets/powertool/models/item/cosmetic_smoker.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:block/smoker" +} \ No newline at end of file diff --git a/src/generated/resources/assets/powertool/models/item/cosmetic_stonecutter.json b/src/generated/resources/assets/powertool/models/item/cosmetic_stonecutter.json new file mode 100644 index 0000000..54ffede --- /dev/null +++ b/src/generated/resources/assets/powertool/models/item/cosmetic_stonecutter.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:block/stonecutter" +} \ No newline at end of file diff --git a/src/main/java/org/teacon/powertool/block/CosmeticBlock.java b/src/main/java/org/teacon/powertool/block/CosmeticBlock.java new file mode 100644 index 0000000..e3b50a2 --- /dev/null +++ b/src/main/java/org/teacon/powertool/block/CosmeticBlock.java @@ -0,0 +1,4 @@ +package org.teacon.powertool.block; + +public interface CosmeticBlock { +} diff --git a/src/main/java/org/teacon/powertool/block/PowerToolBlocks.java b/src/main/java/org/teacon/powertool/block/PowerToolBlocks.java index 97d2956..33bca8c 100644 --- a/src/main/java/org/teacon/powertool/block/PowerToolBlocks.java +++ b/src/main/java/org/teacon/powertool/block/PowerToolBlocks.java @@ -28,8 +28,10 @@ import org.teacon.powertool.block.cosmetical.CosmeticCampfireBlock; import org.teacon.powertool.block.cosmetical.CosmeticFurnace; import org.teacon.powertool.block.cosmetical.CosmeticHopper; +import org.teacon.powertool.block.cosmetical.CosmeticHorizontalDirectionalBlock; import org.teacon.powertool.block.cosmetical.CosmeticSimpleBlock; import org.teacon.powertool.block.cosmetical.CosmeticTrapdoor; +import org.teacon.powertool.block.cosmetical.CosmeticWaterloggedBlock; import org.teacon.powertool.block.entity.CommonHolographicSignBlockEntity; import org.teacon.powertool.block.entity.ItemDisplayBlockEntity; import org.teacon.powertool.block.entity.ItemSupplierBlockEntity; @@ -48,6 +50,7 @@ import java.util.List; import java.util.Map; +import java.util.function.Function; import static org.teacon.powertool.item.PowerToolItems.ITEMS; @@ -68,7 +71,7 @@ public class PowerToolBlocks { () -> SoundEvents.GLOW_ITEM_FRAME_REMOVE_ITEM, () -> SoundEvents.MOSS_CARPET_FALL); - public static final List SIMPLE_BLOCKS = List.of(Blocks.SAND, Blocks.RED_SAND, Blocks.GRAVEL, Blocks.TUBE_CORAL_BLOCK, Blocks.BRAIN_CORAL_BLOCK, Blocks.BUBBLE_CORAL_BLOCK, Blocks.FIRE_CORAL_BLOCK, Blocks.HORN_CORAL_BLOCK, Blocks.REDSTONE_BLOCK); + public static final List SIMPLE_BLOCKS = List.of(Blocks.SAND, Blocks.RED_SAND, Blocks.GRAVEL, Blocks.TUBE_CORAL_BLOCK, Blocks.BRAIN_CORAL_BLOCK, Blocks.BUBBLE_CORAL_BLOCK, Blocks.FIRE_CORAL_BLOCK, Blocks.HORN_CORAL_BLOCK, Blocks.REDSTONE_BLOCK, Blocks.CARTOGRAPHY_TABLE, Blocks.CRAFTING_TABLE, Blocks.FLETCHING_TABLE, Blocks.SMITHING_TABLE,Blocks.BEACON); public static final DeferredRegister BLOCKS = DeferredRegister.create(Registries.BLOCK, PowerTool.MODID); public static final DeferredRegister> BLOCK_ENTITIES = DeferredRegister.create(Registries.BLOCK_ENTITY_TYPE, PowerTool.MODID); @@ -87,7 +90,8 @@ public class PowerToolBlocks { public static DeferredHolder COSMETIC_SOUL_CAMPFIRE; public static DeferredHolder COSMETIC_BEEHIVE; public static DeferredHolder COSMETIC_FURNACE; - public static DeferredHolder COSMETIC_BLAST_FURNACE; + public static DeferredHolder COSMETIC_BLAST_FURNACE; + public static DeferredHolder COSMETIC_SMOKER; public static DeferredHolder COSMETIC_BARREL; public static DeferredHolder HOLOGRAPHIC_SIGN; @@ -232,17 +236,22 @@ public static void register(IEventBus bus) { BlockSetType.IRON, Blocks.IRON_TRAPDOOR )); - regSimpleCosmetic(SIMPLE_BLOCKS); + regCosmetic(SIMPLE_BLOCKS,CosmeticSimpleBlock::new); + regCosmetic(List.of(Blocks.ENCHANTING_TABLE),CosmeticWaterloggedBlock::new); + regCosmetic(List.of(Blocks.STONECUTTER), CosmeticHorizontalDirectionalBlock::new); + COSMETIC_BEEHIVE = BLOCKS.register("cosmetic_beehive", () -> new CosmeticBeehive(BlockBehaviour.Properties.ofFullCopy(Blocks.BEEHIVE))); COSMETIC_FURNACE = BLOCKS.register("cosmetic_furnace", () -> new CosmeticFurnace(BlockBehaviour.Properties.ofFullCopy(Blocks.FURNACE))); COSMETIC_BLAST_FURNACE = BLOCKS.register("cosmetic_blast_furnace", () -> new CosmeticFurnace(BlockBehaviour.Properties.ofFullCopy(Blocks.BLAST_FURNACE))); + COSMETIC_SMOKER = BLOCKS.register("cosmetic_smoker",() -> new CosmeticFurnace(BlockBehaviour.Properties.ofFullCopy(Blocks.SMOKER))); COSMETIC_BARREL = BLOCKS.register("cosmetic_barrel", () -> new CosmeticBarrel(BlockBehaviour.Properties.ofFullCopy(Blocks.BARREL))); - + ITEMS.register("cosmetic_beehive", () -> new BlockItem(COSMETIC_BEEHIVE.get(), new Item.Properties())); ITEMS.register("cosmetic_furnace", () -> new BlockItem(COSMETIC_FURNACE.get(), new Item.Properties())); ITEMS.register("cosmetic_blast_furnace", () -> new BlockItem(COSMETIC_BLAST_FURNACE.get(), new Item.Properties())); + ITEMS.register("cosmetic_smoker",() -> new BlockItem(COSMETIC_SMOKER.get(), new Item.Properties())); ITEMS.register("cosmetic_barrel", () -> new BlockItem(COSMETIC_BARREL.get(), new Item.Properties())); - + ITEMS.register("command_block", () -> new BlockItem(COMMAND_BLOCK.get(), new Item.Properties().rarity(Rarity.EPIC))); ITEMS.register("power_supply", () -> new BlockItem(POWER_SUPPLY.get(), new Item.Properties())); ITEMS.register("item_display", () -> new BlockItem(ITEM_DISPLAY.get(), new Item.Properties())); @@ -285,12 +294,14 @@ private static void regTrapDoors(Map existing) { ITEMS.register(name, () -> new BlockItem(block.get(), new Item.Properties())); } } - - @SuppressWarnings("SameParameterValue") - private static void regSimpleCosmetic(List existing) { + + private static void regCosmetic(List existing, Function factory) { for (var existingBlock : existing) { var name = "cosmetic_" + BuiltInRegistries.BLOCK.getKey(existingBlock).getPath(); - var block = BLOCKS.register(name, () -> new CosmeticSimpleBlock(BlockBehaviour.Properties.ofFullCopy(existingBlock))); + var flag = existingBlock.defaultBlockState().useShapeForLightOcclusion(); + var properties = BlockBehaviour.Properties.ofFullCopy(existingBlock); + if(flag) properties.noOcclusion(); + var block = BLOCKS.register(name, () -> factory.apply(properties)); ITEMS.register(name, () -> new BlockItem(block.get(), new Item.Properties())); } } diff --git a/src/main/java/org/teacon/powertool/block/cosmetical/CosmeticCampfireBlock.java b/src/main/java/org/teacon/powertool/block/cosmetical/CosmeticCampfireBlock.java index d9edb83..7b02ec3 100644 --- a/src/main/java/org/teacon/powertool/block/cosmetical/CosmeticCampfireBlock.java +++ b/src/main/java/org/teacon/powertool/block/cosmetical/CosmeticCampfireBlock.java @@ -41,6 +41,7 @@ import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; +import org.teacon.powertool.block.CosmeticBlock; import org.teacon.powertool.utils.VanillaUtils; import javax.annotation.ParametersAreNonnullByDefault; @@ -48,7 +49,7 @@ @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault -public class CosmeticCampfireBlock extends Block implements SimpleWaterloggedBlock { +public class CosmeticCampfireBlock extends Block implements SimpleWaterloggedBlock, CosmeticBlock { protected static final VoxelShape SHAPE = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 7.0D, 16.0D); public static final BooleanProperty LIT = BlockStateProperties.LIT; diff --git a/src/main/java/org/teacon/powertool/block/cosmetical/CosmeticHopper.java b/src/main/java/org/teacon/powertool/block/cosmetical/CosmeticHopper.java index 1b6762f..3b0dd6e 100644 --- a/src/main/java/org/teacon/powertool/block/cosmetical/CosmeticHopper.java +++ b/src/main/java/org/teacon/powertool/block/cosmetical/CosmeticHopper.java @@ -23,6 +23,7 @@ import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; +import org.teacon.powertool.block.CosmeticBlock; import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; @@ -34,7 +35,7 @@ */ @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault -public class CosmeticHopper extends Block { +public class CosmeticHopper extends Block implements CosmeticBlock { private static final DirectionProperty FACING = BlockStateProperties.FACING_HOPPER; private static final VoxelShape TOP = Block.box(0.0D, 10.0D, 0.0D, 16.0D, 16.0D, 16.0D); private static final VoxelShape FUNNEL = Block.box(4.0D, 4.0D, 4.0D, 12.0D, 10.0D, 12.0D); diff --git a/src/main/java/org/teacon/powertool/block/cosmetical/CosmeticHorizontalDirectionalBlock.java b/src/main/java/org/teacon/powertool/block/cosmetical/CosmeticHorizontalDirectionalBlock.java index fa577f6..21f2697 100644 --- a/src/main/java/org/teacon/powertool/block/cosmetical/CosmeticHorizontalDirectionalBlock.java +++ b/src/main/java/org/teacon/powertool/block/cosmetical/CosmeticHorizontalDirectionalBlock.java @@ -9,7 +9,7 @@ import net.minecraft.world.level.block.state.properties.DirectionProperty; -public abstract class CosmeticHorizontalDirectionalBlock extends CosmeticSimpleBlock{ +public class CosmeticHorizontalDirectionalBlock extends CosmeticSimpleBlock{ public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING; diff --git a/src/main/java/org/teacon/powertool/block/cosmetical/CosmeticSimpleBlock.java b/src/main/java/org/teacon/powertool/block/cosmetical/CosmeticSimpleBlock.java index c647fe5..4c8b23b 100644 --- a/src/main/java/org/teacon/powertool/block/cosmetical/CosmeticSimpleBlock.java +++ b/src/main/java/org/teacon/powertool/block/cosmetical/CosmeticSimpleBlock.java @@ -1,17 +1,20 @@ package org.teacon.powertool.block.cosmetical; import net.minecraft.ChatFormatting; +import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import org.teacon.powertool.block.CosmeticBlock; import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; @ParametersAreNonnullByDefault -public class CosmeticSimpleBlock extends Block { +public class CosmeticSimpleBlock extends Block implements CosmeticBlock { public CosmeticSimpleBlock(Properties p) { super(p); @@ -21,5 +24,5 @@ public CosmeticSimpleBlock(Properties p) { public void appendHoverText(ItemStack stack, Item.TooltipContext context, List tooltipComponents, TooltipFlag tooltipFlag) { tooltipComponents.add(Component.translatable("block.powertool.cosmetic_block.tooltip").withStyle(ChatFormatting.DARK_GRAY)); } - + } diff --git a/src/main/java/org/teacon/powertool/block/cosmetical/CosmeticTrapdoor.java b/src/main/java/org/teacon/powertool/block/cosmetical/CosmeticTrapdoor.java index 1dd1c17..14000d7 100644 --- a/src/main/java/org/teacon/powertool/block/cosmetical/CosmeticTrapdoor.java +++ b/src/main/java/org/teacon/powertool/block/cosmetical/CosmeticTrapdoor.java @@ -23,13 +23,14 @@ import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import org.teacon.powertool.block.CosmeticBlock; import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault -public class CosmeticTrapdoor extends DirectionalBlock implements SimpleWaterloggedBlock { +public class CosmeticTrapdoor extends DirectionalBlock implements SimpleWaterloggedBlock, CosmeticBlock { public static final MapCodec CODEC = simpleCodec(CosmeticTrapdoor::new); diff --git a/src/main/java/org/teacon/powertool/block/cosmetical/CosmeticWaterloggedBlock.java b/src/main/java/org/teacon/powertool/block/cosmetical/CosmeticWaterloggedBlock.java new file mode 100644 index 0000000..7c1e359 --- /dev/null +++ b/src/main/java/org/teacon/powertool/block/cosmetical/CosmeticWaterloggedBlock.java @@ -0,0 +1,60 @@ +package org.teacon.powertool.block.cosmetical; + +import net.minecraft.MethodsReturnNonnullByDefault; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.TrapDoorBlock; +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.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.level.pathfinder.PathComputationType; +import org.jetbrains.annotations.Nullable; + +import javax.annotation.ParametersAreNonnullByDefault; +import java.util.List; + +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault +public class CosmeticWaterloggedBlock extends CosmeticSimpleBlock implements SimpleWaterloggedBlock { + + public CosmeticWaterloggedBlock(Properties p) { + super(p); + this.registerDefaultState(this.defaultBlockState().setValue(BlockStateProperties.WATERLOGGED, Boolean.FALSE)); + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(BlockStateProperties.WATERLOGGED); + } + + @Override + public void appendHoverText(ItemStack stack, Item.TooltipContext context, List tooltipComponents, TooltipFlag tooltipFlag) { + + } + + @Override + public FluidState getFluidState(BlockState state) { + return state.getValue(TrapDoorBlock.WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); + } + + @Nullable + @Override + public BlockState getStateForPlacement(BlockPlaceContext context) { + boolean flag = context.getLevel().getFluidState(context.getClickedPos()).getType() == Fluids.WATER; + return this.defaultBlockState() + .setValue(BlockStateProperties.WATERLOGGED, flag); + + } + + @Override + protected boolean isPathfindable(BlockState state, PathComputationType pathComputationType) { + return false; + } +} diff --git a/src/main/java/org/teacon/powertool/datagen/ModBlockModelProvider.java b/src/main/java/org/teacon/powertool/datagen/ModBlockModelProvider.java index 2511b57..9664702 100644 --- a/src/main/java/org/teacon/powertool/datagen/ModBlockModelProvider.java +++ b/src/main/java/org/teacon/powertool/datagen/ModBlockModelProvider.java @@ -9,9 +9,11 @@ import net.neoforged.neoforge.client.model.generators.BlockStateProvider; import net.neoforged.neoforge.client.model.generators.ConfiguredModel; import net.neoforged.neoforge.common.data.ExistingFileHelper; +import org.apache.commons.compress.utils.Lists; import org.teacon.powertool.block.cosmetical.CosmeticFurnace; import org.teacon.powertool.block.PowerToolBlocks; +import java.util.List; import java.util.Objects; @@ -23,11 +25,15 @@ public ModBlockModelProvider(PackOutput output, ExistingFileHelper existingFileH @Override protected void registerStatesAndModels() { - PowerToolBlocks.SIMPLE_BLOCKS.forEach(block -> simpleBlockWithItem(cosmeticBlock(block), models().getExistingFile(mcLoc(name(block))))); + var simpleBlocks = Lists.newArrayList(PowerToolBlocks.SIMPLE_BLOCKS.iterator()); + simpleBlocks.add(Blocks.ENCHANTING_TABLE); + simpleBlocks.stream().filter(b -> b != Blocks.BEACON).forEach(block -> simpleBlockWithItem(cosmeticBlock(block), models().getExistingFile(mcLoc(name(block))))); cosmeticHorizontalBlockWithItem(Blocks.BEEHIVE); cosmeticFurnaceBlockWithItem(Blocks.FURNACE); cosmeticFurnaceBlockWithItem(Blocks.BLAST_FURNACE); + cosmeticFurnaceBlockWithItem(Blocks.SMOKER); cosmeticDirectionalBlockWithItem(Blocks.BARREL); + cosmeticHorizontalBlockWithItem(Blocks.STONECUTTER); horizontalBlockWithItem(PowerToolBlocks.WHITE_TRASH_CAN.get()); horizontalBlockWithItem(PowerToolBlocks.GRAY_TRASH_CAN.get()); horizontalBlockWithItem(PowerToolBlocks.GREEN_TRASH_CAN.get()); @@ -35,6 +41,9 @@ protected void registerStatesAndModels() { trashCanCap(PowerToolBlocks.WHITE_TRASH_CAN_CAP.get()); //trashCanCap(PowerToolBlocks.GRAY_TRASH_CAN_CAP.get()); trashCanCap(PowerToolBlocks.GREEN_TRASH_CAN_CAP.get()); + cosmeticBlock(Blocks.BEACON); + cosmeticBlock(Blocks.ENCHANTING_TABLE); + simpleBlockWithItem(cosmeticBlock(Blocks.BEACON),models().withExistingParent(name(cosmeticBlock(Blocks.BEACON)),mcLoc(name(Blocks.BEACON))).renderType("cutout")); } private void trashCanCap(TrapDoorBlock block) { diff --git a/src/main/java/org/teacon/powertool/item/PowerToolItems.java b/src/main/java/org/teacon/powertool/item/PowerToolItems.java index c8759d4..2001308 100644 --- a/src/main/java/org/teacon/powertool/item/PowerToolItems.java +++ b/src/main/java/org/teacon/powertool/item/PowerToolItems.java @@ -10,11 +10,13 @@ import net.minecraft.world.entity.vehicle.Boat; import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.ArmorMaterial; +import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.level.block.Blocks; import net.neoforged.bus.api.IEventBus; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.common.EventBusSubscriber; @@ -22,8 +24,10 @@ import net.neoforged.neoforge.registries.DeferredHolder; import net.neoforged.neoforge.registries.DeferredRegister; import org.teacon.powertool.PowerTool; +import org.teacon.powertool.block.CosmeticBlock; import org.teacon.powertool.block.PowerToolBlocks; import org.teacon.powertool.entity.FenceKnotEntity; +import org.teacon.powertool.utils.VanillaUtils; import javax.annotation.ParametersAreNonnullByDefault; import java.util.EnumMap; @@ -48,6 +52,12 @@ public class PowerToolItems { .withTabsBefore(CreativeModeTabs.FOOD_AND_DRINKS, CreativeModeTabs.INGREDIENTS, CreativeModeTabs.SPAWN_EGGS) .build()); + public static final DeferredHolder COSMETIC_TAB = CREATIVE_MODE_TABS.register("cosmetic_tab",() -> CreativeModeTab.builder() + .title(Component.translatable("itemGroup.powertool.cosmetic")) + .icon(() -> Blocks.BEACON.asItem().getDefaultInstance()) + .withTabsBefore(VanillaUtils.modRL("tab")) + .build()); + public static final DeferredHolder HOLO_GLASS_ARMOR_MATERIAL = ARMOR_MATERIAL.register("holo_glass", () -> new ArmorMaterial(Util.make(new EnumMap<>(ArmorItem.Type.class),map -> { for(var type : ArmorItem.Type.values()) { @@ -129,7 +139,12 @@ public boolean isFoil(ItemStack stack) { public static void creativeTab(BuildCreativeModeTabContentsEvent event) { if (event.getTab() == THE_TAB.get()) { for (var regObj : ITEMS.getEntries()) { - event.accept(regObj.get()); + if(!(regObj.get() instanceof BlockItem blockItem) || !(blockItem.getBlock() instanceof CosmeticBlock)) event.accept(regObj.get()); + } + } + if (event.getTab() == COSMETIC_TAB.get()){ + for (var regObj : ITEMS.getEntries()) { + if(regObj.get() instanceof BlockItem blockItem && blockItem.getBlock() instanceof CosmeticBlock) event.accept(regObj.get()); } } } diff --git a/src/main/resources/assets/powertool/lang/en_us.json b/src/main/resources/assets/powertool/lang/en_us.json index 0689bd1..16aa890 100644 --- a/src/main/resources/assets/powertool/lang/en_us.json +++ b/src/main/resources/assets/powertool/lang/en_us.json @@ -131,5 +131,6 @@ "powertool.gui.error_and_close": "An error occurred. Please close the GUI", "powertool.realtime_observer.gui": "Realtime Observer", "powertool.gui.button.utc_time": "Set time zone to UTC + 0", - "powertool.gui.button.local_time": "Set time zone to local time zone" + "powertool.gui.button.local_time": "Set time zone to local time zone", + "itemGroup.powertool.cosmetic": "PowerTool: CosmeticBlocks" } \ No newline at end of file diff --git a/src/main/resources/assets/powertool/lang/zh_cn.json b/src/main/resources/assets/powertool/lang/zh_cn.json index 75c0879..5bedb04 100644 --- a/src/main/resources/assets/powertool/lang/zh_cn.json +++ b/src/main/resources/assets/powertool/lang/zh_cn.json @@ -132,6 +132,7 @@ "powertool.gui.error_and_close": "发生错误,请关闭GUI", "powertool.realtime_observer.gui": "现实时间侦测器", "powertool.gui.button.utc_time": "设置时区为 UTC + 0", - "powertool.gui.button.local_time": "设置时区为本地时区" + "powertool.gui.button.local_time": "设置时区为本地时区", + "itemGroup.powertool.cosmetic": "PowerTool: 装饰方块" } \ No newline at end of file