diff --git a/build.gradle b/build.gradle index 2175e5f40..7889232c4 100644 --- a/build.gradle +++ b/build.gradle @@ -31,7 +31,7 @@ minecraft { // probably for patchouli property 'mixin.env.disableRefMap', 'true' - + args '--username=ADev' mods { cyclic { source sourceSets.main diff --git a/gradle.properties b/gradle.properties index 81e68d81b..20fe1aa04 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,7 +15,6 @@ mc_version=1.19.4 forge_version=45.1.0 - # optional dependencies jei_version=13.1.0.11 curios_version=5.1.5.3 diff --git a/src/main/java/com/lothrazar/cyclic/block/TileBlockEntityCyclic.java b/src/main/java/com/lothrazar/cyclic/block/TileBlockEntityCyclic.java index 0c1d26da0..f3611c52b 100644 --- a/src/main/java/com/lothrazar/cyclic/block/TileBlockEntityCyclic.java +++ b/src/main/java/com/lothrazar/cyclic/block/TileBlockEntityCyclic.java @@ -403,12 +403,6 @@ private static boolean moveItemsInternal(int max, IItemHandler handlerHere, int } return sizeAfter > 0; } - // - // - // - // - // - // protected boolean moveEnergy(Direction myFacingDir, int quantity) { return moveEnergy(myFacingDir, this.worldPosition.relative(myFacingDir), quantity); diff --git a/src/main/java/com/lothrazar/cyclic/block/facade/ITileFacade.java b/src/main/java/com/lothrazar/cyclic/block/facade/ITileFacade.java index d984224c5..d58665a99 100644 --- a/src/main/java/com/lothrazar/cyclic/block/facade/ITileFacade.java +++ b/src/main/java/com/lothrazar/cyclic/block/facade/ITileFacade.java @@ -27,15 +27,12 @@ default void loadFacade(CompoundTag compound) { if (compound.contains(NBT_FACADE)) { this.setFacade(compound.getCompound(NBT_FACADE)); } - else { - this.setFacade(null); - } } default void saveFacade(CompoundTag compound) { CompoundTag facadeState = getFacade(); if (facadeState == null) { - compound.remove(NBT_FACADE); + compound.put(NBT_FACADE, new CompoundTag()); } else { compound.put(NBT_FACADE, facadeState); diff --git a/src/main/java/com/lothrazar/cyclic/block/facade/RenderCableFacade.java b/src/main/java/com/lothrazar/cyclic/block/facade/RenderCableFacade.java index d946e5b87..cc2709aed 100644 --- a/src/main/java/com/lothrazar/cyclic/block/facade/RenderCableFacade.java +++ b/src/main/java/com/lothrazar/cyclic/block/facade/RenderCableFacade.java @@ -28,8 +28,7 @@ public boolean shouldRenderOffScreen(TileCableBase te) { @Override public void render(TileCableBase te, float v, PoseStack matrixStack, MultiBufferSource ibuffer, int packedLight, int packedOverlay) { - if (te.getFacade() != null - && ConfigRegistry.CABLE_FACADES.get()) { + if (ConfigRegistry.CABLE_FACADES.get()) { BlockState facadeState = te.getFacadeState(te.getLevel()); FacadeUtil.renderBlockState(te.getLevel(), te.getBlockPos(), brd, renderer, ibuffer, matrixStack, facadeState, packedLight, packedOverlay); } diff --git a/src/main/java/com/lothrazar/cyclic/block/facade/light/RenderLightFacade.java b/src/main/java/com/lothrazar/cyclic/block/facade/light/RenderLightFacade.java index e4c91aa47..f9a2ed126 100644 --- a/src/main/java/com/lothrazar/cyclic/block/facade/light/RenderLightFacade.java +++ b/src/main/java/com/lothrazar/cyclic/block/facade/light/RenderLightFacade.java @@ -26,9 +26,7 @@ public boolean shouldRenderOffScreen(TileLightFacade te) { @Override public void render(TileLightFacade te, float v, PoseStack matrixStack, MultiBufferSource ibuffer, int packedLight, int packedOverlay) { - if (te.getFacade() != null) { - BlockState facadeState = te.getFacadeState(te.getLevel()); - FacadeUtil.renderBlockState(te.getLevel(), te.getBlockPos(), brd, renderer, ibuffer, matrixStack, facadeState, packedLight, packedOverlay); - } + BlockState facadeState = te.getFacadeState(te.getLevel()); + FacadeUtil.renderBlockState(te.getLevel(), te.getBlockPos(), brd, renderer, ibuffer, matrixStack, facadeState, packedLight, packedOverlay); } } diff --git a/src/main/java/com/lothrazar/cyclic/block/facade/light/TileLightFacade.java b/src/main/java/com/lothrazar/cyclic/block/facade/light/TileLightFacade.java index 043138850..69edc547a 100644 --- a/src/main/java/com/lothrazar/cyclic/block/facade/light/TileLightFacade.java +++ b/src/main/java/com/lothrazar/cyclic/block/facade/light/TileLightFacade.java @@ -1,15 +1,13 @@ package com.lothrazar.cyclic.block.facade.light; -import java.util.ArrayList; -import java.util.List; import com.lothrazar.cyclic.block.TileBlockEntityCyclic; import com.lothrazar.cyclic.block.facade.ITileFacade; import com.lothrazar.cyclic.registry.TileRegistry; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.network.Connection; +import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.phys.AABB; public class TileLightFacade extends TileBlockEntityCyclic implements ITileFacade { @@ -17,10 +15,24 @@ public TileLightFacade(BlockPos pos, BlockState state) { super(TileRegistry.LIGHT_CAMO.get(), pos, state); } + @Override + public CompoundTag getUpdateTag() { + CompoundTag syncData = super.getUpdateTag(); + return syncData; + } + + @Override + public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt) { + if (pkt.getTag().contains(NBT_FACADE)) { + this.load(pkt.getTag()); + super.onDataPacket(net, pkt); + } + } + @Override public void load(CompoundTag tag) { - super.load(tag); this.loadFacade(tag); + super.load(tag); } @Override @@ -29,11 +41,6 @@ public void saveAdditional(CompoundTag tag) { super.saveAdditional(tag); } - @Override - public AABB getRenderBoundingBox() { - return BlockEntity.INFINITE_EXTENT_AABB; - } - @Override public void setField(int field, int value) {} @@ -42,12 +49,6 @@ public int getField(int field) { return 0; } - public List getShape() { - List lis = new ArrayList(); - lis.add(worldPosition); - return lis; - } - private CompoundTag facadeState = null; @Override @@ -56,7 +57,7 @@ public CompoundTag getFacade() { } @Override - public void setFacade(CompoundTag facadeState) { - this.facadeState = facadeState; + public void setFacade(CompoundTag facadeStateIn) { + this.facadeState = facadeStateIn; } } diff --git a/src/main/java/com/lothrazar/cyclic/block/facade/soundmuff/SoundmuffRender.java b/src/main/java/com/lothrazar/cyclic/block/facade/soundmuff/SoundmuffRenderFacade.java similarity index 70% rename from src/main/java/com/lothrazar/cyclic/block/facade/soundmuff/SoundmuffRender.java rename to src/main/java/com/lothrazar/cyclic/block/facade/soundmuff/SoundmuffRenderFacade.java index bb38a82d8..4adf2999f 100644 --- a/src/main/java/com/lothrazar/cyclic/block/facade/soundmuff/SoundmuffRender.java +++ b/src/main/java/com/lothrazar/cyclic/block/facade/soundmuff/SoundmuffRenderFacade.java @@ -9,12 +9,12 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.world.level.block.state.BlockState; -public class SoundmuffRender implements BlockEntityRenderer { +public class SoundmuffRenderFacade implements BlockEntityRenderer { private BlockRenderDispatcher brd; private ModelBlockRenderer renderer; - public SoundmuffRender(BlockEntityRendererProvider.Context d) { + public SoundmuffRenderFacade(BlockEntityRendererProvider.Context d) { this.brd = d.getBlockRenderDispatcher(); this.renderer = brd.getModelRenderer(); } @@ -26,9 +26,7 @@ public boolean shouldRenderOffScreen(SoundmuffTileFacade te) { @Override public void render(SoundmuffTileFacade te, float v, PoseStack matrixStack, MultiBufferSource ibuffer, int packedLight, int packedOverlay) { - if (te.getFacade() != null) { - BlockState facadeState = te.getFacadeState(te.getLevel()); - FacadeUtil.renderBlockState(te.getLevel(), te.getBlockPos(), brd, renderer, ibuffer, matrixStack, facadeState, packedLight, packedOverlay); - } + BlockState facadeState = te.getFacadeState(te.getLevel()); + FacadeUtil.renderBlockState(te.getLevel(), te.getBlockPos(), brd, renderer, ibuffer, matrixStack, facadeState, packedLight, packedOverlay); } } diff --git a/src/main/java/com/lothrazar/cyclic/block/facade/soundmuff/SoundmuffTileFacade.java b/src/main/java/com/lothrazar/cyclic/block/facade/soundmuff/SoundmuffTileFacade.java index 1ea59b227..d9cbc7a2c 100644 --- a/src/main/java/com/lothrazar/cyclic/block/facade/soundmuff/SoundmuffTileFacade.java +++ b/src/main/java/com/lothrazar/cyclic/block/facade/soundmuff/SoundmuffTileFacade.java @@ -1,15 +1,13 @@ package com.lothrazar.cyclic.block.facade.soundmuff; -import java.util.ArrayList; -import java.util.List; import com.lothrazar.cyclic.block.TileBlockEntityCyclic; import com.lothrazar.cyclic.block.facade.ITileFacade; import com.lothrazar.cyclic.registry.TileRegistry; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.network.Connection; +import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.phys.AABB; public class SoundmuffTileFacade extends TileBlockEntityCyclic implements ITileFacade { @@ -17,6 +15,20 @@ public SoundmuffTileFacade(BlockPos pos, BlockState state) { super(TileRegistry.SOUNDPROOFING_GHOST.get(), pos, state); } + @Override + public CompoundTag getUpdateTag() { + CompoundTag syncData = super.getUpdateTag(); + return syncData; + } + + @Override + public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt) { + if (pkt.getTag().contains(NBT_FACADE)) { + this.load(pkt.getTag()); + super.onDataPacket(net, pkt); + } + } + @Override public void load(CompoundTag tag) { this.loadFacade(tag); @@ -29,11 +41,6 @@ public void saveAdditional(CompoundTag tag) { super.saveAdditional(tag); } - @Override - public AABB getRenderBoundingBox() { - return BlockEntity.INFINITE_EXTENT_AABB; - } - @Override public void setField(int field, int value) {} @@ -42,12 +49,6 @@ public int getField(int field) { return 0; } - public List getShape() { - List lis = new ArrayList(); - lis.add(worldPosition); - return lis; - } - private CompoundTag facadeState = null; @Override @@ -56,7 +57,7 @@ public CompoundTag getFacade() { } @Override - public void setFacade(CompoundTag facadeState) { - this.facadeState = facadeState; + public void setFacade(CompoundTag facadeStateIn) { + this.facadeState = facadeStateIn; } } diff --git a/src/main/java/com/lothrazar/cyclic/net/BlockFacadeMessage.java b/src/main/java/com/lothrazar/cyclic/net/BlockFacadeMessage.java index 523d9538f..29e3a90fb 100644 --- a/src/main/java/com/lothrazar/cyclic/net/BlockFacadeMessage.java +++ b/src/main/java/com/lothrazar/cyclic/net/BlockFacadeMessage.java @@ -38,13 +38,15 @@ public static void handle(BlockFacadeMessage message, Supplier