mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-24 14:06:42 +01:00
Place & Crash
- Fixed some incompatibilities between kinetic blocks and schematic tools
This commit is contained in:
parent
32cce4e9b9
commit
1fe647b16e
5 changed files with 19 additions and 5 deletions
|
@ -1,6 +1,7 @@
|
||||||
package com.simibubi.create.modules.contraptions.components.contraptions.bearing;
|
package com.simibubi.create.modules.contraptions.components.contraptions.bearing;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.block.ITE;
|
import com.simibubi.create.foundation.block.ITE;
|
||||||
|
import com.simibubi.create.foundation.utility.WrappedWorld;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
@ -18,7 +19,7 @@ public class MechanicalBearingBlock extends BearingBlock implements ITE<Mechanic
|
||||||
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||||
return new MechanicalBearingTileEntity();
|
return new MechanicalBearingTileEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn,
|
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn,
|
||||||
BlockRayTraceResult hit) {
|
BlockRayTraceResult hit) {
|
||||||
|
@ -40,18 +41,21 @@ public class MechanicalBearingBlock extends BearingBlock implements ITE<Mechanic
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) {
|
public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) {
|
||||||
|
if (worldIn instanceof WrappedWorld)
|
||||||
|
return;
|
||||||
withTileEntityDo(worldIn, pos, MechanicalBearingTileEntity::neighbourChanged);
|
withTileEntityDo(worldIn, pos, MechanicalBearingTileEntity::neighbourChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos,
|
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos,
|
||||||
boolean isMoving) {
|
boolean isMoving) {
|
||||||
|
if (worldIn instanceof WrappedWorld)
|
||||||
|
return;
|
||||||
if (worldIn.isRemote)
|
if (worldIn.isRemote)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
withTileEntityDo(worldIn, pos, MechanicalBearingTileEntity::neighbourChanged);
|
withTileEntityDo(worldIn, pos, MechanicalBearingTileEntity::neighbourChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,9 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
|
||||||
}
|
}
|
||||||
|
|
||||||
public void neighbourChanged() {
|
public void neighbourChanged() {
|
||||||
|
if (!hasWorld())
|
||||||
|
return;
|
||||||
|
|
||||||
boolean shouldWindmill = world.isBlockPowered(pos);
|
boolean shouldWindmill = world.isBlockPowered(pos);
|
||||||
if (shouldWindmill == isWindmill)
|
if (shouldWindmill == isWindmill)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.simibubi.create.modules.contraptions.components.fan;
|
package com.simibubi.create.modules.contraptions.components.fan;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.block.ITE;
|
import com.simibubi.create.foundation.block.ITE;
|
||||||
|
import com.simibubi.create.foundation.utility.WrappedWorld;
|
||||||
import com.simibubi.create.modules.contraptions.base.DirectionalKineticBlock;
|
import com.simibubi.create.modules.contraptions.base.DirectionalKineticBlock;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
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) {
|
protected void blockUpdate(BlockState state, World worldIn, BlockPos pos) {
|
||||||
|
if (worldIn instanceof WrappedWorld)
|
||||||
|
return;
|
||||||
notifyFanTile(worldIn, pos);
|
notifyFanTile(worldIn, pos);
|
||||||
if (worldIn.isRemote)
|
if (worldIn.isRemote)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.foundation.block.ITE;
|
import com.simibubi.create.foundation.block.ITE;
|
||||||
import com.simibubi.create.foundation.utility.AllShapes;
|
import com.simibubi.create.foundation.utility.AllShapes;
|
||||||
|
import com.simibubi.create.foundation.utility.WrappedWorld;
|
||||||
|
|
||||||
import net.minecraft.block.AbstractFurnaceBlock;
|
import net.minecraft.block.AbstractFurnaceBlock;
|
||||||
import net.minecraft.block.Block;
|
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,
|
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos,
|
||||||
boolean isMoving) {
|
boolean isMoving) {
|
||||||
super.neighborChanged(state, worldIn, pos, blockIn, fromPos, isMoving);
|
super.neighborChanged(state, worldIn, pos, blockIn, fromPos, isMoving);
|
||||||
|
if (worldIn instanceof WrappedWorld)
|
||||||
|
return;
|
||||||
if (worldIn.isRemote)
|
if (worldIn.isRemote)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
public void read(CompoundNBT compound) {
|
public void read(CompoundNBT compound) {
|
||||||
inventory.deserializeNBT(compound.getCompound("Inventory"));
|
inventory.deserializeNBT(compound.getCompound("Inventory"));
|
||||||
|
|
||||||
if (compound.contains("Running"))
|
if (compound.contains("CurrentPos"))
|
||||||
currentPos = NBTUtil.readBlockPos(compound.getCompound("CurrentPos"));
|
currentPos = NBTUtil.readBlockPos(compound.getCompound("CurrentPos"));
|
||||||
|
|
||||||
readClientUpdate(compound);
|
readClientUpdate(compound);
|
||||||
|
@ -249,7 +249,8 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
|
|
||||||
if (state == State.RUNNING) {
|
if (state == State.RUNNING) {
|
||||||
compound.putBoolean("Running", true);
|
compound.putBoolean("Running", true);
|
||||||
compound.put("CurrentPos", NBTUtil.writeBlockPos(currentPos));
|
if (currentPos != null)
|
||||||
|
compound.put("CurrentPos", NBTUtil.writeBlockPos(currentPos));
|
||||||
}
|
}
|
||||||
|
|
||||||
writeToClient(compound);
|
writeToClient(compound);
|
||||||
|
|
Loading…
Reference in a new issue