diff --git a/src/main/java/com/github/reviversmc/modern_glass_doors/blocks/GlassDoorBlock.java b/src/main/java/com/github/reviversmc/modern_glass_doors/blocks/GlassDoorBlock.java index 9ea3727..29daf61 100644 --- a/src/main/java/com/github/reviversmc/modern_glass_doors/blocks/GlassDoorBlock.java +++ b/src/main/java/com/github/reviversmc/modern_glass_doors/blocks/GlassDoorBlock.java @@ -3,6 +3,7 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.DoorBlock; +import net.minecraft.block.Material; public class GlassDoorBlock extends DoorBlock { public static BlockState copyState(BlockState state) { @@ -22,17 +23,17 @@ public static BlockState copyState(BlockState state) { return state; } - public final MaterialCategory materialCategory; + public final Material materialCategory; public final DoorBlock parentDoorType; - GlassDoorBlock(MaterialCategory material, DoorBlock parentDoorType) { + GlassDoorBlock(Material materialCategory, DoorBlock parentDoorType) { super(Block.Settings.copy(parentDoorType), parentDoorType.blockSetType); - this.materialCategory = material; + this.materialCategory = materialCategory; this.parentDoorType = (DoorBlock) parentDoorType; } - public MaterialCategory getMaterialCategory() { + public Material getMaterialCategory() { return materialCategory; } diff --git a/src/main/java/com/github/reviversmc/modern_glass_doors/blocks/GlassTrapdoorBlock.java b/src/main/java/com/github/reviversmc/modern_glass_doors/blocks/GlassTrapdoorBlock.java index 34b85f8..b1f3f80 100644 --- a/src/main/java/com/github/reviversmc/modern_glass_doors/blocks/GlassTrapdoorBlock.java +++ b/src/main/java/com/github/reviversmc/modern_glass_doors/blocks/GlassTrapdoorBlock.java @@ -2,6 +2,7 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockState; +import net.minecraft.block.Material; import net.minecraft.block.TrapdoorBlock; public class GlassTrapdoorBlock extends TrapdoorBlock { @@ -24,17 +25,17 @@ public static BlockState copyState(BlockState state) { return state; } - private final MaterialCategory materialCategory; + private final Material materialCategory; private final TrapdoorBlock parentTrapdoorType; - GlassTrapdoorBlock(MaterialCategory materialCategory, TrapdoorBlock parentTrapdoorType) { + GlassTrapdoorBlock(Material materialCategory, TrapdoorBlock parentTrapdoorType) { super(Block.Settings.copy(parentTrapdoorType), parentTrapdoorType.blockSetType); this.materialCategory = materialCategory; this.parentTrapdoorType = (TrapdoorBlock) parentTrapdoorType; } - public MaterialCategory getMaterialCategory() { + public Material getMaterialCategory() { return materialCategory; } diff --git a/src/main/java/com/github/reviversmc/modern_glass_doors/blocks/MaterialCategory.java b/src/main/java/com/github/reviversmc/modern_glass_doors/blocks/MaterialCategory.java deleted file mode 100644 index 7b1c3c0..0000000 --- a/src/main/java/com/github/reviversmc/modern_glass_doors/blocks/MaterialCategory.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.github.reviversmc.modern_glass_doors.blocks; - -public enum MaterialCategory { - WOOD, - NON_FLAMMABLE_WOOD, - METAL -} diff --git a/src/main/java/com/github/reviversmc/modern_glass_doors/blocks/ModernGlassDoorsBlocks.java b/src/main/java/com/github/reviversmc/modern_glass_doors/blocks/ModernGlassDoorsBlocks.java index 11ece25..82f6025 100644 --- a/src/main/java/com/github/reviversmc/modern_glass_doors/blocks/ModernGlassDoorsBlocks.java +++ b/src/main/java/com/github/reviversmc/modern_glass_doors/blocks/ModernGlassDoorsBlocks.java @@ -7,6 +7,7 @@ import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.block.DoorBlock; +import net.minecraft.block.Material; import net.minecraft.block.TrapdoorBlock; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; @@ -22,32 +23,32 @@ public class ModernGlassDoorsBlocks { public static final List GLASS_TRAPDOORS = new ArrayList<>(); // Glass doors - public static final Block OAK_GLASS_DOOR = registerDoor("oak", MaterialCategory.WOOD, Blocks.OAK_DOOR); - public static final Block SPRUCE_GLASS_DOOR = registerDoor("spruce", MaterialCategory.WOOD, Blocks.SPRUCE_DOOR); - public static final Block BIRCH_GLASS_DOOR = registerDoor("birch", MaterialCategory.WOOD, Blocks.BIRCH_DOOR); - public static final Block ACACIA_GLASS_DOOR = registerDoor("acacia", MaterialCategory.WOOD, Blocks.ACACIA_DOOR); - public static final Block JUNGLE_GLASS_DOOR = registerDoor("jungle", MaterialCategory.WOOD, Blocks.JUNGLE_DOOR); - public static final Block DARK_OAK_GLASS_DOOR = registerDoor("dark_oak", MaterialCategory.WOOD, Blocks.DARK_OAK_DOOR); - public static final Block CRIMSON_GLASS_DOOR = registerDoor("crimson", MaterialCategory.NON_FLAMMABLE_WOOD, Blocks.CRIMSON_DOOR); - public static final Block WARPED_GLASS_DOOR = registerDoor("warped", MaterialCategory.NON_FLAMMABLE_WOOD, Blocks.WARPED_DOOR); - public static final Block IRON_GLASS_DOOR = registerDoor("iron", MaterialCategory.METAL, Blocks.IRON_DOOR); - public static final Block MANGROVE_GLASS_DOOR = registerDoor("mangrove", MaterialCategory.WOOD, Blocks.MANGROVE_DOOR); - public static final Block BAMBOO_GLASS_DOOR = registerDoor("bamboo", MaterialCategory.WOOD, Blocks.BAMBOO_DOOR); + public static final Block OAK_GLASS_DOOR = registerDoor("oak", Material.WOOD, Blocks.OAK_DOOR); + public static final Block SPRUCE_GLASS_DOOR = registerDoor("spruce", Material.WOOD, Blocks.SPRUCE_DOOR); + public static final Block BIRCH_GLASS_DOOR = registerDoor("birch", Material.WOOD, Blocks.BIRCH_DOOR); + public static final Block ACACIA_GLASS_DOOR = registerDoor("acacia", Material.WOOD, Blocks.ACACIA_DOOR); + public static final Block JUNGLE_GLASS_DOOR = registerDoor("jungle", Material.WOOD, Blocks.JUNGLE_DOOR); + public static final Block DARK_OAK_GLASS_DOOR = registerDoor("dark_oak", Material.WOOD, Blocks.DARK_OAK_DOOR); + public static final Block CRIMSON_GLASS_DOOR = registerDoor("crimson", Material.NETHER_WOOD, Blocks.CRIMSON_DOOR); + public static final Block WARPED_GLASS_DOOR = registerDoor("warped", Material.NETHER_WOOD, Blocks.WARPED_DOOR); + public static final Block IRON_GLASS_DOOR = registerDoor("iron", Material.METAL, Blocks.IRON_DOOR); + public static final Block MANGROVE_GLASS_DOOR = registerDoor("mangrove", Material.WOOD, Blocks.MANGROVE_DOOR); + public static final Block BAMBOO_GLASS_DOOR = registerDoor("bamboo", Material.WOOD, Blocks.BAMBOO_DOOR); // Glass trapdoors - public static final Block OAK_GLASS_TRAPDOOR = registerTrapdoor("oak", MaterialCategory.WOOD, Blocks.OAK_TRAPDOOR); - public static final Block SPRUCE_GLASS_TRAPDOOR = registerTrapdoor("spruce", MaterialCategory.WOOD, Blocks.SPRUCE_TRAPDOOR); - public static final Block BIRCH_GLASS_TRAPDOOR = registerTrapdoor("birch", MaterialCategory.WOOD, Blocks.BIRCH_TRAPDOOR); - public static final Block ACACIA_GLASS_TRAPDOOR = registerTrapdoor("acacia", MaterialCategory.WOOD, Blocks.ACACIA_TRAPDOOR); - public static final Block JUNGLE_GLASS_TRAPDOOR = registerTrapdoor("jungle", MaterialCategory.WOOD, Blocks.JUNGLE_TRAPDOOR); - public static final Block DARK_OAK_GLASS_TRAPDOOR = registerTrapdoor("dark_oak", MaterialCategory.WOOD, Blocks.DARK_OAK_TRAPDOOR); - public static final Block CRIMSON_GLASS_TRAPDOOR = registerTrapdoor("crimson", MaterialCategory.NON_FLAMMABLE_WOOD, Blocks.CRIMSON_TRAPDOOR); - public static final Block WARPED_GLASS_TRAPDOOR = registerTrapdoor("warped", MaterialCategory.NON_FLAMMABLE_WOOD, Blocks.WARPED_TRAPDOOR); - public static final Block IRON_GLASS_TRAPDOOR = registerTrapdoor("iron", MaterialCategory.METAL, Blocks.IRON_TRAPDOOR); - public static final Block MANGROVE_GLASS_TRAPDOOR = registerTrapdoor("mangrove", MaterialCategory.WOOD, Blocks.MANGROVE_TRAPDOOR); - public static final Block BAMBOO_GLASS_TRAPDOOR = registerTrapdoor("bamboo", MaterialCategory.WOOD, Blocks.BAMBOO_TRAPDOOR); + public static final Block OAK_GLASS_TRAPDOOR = registerTrapdoor("oak", Material.WOOD, Blocks.OAK_TRAPDOOR); + public static final Block SPRUCE_GLASS_TRAPDOOR = registerTrapdoor("spruce", Material.WOOD, Blocks.SPRUCE_TRAPDOOR); + public static final Block BIRCH_GLASS_TRAPDOOR = registerTrapdoor("birch", Material.WOOD, Blocks.BIRCH_TRAPDOOR); + public static final Block ACACIA_GLASS_TRAPDOOR = registerTrapdoor("acacia", Material.WOOD, Blocks.ACACIA_TRAPDOOR); + public static final Block JUNGLE_GLASS_TRAPDOOR = registerTrapdoor("jungle", Material.WOOD, Blocks.JUNGLE_TRAPDOOR); + public static final Block DARK_OAK_GLASS_TRAPDOOR = registerTrapdoor("dark_oak", Material.WOOD, Blocks.DARK_OAK_TRAPDOOR); + public static final Block CRIMSON_GLASS_TRAPDOOR = registerTrapdoor("crimson", Material.NETHER_WOOD, Blocks.CRIMSON_TRAPDOOR); + public static final Block WARPED_GLASS_TRAPDOOR = registerTrapdoor("warped", Material.NETHER_WOOD, Blocks.WARPED_TRAPDOOR); + public static final Block IRON_GLASS_TRAPDOOR = registerTrapdoor("iron", Material.METAL, Blocks.IRON_TRAPDOOR); + public static final Block MANGROVE_GLASS_TRAPDOOR = registerTrapdoor("mangrove", Material.WOOD, Blocks.MANGROVE_TRAPDOOR); + public static final Block BAMBOO_GLASS_TRAPDOOR = registerTrapdoor("bamboo", Material.WOOD, Blocks.BAMBOO_TRAPDOOR); - public static Block registerDoor(String material, MaterialCategory materialCategory, Block parentDoorType) { + public static Block registerDoor(String material, Material materialCategory, Block parentDoorType) { assert parentDoorType instanceof DoorBlock; GlassDoorBlock door = new GlassDoorBlock(materialCategory, (DoorBlock) parentDoorType); @@ -62,7 +63,7 @@ public static Block registerDoor(String material, MaterialCategory materialCateg return door; } - public static Block registerTrapdoor(String material, MaterialCategory materialCategory, Block parentTrapdoorType) { + public static Block registerTrapdoor(String material, Material materialCategory, Block parentTrapdoorType) { assert parentTrapdoorType instanceof TrapdoorBlock; GlassTrapdoorBlock trapdoor = new GlassTrapdoorBlock(materialCategory, (TrapdoorBlock) parentTrapdoorType); diff --git a/src/main/java/com/github/reviversmc/modern_glass_doors/datagen/ModernGlassDoorsBlockTagProvider.java b/src/main/java/com/github/reviversmc/modern_glass_doors/datagen/ModernGlassDoorsBlockTagProvider.java index afdf7f7..9626796 100644 --- a/src/main/java/com/github/reviversmc/modern_glass_doors/datagen/ModernGlassDoorsBlockTagProvider.java +++ b/src/main/java/com/github/reviversmc/modern_glass_doors/datagen/ModernGlassDoorsBlockTagProvider.java @@ -8,6 +8,7 @@ import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider; import net.minecraft.block.Block; import net.minecraft.block.Blocks; +import net.minecraft.block.Material; import net.minecraft.registry.RegistryKeys; import net.minecraft.registry.RegistryWrapper; import net.minecraft.registry.tag.BlockTags; @@ -46,46 +47,38 @@ protected void configure(RegistryWrapper.WrapperLookup arg) { getOrCreateTagBuilder(BlockTags.WOODEN_TRAPDOORS), getOrCreateTagBuilder(WOODEN_GLASS_TRAPDOORS)); - List metalGlassTrapDoorTagBuilders = Arrays.asList( + List metalGlassTrapdoorTagBuilders = Arrays.asList( getOrCreateTagBuilder(BlockTags.TRAPDOORS), getOrCreateTagBuilder(BlockTags.PICKAXE_MINEABLE), getOrCreateTagBuilder(METAL_GLASS_TRAPDOORS)); - for (GlassDoorBlock door: ModernGlassDoorsBlocks.GLASS_DOORS) { - switch (door.getMaterialCategory()) { - case NON_FLAMMABLE_WOOD: - case WOOD: - for (FabricTagBuilder tagBuilder : woodenGlassDoorTagBuilders) { - tagBuilder.add(door); - } - - break; + Material material; - case METAL: - for (FabricTagBuilder tagBuilder : metalGlassDoorTagBuilders) { - tagBuilder.add(door); - } - - break; + for (GlassDoorBlock door: ModernGlassDoorsBlocks.GLASS_DOORS) { + material = door.getMaterialCategory(); + + if (material == Material.NETHER_WOOD || material == Material.WOOD) { + for (FabricTagBuilder tagBuilder : woodenGlassDoorTagBuilders) { + tagBuilder.add(door); + } + } else if (material == Material.METAL) { + for (FabricTagBuilder tagBuilder : metalGlassDoorTagBuilders) { + tagBuilder.add(door); + } } } for (GlassTrapdoorBlock trapdoor: ModernGlassDoorsBlocks.GLASS_TRAPDOORS) { - switch (trapdoor.getMaterialCategory()) { - case NON_FLAMMABLE_WOOD: - case WOOD: - for (FabricTagBuilder tagBuilder : woodenGlassTrapdoorTagBuilders) { - tagBuilder.add(trapdoor); - } - - break; - - case METAL: - for (FabricTagBuilder tagBuilder : metalGlassTrapDoorTagBuilders) { - tagBuilder.add(trapdoor); - } - - break; + material = trapdoor.getMaterialCategory(); + + if (material == Material.NETHER_WOOD || material == Material.WOOD) { + for (FabricTagBuilder tagBuilder : woodenGlassTrapdoorTagBuilders) { + tagBuilder.add(trapdoor); + } + } else if (material == Material.METAL) { + for (FabricTagBuilder tagBuilder : metalGlassTrapdoorTagBuilders) { + tagBuilder.add(trapdoor); + } } } diff --git a/src/main/java/com/github/reviversmc/modern_glass_doors/datagen/ModernGlassDoorsItemTagProvider.java b/src/main/java/com/github/reviversmc/modern_glass_doors/datagen/ModernGlassDoorsItemTagProvider.java index c2024a6..1bd26d7 100644 --- a/src/main/java/com/github/reviversmc/modern_glass_doors/datagen/ModernGlassDoorsItemTagProvider.java +++ b/src/main/java/com/github/reviversmc/modern_glass_doors/datagen/ModernGlassDoorsItemTagProvider.java @@ -4,12 +4,12 @@ import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider; +import net.minecraft.block.Material; import net.minecraft.registry.RegistryWrapper; import net.minecraft.registry.tag.ItemTags; import com.github.reviversmc.modern_glass_doors.blocks.GlassDoorBlock; import com.github.reviversmc.modern_glass_doors.blocks.GlassTrapdoorBlock; -import com.github.reviversmc.modern_glass_doors.blocks.MaterialCategory; import com.github.reviversmc.modern_glass_doors.blocks.ModernGlassDoorsBlocks; public class ModernGlassDoorsItemTagProvider extends FabricTagProvider.ItemTagProvider { @@ -20,13 +20,13 @@ public ModernGlassDoorsItemTagProvider(FabricDataOutput output, CompletableFutur @Override protected void configure(RegistryWrapper.WrapperLookup arg) { for (GlassDoorBlock door: ModernGlassDoorsBlocks.GLASS_DOORS) { - if (door.getMaterialCategory() == MaterialCategory.NON_FLAMMABLE_WOOD) { + if (door.getMaterialCategory() == Material.NETHER_WOOD) { getOrCreateTagBuilder(ItemTags.NON_FLAMMABLE_WOOD).add(door.asItem()); } } for (GlassTrapdoorBlock trapdoor: ModernGlassDoorsBlocks.GLASS_TRAPDOORS) { - if (trapdoor.getMaterialCategory() == MaterialCategory.NON_FLAMMABLE_WOOD) { + if (trapdoor.getMaterialCategory() == Material.NETHER_WOOD) { getOrCreateTagBuilder(ItemTags.NON_FLAMMABLE_WOOD).add(trapdoor.asItem()); } }