diff --git a/README.md b/README.md index b3abcc9..8629987 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ -

Art of Alchemy

- +

diff --git a/build.gradle b/build.gradle index 75fc270..1bee5ef 100644 --- a/build.gradle +++ b/build.gradle @@ -1,20 +1,17 @@ plugins { - id 'fabric-loom' version '0.9.+' + id 'fabric-loom' version '1.4-SNAPSHOT' id 'maven-publish' } -sourceCompatibility = JavaVersion.VERSION_16 -targetCompatibility = JavaVersion.VERSION_16 - -archivesBaseName = project.archives_base_name version = project.mod_version + "+" + project.minecraft_version group = project.maven_group -if (System.env.RUN_COUNT) { // only change version if we're in github's workflow environment - full releases shouldn't have the +build - version = version + "+build." + System.env.RUN_COUNT // automatically increments every time the workflow runs, but won't affect fabric.mod.json dependencies +base { + archivesBaseName = project.archives_base_name } -minecraft { +if (System.env.RUN_COUNT) { // only change version if we're in github's workflow environment - full releases shouldn't have the +build + version = version + "+build." + System.env.RUN_COUNT // automatically increments every time the workflow runs, but won't affect fabric.mod.json dependencies } repositories { @@ -27,7 +24,7 @@ repositories { maven { name = 'TerraformersMC' - url = 'https://maven.kotlindiscord.com/repository/terraformers/' + url = 'https://maven.terraformersmc.com/' } maven { @@ -70,18 +67,20 @@ processResources { // ensure that the encoding is set to UTF-8, no matter what the system default is // this fixes some edge cases with special characters not displaying correctly // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html -tasks.withType(JavaCompile) { +tasks.withType(JavaCompile).configureEach { options.encoding = "UTF-8" - it.options.release = 16 + it.options.release = 17 } -// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task -// if it is present. -// If you remove this task, sources will not be generated. -task sourcesJar(type: Jar, dependsOn: classes) { - classifier = "sources" - from sourceSets.main.allSource +java { + // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task + // if it is present. + // If you remove this line, sources will not be generated. + withSourcesJar() + + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } jar { diff --git a/gradle.properties b/gradle.properties index e66d2a0..8965533 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,18 +1,19 @@ org.gradle.jvmargs = -Xmx1G +org.gradle.parallel = true # Fabric properties -minecraft_version=1.18-pre1 -yarn_mappings=1.18-pre1+build.11 -loader_version=0.12.5 +minecraft_version = 1.18.1 +yarn_mappings = 1.18+build.1 +loader_version = 0.15.3 # Mod properties -mod_version = 1.3.4 +mod_version = 1.3.5-alpha maven_group = dev.cafeteria.artofalchemy archives_base_name = artofalchemy # Dependencies -fabric_api_version = 0.42.2+1.18 +fabric_api_version = 0.46.6+1.18 -libgui_version = 5.0.0+1.18-pre1 +libgui_version = 5.0.0+1.18 modmenu_version = 3.0.0 clothconfig_version = 6.0.42 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 37c7bb8..1af9e09 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ -#Fri Apr 10 15:58:04 MST 2020 -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntityCalcinator.java b/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntityCalcinator.java index e72ded9..5fe950e 100644 --- a/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntityCalcinator.java +++ b/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntityCalcinator.java @@ -1,5 +1,7 @@ package dev.cafeteria.artofalchemy.blockentity; +import org.jetbrains.annotations.Nullable; + import dev.cafeteria.artofalchemy.AoAConfig; import dev.cafeteria.artofalchemy.ArtOfAlchemy; import dev.cafeteria.artofalchemy.block.BlockCalcinator; @@ -10,9 +12,9 @@ import dev.cafeteria.artofalchemy.util.FuelHelper; import dev.cafeteria.artofalchemy.util.ImplementedInventory; import io.github.cottonmc.cotton.gui.PropertyDelegateHolder; -import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable; import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory; import net.fabricmc.fabric.api.tag.TagFactory; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntityTicker; @@ -23,7 +25,10 @@ import net.minecraft.inventory.SidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; +import net.minecraft.network.Packet; import net.minecraft.network.PacketByteBuf; +import net.minecraft.network.listener.ClientPlayPacketListener; +import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; import net.minecraft.screen.PropertyDelegate; import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.ScreenHandlerContext; @@ -38,7 +43,7 @@ public class BlockEntityCalcinator extends BlockEntity implements ImplementedInventory, BlockEntityTicker, PropertyDelegateHolder, - BlockEntityClientSerializable, SidedInventory, ExtendedScreenHandlerFactory { + SidedInventory, ExtendedScreenHandlerFactory { protected static final int[] TOP_SLOTS = { 0 @@ -189,9 +194,10 @@ private void doCraft(final RecipeCalcination recipe) { } + @Nullable @Override - public void fromClientTag(final NbtCompound tag) { - this.readNbt(tag); + public Packet toUpdatePacket() { + return BlockEntityUpdateS2CPacket.create(this); } @Override @@ -250,6 +256,10 @@ public void markDirty() { this.sync(); } } + + public void sync() { + world.updateListeners(pos, world.getBlockState(pos), world.getBlockState(pos), Block.NOTIFY_LISTENERS); + } @Override public void readNbt(final NbtCompound tag) { @@ -323,17 +333,17 @@ public void tick( } @Override - public NbtCompound toClientTag(final NbtCompound tag) { - return this.writeNbt(tag); + public NbtCompound toInitialChunkDataNbt() { + return createNbt(); } @Override - public NbtCompound writeNbt(final NbtCompound tag) { + public void writeNbt(final NbtCompound tag) { tag.putInt("fuel", this.fuel); tag.putInt("progress", this.progress); tag.putInt("maxFuel", this.maxFuel); Inventories.writeNbt(tag, this.items); - return super.writeNbt(tag); + super.writeNbt(tag); } @Override diff --git a/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntityDissolver.java b/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntityDissolver.java index b7e784e..09aa3ba 100644 --- a/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntityDissolver.java +++ b/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntityDissolver.java @@ -1,5 +1,7 @@ package dev.cafeteria.artofalchemy.blockentity; +import org.jetbrains.annotations.Nullable; + import dev.cafeteria.artofalchemy.AoAConfig; import dev.cafeteria.artofalchemy.ArtOfAlchemy; import dev.cafeteria.artofalchemy.block.BlockDissolver; @@ -14,12 +16,12 @@ import dev.cafeteria.artofalchemy.util.AoAHelper; import dev.cafeteria.artofalchemy.util.ImplementedInventory; import io.github.cottonmc.cotton.gui.PropertyDelegateHolder; -import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable; import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory; import net.fabricmc.fabric.api.tag.TagFactory; import net.fabricmc.fabric.api.transfer.v1.fluid.FluidConstants; import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; import net.fabricmc.fabric.api.transfer.v1.storage.base.SingleVariantStorage; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntityTicker; @@ -30,7 +32,10 @@ import net.minecraft.inventory.SidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; +import net.minecraft.network.Packet; import net.minecraft.network.PacketByteBuf; +import net.minecraft.network.listener.ClientPlayPacketListener; +import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; import net.minecraft.screen.PropertyDelegate; import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.ScreenHandlerContext; @@ -45,7 +50,7 @@ @SuppressWarnings("deprecation") // Experimental API public class BlockEntityDissolver extends BlockEntity implements ImplementedInventory, BlockEntityTicker, PropertyDelegateHolder, - BlockEntityClientSerializable, HasEssentia, HasAlkahest, SidedInventory, ExtendedScreenHandlerFactory { + HasEssentia, HasAlkahest, SidedInventory, ExtendedScreenHandlerFactory { private static final int[] TOP_SLOTS = { 0 @@ -210,9 +215,10 @@ private void doCraft(final RecipeDissolution recipe) { this.addAlkahest(-alkahestCost); } + @Nullable @Override - public void fromClientTag(final NbtCompound tag) { - this.readNbt(tag); + public Packet toUpdatePacket() { + return BlockEntityUpdateS2CPacket.create(this); } @Override @@ -302,10 +308,9 @@ public void readNbt(final NbtCompound tag) { this.essentia = new EssentiaContainer(tag.getCompound("essentia")); } - @Override public void sync() { AoANetworking.sendEssentiaPacket(this.world, this.pos, 0, this.essentia); - BlockEntityClientSerializable.super.sync(); + world.updateListeners(pos, world.getBlockState(pos), world.getBlockState(pos), Block.NOTIFY_LISTENERS); } @Override @@ -358,8 +363,8 @@ public void tick( } @Override - public NbtCompound toClientTag(final NbtCompound tag) { - return this.writeNbt(tag); + public NbtCompound toInitialChunkDataNbt() { + return createNbt(); } private boolean updateStatus(final int status) { @@ -371,14 +376,14 @@ private boolean updateStatus(final int status) { } @Override - public NbtCompound writeNbt(final NbtCompound tag) { + public void writeNbt(final NbtCompound tag) { tag.putInt("alkahest", AoAHelper.mBFromFluid(this.getAlkahest())); // As mB mostly for legacy reasons tag.putInt("progress", this.progress); tag.putInt("max_progress", this.maxProgress); tag.putInt("status", this.status); tag.put("essentia", this.essentia.writeNbt()); Inventories.writeNbt(tag, this.items); - return super.writeNbt(tag); + super.writeNbt(tag); } @Override diff --git a/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntityDistiller.java b/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntityDistiller.java index 1b558e2..4745c16 100644 --- a/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntityDistiller.java +++ b/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntityDistiller.java @@ -1,5 +1,7 @@ package dev.cafeteria.artofalchemy.blockentity; +import org.jetbrains.annotations.Nullable; + import dev.cafeteria.artofalchemy.AoAConfig; import dev.cafeteria.artofalchemy.ArtOfAlchemy; import dev.cafeteria.artofalchemy.block.BlockDissolver; @@ -12,12 +14,12 @@ import dev.cafeteria.artofalchemy.util.FuelHelper; import dev.cafeteria.artofalchemy.util.ImplementedInventory; import io.github.cottonmc.cotton.gui.PropertyDelegateHolder; -import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable; import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory; import net.fabricmc.fabric.api.tag.TagFactory; import net.fabricmc.fabric.api.transfer.v1.fluid.FluidConstants; import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; import net.fabricmc.fabric.api.transfer.v1.storage.base.SingleVariantStorage; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntityTicker; @@ -28,7 +30,10 @@ import net.minecraft.inventory.SidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; +import net.minecraft.network.Packet; import net.minecraft.network.PacketByteBuf; +import net.minecraft.network.listener.ClientPlayPacketListener; +import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; import net.minecraft.screen.PropertyDelegate; import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.ScreenHandlerContext; @@ -43,7 +48,7 @@ @SuppressWarnings("deprecation") // Experimental API public class BlockEntityDistiller extends BlockEntity implements ImplementedInventory, BlockEntityTicker, PropertyDelegateHolder, - BlockEntityClientSerializable, HasEssentia, HasAlkahest, SidedInventory, ExtendedScreenHandlerFactory { + HasEssentia, HasAlkahest, SidedInventory, ExtendedScreenHandlerFactory { private static final int[] TOP_SLOTS = { 0 @@ -161,9 +166,10 @@ private void distill() { this.updateEssentiaTankSize(); } + @Nullable @Override - public void fromClientTag(final NbtCompound tag) { - this.readNbt(tag); + public Packet toUpdatePacket() { + return BlockEntityUpdateS2CPacket.create(this); } @Override @@ -300,11 +306,10 @@ private void setLit(final boolean lit) { this.updateLit(); } - @Override public void sync() { // AoANetworking.sendEssentiaPacket(world, pos, 0, essentiaInput); // KG: Is // this needed? - BlockEntityClientSerializable.super.sync(); + world.updateListeners(pos, world.getBlockState(pos), world.getBlockState(pos), Block.NOTIFY_LISTENERS); } @Override @@ -339,8 +344,8 @@ public void tick( } @Override - public NbtCompound toClientTag(final NbtCompound tag) { - return this.writeNbt(tag); + public NbtCompound toInitialChunkDataNbt() { + return createNbt(); } private void tryConvertEssentia() { // KG: Not clean, could have issues if this function is missed for a tick. @@ -360,14 +365,14 @@ private void updateLit() { } @Override - public NbtCompound writeNbt(final NbtCompound tag) { + public void writeNbt(final NbtCompound tag) { tag.putInt("progress", this.progress); tag.putInt("fuel", this.fuel); tag.putInt("essentia", this.essentia); tag.putInt("alkahest", AoAHelper.mBFromFluid(this.getAlkahest())); // As mB mostly for legacy reasons tag.put("essentiaInput", this.essentiaInput.writeNbt()); Inventories.writeNbt(tag, this.items); - return super.writeNbt(tag); + super.writeNbt(tag); } @Override diff --git a/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntityPipe.java b/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntityPipe.java index 46ea9f9..663b680 100644 --- a/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntityPipe.java +++ b/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntityPipe.java @@ -3,19 +3,24 @@ import java.util.HashMap; import java.util.Map; +import org.jetbrains.annotations.Nullable; + import dev.cafeteria.artofalchemy.transport.NetworkNode; -import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable; import net.fabricmc.fabric.api.rendering.data.v1.RenderAttachedBlockView; import net.fabricmc.fabric.api.rendering.data.v1.RenderAttachmentBlockEntity; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; import net.minecraft.nbt.NbtCompound; +import net.minecraft.network.Packet; +import net.minecraft.network.listener.ClientPlayPacketListener; +import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; import net.minecraft.util.StringIdentifiable; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.BlockRenderView; -public class BlockEntityPipe extends BlockEntity implements BlockEntityClientSerializable, RenderAttachmentBlockEntity { +public class BlockEntityPipe extends BlockEntity implements RenderAttachmentBlockEntity { public enum IOFace implements StringIdentifiable { NONE, CONNECT, BLOCK, INSERTER(NetworkNode.Type.PULL), EXTRACTOR(NetworkNode.Type.PUSH), @@ -65,9 +70,10 @@ public BlockEntityPipe(final BlockPos pos, final BlockState state) { } } + @Nullable @Override - public void fromClientTag(final NbtCompound tag) { - this.readNbt(tag); + public Packet toUpdatePacket() { + return BlockEntityUpdateS2CPacket.create(this); } public IOFace getFace(final Direction dir) { @@ -104,22 +110,21 @@ public void setFaces(final Map faces) { this.faces = faces; } - @Override public void sync() { - BlockEntityClientSerializable.super.sync(); + world.updateListeners(pos, world.getBlockState(pos), world.getBlockState(pos), Block.NOTIFY_LISTENERS); } @Override - public NbtCompound toClientTag(final NbtCompound tag) { - return this.writeNbt(tag); + public NbtCompound toInitialChunkDataNbt() { + return createNbt(); } @Override - public NbtCompound writeNbt(final NbtCompound tag) { + public void writeNbt(final NbtCompound tag) { for (final Direction dir : Direction.values()) { tag.putString(dir.toString(), this.faces.get(dir).toString()); } - return super.writeNbt(tag); + super.writeNbt(tag); } } diff --git a/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntityProjector.java b/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntityProjector.java index d724a64..e271786 100644 --- a/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntityProjector.java +++ b/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntityProjector.java @@ -1,5 +1,7 @@ package dev.cafeteria.artofalchemy.blockentity; +import org.jetbrains.annotations.Nullable; + import dev.cafeteria.artofalchemy.AoAConfig; import dev.cafeteria.artofalchemy.block.BlockDissolver; import dev.cafeteria.artofalchemy.gui.handler.HandlerProjector; @@ -9,11 +11,11 @@ import dev.cafeteria.artofalchemy.util.AoAHelper; import dev.cafeteria.artofalchemy.util.ImplementedInventory; import io.github.cottonmc.cotton.gui.PropertyDelegateHolder; -import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable; import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory; import net.fabricmc.fabric.api.transfer.v1.fluid.FluidConstants; import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; import net.fabricmc.fabric.api.transfer.v1.storage.base.SingleVariantStorage; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntityTicker; @@ -24,7 +26,10 @@ import net.minecraft.inventory.SidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; +import net.minecraft.network.Packet; import net.minecraft.network.PacketByteBuf; +import net.minecraft.network.listener.ClientPlayPacketListener; +import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; import net.minecraft.screen.PropertyDelegate; import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.ScreenHandlerContext; @@ -39,7 +44,7 @@ @SuppressWarnings("deprecation") // Experimental API public class BlockEntityProjector extends BlockEntity implements ImplementedInventory, BlockEntityTicker, PropertyDelegateHolder, - BlockEntityClientSerializable, HasAlkahest, SidedInventory, ExtendedScreenHandlerFactory { + HasAlkahest, SidedInventory, ExtendedScreenHandlerFactory { private static final int[] TOP_SLOTS = { 0 @@ -155,9 +160,10 @@ private void doCraft(final RecipeProjection recipe) { } } + @Nullable @Override - public void fromClientTag(final NbtCompound tag) { - this.readNbt(tag); + public Packet toUpdatePacket() { + return BlockEntityUpdateS2CPacket.create(this); } @Override @@ -222,9 +228,8 @@ public void readNbt(final NbtCompound tag) { this.maxProgress = this.getOperationTime(); } - @Override public void sync() { - BlockEntityClientSerializable.super.sync(); + world.updateListeners(pos, world.getBlockState(pos), world.getBlockState(pos), Block.NOTIFY_LISTENERS); } @Override @@ -272,16 +277,16 @@ public void tick( } @Override - public NbtCompound toClientTag(final NbtCompound tag) { - return this.writeNbt(tag); + public NbtCompound toInitialChunkDataNbt() { + return createNbt(); } @Override - public NbtCompound writeNbt(final NbtCompound tag) { + public void writeNbt(final NbtCompound tag) { tag.putInt("alkahest", AoAHelper.mBFromFluid(this.getAlkahest())); // As mB mostly for legacy reasons tag.putInt("progress", this.progress); Inventories.writeNbt(tag, this.items); - return super.writeNbt(tag); + super.writeNbt(tag); } @Override diff --git a/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntitySynthesizer.java b/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntitySynthesizer.java index 6d32954..a209ceb 100644 --- a/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntitySynthesizer.java +++ b/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntitySynthesizer.java @@ -1,5 +1,7 @@ package dev.cafeteria.artofalchemy.blockentity; +import org.jetbrains.annotations.Nullable; + import dev.cafeteria.artofalchemy.AoAConfig; import dev.cafeteria.artofalchemy.block.BlockSynthesizer; import dev.cafeteria.artofalchemy.essentia.EssentiaContainer; @@ -13,8 +15,8 @@ import dev.cafeteria.artofalchemy.util.AoATags; import dev.cafeteria.artofalchemy.util.ImplementedInventory; import io.github.cottonmc.cotton.gui.PropertyDelegateHolder; -import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable; import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntityTicker; @@ -26,7 +28,10 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; +import net.minecraft.network.Packet; import net.minecraft.network.PacketByteBuf; +import net.minecraft.network.listener.ClientPlayPacketListener; +import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; import net.minecraft.recipe.Ingredient; import net.minecraft.screen.PropertyDelegate; import net.minecraft.screen.ScreenHandler; @@ -41,7 +46,7 @@ public class BlockEntitySynthesizer extends BlockEntity implements ImplementedInventory, BlockEntityTicker, SidedInventory, PropertyDelegateHolder, - BlockEntityClientSerializable, HasEssentia, ExtendedScreenHandlerFactory { + HasEssentia, ExtendedScreenHandlerFactory { private static final int[] TOP_SLOTS = { 0 @@ -225,9 +230,10 @@ private void doCraft(final RecipeSynthesis recipe) { // this.addXp(-xpCost); } + @Nullable @Override - public void fromClientTag(final NbtCompound tag) { - this.readNbt(tag); + public Packet toUpdatePacket() { + return BlockEntityUpdateS2CPacket.create(this); } @Override @@ -329,10 +335,9 @@ public void recipeSync() { AoANetworking.sendEssentiaPacketWithRequirements(this.world, this.pos, 0, this.essentiaContainer, requirements); } - @Override public void sync() { this.recipeSync(); - BlockEntityClientSerializable.super.sync(); + world.updateListeners(pos, world.getBlockState(pos), world.getBlockState(pos), Block.NOTIFY_LISTENERS); } @Override @@ -389,8 +394,8 @@ public void tick( } @Override - public NbtCompound toClientTag(final NbtCompound tag) { - return this.writeNbt(tag); + public NbtCompound toInitialChunkDataNbt() { + return createNbt(); } private boolean updateStatus(final int status) { @@ -402,13 +407,13 @@ private boolean updateStatus(final int status) { } @Override - public NbtCompound writeNbt(final NbtCompound tag) { + public void writeNbt(final NbtCompound tag) { tag.putInt("progress", this.progress); tag.putInt("max_progress", this.maxProgress); tag.putInt("status", this.status); tag.put("essentia", this.essentiaContainer.writeNbt()); Inventories.writeNbt(tag, this.items); - return super.writeNbt(tag); + super.writeNbt(tag); } @Override diff --git a/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntityTank.java b/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntityTank.java index f864f75..ebd4a6b 100644 --- a/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntityTank.java +++ b/src/main/java/dev/cafeteria/artofalchemy/blockentity/BlockEntityTank.java @@ -1,21 +1,26 @@ package dev.cafeteria.artofalchemy.blockentity; +import org.jetbrains.annotations.Nullable; + import dev.cafeteria.artofalchemy.AoAConfig; import dev.cafeteria.artofalchemy.block.AoABlocks; import dev.cafeteria.artofalchemy.essentia.EssentiaContainer; import dev.cafeteria.artofalchemy.network.AoANetworking; import dev.cafeteria.artofalchemy.transport.HasEssentia; -import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntityTicker; import net.minecraft.nbt.NbtCompound; +import net.minecraft.network.Packet; +import net.minecraft.network.listener.ClientPlayPacketListener; +import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.World; public class BlockEntityTank extends BlockEntity - implements BlockEntityTicker, HasEssentia, BlockEntityClientSerializable { + implements BlockEntityTicker, HasEssentia { protected EssentiaContainer essentia = new EssentiaContainer().setCapacity(AoAConfig.get().tankCapacity) .setInput(true).setOutput(true); @@ -24,9 +29,10 @@ public BlockEntityTank(final BlockPos pos, final BlockState state) { super(AoABlockEntities.TANK, pos, state); } + @Nullable @Override - public void fromClientTag(final NbtCompound tag) { - this.readNbt(tag); + public Packet toUpdatePacket() { + return BlockEntityUpdateS2CPacket.create(this); } @Override @@ -62,10 +68,9 @@ public void readNbt(final NbtCompound tag) { this.essentia = new EssentiaContainer(tag.getCompound("essentia")); } - @Override public void sync() { AoANetworking.sendEssentiaPacket(this.world, this.pos, 0, this.essentia); - BlockEntityClientSerializable.super.sync(); + world.updateListeners(pos, world.getBlockState(pos), world.getBlockState(pos), Block.NOTIFY_LISTENERS); } @Override @@ -84,13 +89,13 @@ public void tick(final World world, final BlockPos pos, final BlockState state, } @Override - public NbtCompound toClientTag(final NbtCompound tag) { - return this.writeNbt(tag); + public NbtCompound toInitialChunkDataNbt() { + return createNbt(); } @Override - public NbtCompound writeNbt(final NbtCompound tag) { + public void writeNbt(final NbtCompound tag) { tag.put("essentia", this.essentia.writeNbt()); - return super.writeNbt(tag); + super.writeNbt(tag); } } diff --git a/src/main/java/dev/cafeteria/artofalchemy/render/RendererTank.java b/src/main/java/dev/cafeteria/artofalchemy/render/RendererTank.java index ce262fd..21e9829 100644 --- a/src/main/java/dev/cafeteria/artofalchemy/render/RendererTank.java +++ b/src/main/java/dev/cafeteria/artofalchemy/render/RendererTank.java @@ -34,8 +34,8 @@ public void render( final BlockEntityTank blockEntity, final float tickDelta, final MatrixStack matrices, final VertexConsumerProvider vertexConsumers, final int light, final int overlay ) { - final Matrix4f model = matrices.peek().getModel(); - final Matrix3f normal = matrices.peek().getNormal(); + final Matrix4f model = matrices.peek().getPositionMatrix(); + final Matrix3f normal = matrices.peek().getNormalMatrix(); VertexConsumer buffer; if (this.client.options.graphicsMode == GraphicsMode.FABULOUS) { // Translucent-layer quads don't show up under Fabulous settings, so here's a @@ -45,7 +45,7 @@ public void render( buffer = vertexConsumers.getBuffer(RenderLayer.getTranslucent()); } final Sprite sprite = this.client.getBlockRenderManager().getModel(AoABlocks.ALKAHEST.getDefaultState()) - .getSprite(); + .getParticleSprite(); final BlockState state = blockEntity.getWorld().getBlockState(blockEntity.getPos()); state.getProperties(); final EssentiaContainer container = blockEntity.getContainer(); diff --git a/src/main/java/dev/cafeteria/artofalchemy/render/model/ModelPipe.java b/src/main/java/dev/cafeteria/artofalchemy/render/model/ModelPipe.java index 02b16c0..db05cdf 100644 --- a/src/main/java/dev/cafeteria/artofalchemy/render/model/ModelPipe.java +++ b/src/main/java/dev/cafeteria/artofalchemy/render/model/ModelPipe.java @@ -490,7 +490,7 @@ public List getQuads(final BlockState state, final Direction face, fi } @Override - public Sprite getSprite() { + public Sprite getParticleSprite() { return this.blockBreakSprite; } diff --git a/src/main/resources/artofalchemy.mixins.json b/src/main/resources/artofalchemy.mixins.json index 354703e..2635cbf 100644 --- a/src/main/resources/artofalchemy.mixins.json +++ b/src/main/resources/artofalchemy.mixins.json @@ -2,7 +2,7 @@ "required": true, "minVersion": "0.8", "package": "dev.cafeteria.artofalchemy.mixin", - "compatibilityLevel": "JAVA_16", + "compatibilityLevel": "JAVA_17", "mixins": [ "RegistryAccessor", "MixinRecipeManager" diff --git a/src/main/resources/assets/artofalchemy/banner.png b/src/main/resources/assets/artofalchemy/banner.png new file mode 100644 index 0000000..ca32a6c Binary files /dev/null and b/src/main/resources/assets/artofalchemy/banner.png differ diff --git a/src/main/resources/assets/artofalchemy/lang/pt_br.json b/src/main/resources/assets/artofalchemy/lang/pt_br.json new file mode 100644 index 0000000..a001bbc --- /dev/null +++ b/src/main/resources/assets/artofalchemy/lang/pt_br.json @@ -0,0 +1,172 @@ +{ + "item.artofalchemy.icon_item": "Sigilo Misterioso", + "item.artofalchemy.azoth": "Azoth", + "item.artofalchemy.amaranth_pearl": "Pérola de amaranto", + "item.artofalchemy.cracked_amaranth_pearl": "Pérola de amaranto quebrada", + "item.artofalchemy.activated_amaranth_pearl": "Pérola de amaranto ativada", + "item.artofalchemy.philosophers_stone": "Pedra filosofal", + + "item.artofalchemy.alchemical_journal": "Almanaque Alquímico", + "item.artofalchemy.alchemical_journal.tooltip_entries": "%d entries", + "item.artofalchemy.alchemy_formula": "Formula de transmutação", + "item.artofalchemy.brewing_formula": "Fórmula de poção", + "item.artofalchemy.enchantment_formula": "Formula de encantamento", + + "block.artofalchemy.calcination_furnace": "Forno de Calcinação", + "block.artofalchemy.dissolution_chamber": "Câmara de Dissolução", + "block.artofalchemy.distillation_apparatus": "Aparelho de Destilação", + "block.artofalchemy.synthesis_table": "Mesa de Síntese", + "block.artofalchemy.analysis_desk": "Escrivaninha de Análise", + "block.artofalchemy.calcination_furnace_plus": "Forno de Calcinação +", + "block.artofalchemy.dissolution_chamber_plus": "Câmara de Dissolução +", + "block.artofalchemy.synthesis_table_plus": "Mesa de Síntese +", + "block.artofalchemy.projection_altar": "Altar de projeção", + "block.artofalchemy.astrological_centrifuge": "Centrífuga Astral", + "block.artofalchemy.elemental_centrifuge": "Centrífuga Elemental", + + "block.artofalchemy.essentia_pipe": "Duto de Essência", + "block.artofalchemy.essentia_tank": "Tank de Essência", + "item.artofalchemy.essentia_port": "Conector de Essência", + "item.artofalchemy.essentia_inserter": "Conector de Essência Evacuado", + "item.artofalchemy.essentia_extractor": "Conector de Essência Pressurizado", + + "item.artofalchemy.materia_omega": "Matéria Rank-Ω", + "item.artofalchemy.materia_s": "Matéria Rank-S", + "item.artofalchemy.materia_a": "Matéria Rank-A", + "item.artofalchemy.materia_b": "Matéria Rank-B", + "item.artofalchemy.materia_c": "Matéria Rank-C", + "item.artofalchemy.materia_d": "Matéria Rank-D", + "item.artofalchemy.materia_e": "Matéria Rank-E", + "item.artofalchemy.materia_f": "Matéria Rank-F", + + "block.artofalchemy.materia_block_omega": "Bloco de Matéria Rank-Ω", + "block.artofalchemy.materia_block_s": "Bloco de Matéria Rank-S", + "block.artofalchemy.materia_block_a": "Bloco de Matéria Rank-A", + "block.artofalchemy.materia_block_b": "Bloco de Matéria Rank-B", + "block.artofalchemy.materia_block_c": "Bloco de Matéria Rank-C", + "block.artofalchemy.materia_block_d": "Bloco de Matéria Rank-D", + "block.artofalchemy.materia_block_e": "Bloco de Matéria Rank-E", + "block.artofalchemy.materia_block_f": "Bloco de Matéria Rank-F", + + "item.artofalchemy.alkahest_bucket": "Balde de Alcaeste", + "item.artofalchemy.essentia_bucket_mercury": "Balde de essência de Mercúrio", + "item.artofalchemy.essentia_bucket_venus": "Balde de essência de Vênus", + "item.artofalchemy.essentia_bucket_tellus": "Balde de essência de Telo", + "item.artofalchemy.essentia_bucket_mars": "Balde de essência de Marte", + "item.artofalchemy.essentia_bucket_jupiter": "Balde de essência de Jupiter", + "item.artofalchemy.essentia_bucket_saturn": "Balde de essência de Saturno", + "item.artofalchemy.essentia_bucket_uranus": "Balde de essência de Uranu", + "item.artofalchemy.essentia_bucket_neptune": "Balde de essência de Netuno", + "item.artofalchemy.essentia_bucket_apollo": "Balde de essência de Apolo", + "item.artofalchemy.essentia_bucket_diana": "Balde de essência de Diana", + "item.artofalchemy.essentia_bucket_ceres": "Balde de essência de Ceres", + "item.artofalchemy.essentia_bucket_pluto": "Balde de essência de Plutão", + "item.artofalchemy.essentia_bucket_void": "Balde de essência do vazio", + + "block.artofalchemy.alkahest": "Alcaeste", + "block.artofalchemy.essentia_mercury": "Essência de Mercúrio", + "block.artofalchemy.essentia_venus": "Essência de Vênus", + "block.artofalchemy.essentia_tellus": "Essência de Telo", + "block.artofalchemy.essentia_mars": "Essência de Marte", + "block.artofalchemy.essentia_jupiter": "Essência de Jupiter", + "block.artofalchemy.essentia_saturn": "Essência de Saturno", + "block.artofalchemy.essentia_uranus": "Essência de Uranu", + "block.artofalchemy.essentia_neptune": "Essência de Netuno", + "block.artofalchemy.essentia_apollo": "Essência de Apolo", + "block.artofalchemy.essentia_diana": "Essência de Diana", + "block.artofalchemy.essentia_ceres": "Essência de Ceres", + "block.artofalchemy.essentia_pluto": "Essência de Plutão", + "block.artofalchemy.essentia_void": "Essência do vazio", + + "fluid.artofalchemy.alkahest": "Alcaeste", + "fluid.artofalchemy.essentia_mercury": "Essência de Mercúrio", + "fluid.artofalchemy.essentia_venus": "Essência de Vênus", + "fluid.artofalchemy.essentia_tellus": "Essência de Telo", + "fluid.artofalchemy.essentia_mars": "Essência de Marte", + "fluid.artofalchemy.essentia_jupiter": "Essência de Jupiter", + "fluid.artofalchemy.essentia_saturn": "Essência de Saturno", + "fluid.artofalchemy.essentia_uranus": "Essência de Uranu", + "fluid.artofalchemy.essentia_neptune": "Essência de Netuno", + "fluid.artofalchemy.essentia_apollo": "Essência de Apolo", + "fluid.artofalchemy.essentia_diana": "Essência de Diana", + "fluid.artofalchemy.essentia_ceres": "Essência de Ceres", + "fluid.artofalchemy.essentia_pluto": "Essência de Plutão", + "fluid.artofalchemy.essentia_void": "Essência do vazio", + + "essentia.artofalchemy": "Essência", + "essentia.artofalchemy.mercury": "Mercúrio", + "essentia.artofalchemy.venus": "Vênus", + "essentia.artofalchemy.tellus": "Telo", + "essentia.artofalchemy.mars": "Marte", + "essentia.artofalchemy.jupiter": "Jupiter", + "essentia.artofalchemy.saturn": "Saturno", + "essentia.artofalchemy.uranus": "Uranu", + "essentia.artofalchemy.neptune": "Netuno", + "essentia.artofalchemy.apollo": "Apolo", + "essentia.artofalchemy.diana": "Diana", + "essentia.artofalchemy.ceres": "Ceres", + "essentia.artofalchemy.pluto": "Plutão", + "essentia.artofalchemy.void": "Vazio", + + "item.artofalchemy.essentia_vessel": "Recipiente de Essência", + "item.artofalchemy.essentia_vessel.tooltip_infinite": "Infinito", + "item.artofalchemy.essentia_vessel.tooltip_empty": "Vazio", + "item.artofalchemy.essentia_vessel.tooltip_mixed": "%d/%d", + "item.artofalchemy.essentia_vessel.tooltip_mixed_unlim": "%d", + "item.artofalchemy.essentia_vessel.tooltip_single": "%s (%d/%d)", + "item.artofalchemy.essentia_vessel.tooltip_single_unlim": "%s (%d)", + "item.artofalchemy.essentia_vessel.tooltip_component": "%s: %d", + "item.artofalchemy.essentia_vessel.tooltip_component_inf": "%s", + "item.artofalchemy.essentia_vessel.tooltip_unlocked": "Desbloqueado", + "item.artofalchemy.essentia_vessel.tooltip_input": "Apenas entrada", + "item.artofalchemy.essentia_vessel.tooltip_output": "Apenas saída", + "item.artofalchemy.essentia_vessel.tooltip_locked": "Bloqueado", + "item.artofalchemy.essentia_vessel.tooltip_pulled": "Retirou %d de essência", + "item.artofalchemy.essentia_vessel.tooltip_pushed": "Colocou %d de essência", + "item.artofalchemy.essentia_vessel.tooltip_deprecated": "Descontinuado!", + + "gui.artofalchemy.alkahest_tooltip": "Alcaeste §7(%d/%d)", + "gui.artofalchemy.mixed_essentia_tooltip": "Essência misturada §7(%d/%d)", + "gui.artofalchemy.alkahest_warning": "Precisa de alcaeste!", + "gui.artofalchemy.buffer_warning": "O buffer está cheio!", + "gui.artofalchemy.target_warning": "Alvo desconhecido ou faltando!", + "gui.artofalchemy.materia_warning": "Precisa de matéria!", + "gui.artofalchemy.essentia_warning": "Precisa de essência!", + "gui.artofalchemy.container_warning": "Precisa de um contêiner para encher!", + "gui.artofalchemy.tier_warning": "Rank do alvo é muito alto!", + "gui.artofalchemy.empty": "Vazio", + "gui.artofalchemy.essentia_amount": "%d/%d", + "gui.artofalchemy.required_amount": "!%d", + "gui.artofalchemy.formula_type.transmutation": "Transmutação", + + "itemGroup.artofalchemy.alchemy": "Arte da Alquimia", + + "text.autoconfig.artofalchemy.title": "Art of Alchemy", + "text.autoconfig.artofalchemy.option.networkProcessingLimit": "Essentia network processing limit", + "text.autoconfig.artofalchemy.option.formulaLoot": "Add Philosopher's Stone formula to loot tables", + "text.autoconfig.artofalchemy.option.vesselCapacity": "Essentia Vessel capacity", + "text.autoconfig.artofalchemy.option.tankCapacity": "Essentia Tank capacity", + "text.autoconfig.artofalchemy.option.centrifugeCapacity": "Centrifuge capacities", + "text.autoconfig.artofalchemy.option.calcinatorSettings": "Calcination Furnace", + "text.autoconfig.artofalchemy.option.calcinatorSettings.yieldBasic": "Yield (Basic)", + "text.autoconfig.artofalchemy.option.calcinatorSettings.yieldPlus": "Yield (Upgraded)", + "text.autoconfig.artofalchemy.option.calcinatorSettings.opTimeBasic": "Operation time (Basic)", + "text.autoconfig.artofalchemy.option.calcinatorSettings.opTimePlus": "Operation time (Upgraded)", + "text.autoconfig.artofalchemy.option.dissolverSettings": "Dissolution Chamber", + "text.autoconfig.artofalchemy.option.dissolverSettings.yieldBasic": "Yield (Basic)", + "text.autoconfig.artofalchemy.option.dissolverSettings.yieldPlus": "Yield (Upgraded)", + "text.autoconfig.artofalchemy.option.dissolverSettings.speedBasic": "Speed factor (Basic)", + "text.autoconfig.artofalchemy.option.dissolverSettings.speedPlus": "Speed factor (Upgraded)", + "text.autoconfig.artofalchemy.option.dissolverSettings.tankBasic": "Tank size (Basic)", + "text.autoconfig.artofalchemy.option.dissolverSettings.tankPlus": "Tank size (Upgraded)", + "text.autoconfig.artofalchemy.option.synthesizerSettings": "Synthesis Table", + "text.autoconfig.artofalchemy.option.synthesizerSettings.maxTierBasic": "Max tier (Basic)", + "text.autoconfig.artofalchemy.option.synthesizerSettings.maxTierPlus": "Max tier (Upgraded)", + "text.autoconfig.artofalchemy.option.synthesizerSettings.speedBasic": "Speed factor (Basic)", + "text.autoconfig.artofalchemy.option.synthesizerSettings.speedPlus": "Speed factor (Upgraded)", + "text.autoconfig.artofalchemy.option.synthesizerSettings.tankBasic": "Tank size (Basic)", + "text.autoconfig.artofalchemy.option.synthesizerSettings.tankPlus": "Tank size (Upgraded)", + "text.autoconfig.artofalchemy.option.projectorSettings": "Projection Altar", + "text.autoconfig.artofalchemy.option.projectorSettings.opTime": "Operation time", + "text.autoconfig.artofalchemy.option.projectorSettings.tankSize": "Tank size" +} diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index b6406ea..da3aff1 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "artofalchemy", - "version": "1.3.4", + "version": "1.3.5-alpha", "name": "Art of Alchemy", "description": "An industrial magic mod that allows you to unleash the power of transmutation!\nIn loving memory of Amelia aka SynthRose.", "authors": [ @@ -34,7 +34,7 @@ "artofalchemy.mixins.json" ], "depends": { - "minecraft": "~1.17.1", + "minecraft": "~1.18", "libgui": ">=4.1.2", "fabricloader": ">=0.11.6", "fabric": ">=0.40.1"