Place & Crash

- Fixed some incompatibilities between kinetic blocks and schematic tools
This commit is contained in:
simibubi 2020-05-09 19:17:51 +02:00
parent 32cce4e9b9
commit 1fe647b16e
5 changed files with 19 additions and 5 deletions

View file

@ -1,6 +1,7 @@
package com.simibubi.create.modules.contraptions.components.contraptions.bearing;
import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.utility.WrappedWorld;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -43,15 +44,18 @@ public class MechanicalBearingBlock extends BearingBlock implements ITE<Mechanic
@Override
public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) {
if (worldIn instanceof WrappedWorld)
return;
withTileEntityDo(worldIn, pos, MechanicalBearingTileEntity::neighbourChanged);
}
@Override
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos,
boolean isMoving) {
if (worldIn instanceof WrappedWorld)
return;
if (worldIn.isRemote)
return;
withTileEntityDo(worldIn, pos, MechanicalBearingTileEntity::neighbourChanged);
}

View file

@ -62,6 +62,9 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
}
public void neighbourChanged() {
if (!hasWorld())
return;
boolean shouldWindmill = world.isBlockPowered(pos);
if (shouldWindmill == isWindmill)
return;

View file

@ -1,6 +1,7 @@
package com.simibubi.create.modules.contraptions.components.fan;
import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.utility.WrappedWorld;
import com.simibubi.create.modules.contraptions.base.DirectionalKineticBlock;
import net.minecraft.block.Block;
@ -50,6 +51,8 @@ public class EncasedFanBlock extends DirectionalKineticBlock implements ITE<Enca
}
protected void blockUpdate(BlockState state, World worldIn, BlockPos pos) {
if (worldIn instanceof WrappedWorld)
return;
notifyFanTile(worldIn, pos);
if (worldIn.isRemote)
return;

View file

@ -4,6 +4,7 @@ import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.utility.AllShapes;
import com.simibubi.create.foundation.utility.WrappedWorld;
import net.minecraft.block.AbstractFurnaceBlock;
import net.minecraft.block.Block;
@ -53,6 +54,8 @@ public class FurnaceEngineBlock extends EngineBlock implements ITE<FurnaceEngine
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos,
boolean isMoving) {
super.neighborChanged(state, worldIn, pos, blockIn, fromPos, isMoving);
if (worldIn instanceof WrappedWorld)
return;
if (worldIn.isRemote)
return;

View file

@ -170,7 +170,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
public void read(CompoundNBT compound) {
inventory.deserializeNBT(compound.getCompound("Inventory"));
if (compound.contains("Running"))
if (compound.contains("CurrentPos"))
currentPos = NBTUtil.readBlockPos(compound.getCompound("CurrentPos"));
readClientUpdate(compound);
@ -249,7 +249,8 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
if (state == State.RUNNING) {
compound.putBoolean("Running", true);
compound.put("CurrentPos", NBTUtil.writeBlockPos(currentPos));
if (currentPos != null)
compound.put("CurrentPos", NBTUtil.writeBlockPos(currentPos));
}
writeToClient(compound);