From e077ce44496a09ae46ddc46050d6940030046fd4 Mon Sep 17 00:00:00 2001 From: realguyman Date: Sun, 8 Jan 2023 12:09:09 -0900 Subject: [PATCH] Update to Minecraft 1.19.3 --- gradle.properties | 10 +++++----- .../totally_lit/TotallyLitModInitializer.java | 10 ++++++++++ .../totally_lit/api/item/LitTorchItem.java | 9 +++++---- .../totally_lit/api/item/UnlitTorchItem.java | 9 +++++---- .../totally_lit/mixin/AbstractBlockMixin.java | 10 +++++----- .../totally_lit/mixin/BlockMixin.java | 2 +- .../totally_lit/registry/BlockRegistry.java | 5 +++-- .../totally_lit/registry/ItemRegistry.java | 19 +++++++++++-------- .../totally_lit/registry/TagRegistry.java | 10 +++++----- src/main/resources/fabric.mod.json | 8 ++++---- 10 files changed, 54 insertions(+), 38 deletions(-) diff --git a/gradle.properties b/gradle.properties index e184961..4d4fe7f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,11 @@ org.gradle.jvmargs = -Xmx1G -minecraft = 1.19 -mappings = 1.19+build.4 +minecraft = 1.19.3 +mappings = 1.19.3+build.5 fabric_loader = 0.14.12 -fabric_api = 0.58.0+1.19 -cloth_config = 8.2.88 -mod_menu = 4.0.4 +fabric_api = 0.72.0+1.19.3 +cloth_config = 9.0.94 +mod_menu = 5.0.2 version = 0.11.2+1.19 group = io.github.realguyman diff --git a/src/main/java/io/github/realguyman/totally_lit/TotallyLitModInitializer.java b/src/main/java/io/github/realguyman/totally_lit/TotallyLitModInitializer.java index 08f0688..7b01306 100644 --- a/src/main/java/io/github/realguyman/totally_lit/TotallyLitModInitializer.java +++ b/src/main/java/io/github/realguyman/totally_lit/TotallyLitModInitializer.java @@ -7,6 +7,9 @@ import me.shedaniel.autoconfig.serializer.GsonConfigSerializer; import me.shedaniel.autoconfig.serializer.PartitioningSerializer; import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; +import net.minecraft.item.ItemGroups; +import net.minecraft.item.Items; public class TotallyLitModInitializer implements ModInitializer { public static final String IDENTIFIER = "totally_lit"; @@ -16,6 +19,13 @@ public class TotallyLitModInitializer implements ModInitializer { public void onInitialize() { new BlockRegistry(); new ItemRegistry(); + + ItemGroupEvents.modifyEntriesEvent(ItemGroups.FUNCTIONAL).register(listener -> { + listener.addAfter(Items.TORCH, ItemRegistry.UNLIT_TORCH); + listener.addAfter(Items.SOUL_TORCH, ItemRegistry.UNLIT_SOUL_TORCH, ItemRegistry.GLOWSTONE_TORCH); + listener.addAfter(Items.LANTERN, ItemRegistry.UNLIT_LANTERN); + listener.addAfter(Items.SOUL_LANTERN, ItemRegistry.UNLIT_SOUL_LANTERN, ItemRegistry.GLOWSTONE_LANTERN); + }); } public static Configuration getConfiguration() { diff --git a/src/main/java/io/github/realguyman/totally_lit/api/item/LitTorchItem.java b/src/main/java/io/github/realguyman/totally_lit/api/item/LitTorchItem.java index e7af742..9a1282c 100644 --- a/src/main/java/io/github/realguyman/totally_lit/api/item/LitTorchItem.java +++ b/src/main/java/io/github/realguyman/totally_lit/api/item/LitTorchItem.java @@ -2,13 +2,14 @@ import net.minecraft.block.Block; import net.minecraft.item.Item; -import net.minecraft.item.WallStandingBlockItem; +import net.minecraft.item.VerticallyAttachableBlockItem; +import net.minecraft.util.math.Direction; -public class LitTorchItem extends WallStandingBlockItem { +public class LitTorchItem extends VerticallyAttachableBlockItem { private final Item unlitItem; - public LitTorchItem(Block standingBlock, Block wallBlock, Settings settings, Item unlitItem) { - super(standingBlock, wallBlock, settings); + public LitTorchItem(Block standingBlock, Block wallBlock, Settings settings, Direction verticalAttachmentDirection, Item unlitItem) { + super(standingBlock, wallBlock, settings, verticalAttachmentDirection); this.unlitItem = unlitItem; } diff --git a/src/main/java/io/github/realguyman/totally_lit/api/item/UnlitTorchItem.java b/src/main/java/io/github/realguyman/totally_lit/api/item/UnlitTorchItem.java index fe2f857..78cc7e0 100644 --- a/src/main/java/io/github/realguyman/totally_lit/api/item/UnlitTorchItem.java +++ b/src/main/java/io/github/realguyman/totally_lit/api/item/UnlitTorchItem.java @@ -6,16 +6,17 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUsageContext; -import net.minecraft.item.WallStandingBlockItem; +import net.minecraft.item.VerticallyAttachableBlockItem; import net.minecraft.util.ActionResult; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; import net.minecraft.world.World; -public class UnlitTorchItem extends WallStandingBlockItem { +public class UnlitTorchItem extends VerticallyAttachableBlockItem { private final Item litItem; - public UnlitTorchItem(Block standing, Block wall, Settings settings, Item litItem) { - super(standing, wall, settings); + public UnlitTorchItem(Block standing, Block wall, Settings settings, Direction verticalAttachmentDirection, Item litItem) { + super(standing, wall, settings, verticalAttachmentDirection); this.litItem = litItem; } diff --git a/src/main/java/io/github/realguyman/totally_lit/mixin/AbstractBlockMixin.java b/src/main/java/io/github/realguyman/totally_lit/mixin/AbstractBlockMixin.java index b9c02b6..f282696 100644 --- a/src/main/java/io/github/realguyman/totally_lit/mixin/AbstractBlockMixin.java +++ b/src/main/java/io/github/realguyman/totally_lit/mixin/AbstractBlockMixin.java @@ -9,10 +9,10 @@ import net.minecraft.block.*; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.CampfireBlockEntity; +import net.minecraft.registry.tag.BlockTags; import net.minecraft.server.world.ServerWorld; import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundEvents; -import net.minecraft.tag.BlockTags; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.random.Random; import net.minecraft.world.tick.WorldTickScheduler; @@ -46,7 +46,7 @@ private void randomTick(BlockState state, ServerWorld world, BlockPos pos, Rando Block block = state.getBlock(); if (!scheduler.isQueued(pos, block) && !scheduler.isTicking(pos, block)) { - world.createAndScheduleBlockTick(pos, block, TotallyLitModInitializer.getConfiguration().candleConfiguration.burnDuration * 6_000); + world.scheduleBlockTick(pos, block, TotallyLitModInitializer.getConfiguration().candleConfiguration.burnDuration * 6_000); } } @@ -59,7 +59,7 @@ private void randomTick(BlockState state, ServerWorld world, BlockPos pos, Rando Block block = state.getBlock(); if (!scheduler.isQueued(pos, block) && !scheduler.isTicking(pos, block)) { - world.createAndScheduleBlockTick(pos, block, TotallyLitModInitializer.getConfiguration().jackOLanternConfiguration.burnDuration * 6_000); + world.scheduleBlockTick(pos, block, TotallyLitModInitializer.getConfiguration().jackOLanternConfiguration.burnDuration * 6_000); } } @@ -72,7 +72,7 @@ private void randomTick(BlockState state, ServerWorld world, BlockPos pos, Rando Block block = state.getBlock(); if (!scheduler.isQueued(pos, block) && !scheduler.isTicking(pos, block)) { - world.createAndScheduleBlockTick(pos, block, TotallyLitModInitializer.getConfiguration().lanternConfiguration.burnDuration * 6_000); + world.scheduleBlockTick(pos, block, TotallyLitModInitializer.getConfiguration().lanternConfiguration.burnDuration * 6_000); } } @@ -85,7 +85,7 @@ private void randomTick(BlockState state, ServerWorld world, BlockPos pos, Rando Block block = state.getBlock(); if (!scheduler.isQueued(pos, block) && !scheduler.isTicking(pos, block)) { - world.createAndScheduleBlockTick(pos, block, TotallyLitModInitializer.getConfiguration().torchConfiguration.burnDuration * 6_000); + world.scheduleBlockTick(pos, block, TotallyLitModInitializer.getConfiguration().torchConfiguration.burnDuration * 6_000); } } diff --git a/src/main/java/io/github/realguyman/totally_lit/mixin/BlockMixin.java b/src/main/java/io/github/realguyman/totally_lit/mixin/BlockMixin.java index 340627e..a5eb6b7 100644 --- a/src/main/java/io/github/realguyman/totally_lit/mixin/BlockMixin.java +++ b/src/main/java/io/github/realguyman/totally_lit/mixin/BlockMixin.java @@ -9,10 +9,10 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; +import net.minecraft.registry.tag.BlockTags; import net.minecraft.server.world.ServerWorld; import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundEvents; -import net.minecraft.tag.BlockTags; import net.minecraft.util.math.BlockBox; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; diff --git a/src/main/java/io/github/realguyman/totally_lit/registry/BlockRegistry.java b/src/main/java/io/github/realguyman/totally_lit/registry/BlockRegistry.java index 1e2de85..3ed9bbf 100644 --- a/src/main/java/io/github/realguyman/totally_lit/registry/BlockRegistry.java +++ b/src/main/java/io/github/realguyman/totally_lit/registry/BlockRegistry.java @@ -6,8 +6,9 @@ import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.block.LanternBlock; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; public class BlockRegistry { public static final Block GLOWSTONE_TORCH = add("glowstone_torch", new NoParticleTorchBlock(Settings.copy(Blocks.TORCH))); @@ -21,6 +22,6 @@ public class BlockRegistry { public static final Block UNLIT_WALL_TORCH = add("unlit_wall_torch", new UnlitWallTorchBlock(Settings.copy(Blocks.WALL_TORCH).luminance(state -> 0).dropsLike(UNLIT_TORCH), Blocks.WALL_TORCH)); private static Block add(String path, Block block) { - return Registry.register(Registry.BLOCK, new Identifier(TotallyLitModInitializer.IDENTIFIER, path), block); + return Registry.register(Registries.BLOCK, new Identifier(TotallyLitModInitializer.IDENTIFIER, path), block); } } diff --git a/src/main/java/io/github/realguyman/totally_lit/registry/ItemRegistry.java b/src/main/java/io/github/realguyman/totally_lit/registry/ItemRegistry.java index 8104a43..45c1965 100644 --- a/src/main/java/io/github/realguyman/totally_lit/registry/ItemRegistry.java +++ b/src/main/java/io/github/realguyman/totally_lit/registry/ItemRegistry.java @@ -4,18 +4,21 @@ import io.github.realguyman.totally_lit.api.item.UnlitLanternItem; import io.github.realguyman.totally_lit.api.item.UnlitTorchItem; import net.minecraft.item.*; +import net.minecraft.item.Items; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; +import net.minecraft.util.math.Direction; public class ItemRegistry { - public static final Item GLOWSTONE_TORCH = add("glowstone_torch", new WallStandingBlockItem(BlockRegistry.GLOWSTONE_TORCH, BlockRegistry.GLOWSTONE_WALL_TORCH, new Item.Settings().group(ItemGroup.DECORATIONS))); - public static final Item GLOWSTONE_LANTERN = add("glowstone_lantern", new BlockItem(BlockRegistry.GLOWSTONE_LANTERN, new Item.Settings().group(ItemGroup.DECORATIONS))); - public static final Item UNLIT_LANTERN = add("unlit_lantern", new UnlitLanternItem(BlockRegistry.UNLIT_LANTERN, new Item.Settings().group(ItemGroup.DECORATIONS), Items.LANTERN)); - public static final Item UNLIT_SOUL_LANTERN = add("unlit_soul_lantern", new UnlitLanternItem(BlockRegistry.UNLIT_SOUL_LANTERN, new Item.Settings().group(ItemGroup.DECORATIONS), Items.SOUL_LANTERN)); - public static final Item UNLIT_SOUL_TORCH = add("unlit_soul_torch", new UnlitTorchItem(BlockRegistry.UNLIT_SOUL_TORCH, BlockRegistry.UNLIT_SOUL_WALL_TORCH, new Item.Settings().group(ItemGroup.DECORATIONS), Items.SOUL_TORCH)); - public static final Item UNLIT_TORCH = add("unlit_torch", new UnlitTorchItem(BlockRegistry.UNLIT_TORCH, BlockRegistry.UNLIT_WALL_TORCH, new Item.Settings().group(ItemGroup.DECORATIONS), Items.TORCH)); + public static final Item GLOWSTONE_TORCH = add("glowstone_torch", new VerticallyAttachableBlockItem(BlockRegistry.GLOWSTONE_TORCH, BlockRegistry.GLOWSTONE_WALL_TORCH, new Item.Settings(), Direction.DOWN)); + public static final Item GLOWSTONE_LANTERN = add("glowstone_lantern", new BlockItem(BlockRegistry.GLOWSTONE_LANTERN, new Item.Settings())); + public static final Item UNLIT_LANTERN = add("unlit_lantern", new UnlitLanternItem(BlockRegistry.UNLIT_LANTERN, new Item.Settings(), Items.LANTERN)); + public static final Item UNLIT_SOUL_LANTERN = add("unlit_soul_lantern", new UnlitLanternItem(BlockRegistry.UNLIT_SOUL_LANTERN, new Item.Settings(), Items.SOUL_LANTERN)); + public static final Item UNLIT_SOUL_TORCH = add("unlit_soul_torch", new UnlitTorchItem(BlockRegistry.UNLIT_SOUL_TORCH, BlockRegistry.UNLIT_SOUL_WALL_TORCH, new Item.Settings(), Direction.DOWN, Items.SOUL_TORCH)); + public static final Item UNLIT_TORCH = add("unlit_torch", new UnlitTorchItem(BlockRegistry.UNLIT_TORCH, BlockRegistry.UNLIT_WALL_TORCH, new Item.Settings(), Direction.DOWN, Items.TORCH)); private static Item add(String path, Item item) { - return Registry.register(Registry.ITEM, new Identifier(TotallyLitModInitializer.IDENTIFIER, path), item); + return Registry.register(Registries.ITEM, new Identifier(TotallyLitModInitializer.IDENTIFIER, path), item); } } diff --git a/src/main/java/io/github/realguyman/totally_lit/registry/TagRegistry.java b/src/main/java/io/github/realguyman/totally_lit/registry/TagRegistry.java index 4dd3aa5..6a5da7b 100644 --- a/src/main/java/io/github/realguyman/totally_lit/registry/TagRegistry.java +++ b/src/main/java/io/github/realguyman/totally_lit/registry/TagRegistry.java @@ -4,12 +4,12 @@ import net.minecraft.block.Block; import net.minecraft.fluid.Fluid; import net.minecraft.item.Item; -import net.minecraft.tag.TagKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.tag.TagKey; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; public class TagRegistry { - public static final TagKey TORCH_IGNITER_BLOCKS = TagKey.of(Registry.BLOCK_KEY, new Identifier(TotallyLitModInitializer.IDENTIFIER, "torch_igniters")); - public static final TagKey TORCH_IGNITER_FLUIDS = TagKey.of(Registry.FLUID_KEY, new Identifier(TotallyLitModInitializer.IDENTIFIER, "torch_igniters")); - public static final TagKey TORCH_IGNITER_ITEMS = TagKey.of(Registry.ITEM_KEY, new Identifier(TotallyLitModInitializer.IDENTIFIER, "torch_igniters")); + public static final TagKey TORCH_IGNITER_BLOCKS = TagKey.of(RegistryKeys.BLOCK, new Identifier(TotallyLitModInitializer.IDENTIFIER, "torch_igniters")); + public static final TagKey TORCH_IGNITER_FLUIDS = TagKey.of(RegistryKeys.FLUID, new Identifier(TotallyLitModInitializer.IDENTIFIER, "torch_igniters")); + public static final TagKey TORCH_IGNITER_ITEMS = TagKey.of(RegistryKeys.ITEM, new Identifier(TotallyLitModInitializer.IDENTIFIER, "torch_igniters")); } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index c880b60..2aff2dc 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -21,10 +21,10 @@ }, "depends": { "java": ">=17", - "minecraft": ["1.19", "1.19.1", "1.19.2"], - "fabricloader": ">=0.14.6", - "fabric": "*", - "cloth-config": "^8.0.0" + "minecraft": "1.19.3", + "fabricloader": ">=0.14.12", + "fabric-api": "*", + "cloth-config": "^9.0.0" }, "conflicts": { "fading": "*",