diff --git a/CHANGELOG.md b/CHANGELOG.md index 26c2db6..e2b6d7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,18 +3,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog]. -## [v2.0.0-1.17.1] - 2021-12-06 -### Added -- Added new system for manually registering crafting table blocks that should be supported by Visual Workbench -- Previous solution was too unreliable -### Fixed -- Fixed a client desync issue when FastWorkbench Minus Replacement mod is installed - -## [v2.0.0b2-1.17.1] - 2021-11-28 -### Fixed -- Fixed an issue where shift-clicking multiple crafting results wouldn't work properly - -## [v2.0.0b1-1.17.1] - 2021-11-23 -- Ported to Minecraft 1.17 +## [v3.0.0-1.18] - 2021-12-06 +- Ported to Minecraft 1.18 [Keep a Changelog]: https://keepachangelog.com/en/1.0.0/ diff --git a/build.gradle b/build.gradle index 984d4ac..54275a4 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,7 @@ apply plugin: 'eclipse' apply plugin: 'org.spongepowered.mixin' apply plugin: 'org.parchmentmc.librarian.forgegradle' -java.toolchain.languageVersion = JavaLanguageVersion.of(16) +java.toolchain.languageVersion = JavaLanguageVersion.of(17) println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) ext.mcversion = "${minecraftVersion}" @@ -79,18 +79,18 @@ repositories { dependencies { minecraft "net.minecraftforge:forge:${forgeVersion}" - annotationProcessor 'org.spongepowered:mixin:0.8.4:processor' + annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' // don't enable these for puzzles, they'll be forced upon all dependencies then via maven - runtimeOnly fg.deobf("curse.maven:catalogue-459701:3399552") - runtimeOnly fg.deobf("curse.maven:bettermodsbutton-541584:3519040") - runtimeOnly fg.deobf("curse.maven:configmenusforge-544048:3518700") + runtimeOnly fg.deobf("curse.maven:catalogue-459701:3543625") + runtimeOnly fg.deobf("curse.maven:bettermodsbutton-541584:3548185") + runtimeOnly fg.deobf("curse.maven:configmenusforge-544048:3548199") // compile against the JEI API but do not include it at runtime - compileOnly fg.deobf("mezz.jei:jei-1.17.1:8.2.0.36") + compileOnly fg.deobf("mezz.jei:jei-1.18:9.0.0.40") // at runtime, use the full JEI jar - runtimeOnly fg.deobf("mezz.jei:jei-1.17.1:8.2.0.36") - runtimeOnly fg.deobf("curse.maven:balm-531761:3515759") - runtimeOnly fg.deobf("curse.maven:craftingtweaks-233071:3493701") + runtimeOnly fg.deobf("mezz.jei:jei-1.18:9.0.0.40") + runtimeOnly fg.deobf("curse.maven:balm-531761:3550130") + runtimeOnly fg.deobf("curse.maven:craftingtweaks-233071:3545611") // from local maven, those builds are not obfuscated implementation "fuzs.puzzleslib:PuzzlesLib:${puzzlesVersion}" diff --git a/gradle.properties b/gradle.properties index ef130fd..fcc33b3 100755 --- a/gradle.properties +++ b/gradle.properties @@ -4,25 +4,25 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false # environment -minecraftVersion=1.17.1 +minecraftVersion=1.18 projectLoader=Forge -forgeVersion=1.17.1-37.0.104 -puzzlesVersion=v2.0.2-1.17.1-Forge -mappingsChannel=parchment -mappingsVersion=2021.10.31-1.17.1 +forgeVersion=1.18-38.0.15 +puzzlesVersion=v3.0.1-1.18-Forge +mappingsChannel=official +mappingsVersion=1.18 enableHotswap=false copyBuildJar=true # dependencies -minForgeVersion=37 -minMinecraftVersion=1.17.1 -minPuzzlesVersion=2.0.2 -packFormat=7 +minForgeVersion=38 +minMinecraftVersion=1.18 +minPuzzlesVersion=3.0.0 +packFormat=8 # attributes modId=visualworkbench modName=Visual Workbench -modVersion=2.0.0 +modVersion=3.0.0 modAuthor=Fuzs modDescription=Items stay inside of crafting tables and are also rendered on top. It's really fancy! modPageUrl=https://www.curseforge.com/minecraft/mc-mods/visual-workbench @@ -34,4 +34,4 @@ modGroup=fuzs.visualworkbench # publishing curseProjectId=500273 curseReleaseType=release -curseProjectVersion=1.17.1 +curseProjectVersion=1.18 diff --git a/src/main/java/fuzs/visualworkbench/registry/ModRegistry.java b/src/main/java/fuzs/visualworkbench/registry/ModRegistry.java index 46d1e1a..a385a9a 100644 --- a/src/main/java/fuzs/visualworkbench/registry/ModRegistry.java +++ b/src/main/java/fuzs/visualworkbench/registry/ModRegistry.java @@ -8,7 +8,7 @@ import net.minecraft.world.inventory.MenuType; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; -import net.minecraftforge.fmllegacy.RegistryObject; +import net.minecraftforge.registries.RegistryObject; public class ModRegistry { private static final RegistryManager REGISTRY = RegistryManager.of(VisualWorkbench.MOD_ID); diff --git a/src/main/java/fuzs/visualworkbench/world/level/block/entity/CraftingTableBlockEntity.java b/src/main/java/fuzs/visualworkbench/world/level/block/entity/CraftingTableBlockEntity.java index 5246e71..704689d 100644 --- a/src/main/java/fuzs/visualworkbench/world/level/block/entity/CraftingTableBlockEntity.java +++ b/src/main/java/fuzs/visualworkbench/world/level/block/entity/CraftingTableBlockEntity.java @@ -5,7 +5,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.NonNullList; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.Connection; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; @@ -24,7 +23,7 @@ import javax.annotation.Nullable; public class CraftingTableBlockEntity extends BaseContainerBlockEntity { - private final NonNullList items = NonNullList.withSize(9, ItemStack.EMPTY); + private final NonNullList inventory = NonNullList.withSize(9, ItemStack.EMPTY); public int combinedLight; public int ticks; public float currentAngle; @@ -46,39 +45,27 @@ protected Component getDefaultName() { } @Override - public void load(CompoundTag compound) { - super.load(compound); - this.clearContent(); - ContainerHelper.loadAllItems(compound, this.items); + public void load(CompoundTag nbt) { + super.load(nbt); + this.inventory.clear(); + ContainerHelper.loadAllItems(nbt, this.inventory); } @Override - public CompoundTag save(CompoundTag compound) { - return this.saveMetadataAndItems(compound); + protected void saveAdditional(CompoundTag compoundTag) { + super.saveAdditional(compoundTag); + ContainerHelper.saveAllItems(compoundTag, this.inventory, true); } - private CompoundTag saveMetadataAndItems(CompoundTag compound) { - super.save(compound); - ContainerHelper.saveAllItems(compound, this.items, true); - return compound; - } - - @Nullable @Override + @Nullable public ClientboundBlockEntityDataPacket getUpdatePacket() { - return new ClientboundBlockEntityDataPacket(this.worldPosition, -1, this.getUpdateTag()); + return ClientboundBlockEntityDataPacket.create(this); } @Override public CompoundTag getUpdateTag() { - return this.saveMetadataAndItems(new CompoundTag()); - } - - @Override - public void onDataPacket(Connection networkManager, ClientboundBlockEntityDataPacket updatePacket) { - CompoundTag compound = updatePacket.getTag(); - this.clearContent(); - ContainerHelper.loadAllItems(compound, this.items); + return this.saveWithoutMetadata(); } @Override @@ -91,12 +78,12 @@ public void setChanged() { @Override public int getContainerSize() { - return this.items.size(); + return this.inventory.size(); } @Override public boolean isEmpty() { - for (ItemStack itemstack : this.items) { + for (ItemStack itemstack : this.inventory) { if (!itemstack.isEmpty()) { return false; } @@ -106,12 +93,12 @@ public boolean isEmpty() { @Override public ItemStack getItem(int index) { - return index >= 0 && index < this.items.size() ? this.items.get(index) : ItemStack.EMPTY; + return index >= 0 && index < this.inventory.size() ? this.inventory.get(index) : ItemStack.EMPTY; } @Override public ItemStack removeItem(int index, int count) { - ItemStack itemStack = ContainerHelper.removeItem(this.items, index, count); + ItemStack itemStack = ContainerHelper.removeItem(this.inventory, index, count); if (!itemStack.isEmpty()) { // vanilla is fine, but crafting tweaks mod doesn't update the client properly without this this.setChanged(); @@ -121,7 +108,7 @@ public ItemStack removeItem(int index, int count) { @Override public ItemStack removeItemNoUpdate(int index) { - ItemStack itemStack = ContainerHelper.takeItem(this.items, index); + ItemStack itemStack = ContainerHelper.takeItem(this.inventory, index); if (!itemStack.isEmpty()) { // vanilla is fine, but crafting tweaks mod doesn't update the client properly without this this.setChanged(); @@ -131,8 +118,8 @@ public ItemStack removeItemNoUpdate(int index) { @Override public void setItem(int index, ItemStack stack) { - if (index >= 0 && index < this.items.size()) { - this.items.set(index, stack); + if (index >= 0 && index < this.inventory.size()) { + this.inventory.set(index, stack); // vanilla is fine, but crafting tweaks mod doesn't update the client properly without this this.setChanged(); } @@ -154,7 +141,7 @@ protected AbstractContainerMenu createMenu(int id, Inventory playerInventory) { @Override public void clearContent() { - this.items.clear(); + this.inventory.clear(); } public static void tick(Level pLevel, BlockPos pPos, BlockState pState, CraftingTableBlockEntity pBlockEntity) {