mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-14 22:44:07 +01:00
Fix breaking piston pole making piston base unusable
This commit is contained in:
parent
5ec8312322
commit
b0a84a9bc1
@ -288,6 +288,11 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onLengthBroken() {
|
||||||
|
offset = 0;
|
||||||
|
sendData();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
return !isRemoved();
|
return !isRemoved();
|
||||||
|
@ -9,6 +9,7 @@ import java.util.function.Predicate;
|
|||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.AllShapes;
|
import com.simibubi.create.AllShapes;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.PistonState;
|
import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.PistonState;
|
||||||
|
import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
|
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
|
||||||
import com.simibubi.create.foundation.block.ProperDirectionalBlock;
|
import com.simibubi.create.foundation.block.ProperDirectionalBlock;
|
||||||
import com.simibubi.create.foundation.utility.placement.IPlacementHelper;
|
import com.simibubi.create.foundation.utility.placement.IPlacementHelper;
|
||||||
@ -29,6 +30,7 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.pathfinding.PathType;
|
import net.minecraft.pathfinding.PathType;
|
||||||
import net.minecraft.state.StateContainer.Builder;
|
import net.minecraft.state.StateContainer.Builder;
|
||||||
import net.minecraft.state.properties.BlockStateProperties;
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.ActionResultType;
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
@ -117,6 +119,13 @@ public class PistonExtensionPoleBlock extends ProperDirectionalBlock implements
|
|||||||
.forEach(p -> worldIn.destroyBlock(p, !player.isCreative()));
|
.forEach(p -> worldIn.destroyBlock(p, !player.isCreative()));
|
||||||
worldIn.setBlockState(basePos, worldIn.getBlockState(basePos)
|
worldIn.setBlockState(basePos, worldIn.getBlockState(basePos)
|
||||||
.with(MechanicalPistonBlock.STATE, PistonState.RETRACTED));
|
.with(MechanicalPistonBlock.STATE, PistonState.RETRACTED));
|
||||||
|
|
||||||
|
TileEntity te = worldIn.getTileEntity(basePos);
|
||||||
|
if (te instanceof MechanicalPistonTileEntity) {
|
||||||
|
MechanicalPistonTileEntity baseTE = (MechanicalPistonTileEntity) te;
|
||||||
|
baseTE.offset = 0;
|
||||||
|
baseTE.onLengthBroken();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onBlockHarvested(worldIn, pos, state, player);
|
super.onBlockHarvested(worldIn, pos, state, player);
|
||||||
|
@ -43,11 +43,11 @@ public class PulleyBlock extends HorizontalAxisKineticBlock implements ITE<Pulle
|
|||||||
|
|
||||||
private static void onRopeBroken(World world, BlockPos pulleyPos) {
|
private static void onRopeBroken(World world, BlockPos pulleyPos) {
|
||||||
TileEntity te = world.getTileEntity(pulleyPos);
|
TileEntity te = world.getTileEntity(pulleyPos);
|
||||||
if (!(te instanceof PulleyTileEntity))
|
if (te instanceof PulleyTileEntity) {
|
||||||
return;
|
PulleyTileEntity pulley = (PulleyTileEntity) te;
|
||||||
PulleyTileEntity pulley = (PulleyTileEntity) te;
|
pulley.initialOffset = 0;
|
||||||
pulley.offset = 0;
|
pulley.onLengthBroken();
|
||||||
pulley.sendData();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user