i should probably pull and merge the old updates before merging twice.... oops
This commit is contained in:
commit
dfdba40c45
4 changed files with 122 additions and 110 deletions
|
@ -207,8 +207,8 @@
|
|||
},
|
||||
{
|
||||
"when": {
|
||||
"sticky_east": "true",
|
||||
"axis": "x"
|
||||
"axis": "x",
|
||||
"sticky_east": "true"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/radial_chassis_side_x_sticky",
|
||||
|
@ -217,8 +217,8 @@
|
|||
},
|
||||
{
|
||||
"when": {
|
||||
"sticky_east": "true",
|
||||
"axis": "y"
|
||||
"axis": "y",
|
||||
"sticky_east": "true"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/radial_chassis_side_y_sticky",
|
||||
|
@ -227,8 +227,8 @@
|
|||
},
|
||||
{
|
||||
"when": {
|
||||
"sticky_east": "true",
|
||||
"axis": "z"
|
||||
"axis": "z",
|
||||
"sticky_east": "true"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/radial_chassis_side_z_sticky"
|
||||
|
@ -236,8 +236,8 @@
|
|||
},
|
||||
{
|
||||
"when": {
|
||||
"sticky_east": "false",
|
||||
"axis": "x"
|
||||
"axis": "x",
|
||||
"sticky_east": "false"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/radial_chassis_side_x",
|
||||
|
@ -246,8 +246,8 @@
|
|||
},
|
||||
{
|
||||
"when": {
|
||||
"sticky_east": "false",
|
||||
"axis": "y"
|
||||
"axis": "y",
|
||||
"sticky_east": "false"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/radial_chassis_side_y",
|
||||
|
@ -256,8 +256,8 @@
|
|||
},
|
||||
{
|
||||
"when": {
|
||||
"sticky_east": "false",
|
||||
"axis": "z"
|
||||
"axis": "z",
|
||||
"sticky_east": "false"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/radial_chassis_side_z"
|
||||
|
|
|
@ -36,119 +36,129 @@ import net.minecraft.world.IWorld;
|
|||
import net.minecraft.world.World;
|
||||
|
||||
public class PistonExtensionPoleBlock extends ProperDirectionalBlock implements IWrenchable, IWaterLoggable {
|
||||
public PistonExtensionPoleBlock(Properties properties) {
|
||||
super(properties);
|
||||
setDefaultState(getDefaultState().with(FACING, Direction.UP).with(BlockStateProperties.WATERLOGGED, false));
|
||||
}
|
||||
public PistonExtensionPoleBlock(Properties properties) {
|
||||
super(properties);
|
||||
setDefaultState(getDefaultState().with(FACING, Direction.UP)
|
||||
.with(BlockStateProperties.WATERLOGGED, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PushReaction getPushReaction(BlockState state) {
|
||||
return PushReaction.NORMAL;
|
||||
}
|
||||
@Override
|
||||
public PushReaction getPushReaction(BlockState state) {
|
||||
return PushReaction.NORMAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World worldIn, BlockPos pos, BlockState state, PlayerEntity player) {
|
||||
Axis axis = state.get(FACING)
|
||||
.getAxis();
|
||||
Direction direction = Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis);
|
||||
BlockPos pistonHead = null;
|
||||
BlockPos pistonBase = null;
|
||||
@Override
|
||||
public void onBlockHarvested(World worldIn, BlockPos pos, BlockState state, PlayerEntity player) {
|
||||
Axis axis = state.get(FACING)
|
||||
.getAxis();
|
||||
Direction direction = Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis);
|
||||
BlockPos pistonHead = null;
|
||||
BlockPos pistonBase = null;
|
||||
|
||||
for (int modifier : new int[]{1, -1}) {
|
||||
for (int offset = modifier; modifier * offset < MechanicalPistonBlock.maxAllowedPistonPoles(); offset +=
|
||||
modifier) {
|
||||
BlockPos currentPos = pos.offset(direction, offset);
|
||||
BlockState block = worldIn.getBlockState(currentPos);
|
||||
for (int modifier : new int[] { 1, -1 }) {
|
||||
for (int offset = modifier; modifier * offset < MechanicalPistonBlock.maxAllowedPistonPoles(); offset +=
|
||||
modifier) {
|
||||
BlockPos currentPos = pos.offset(direction, offset);
|
||||
BlockState block = worldIn.getBlockState(currentPos);
|
||||
|
||||
if (isExtensionPole(block) && axis == block.get(FACING)
|
||||
.getAxis())
|
||||
continue;
|
||||
if (isExtensionPole(block) && axis == block.get(FACING)
|
||||
.getAxis())
|
||||
continue;
|
||||
|
||||
if (isPiston(block) && block.get(BlockStateProperties.FACING)
|
||||
.getAxis() == axis)
|
||||
pistonBase = currentPos;
|
||||
if (isPiston(block) && block.get(BlockStateProperties.FACING)
|
||||
.getAxis() == axis)
|
||||
pistonBase = currentPos;
|
||||
|
||||
if (isPistonHead(block) && block.get(BlockStateProperties.FACING)
|
||||
.getAxis() == axis)
|
||||
pistonHead = currentPos;
|
||||
if (isPistonHead(block) && block.get(BlockStateProperties.FACING)
|
||||
.getAxis() == axis)
|
||||
pistonHead = currentPos;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (pistonHead != null && pistonBase != null && worldIn.getBlockState(pistonHead)
|
||||
.get(BlockStateProperties.FACING) == worldIn.getBlockState(pistonBase)
|
||||
.get(BlockStateProperties.FACING)) {
|
||||
if (pistonHead != null && pistonBase != null && worldIn.getBlockState(pistonHead)
|
||||
.get(BlockStateProperties.FACING) == worldIn.getBlockState(pistonBase)
|
||||
.get(BlockStateProperties.FACING)) {
|
||||
|
||||
final BlockPos basePos = pistonBase;
|
||||
BlockPos.getAllInBox(pistonBase, pistonHead)
|
||||
.filter(p -> !p.equals(pos) && !p.equals(basePos))
|
||||
.forEach(p -> worldIn.destroyBlock(p, !player.isCreative()));
|
||||
worldIn.setBlockState(basePos, worldIn.getBlockState(basePos)
|
||||
.with(MechanicalPistonBlock.STATE, PistonState.RETRACTED));
|
||||
}
|
||||
final BlockPos basePos = pistonBase;
|
||||
BlockPos.getAllInBox(pistonBase, pistonHead)
|
||||
.filter(p -> !p.equals(pos) && !p.equals(basePos))
|
||||
.forEach(p -> worldIn.destroyBlock(p, !player.isCreative()));
|
||||
worldIn.setBlockState(basePos, worldIn.getBlockState(basePos)
|
||||
.with(MechanicalPistonBlock.STATE, PistonState.RETRACTED));
|
||||
}
|
||||
|
||||
super.onBlockHarvested(worldIn, pos, state, player);
|
||||
}
|
||||
super.onBlockHarvested(worldIn, pos, state, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
||||
return AllShapes.FOUR_VOXEL_POLE.get(state.get(FACING)
|
||||
.getAxis());
|
||||
}
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
||||
return AllShapes.FOUR_VOXEL_POLE.get(state.get(FACING)
|
||||
.getAxis());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||
FluidState ifluidstate = context.getWorld().getFluidState(context.getPos());
|
||||
return getDefaultState().with(FACING, context.getFace().getOpposite())
|
||||
.with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER));
|
||||
}
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||
FluidState FluidState = context.getWorld()
|
||||
.getFluidState(context.getPos());
|
||||
return getDefaultState().with(FACING, context.getFace()
|
||||
.getOpposite())
|
||||
.with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(FluidState.getFluid() == Fluids.WATER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult ray) {
|
||||
ItemStack heldItem = player.getHeldItem(hand);
|
||||
@Override
|
||||
public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand,
|
||||
BlockRayTraceResult ray) {
|
||||
ItemStack heldItem = player.getHeldItem(hand);
|
||||
|
||||
if (AllBlocks.PISTON_EXTENSION_POLE.isIn(heldItem) && !player.isSneaking()) {
|
||||
Pair<Direction, Integer> offset = PistonPolePlacementHelper.getPlacementOffset(world, state.get(FACING).getAxis(), pos, ray.getHitVec());
|
||||
if (AllBlocks.PISTON_EXTENSION_POLE.isIn(heldItem) && !player.isSneaking()) {
|
||||
Pair<Direction, Integer> offset = PistonPolePlacementHelper.getPlacementOffset(world, state.get(FACING)
|
||||
.getAxis(), pos, ray.getHitVec());
|
||||
|
||||
if (offset == null || offset.getSecond() == 0)
|
||||
return ActionResultType.PASS;
|
||||
if (offset == null || offset.getSecond() == 0)
|
||||
return ActionResultType.PASS;
|
||||
|
||||
BlockPos newPos = pos.offset(offset.getFirst(), offset.getSecond());
|
||||
BlockPos newPos = pos.offset(offset.getFirst(), offset.getSecond());
|
||||
|
||||
if (!world.getBlockState(newPos).getMaterial().isReplaceable())
|
||||
return ActionResultType.PASS;
|
||||
if (!world.getBlockState(newPos)
|
||||
.getMaterial()
|
||||
.isReplaceable())
|
||||
return ActionResultType.PASS;
|
||||
|
||||
if (world.isRemote)
|
||||
return ActionResultType.SUCCESS;
|
||||
if (world.isRemote)
|
||||
return ActionResultType.SUCCESS;
|
||||
|
||||
world.setBlockState(newPos, AllBlocks.PISTON_EXTENSION_POLE.getDefaultState().with(FACING, state.get(FACING)));
|
||||
if (!player.isCreative())
|
||||
heldItem.shrink(1);
|
||||
world.setBlockState(newPos, AllBlocks.PISTON_EXTENSION_POLE.getDefaultState()
|
||||
.with(FACING, state.get(FACING)));
|
||||
if (!player.isCreative())
|
||||
heldItem.shrink(1);
|
||||
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidState getFluidState(BlockState state) {
|
||||
return state.get(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getStillFluidState(false) : Fluids.EMPTY.getDefaultState();
|
||||
}
|
||||
@Override
|
||||
public FluidState getFluidState(BlockState state) {
|
||||
return state.get(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getStillFluidState(false)
|
||||
: Fluids.EMPTY.getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(Builder<Block, BlockState> builder) {
|
||||
builder.add(BlockStateProperties.WATERLOGGED);
|
||||
super.fillStateContainer(builder);
|
||||
}
|
||||
@Override
|
||||
protected void fillStateContainer(Builder<Block, BlockState> builder) {
|
||||
builder.add(BlockStateProperties.WATERLOGGED);
|
||||
super.fillStateContainer(builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState updatePostPlacement(BlockState state, Direction direction, BlockState neighbourState,
|
||||
IWorld world, BlockPos pos, BlockPos neighbourPos) {
|
||||
if (state.get(BlockStateProperties.WATERLOGGED)) {
|
||||
world.getPendingFluidTicks().scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world));
|
||||
}
|
||||
return state;
|
||||
}
|
||||
@Override
|
||||
public BlockState updatePostPlacement(BlockState state, Direction direction, BlockState neighbourState,
|
||||
IWorld world, BlockPos pos, BlockPos neighbourPos) {
|
||||
if (state.get(BlockStateProperties.WATERLOGGED)) {
|
||||
world.getPendingFluidTicks()
|
||||
.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world));
|
||||
}
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,11 @@ import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
|
|||
import net.minecraft.entity.item.minecart.FurnaceMinecartEntity;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.state.*;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.state.EnumProperty;
|
||||
import net.minecraft.state.IntegerProperty;
|
||||
import net.minecraft.state.Property;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.state.properties.RailShape;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.simibubi.create.foundation.config.AllConfigs;
|
|||
import com.simibubi.create.foundation.gui.GuiGameElement;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
|
@ -32,11 +33,6 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
|||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation.spacing;
|
||||
|
||||
@EventBusSubscriber(value = Dist.CLIENT)
|
||||
public class GoggleOverlayRenderer {
|
||||
|
||||
|
@ -105,7 +101,9 @@ public class GoggleOverlayRenderer {
|
|||
if (!tooltip.isEmpty())
|
||||
tooltip.add(StringTextComponent.EMPTY);
|
||||
|
||||
tooltip.add(IHaveGoggleInformation.componentSpacing.copy().append(Lang.translate("gui.goggles.pole_length")).append(" " + poles));
|
||||
tooltip.add(IHaveGoggleInformation.componentSpacing.copy()
|
||||
.append(Lang.translate("gui.goggles.pole_length"))
|
||||
.append(new StringTextComponent(" " + poles)));
|
||||
}
|
||||
|
||||
if (tooltip.isEmpty())
|
||||
|
|
Loading…
Reference in a new issue