Fixed Double-T support thick steel pole connection. Concrete and Clinker walls connect to windows and glass panes.

This commit is contained in:
stfwi 2020-09-13 14:53:56 +02:00
parent 3efa21e1b6
commit 16ad286f59
9 changed files with 67 additions and 31 deletions

View file

@ -484,7 +484,10 @@ public class ModContent
public static final EdHorizontalSupportBlock STEEL_DOUBLE_T_SUPPORT = (EdHorizontalSupportBlock)(new EdHorizontalSupportBlock(
DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
Auxiliaries.getPixeledAABB(5,11,0, 11,16,16)
Auxiliaries.getPixeledAABB( 5,11,0, 11,16,16), // main beam
Auxiliaries.getPixeledAABB(10,11,5, 16,16,11), // east beam (also for west 180deg)
Auxiliaries.getPixeledAABB( 6, 0,6, 10,16,10), // down thin
Auxiliaries.getPixeledAABB( 5, 0,5, 11,16,11) // down thick
)).setRegistryName(new ResourceLocation(MODID, "steel_double_t_support"));
// -------------------------------------------------------------------------------------------------------------------

View file

@ -9,12 +9,9 @@
*/
package wile.engineersdecor.blocks;
import net.minecraft.entity.EntitySpawnPlacementRegistry;
import wile.engineersdecor.ModContent;
import wile.engineersdecor.libmc.detail.Auxiliaries;
import net.minecraft.entity.EntityType;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.block.Block;
import net.minecraft.entity.EntitySpawnPlacementRegistry;
import net.minecraft.entity.EntityType;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.IntegerProperty;
@ -22,15 +19,20 @@ import net.minecraft.state.StateContainer;
import net.minecraft.util.*;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.util.math.shapes.IBooleanFunction;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import wile.engineersdecor.ModContent;
import wile.engineersdecor.libmc.detail.Auxiliaries;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
public class EdHorizontalSupportBlock extends DecorBlock.WaterLoggable implements IDecorBlock
@ -39,19 +41,29 @@ public class EdHorizontalSupportBlock extends DecorBlock.WaterLoggable implement
public static final BooleanProperty LEFTBEAM = BooleanProperty.create("leftbeam");
public static final BooleanProperty RIGHTBEAM = BooleanProperty.create("rightbeam");
public static final IntegerProperty DOWNCONNECT = IntegerProperty.create("downconnect", 0, 2);
protected final ArrayList<VoxelShape> AABBs;
protected final Map<BlockState, VoxelShape> AABBs;
public EdHorizontalSupportBlock(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB)
public EdHorizontalSupportBlock(long config, Block.Properties builder, final AxisAlignedBB mainBeamAABB, final AxisAlignedBB eastBeamAABB, final AxisAlignedBB thinDownBeamAABB, final AxisAlignedBB thickDownBeamAABB)
{
super(config|DecorBlock.CFG_HORIZIONTAL, builder);
AABBs = new ArrayList<VoxelShape>(Arrays.asList(
// Effective bounding box
VoxelShapes.create(Auxiliaries.getRotatedAABB(unrotatedAABB.grow(2.0/16, 0, 0), Direction.NORTH, true)),
VoxelShapes.create(Auxiliaries.getRotatedAABB(unrotatedAABB.grow(2.0/16, 0, 0), Direction.WEST, true)),
// Displayed bounding box
VoxelShapes.create(Auxiliaries.getRotatedAABB(unrotatedAABB, Direction.NORTH, true)),
VoxelShapes.create(Auxiliaries.getRotatedAABB(unrotatedAABB, Direction.WEST, true))
));
Map<BlockState, VoxelShape> aabbs = new HashMap<>();
for(boolean eastwest:EASTWEST.getAllowedValues()) {
for(boolean leftbeam:LEFTBEAM.getAllowedValues()) {
for(boolean rightbeam:RIGHTBEAM.getAllowedValues()) {
for(int downconnect:DOWNCONNECT.getAllowedValues()) {
final BlockState state = getDefaultState().with(EASTWEST, eastwest).with(LEFTBEAM, leftbeam).with(RIGHTBEAM, rightbeam).with(DOWNCONNECT, downconnect);
VoxelShape shape = VoxelShapes.create(Auxiliaries.getRotatedAABB(mainBeamAABB, eastwest?Direction.EAST:Direction.NORTH, true));
if(rightbeam) shape = VoxelShapes.combine(shape, VoxelShapes.create(Auxiliaries.getRotatedAABB(eastBeamAABB, eastwest?Direction.EAST:Direction.NORTH, true)), IBooleanFunction.OR);
if(leftbeam) shape = VoxelShapes.combine(shape, VoxelShapes.create(Auxiliaries.getRotatedAABB(eastBeamAABB, eastwest?Direction.WEST:Direction.SOUTH, true)), IBooleanFunction.OR);
if(downconnect==1) shape = VoxelShapes.combine(shape, VoxelShapes.create(thinDownBeamAABB), IBooleanFunction.OR);
if(downconnect==2) shape = VoxelShapes.combine(shape, VoxelShapes.create(thickDownBeamAABB), IBooleanFunction.OR);
aabbs.put(state.with(WATERLOGGED, false), shape);
aabbs.put(state.with(WATERLOGGED, true), shape);
}
}
}
}
AABBs = aabbs;
}
@Override
@ -68,7 +80,7 @@ public class EdHorizontalSupportBlock extends DecorBlock.WaterLoggable implement
@Override
public VoxelShape getShape(BlockState state, IBlockReader source, BlockPos pos, ISelectionContext selectionContext)
{ return AABBs.get(state.get(EASTWEST) ? 0x1 : 0x0); }
{ return AABBs.get(state); }
@Override
public VoxelShape getCollisionShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext selectionContext)

View file

@ -8,11 +8,24 @@
*/
package wile.engineersdecor.blocks;
import wile.engineersdecor.libmc.blocks.VariantWallBlock;
import net.minecraft.block.*;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorldReader;
import wile.engineersdecor.libmc.blocks.VariantWallBlock;
public class EdWallBlock extends VariantWallBlock implements IDecorBlock
{
public EdWallBlock(long config, Block.Properties builder)
{ super(config, builder); }
protected boolean attachesTo(BlockState facingState, IWorldReader world, BlockPos facingPos, Direction side)
{
if(facingState==null) return false;
if(super.attachesTo(facingState, world, facingPos, side)) return true;
if(facingState.getBlock() instanceof EdWindowBlock) return true;
if(facingState.getBlock() instanceof PaneBlock) return true;
return false;
}
}

View file

@ -132,7 +132,7 @@ public class VariantWallBlock extends WallBlock implements StandardBlocks.IStand
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
{ super.fillStateContainer(builder); builder.add(TEXTURE_VARIANT); }
private boolean attachesTo(BlockState facingState, IWorldReader world, BlockPos facingPos, Direction side)
protected boolean attachesTo(BlockState facingState, IWorldReader world, BlockPos facingPos, Direction side)
{
final Block block = facingState.getBlock();
if((block instanceof FenceGateBlock) || (block instanceof WallBlock)) return true;

View file

@ -14,6 +14,6 @@
},{ "when": { "downconnect" : "1" },
"apply": { "model": "engineersdecor:block/hsupport/steel_double_t_support_xconnect_thin_pole_model" }
},{ "when": { "downconnect" : "2" },
"apply": { "model": "engineersdecor:block/hsupport/steel_double_t_support_xconnect_thin_pole_model" }
"apply": { "model": "engineersdecor:block/hsupport/steel_double_t_support_xconnect_thick_pole_model" }
}
]}