63 lines
2.5 KiB
Java
63 lines
2.5 KiB
Java
package com.dairymoose.modernlife.tileentities;
|
|
|
|
import com.dairymoose.modernlife.core.CustomBlocks;
|
|
import com.mojang.datafixers.types.Type;
|
|
import net.minecraft.core.BlockPos;
|
|
import net.minecraft.nbt.CompoundTag;
|
|
import net.minecraft.network.Connection;
|
|
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
|
import net.minecraft.world.level.block.Block;
|
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
|
import net.minecraft.world.level.block.entity.BlockEntityType;
|
|
import net.minecraft.world.level.block.state.BlockState;
|
|
|
|
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/tileentities/MirrorBlockEntity.class */
|
|
public class MirrorBlockEntity extends BlockEntity {
|
|
public static final BlockEntityType<MirrorBlockEntity> MIRROR = BlockEntityType.Builder.of(MirrorBlockEntity::new, new Block[]{(Block) CustomBlocks.BLOCK_MIRROR.get(), (Block) CustomBlocks.BLOCK_TALL_MIRROR.get(), (Block) CustomBlocks.BLOCK_LARGE_MIRROR.get(), (Block) CustomBlocks.BLOCK_MASSIVE_MIRROR.get(), (Block) CustomBlocks.BLOCK_CCTV_SCREEN.get()}).build((Type) null);
|
|
public int cctvScreenCurrentCamera;
|
|
public int cctvScreenCurrentCameraDisplayValue;
|
|
|
|
/* renamed from: getUpdatePacket */
|
|
public ClientboundBlockEntityDataPacket m231getUpdatePacket() {
|
|
return ClientboundBlockEntityDataPacket.create(this);
|
|
}
|
|
|
|
public void onDataPacket(Connection conn, ClientboundBlockEntityDataPacket pkt) {
|
|
CompoundTag nbt = pkt.getTag();
|
|
if (nbt != null) {
|
|
this.cctvScreenCurrentCamera = nbt.getInt("Camera");
|
|
}
|
|
super.onDataPacket(conn, pkt);
|
|
}
|
|
|
|
public CompoundTag getUpdateTag() {
|
|
CompoundTag nbt = super.getUpdateTag();
|
|
if (getBlockState().getBlock() == CustomBlocks.BLOCK_CCTV_SCREEN.get()) {
|
|
nbt.putInt("Camera", this.cctvScreenCurrentCamera);
|
|
}
|
|
return nbt;
|
|
}
|
|
|
|
public void handleUpdateTag(CompoundTag nbt) {
|
|
this.cctvScreenCurrentCamera = nbt.getInt("Camera");
|
|
super.handleUpdateTag(nbt);
|
|
}
|
|
|
|
public void load(CompoundTag nbt) {
|
|
super.load(nbt);
|
|
this.cctvScreenCurrentCamera = nbt.getInt("Camera");
|
|
}
|
|
|
|
protected void saveAdditional(CompoundTag nbt) {
|
|
if (getBlockState().getBlock() == CustomBlocks.BLOCK_CCTV_SCREEN.get()) {
|
|
nbt.putInt("Camera", this.cctvScreenCurrentCamera);
|
|
}
|
|
}
|
|
|
|
public MirrorBlockEntity(BlockPos pos, BlockState state) {
|
|
super(MIRROR, pos, state);
|
|
this.cctvScreenCurrentCamera = 0;
|
|
this.cctvScreenCurrentCameraDisplayValue = 0;
|
|
}
|
|
}
|