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();
|
||||||
@ -311,4 +316,4 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity
|
|||||||
public BlockPos getBlockPosition() {
|
public BlockPos getBlockPosition() {
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
@ -71,7 +73,7 @@ public class PistonExtensionPoleBlock extends ProperDirectionalBlock implements
|
|||||||
public boolean isToolEffective(BlockState state, ToolType tool) {
|
public boolean isToolEffective(BlockState state, ToolType tool) {
|
||||||
return tool == ToolType.AXE || tool == ToolType.PICKAXE;
|
return tool == ToolType.AXE || tool == ToolType.PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PushReaction getPushReaction(BlockState state) {
|
public PushReaction getPushReaction(BlockState state) {
|
||||||
return PushReaction.NORMAL;
|
return PushReaction.NORMAL;
|
||||||
@ -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);
|
||||||
@ -168,7 +177,7 @@ public class PistonExtensionPoleBlock extends ProperDirectionalBlock implements
|
|||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean allowsMovement(BlockState state, IBlockReader reader, BlockPos pos, PathType type) {
|
public boolean allowsMovement(BlockState state, IBlockReader reader, BlockPos pos, PathType type) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -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
|
||||||
@ -98,7 +98,7 @@ public class PulleyBlock extends HorizontalAxisKineticBlock implements ITE<Pulle
|
|||||||
super(properties);
|
super(properties);
|
||||||
setDefaultState(super.getDefaultState().with(BlockStateProperties.WATERLOGGED, false));
|
setDefaultState(super.getDefaultState().with(BlockStateProperties.WATERLOGGED, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean allowsMovement(BlockState state, IBlockReader reader, BlockPos pos, PathType type) {
|
public boolean allowsMovement(BlockState state, IBlockReader reader, BlockPos pos, PathType type) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user