Skip to content

Commit

Permalink
Merge branch 'trunk/1.19.2' of github.com:Lothrazar/Cyclic into trunk…
Browse files Browse the repository at this point in the history
…/1.19.4
  • Loading branch information
Lothrazar committed Nov 6, 2024
2 parents ff6b311 + e8a8bb1 commit 4b0a84d
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 62 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ minecraft {

// probably for patchouli
property 'mixin.env.disableRefMap', 'true'

args '--username=ADev'
mods {
cyclic {
source sourceSets.main
Expand Down
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -1,26 +1,38 @@
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 {

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
Expand All @@ -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) {}

Expand All @@ -42,12 +49,6 @@ public int getField(int field) {
return 0;
}

public List<BlockPos> getShape() {
List<BlockPos> lis = new ArrayList<BlockPos>();
lis.add(worldPosition);
return lis;
}

private CompoundTag facadeState = null;

@Override
Expand All @@ -56,7 +57,7 @@ public CompoundTag getFacade() {
}

@Override
public void setFacade(CompoundTag facadeState) {
this.facadeState = facadeState;
public void setFacade(CompoundTag facadeStateIn) {
this.facadeState = facadeStateIn;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.world.level.block.state.BlockState;

public class SoundmuffRender implements BlockEntityRenderer<SoundmuffTileFacade> {
public class SoundmuffRenderFacade implements BlockEntityRenderer<SoundmuffTileFacade> {

private BlockRenderDispatcher brd;
private ModelBlockRenderer renderer;

public SoundmuffRender(BlockEntityRendererProvider.Context d) {
public SoundmuffRenderFacade(BlockEntityRendererProvider.Context d) {
this.brd = d.getBlockRenderDispatcher();
this.renderer = brd.getModelRenderer();
}
Expand All @@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
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 {

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);
Expand All @@ -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) {}

Expand All @@ -42,12 +49,6 @@ public int getField(int field) {
return 0;
}

public List<BlockPos> getShape() {
List<BlockPos> lis = new ArrayList<BlockPos>();
lis.add(worldPosition);
return lis;
}

private CompoundTag facadeState = null;

@Override
Expand All @@ -56,7 +57,7 @@ public CompoundTag getFacade() {
}

@Override
public void setFacade(CompoundTag facadeState) {
this.facadeState = facadeState;
public void setFacade(CompoundTag facadeStateIn) {
this.facadeState = facadeStateIn;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ public static void handle(BlockFacadeMessage message, Supplier<NetworkEvent.Cont
if (bs.getBlock() instanceof IBlockFacade facadeBlock) {
ITileFacade tile = facadeBlock.getTileFacade(serverWorld, message.pos);
if (message.erase) {
tile.setFacade(null);
tile.setFacade(new CompoundTag());
}
else {
tile.setFacade(message.blockStateTag);
}
serverWorld.markAndNotifyBlock(message.pos, serverWorld.getChunkAt(message.pos),
bs, bs, 3, 1);
serverWorld.sendBlockUpdated(message.pos, bs, bs, 3);
serverWorld.blockUpdated(message.pos, bs.getBlock());
}
});
ctx.get().setPacketHandled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import com.lothrazar.cyclic.block.endershelf.EnderShelfRenderer;
import com.lothrazar.cyclic.block.facade.RenderCableFacade;
import com.lothrazar.cyclic.block.facade.light.RenderLightFacade;
import com.lothrazar.cyclic.block.facade.soundmuff.SoundmuffRender;
import com.lothrazar.cyclic.block.facade.soundmuff.SoundmuffRenderFacade;
import com.lothrazar.cyclic.block.fan.RenderFan;
import com.lothrazar.cyclic.block.fishing.RenderFisher;
import com.lothrazar.cyclic.block.forester.RenderForester;
Expand Down Expand Up @@ -154,7 +154,7 @@ public static void onRegisterRenderers(EntityRenderersEvent.RegisterRenderers ev
event.registerBlockEntityRenderer(TileRegistry.SCREEN.get(), RenderScreentext::new);
event.registerBlockEntityRenderer(TileRegistry.COMPUTER_SHAPE.get(), RenderShapedata::new);
event.registerBlockEntityRenderer(TileRegistry.SOLIDIFIER.get(), RenderSolidifier::new);
event.registerBlockEntityRenderer(TileRegistry.SOUNDPROOFING_GHOST.get(), SoundmuffRender::new);
event.registerBlockEntityRenderer(TileRegistry.SOUNDPROOFING_GHOST.get(), SoundmuffRenderFacade::new);
event.registerBlockEntityRenderer(TileRegistry.SPRINKLER.get(), RenderSprinkler::new);
event.registerBlockEntityRenderer(TileRegistry.TANK.get(), RenderTank::new);
event.registerBlockEntityRenderer(TileRegistry.WIRELESS_TRANSMITTER.get(), RenderTransmit::new);
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/lothrazar/cyclic/util/FacadeUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ public class FacadeUtil {

public static void renderBlockState(Level level, BlockPos pos, BlockRenderDispatcher brd, ModelBlockRenderer renderer,
MultiBufferSource ibuffer, PoseStack matrixStack, BlockState facadeState, int packedLight, int packedOverlay) {
if (facadeState == null) {
return;
}
BakedModel model = brd.getBlockModel(facadeState);
VertexConsumer vertexConsumer = VertexMultiConsumer.create(ibuffer.getBuffer(RenderType.solid()));
renderer.tesselateBlock(level, model, facadeState, pos,
Expand Down

0 comments on commit 4b0a84d

Please sign in to comment.