Top Aligned (raised) Catwalk added. Catwalk Stairs added.
This commit is contained in:
parent
1a3fcb4376
commit
e4819b4666
44 changed files with 2902 additions and 1942 deletions
|
@ -864,20 +864,71 @@ public class ModContent
|
|||
)).setRegistryName(new ResourceLocation(MODID, "steel_mesh_fence_gate"));
|
||||
|
||||
public static final EdRailingBlock STEEL_RAILING = (EdRailingBlock)(new EdRailingBlock(
|
||||
DecorBlock.CFG_CUTOUT|DecorBlock.CFG_EXPERIMENTAL,
|
||||
DecorBlock.CFG_CUTOUT,
|
||||
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 20f).sound(SoundType.METAL).notSolid(),
|
||||
Auxiliaries.getPixeledAABB(0,0,0, 0, 0,0),
|
||||
Auxiliaries.getPixeledAABB(0,0,0, 16,15.9,1)
|
||||
)).setRegistryName(new ResourceLocation(MODID, "steel_railing"));
|
||||
|
||||
public static final EdCatwalkBlock STEEL_CATWALK = (EdCatwalkBlock)(new EdCatwalkBlock(
|
||||
DecorBlock.CFG_CUTOUT|DecorBlock.CFG_EXPERIMENTAL,
|
||||
DecorBlock.CFG_CUTOUT,
|
||||
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 20f).sound(SoundType.METAL).notSolid(),
|
||||
Auxiliaries.getPixeledAABB(0,0,0, 16, 2,16),
|
||||
Auxiliaries.getPixeledAABB(0,0,0, 16,15.9, 1),
|
||||
STEEL_RAILING
|
||||
)).setRegistryName(new ResourceLocation(MODID, "steel_catwalk"));
|
||||
|
||||
public static final EdCatwalkTopAlignedBlock STEEL_CATWALK_TOP_ALIGNED = (EdCatwalkTopAlignedBlock)(new EdCatwalkTopAlignedBlock(
|
||||
DecorBlock.CFG_CUTOUT,
|
||||
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 20f).sound(SoundType.METAL).notSolid(),
|
||||
new VoxelShape[]{
|
||||
VoxelShapes.create(Auxiliaries.getPixeledAABB(0,14,0, 16, 16,16)), // only base
|
||||
Auxiliaries.getUnionShape( // base with thick pole
|
||||
Auxiliaries.getPixeledAABB(0,14,0, 16, 16,16),
|
||||
Auxiliaries.getPixeledAABB(5, 0,5, 11,15, 11)
|
||||
),
|
||||
Auxiliaries.getUnionShape( // base with thin pole
|
||||
Auxiliaries.getPixeledAABB(0,14,0, 16, 16,16),
|
||||
Auxiliaries.getPixeledAABB(6, 0,6, 10,15, 10)
|
||||
),
|
||||
Auxiliaries.getUnionShape( // structure frame-like
|
||||
Auxiliaries.getPixeledAABB( 0, 0, 0, 16, 2,16),
|
||||
Auxiliaries.getPixeledAABB( 0,14, 0, 16, 16,16),
|
||||
Auxiliaries.getPixeledAABB( 0, 0, 0, 1, 16, 1),
|
||||
Auxiliaries.getPixeledAABB(15, 0, 0, 16, 16, 1),
|
||||
Auxiliaries.getPixeledAABB(15, 0,15, 16, 16,16),
|
||||
Auxiliaries.getPixeledAABB( 0, 0,15, 1, 16,16)
|
||||
)
|
||||
}
|
||||
)).setRegistryName(new ResourceLocation(MODID, "steel_catwalk_ta"));
|
||||
|
||||
public static final EdCatwalkStairsBlock STEEL_CATWALK_STAIRS = (EdCatwalkStairsBlock)(new EdCatwalkStairsBlock(
|
||||
DecorBlock.CFG_CUTOUT,
|
||||
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 20f).sound(SoundType.METAL).notSolid(),
|
||||
new AxisAlignedBB[] { // base
|
||||
Auxiliaries.getPixeledAABB( 1, 2, 8, 15, 4, 16),
|
||||
Auxiliaries.getPixeledAABB( 1,10, 0, 15, 12, 8),
|
||||
},
|
||||
new AxisAlignedBB[] { // railing left
|
||||
Auxiliaries.getPixeledAABB(0.4, 0, 15, 0.6, 15, 16),
|
||||
Auxiliaries.getPixeledAABB(0.4, 1, 14, 0.6, 16, 15),
|
||||
Auxiliaries.getPixeledAABB(0.4, 2, 13, 0.6, 17, 14),
|
||||
Auxiliaries.getPixeledAABB(0.4, 3, 12, 0.6, 18, 13),
|
||||
Auxiliaries.getPixeledAABB(0.4, 4, 11, 0.6, 19, 12),
|
||||
Auxiliaries.getPixeledAABB(0.4, 5, 10, 0.6, 20, 11),
|
||||
Auxiliaries.getPixeledAABB(0.4, 6, 9, 0.6, 21, 10),
|
||||
Auxiliaries.getPixeledAABB(0.4, 7, 8, 0.6, 22, 9),
|
||||
Auxiliaries.getPixeledAABB(0.4, 8, 7, 0.6, 23, 8),
|
||||
Auxiliaries.getPixeledAABB(0.4, 9, 6, 0.6, 24, 7),
|
||||
Auxiliaries.getPixeledAABB(0.4, 10, 5, 0.6, 25, 6),
|
||||
Auxiliaries.getPixeledAABB(0.4, 11, 4, 0.6, 26, 5),
|
||||
Auxiliaries.getPixeledAABB(0.4, 12, 3, 0.6, 27, 4),
|
||||
Auxiliaries.getPixeledAABB(0.4, 13, 2, 0.6, 28, 3),
|
||||
Auxiliaries.getPixeledAABB(0.4, 14, 1, 0.6, 29, 2),
|
||||
Auxiliaries.getPixeledAABB(0.4, 15, 0, 0.6, 30, 1)
|
||||
}
|
||||
)).setRegistryName(new ResourceLocation(MODID, "steel_catwalk_stairs"));
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public static final EdTestBlock.TestBlock TEST_BLOCK = (EdTestBlock.TestBlock)(new EdTestBlock.TestBlock(
|
||||
|
@ -978,6 +1029,8 @@ public class ModContent
|
|||
STEEL_MESH_FENCE_GATE,
|
||||
STEEL_CATWALK,
|
||||
STEEL_RAILING,
|
||||
STEEL_CATWALK_TOP_ALIGNED,
|
||||
STEEL_CATWALK_STAIRS,
|
||||
TREATED_WOOD_POLE,
|
||||
TREATED_WOOD_POLE_HEAD,
|
||||
TREATED_WOOD_POLE_SUPPORT,
|
||||
|
|
|
@ -121,8 +121,8 @@ public class DecorBlock
|
|||
|
||||
public static class HorizontalFourWayWaterLoggable extends StandardBlocks.HorizontalFourWayWaterLoggable implements IWaterLoggable
|
||||
{
|
||||
public HorizontalFourWayWaterLoggable(long config, Block.Properties properties, AxisAlignedBB base_aabb, AxisAlignedBB side_aabb)
|
||||
{ super(config, properties, base_aabb, side_aabb); }
|
||||
public HorizontalFourWayWaterLoggable(long config, Block.Properties properties, AxisAlignedBB base_aabb, AxisAlignedBB side_aabb, int railing_height_extension)
|
||||
{ super(config, properties, base_aabb, side_aabb, railing_height_extension); }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public class EdCatwalkBlock extends DecorBlock.HorizontalFourWayWaterLoggable im
|
|||
final AxisAlignedBB base_aabb;
|
||||
|
||||
public EdCatwalkBlock(long config, Block.Properties properties, final AxisAlignedBB base_aabb, final AxisAlignedBB railing_aabb, final Block railing_block)
|
||||
{ super(config, properties, base_aabb, railing_aabb); this.railing_block = railing_block; this.base_aabb=base_aabb; }
|
||||
{ super(config, properties, base_aabb, railing_aabb, 0); this.railing_block = railing_block; this.base_aabb=base_aabb; }
|
||||
|
||||
@Override
|
||||
public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos)
|
||||
|
@ -53,7 +53,7 @@ public class EdCatwalkBlock extends DecorBlock.HorizontalFourWayWaterLoggable im
|
|||
{
|
||||
if(!world.setBlockState(pos, state, 1|2)) return false;
|
||||
world.playSound(player, pos, SoundEvents.BLOCK_METAL_PLACE, SoundCategory.BLOCKS, 1f, 1f);
|
||||
if(!player.isCreative()) {
|
||||
if((!player.isCreative()) && (!world.isRemote())) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if(shrink >= 0) {
|
||||
stack.shrink(shrink);
|
||||
|
|
|
@ -0,0 +1,180 @@
|
|||
/*
|
||||
* @file EdCatwalkStairsBlock.java
|
||||
* @author Stefan Wilhelm (wile)
|
||||
* @copyright (C) 2020 Stefan Wilhelm
|
||||
* @license MIT (see https://opensource.org/licenses/MIT)
|
||||
*
|
||||
* Stair version of the catwalk block, optional left/right railings.
|
||||
*/
|
||||
package wile.engineersdecor.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.shapes.IBooleanFunction;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import wile.engineersdecor.ModContent;
|
||||
import wile.engineersdecor.libmc.detail.Auxiliaries;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
public class EdCatwalkStairsBlock extends DecorBlock.HorizontalWaterLoggable implements IDecorBlock
|
||||
{
|
||||
public static final BooleanProperty RIGHT_RAILING = BooleanProperty.create("right_railing");
|
||||
public static final BooleanProperty LEFT_RAILING = BooleanProperty.create("left_railing");
|
||||
protected final Map<BlockState, VoxelShape> shapes;
|
||||
protected final Map<BlockState, VoxelShape> collision_shapes;
|
||||
protected final Map<Direction, Integer> y_rotations;
|
||||
|
||||
public EdCatwalkStairsBlock(long config, Block.Properties properties, final AxisAlignedBB[] base_aabb, final AxisAlignedBB[] railing_aabbs)
|
||||
{
|
||||
super(config, properties, base_aabb);
|
||||
Map<BlockState, VoxelShape> sh = new HashMap<>();
|
||||
Map<BlockState, VoxelShape> csh = new HashMap<>();
|
||||
getStateContainer().getValidStates().forEach(state->{
|
||||
Direction facing = state.get(HORIZONTAL_FACING);
|
||||
VoxelShape base_shape = Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(base_aabb, facing, true));
|
||||
if(state.get(RIGHT_RAILING)) {
|
||||
VoxelShape right_shape = Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(Auxiliaries.getMirroredAABB(railing_aabbs, Axis.X), facing, true));
|
||||
base_shape = VoxelShapes.combine(base_shape, right_shape, IBooleanFunction.OR);
|
||||
}
|
||||
if(state.get(LEFT_RAILING)) {
|
||||
VoxelShape left_shape = Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(railing_aabbs, facing, true));
|
||||
base_shape = VoxelShapes.combine(base_shape, left_shape, IBooleanFunction.OR);
|
||||
}
|
||||
sh.put(state, base_shape);
|
||||
csh.put(state, base_shape);
|
||||
});
|
||||
shapes = sh;
|
||||
collision_shapes = csh;
|
||||
y_rotations = new HashMap<>();
|
||||
y_rotations.put(Direction.NORTH, 0);
|
||||
y_rotations.put(Direction.EAST, 1);
|
||||
y_rotations.put(Direction.SOUTH, 2);
|
||||
y_rotations.put(Direction.WEST, 3);
|
||||
y_rotations.put(Direction.UP, 0);
|
||||
y_rotations.put(Direction.DOWN, 0);
|
||||
setDefaultState(getStateContainer().getBaseState().with(LEFT_RAILING, false).with(RIGHT_RAILING, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context)
|
||||
{ return shapes.getOrDefault(state, VoxelShapes.fullCube()); }
|
||||
|
||||
@Override
|
||||
public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context)
|
||||
{ return collision_shapes.getOrDefault(state, VoxelShapes.fullCube()); }
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
|
||||
{ super.fillStateContainer(builder); builder.add(RIGHT_RAILING, LEFT_RAILING); }
|
||||
|
||||
@Override
|
||||
public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos)
|
||||
{ return true; }
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context)
|
||||
{ return super.getStateForPlacement(context); }
|
||||
|
||||
@Override
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
|
||||
{
|
||||
final Item item = player.getHeldItem(hand).getItem();
|
||||
if((!(item instanceof BlockItem))) return ActionResultType.PASS;
|
||||
final Block block = ((BlockItem)item).getBlock();
|
||||
final Direction facing = state.get(HORIZONTAL_FACING);
|
||||
if(block == this) {
|
||||
final Direction hlv = Arrays.stream(Direction.getFacingDirections(player)).filter(d->d.getAxis().isHorizontal()).findFirst().orElse(Direction.NORTH);
|
||||
BlockPos adjacent_pos;
|
||||
if(hlv == facing) {
|
||||
adjacent_pos = pos.up().offset(hlv);
|
||||
} else if(hlv == facing.getOpposite()) {
|
||||
adjacent_pos = pos.down().offset(hlv);
|
||||
} else {
|
||||
return world.isRemote() ? ActionResultType.SUCCESS : ActionResultType.CONSUME;
|
||||
}
|
||||
final BlockState adjacent_state = world.getBlockState(adjacent_pos);
|
||||
if(adjacent_state == null) return world.isRemote() ? ActionResultType.SUCCESS : ActionResultType.CONSUME;
|
||||
if(!adjacent_state.isReplaceable(new DirectionalPlaceContext(world, adjacent_pos, hit.getFace().getOpposite(), player.getHeldItem(hand), hit.getFace()))) return ActionResultType.CONSUME;
|
||||
BlockState place_state = getDefaultState().with(HORIZONTAL_FACING, facing);
|
||||
place_state = place_state.with(WATERLOGGED,adjacent_state.getFluidState().getFluid()==Fluids.WATER);
|
||||
EdCatwalkBlock.place_consume(place_state, world, adjacent_pos, player, hand, 1);
|
||||
return world.isRemote() ? ActionResultType.SUCCESS : ActionResultType.CONSUME;
|
||||
} else if((block == ModContent.STEEL_CATWALK) || (block == ModContent.STEEL_CATWALK_TOP_ALIGNED)) {
|
||||
BlockPos adjacent_pos;
|
||||
adjacent_pos = pos.offset(facing);
|
||||
final BlockState adjacent_state = world.getBlockState(adjacent_pos);
|
||||
if(adjacent_state == null) return ActionResultType.CONSUME;
|
||||
if(!adjacent_state.isReplaceable(new DirectionalPlaceContext(world, adjacent_pos, hit.getFace().getOpposite(), player.getHeldItem(hand), hit.getFace()))) return ActionResultType.CONSUME;
|
||||
BlockState place_state = ModContent.STEEL_CATWALK_TOP_ALIGNED.getDefaultState();
|
||||
place_state = place_state.with(WATERLOGGED,adjacent_state.getFluidState().getFluid()==Fluids.WATER);
|
||||
EdCatwalkBlock.place_consume(place_state, world, adjacent_pos, player, hand, 1);
|
||||
return world.isRemote() ? ActionResultType.SUCCESS : ActionResultType.CONSUME;
|
||||
} else if(block == ModContent.STEEL_RAILING) {
|
||||
Direction face = hit.getFace();
|
||||
int shrink = 0;
|
||||
BlockState place_state = state;
|
||||
if(face == Direction.UP) {
|
||||
Vector3d rhv = hit.getHitVec().subtract(Vector3d.copyCentered(hit.getPos())).mul(new Vector3d(1,0,1)).crossProduct(Vector3d.copy(facing.getDirectionVec()));
|
||||
face = (rhv.y > 0) ? (facing.rotateY()) : (facing.rotateYCCW());
|
||||
}
|
||||
if(face == facing.rotateY()) {
|
||||
if(state.get(RIGHT_RAILING)) {
|
||||
place_state = state.with(RIGHT_RAILING, false);
|
||||
shrink = -1;
|
||||
} else {
|
||||
place_state = state.with(RIGHT_RAILING, true);
|
||||
shrink = 1;
|
||||
}
|
||||
} else if(face == facing.rotateYCCW()) {
|
||||
if(state.get(LEFT_RAILING)) {
|
||||
place_state = state.with(LEFT_RAILING, false);
|
||||
shrink = -1;
|
||||
} else {
|
||||
place_state = state.with(LEFT_RAILING, true);
|
||||
shrink = 1;
|
||||
}
|
||||
}
|
||||
if(shrink != 0) EdCatwalkBlock.place_consume(place_state, world, pos, player, hand, shrink);
|
||||
return world.isRemote() ? ActionResultType.SUCCESS : ActionResultType.CONSUME;
|
||||
}
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
// -- IDecorBlock
|
||||
|
||||
@Override
|
||||
public boolean hasDynamicDropList()
|
||||
{ return true; }
|
||||
|
||||
@Override
|
||||
public List<ItemStack> dropList(BlockState state, World world, @Nullable TileEntity te, boolean explosion)
|
||||
{
|
||||
if(world.isRemote()) return Collections.singletonList(ItemStack.EMPTY);
|
||||
List<ItemStack> drops = new ArrayList<>();
|
||||
drops.add(new ItemStack(state.getBlock().asItem()));
|
||||
int n = (state.get(LEFT_RAILING)?1:0)+(state.get(RIGHT_RAILING)?1:0);
|
||||
if(n > 0) drops.add(new ItemStack(ModContent.STEEL_RAILING, n));
|
||||
return drops;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* @file EdCatwalkTopAlignedBlock.java
|
||||
* @author Stefan Wilhelm (wile)
|
||||
* @copyright (C) 2020 Stefan Wilhelm
|
||||
* @license MIT (see https://opensource.org/licenses/MIT)
|
||||
*
|
||||
* Top aligned platforms, down-connection to poles.
|
||||
*/
|
||||
package wile.engineersdecor.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.state.IntegerProperty;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import wile.engineersdecor.ModContent;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class EdCatwalkTopAlignedBlock extends DecorBlock.WaterLoggable implements IDecorBlock
|
||||
{
|
||||
public static final IntegerProperty VARIANT = IntegerProperty.create("variant", 0, 3);
|
||||
protected final List<VoxelShape> variant_shapes;
|
||||
|
||||
public EdCatwalkTopAlignedBlock(long config, Block.Properties properties, final VoxelShape[] variant_shapes)
|
||||
{
|
||||
super(config, properties, variant_shapes[0]);
|
||||
setDefaultState(getStateContainer().getBaseState().with(VARIANT, 0));
|
||||
this.variant_shapes = VARIANT.getAllowedValues().stream().map(i->(i<variant_shapes.length) ? (variant_shapes[i]) : (VoxelShapes.fullCube())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos)
|
||||
{ return true; }
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext selectionContext)
|
||||
{ return variant_shapes.get(state.get(VARIANT)); }
|
||||
|
||||
@Override
|
||||
public VoxelShape getCollisionShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext selectionContext)
|
||||
{ return getShape(state, world, pos, selectionContext); }
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
|
||||
{ super.fillStateContainer(builder); builder.add(VARIANT); }
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context)
|
||||
{
|
||||
BlockState state = adapted_state(super.getStateForPlacement(context), context.getWorld(), context.getPos());
|
||||
if(context.getFace() != Direction.UP) return state;
|
||||
BlockState below = context.getWorld().getBlockState(context.getPos().down());
|
||||
if((state.get(VARIANT)==0) && (below.isSolidSide(context.getWorld(), context.getPos().down(), Direction.UP))) return state.with(VARIANT, 3);
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
|
||||
{
|
||||
final Item item = player.getHeldItem(hand).getItem();
|
||||
if(item != this.asItem()) return ActionResultType.PASS;
|
||||
if(hit.getFace().getAxis().isHorizontal()) return ActionResultType.PASS;
|
||||
BlockPos adjacent_pos = pos.offset(player.getHorizontalFacing());
|
||||
BlockState adjacent_state = world.getBlockState(adjacent_pos);
|
||||
if(adjacent_state.isReplaceable(new DirectionalPlaceContext(world, adjacent_pos, hit.getFace().getOpposite(), player.getHeldItem(hand), hit.getFace()))) {
|
||||
BlockState place_state = getDefaultState();
|
||||
place_state = place_state.with(WATERLOGGED,adjacent_state.getFluidState().getFluid()==Fluids.WATER);
|
||||
EdCatwalkBlock.place_consume(adapted_state(place_state, world, adjacent_pos), world, adjacent_pos, player, hand, 1);
|
||||
}
|
||||
return world.isRemote() ? ActionResultType.SUCCESS : ActionResultType.CONSUME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos)
|
||||
{ return adapted_state(super.updatePostPlacement(state, facing, facingState, world, pos, facingPos), world, pos); }
|
||||
|
||||
// ---
|
||||
|
||||
private BlockState adapted_state(BlockState state, IWorld world, BlockPos pos)
|
||||
{
|
||||
BlockState below = world.getBlockState(pos.down());
|
||||
if((below == null) || (state == null)) return state;
|
||||
if((below.getBlock() == ModContent.THICK_STEEL_POLE) || (below.getBlock() == ModContent.THICK_STEEL_POLE_HEAD)) return state.with(VARIANT, 1);
|
||||
if((below.getBlock() == ModContent.THIN_STEEL_POLE) || (below.getBlock() == ModContent.THIN_STEEL_POLE_HEAD)) return state.with(VARIANT, 2);
|
||||
return state;
|
||||
}
|
||||
|
||||
}
|
|
@ -418,7 +418,7 @@ public class EdFluidBarrel
|
|||
public ItemStack getContainerItem(ItemStack stack)
|
||||
{
|
||||
FluidStack fs = getFluid(stack);
|
||||
fs.shrink(1000);
|
||||
if(fs.getAmount() > 1000) fs.shrink(1000); else fs = FluidStack.EMPTY;
|
||||
return setFluid(stack, fs);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import java.util.List;
|
|||
public class EdRailingBlock extends DecorBlock.HorizontalFourWayWaterLoggable implements IDecorBlock
|
||||
{
|
||||
public EdRailingBlock(long config, Block.Properties properties, final AxisAlignedBB base_aabb, final AxisAlignedBB railing_aabb)
|
||||
{ super(config, properties, base_aabb, railing_aabb); }
|
||||
{ super(config, properties, base_aabb, railing_aabb, 0); }
|
||||
|
||||
@Override
|
||||
public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos)
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
* JEI plugin (see https://github.com/mezz/JustEnoughItems/wiki/Creating-Plugins)
|
||||
*/
|
||||
package wile.engineersdecor.eapi.jei;
|
||||
public class JEIPlugin {}
|
||||
/*
|
||||
//public class JEIPlugin {}
|
||||
|
||||
import wile.engineersdecor.ModEngineersDecor;
|
||||
import wile.engineersdecor.ModConfig;
|
||||
import wile.engineersdecor.ModContent;
|
||||
|
@ -74,4 +74,3 @@ public class JEIPlugin implements mezz.jei.api.IModPlugin
|
|||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -441,7 +441,7 @@ public class StandardBlocks
|
|||
protected final Map<BlockState, VoxelShape> shapes;
|
||||
protected final Map<BlockState, VoxelShape> collision_shapes;
|
||||
|
||||
public HorizontalFourWayWaterLoggable(long config, Block.Properties properties, AxisAlignedBB base_aabb, final AxisAlignedBB side_aabb)
|
||||
public HorizontalFourWayWaterLoggable(long config, Block.Properties properties, AxisAlignedBB base_aabb, final AxisAlignedBB side_aabb, int railing_height_extension)
|
||||
{
|
||||
super(config, properties, base_aabb);
|
||||
Map<BlockState, VoxelShape> build_shapes = new HashMap<>();
|
||||
|
@ -460,10 +460,10 @@ public class StandardBlocks
|
|||
{
|
||||
// how the hack to extend a shape, these are the above with y+4px.
|
||||
VoxelShape shape = ((base_aabb.getXSize()==0) || (base_aabb.getYSize()==0) || (base_aabb.getZSize()==0)) ? VoxelShapes.empty() : VoxelShapes.create(base_aabb);
|
||||
if(state.get(NORTH)) shape = VoxelShapes.combine(shape,VoxelShapes.create(Auxiliaries.getRotatedAABB(side_aabb, Direction.NORTH, true).expand(0, 2, 0)), IBooleanFunction.OR);
|
||||
if(state.get(EAST)) shape = VoxelShapes.combine(shape,VoxelShapes.create(Auxiliaries.getRotatedAABB(side_aabb, Direction.EAST, true).expand(0, 2, 0)), IBooleanFunction.OR);
|
||||
if(state.get(SOUTH)) shape = VoxelShapes.combine(shape,VoxelShapes.create(Auxiliaries.getRotatedAABB(side_aabb, Direction.SOUTH, true).expand(0, 2, 0)), IBooleanFunction.OR);
|
||||
if(state.get(WEST)) shape = VoxelShapes.combine(shape,VoxelShapes.create(Auxiliaries.getRotatedAABB(side_aabb, Direction.WEST, true).expand(0, 2, 0)), IBooleanFunction.OR);
|
||||
if(state.get(NORTH)) shape = VoxelShapes.combine(shape,VoxelShapes.create(Auxiliaries.getRotatedAABB(side_aabb, Direction.NORTH, true).expand(0, railing_height_extension, 0)), IBooleanFunction.OR);
|
||||
if(state.get(EAST)) shape = VoxelShapes.combine(shape,VoxelShapes.create(Auxiliaries.getRotatedAABB(side_aabb, Direction.EAST, true).expand(0, railing_height_extension, 0)), IBooleanFunction.OR);
|
||||
if(state.get(SOUTH)) shape = VoxelShapes.combine(shape,VoxelShapes.create(Auxiliaries.getRotatedAABB(side_aabb, Direction.SOUTH, true).expand(0, railing_height_extension, 0)), IBooleanFunction.OR);
|
||||
if(state.get(WEST)) shape = VoxelShapes.combine(shape,VoxelShapes.create(Auxiliaries.getRotatedAABB(side_aabb, Direction.WEST, true).expand(0, railing_height_extension, 0)), IBooleanFunction.OR);
|
||||
if(shape.isEmpty()) shape = VoxelShapes.fullCube();
|
||||
build_collision_shapes.put(state.with(WATERLOGGED, false), shape);
|
||||
build_collision_shapes.put(state.with(WATERLOGGED, true), shape);
|
||||
|
|
|
@ -339,6 +339,13 @@ public class Auxiliaries
|
|||
return transformed;
|
||||
}
|
||||
|
||||
public static final VoxelShape getUnionShape(AxisAlignedBB ... aabbs)
|
||||
{
|
||||
VoxelShape shape = VoxelShapes.empty();
|
||||
for(AxisAlignedBB aabb: aabbs) shape = VoxelShapes.combine(shape, VoxelShapes.create(aabb), IBooleanFunction.OR);
|
||||
return shape;
|
||||
}
|
||||
|
||||
public static final VoxelShape getUnionShape(AxisAlignedBB[] ... aabb_list)
|
||||
{
|
||||
VoxelShape shape = VoxelShapes.empty();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue