Skip to content

Commit 78a4874

Browse files
committed
Clean up several code areas around CM blocks
1 parent fc93d28 commit 78a4874

File tree

2 files changed

+4
-96
lines changed

2 files changed

+4
-96
lines changed

src/main/java/dev/compactmods/machines/block/BlockCompactMachine.java

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@ public BlockCompactMachine(EnumMachineSize size, AbstractBlock.Properties props)
5151
this.size = size;
5252
}
5353

54-
@Override
55-
public void entityInside(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) {
56-
super.entityInside(p_196262_1_, p_196262_2_, p_196262_3_, p_196262_4_);
57-
}
58-
5954
@Override
6055
public float getDestroyProgress(BlockState state, PlayerEntity player, IBlockReader worldIn, BlockPos pos) {
6156
CompactMachineTile tile = (CompactMachineTile) worldIn.getBlockEntity(pos);
@@ -238,13 +233,6 @@ public ItemStack getPickBlock(BlockState state, RayTraceResult target, IBlockRea
238233
return stack;
239234
}
240235

241-
242-
// @Override
243-
// public String getSpecialName(ItemStack stack) {
244-
// return this.getStateFromMeta(stack.getItemDamage()).getValue(SIZE).getName();
245-
// }
246-
247-
248236
@Override
249237
public boolean hasTileEntity(BlockState state) {
250238
return true;
@@ -256,27 +244,6 @@ public TileEntity createTileEntity(BlockState state, IBlockReader world) {
256244
return new CompactMachineTile();
257245
}
258246

259-
@Override
260-
public void destroy(IWorld world, BlockPos pos, BlockState state) {
261-
if (world.isClientSide()) {
262-
super.destroy(world, pos, state);
263-
return;
264-
}
265-
266-
if (!(world.getBlockEntity(pos) instanceof CompactMachineTile)) {
267-
return;
268-
}
269-
270-
CompactMachineTile te = (CompactMachineTile) world.getBlockEntity(pos);
271-
// WorldSavedDataMachines.INSTANCE.removeMachinePosition(te.coords);
272-
//
273-
// BlockMachine.spawnItemWithNBT(world, pos, state.get(BlockMachine.SIZE), te);
274-
//
275-
// ChunkLoadingMachines.unforceChunk(te.coords);
276-
277-
super.destroy(world, pos, state);
278-
}
279-
280247
@Override
281248
public void setPlacedBy(World worldIn, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) {
282249

@@ -315,7 +282,6 @@ public void setPlacedBy(World worldIn, BlockPos pos, BlockState state, @Nullable
315282
}
316283

317284
tile.doPostPlaced();
318-
tile.setChanged();
319285
}
320286

321287
@Override
@@ -350,46 +316,4 @@ public EnumMachineSize getSize() {
350316
public void addProbeData(IProbeData data, PlayerEntity player, World world, BlockState state) {
351317
CompactMachineProvider.exec(data, world);
352318
}
353-
354-
// 1.12.1 code
355-
// @Override
356-
// public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
357-
// if(player.isSneaking()) {
358-
// return false;
359-
// }
360-
//
361-
// if(world.isRemote || !(player instanceof EntityPlayerMP)) {
362-
// return true;
363-
// }
364-
//
365-
// if(!(world.getTileEntity(pos) instanceof TileEntityMachine)) {
366-
// return false;
367-
// }
368-
//
369-
// TileEntityMachine machine = (TileEntityMachine)world.getTileEntity(pos);
370-
// ItemStack playerStack = player.getHeldItemMainhand();
371-
// if(ShrinkingDeviceUtils.isShrinkingDevice(playerStack)) {
372-
// TeleportationTools.tryToEnterMachine(player, machine);
373-
// return true;
374-
// }
375-
//
376-
// player.openGui(compactmachines.instance, GuiIds.MACHINE_VIEW.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
377-
// PackageHandler.instance.sendTo(new MessageMachineContent(machine.coords), (EntityPlayerMP)player);
378-
// PackageHandler.instance.sendTo(new MessageMachineChunk(machine.coords), (EntityPlayerMP)player);
379-
//
380-
// return true;
381-
// }
382-
383-
// TOP code
384-
// @Override
385-
// public String getID() {
386-
// return CompactMachines.MODID + ":" + "machine";
387-
// }
388-
//
389-
// @Override
390-
// public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, PlayerEntity player, World world, BlockState blockState, IProbeHitData data) {
391-
// String size = this.size.getName();
392-
// probeInfo.text(new TranslationTextComponent("machines.sizes." + size));
393-
//
394-
// }
395319
}

src/main/java/dev/compactmods/machines/block/tiles/CompactMachineTile.java

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,9 @@ public class CompactMachineTile extends TileEntity implements ICapabilityProvide
4646
protected UUID owner;
4747
protected String schema;
4848
protected boolean locked = false;
49-
protected Set<String> playerWhiteList;
5049

5150
public CompactMachineTile() {
5251
super(Registration.MACHINE_TILE_ENTITY.get());
53-
54-
playerWhiteList = new HashSet<>();
5552
}
5653

5754
@Override
@@ -114,12 +111,6 @@ public void load(BlockState state, CompoundNBT nbt) {
114111
} else {
115112
locked = false;
116113
}
117-
118-
playerWhiteList = new HashSet<>();
119-
if (nbt.contains("playerWhiteList")) {
120-
ListNBT list = nbt.getList("playerWhiteList", Constants.NBT.TAG_STRING);
121-
list.forEach(nametag -> playerWhiteList.add(nametag.getAsString()));
122-
}
123114
}
124115

125116
@Override
@@ -140,16 +131,6 @@ public CompoundNBT save(CompoundNBT nbt) {
140131

141132
nbt.putBoolean("locked", locked);
142133

143-
if (playerWhiteList.size() > 0) {
144-
ListNBT list = new ListNBT();
145-
playerWhiteList.forEach(player -> {
146-
StringNBT nameTag = StringNBT.valueOf(player);
147-
list.add(nameTag);
148-
});
149-
150-
nbt.put("playerWhiteList", list);
151-
}
152-
153134
return nbt;
154135
}
155136

@@ -291,8 +272,9 @@ public boolean hasPlayersInside() {
291272
}
292273

293274
public void doPostPlaced() {
294-
if (this.level == null || this.level.isClientSide)
275+
if (this.level == null || this.level.isClientSide) {
295276
return;
277+
}
296278

297279
MinecraftServer serv = this.level.getServer();
298280
if (serv == null)
@@ -308,6 +290,8 @@ public void doPostPlaced() {
308290

309291
if(ServerConfig.MACHINE_CHUNKLOADING.get())
310292
CompactMachines.CHUNKLOAD_MANAGER.onMachineChunkLoad(machineId);
293+
294+
this.setChanged();
311295
}
312296

313297
public void handlePlayerLeft(UUID playerID) {

0 commit comments

Comments
 (0)