Removed getShape() from standard blocks base to enable Chisels&Bits to support basic blocks like clinkers. Labeled Crate drops made stateless.
This commit is contained in:
parent
4f07f82e01
commit
bed43ef505
33 changed files with 122 additions and 111 deletions
|
@ -1,5 +1,5 @@
|
|||
// @file build.gradle
|
||||
// Engineer's decor mod gradle build relay (mc1.15.1)
|
||||
// Engineer's decor mod gradle build.
|
||||
import net.minecraftforge.gradle.common.task.SignJar
|
||||
buildscript {
|
||||
repositories {
|
||||
|
@ -31,7 +31,7 @@ minecraft {
|
|||
runs {
|
||||
client {
|
||||
workingDirectory project.file('run')
|
||||
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
|
||||
property 'forge.logging.markers', '' // SCAN,REGISTRIES,REGISTRYDUMP
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
mods {
|
||||
engineersdecor {
|
||||
|
@ -41,7 +41,7 @@ minecraft {
|
|||
}
|
||||
server {
|
||||
workingDirectory project.file('run')
|
||||
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
|
||||
property 'forge.logging.markers', '' // SCAN,REGISTRIES,REGISTRYDUMP
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
mods {
|
||||
engineersdecor {
|
||||
|
@ -51,7 +51,7 @@ minecraft {
|
|||
}
|
||||
data {
|
||||
workingDirectory project.file('run')
|
||||
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
|
||||
property 'forge.logging.markers', '' // SCAN,REGISTRIES,REGISTRYDUMP
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
args '--mod', 'engineersdecor', '--all', '--output', file('src/generated/resources/')
|
||||
mods {
|
||||
|
|
|
@ -5,4 +5,4 @@ version_minecraft=1.16.4
|
|||
version_forge_minecraft=1.16.4-35.1.10
|
||||
version_fml_mappings=20201028-1.16.3
|
||||
version_jei=1.16.4:7.6.1.63
|
||||
version_engineersdecor=1.1.11
|
||||
version_engineersdecor=1.1.12
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
|
||||
"1.16.4": {
|
||||
"1.1.12": "[F] Chisels&Bits compatibility addressed (issue #172, ty rodg88).\n[F] Labeled Crate drop list made stateless (issue #173, ty HopsandBarley && Harmonised).",
|
||||
"1.1.11": "[F] Fixed Window placement dupe (issue #170, ty NillerMedDild).",
|
||||
"1.1.10": "[A] Added Small Lab Furnace config for accepted speed-boost heaters (PR#165, ty mrh0).\n[F] Fixed Labeled Crate mouse scrolling crash (issue #169, ty vaelzan).",
|
||||
"1.1.9": "[A] Dark Shingle Roof Wire Conduit recipe added.\n[F] Fixed Ladder climbing (affects forge>=36.0.45, issue #167, thx ZED).",
|
||||
|
@ -31,7 +32,7 @@
|
|||
"1.1.2-b1": "[U] Ported to MC1.16.2."
|
||||
},
|
||||
"promos": {
|
||||
"1.16.4-recommended": "1.1.11",
|
||||
"1.16.4-latest": "1.1.11"
|
||||
"1.16.4-recommended": "1.1.12",
|
||||
"1.16.4-latest": "1.1.12"
|
||||
}
|
||||
}
|
|
@ -11,6 +11,9 @@ Mod sources for Minecraft version 1.16.x.
|
|||
|
||||
## Version history
|
||||
|
||||
- v1.1.12 [F] Chisels&Bits compatibility addressed (issue #172, ty rodg88).
|
||||
[F] Labeled Crate drop list made stateless (issue #173, ty HopsandBarley && Harmonised).
|
||||
|
||||
- v1.1.11 [F] Fixed Window placement dupe (issue #170, ty NillerMedDild).
|
||||
|
||||
- v1.1.10 [A] Added Small Lab Furnace config for accepted speed-boost heaters (PR#165, ty mrh0).
|
||||
|
|
|
@ -44,15 +44,21 @@ public class DecorBlock
|
|||
public static class Normal extends StandardBlocks.BaseBlock implements IDecorBlock
|
||||
{
|
||||
public Normal(long conf, Block.Properties properties)
|
||||
{ super(conf, properties); }
|
||||
}
|
||||
|
||||
public static class Cutout extends StandardBlocks.Cutout implements IDecorBlock
|
||||
{
|
||||
public Cutout(long conf, Block.Properties properties)
|
||||
{ super(conf, properties, Auxiliaries.getPixeledAABB(0, 0, 0, 16, 16,16 )); }
|
||||
|
||||
public Normal(long conf, Block.Properties properties, AxisAlignedBB aabb)
|
||||
public Cutout(long conf, Block.Properties properties, AxisAlignedBB aabb)
|
||||
{ super(conf, properties, aabb);}
|
||||
|
||||
public Normal(long conf, Block.Properties properties, VoxelShape voxel_shape)
|
||||
public Cutout(long conf, Block.Properties properties, VoxelShape voxel_shape)
|
||||
{ super(conf, properties, voxel_shape); }
|
||||
|
||||
public Normal(long conf, Block.Properties properties, AxisAlignedBB[] aabbs)
|
||||
public Cutout(long conf, Block.Properties properties, AxisAlignedBB[] aabbs)
|
||||
{ super(conf, properties, aabbs); }
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ public class EdCatwalkBlock extends DecorBlock.HorizontalFourWayWaterLoggable im
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
|
||||
{
|
||||
final Item item = player.getHeldItem(hand).getItem();
|
||||
|
|
|
@ -96,6 +96,7 @@ public class EdCatwalkStairsBlock extends DecorBlock.HorizontalWaterLoggable imp
|
|||
{ return super.getStateForPlacement(context); }
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
|
||||
{
|
||||
final Item item = player.getHeldItem(hand).getItem();
|
||||
|
|
|
@ -70,6 +70,7 @@ public class EdCatwalkTopAlignedBlock extends DecorBlock.WaterLoggable implement
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
|
||||
{
|
||||
final Item item = player.getHeldItem(hand).getItem();
|
||||
|
|
|
@ -53,6 +53,7 @@ public class EdChair
|
|||
{ super(config, builder.tickRandomly(), unrotatedAABBs); }
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
|
||||
{
|
||||
if(!sitting_enabled) return ActionResultType.PASS;
|
||||
|
@ -69,6 +70,7 @@ public class EdChair
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void tick(BlockState state, ServerWorld world, BlockPos pos, Random rnd)
|
||||
{
|
||||
if((!sitting_enabled) || (sitting_probability < 1e-6)) return;
|
||||
|
|
|
@ -29,7 +29,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
|||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
public class EdChimneyBlock extends DecorBlock.Normal implements IDecorBlock
|
||||
public class EdChimneyBlock extends DecorBlock.Cutout implements IDecorBlock
|
||||
{
|
||||
public static final IntegerProperty POWER = BlockStateProperties.POWER_0_15;
|
||||
|
||||
|
|
|
@ -105,6 +105,7 @@ public class EdCraftingTable
|
|||
{ return new EdCraftingTable.CraftingTableTileEntity(); }
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
|
||||
{
|
||||
if(world.isRemote()) return ActionResultType.SUCCESS;
|
||||
|
@ -160,6 +161,7 @@ public class EdCraftingTable
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void tick(BlockState state, ServerWorld world, BlockPos pos, Random rand)
|
||||
{
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
|
@ -806,6 +808,7 @@ public class EdCraftingTable
|
|||
}
|
||||
}
|
||||
if(recipe != null) {
|
||||
sync();
|
||||
onCraftMatrixChanged();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -170,6 +170,7 @@ public class EdDropper
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
|
||||
{
|
||||
if(world.isRemote()) return ActionResultType.SUCCESS;
|
||||
|
|
|
@ -62,7 +62,7 @@ public class EdFluidFunnel
|
|||
// Block
|
||||
//--------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public static class FluidFunnelBlock extends DecorBlock.Normal implements IDecorBlock
|
||||
public static class FluidFunnelBlock extends DecorBlock.Cutout implements IDecorBlock
|
||||
{
|
||||
public static final int FILL_LEVEL_MAX = 3;
|
||||
public static final IntegerProperty FILL_LEVEL = IntegerProperty.create("level", 0, FILL_LEVEL_MAX);
|
||||
|
@ -143,6 +143,7 @@ public class EdFluidFunnel
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
|
||||
{
|
||||
if(world.isRemote) return ActionResultType.SUCCESS;
|
||||
|
|
|
@ -111,6 +111,7 @@ public class EdFreezer
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
|
||||
{
|
||||
if(player.isSneaking()) return ActionResultType.PASS;
|
||||
|
|
|
@ -169,6 +169,7 @@ public class EdFurnace
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
|
||||
{
|
||||
if(world.isRemote()) return ActionResultType.SUCCESS;
|
||||
|
|
|
@ -89,6 +89,7 @@ public class EdHatchBlock extends DecorBlock.HorizontalWaterLoggable implements
|
|||
{ super.fillStateContainer(builder); builder.add(OPEN, POWERED); }
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
|
||||
{
|
||||
if(world.isRemote()) return ActionResultType.SUCCESS;
|
||||
|
|
|
@ -142,6 +142,7 @@ public class EdHopper
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
|
||||
{
|
||||
if(world.isRemote()) return ActionResultType.SUCCESS;
|
||||
|
|
|
@ -129,6 +129,7 @@ public class EdHorizontalSupportBlock extends DecorBlock.WaterLoggable implement
|
|||
{ return temp_block_update_until_better(state, world, pos); }
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
|
||||
{
|
||||
ItemStack held_stack = player.getHeldItem(hand);
|
||||
|
|
|
@ -135,11 +135,11 @@ public class EdLabeledCrate
|
|||
public List<ItemStack> dropList(BlockState state, World world, final TileEntity te, boolean explosion)
|
||||
{
|
||||
final List<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
if(world.isRemote) return stacks;
|
||||
if(world.isRemote()) return stacks;
|
||||
if(!(te instanceof LabeledCrateTileEntity)) return stacks;
|
||||
if(!explosion) {
|
||||
ItemStack stack = new ItemStack(this, 1);
|
||||
CompoundNBT te_nbt = ((LabeledCrateTileEntity)te).reset_getnbt();
|
||||
CompoundNBT te_nbt = ((LabeledCrateTileEntity)te).getnbt();
|
||||
CompoundNBT nbt = new CompoundNBT();
|
||||
if(!te_nbt.isEmpty()) nbt.put("tedata", te_nbt);
|
||||
if(!nbt.isEmpty()) stack.setTag(nbt);
|
||||
|
@ -147,7 +147,7 @@ public class EdLabeledCrate
|
|||
stacks.add(stack);
|
||||
} else {
|
||||
for(ItemStack stack: ((LabeledCrateTileEntity)te).main_inventory_) stacks.add(stack);
|
||||
((LabeledCrateTileEntity)te).reset_getnbt();
|
||||
((LabeledCrateTileEntity)te).getnbt();
|
||||
}
|
||||
return stacks;
|
||||
}
|
||||
|
@ -253,16 +253,8 @@ public class EdLabeledCrate
|
|||
});
|
||||
}
|
||||
|
||||
public CompoundNBT reset_getnbt()
|
||||
{
|
||||
CompoundNBT nbt = new CompoundNBT();
|
||||
writenbt(nbt);
|
||||
reset();
|
||||
return nbt;
|
||||
}
|
||||
|
||||
protected void reset()
|
||||
{ main_inventory_.clear(); }
|
||||
public CompoundNBT getnbt()
|
||||
{ return writenbt(new CompoundNBT()); }
|
||||
|
||||
public CompoundNBT readnbt(CompoundNBT nbt)
|
||||
{
|
||||
|
|
|
@ -111,6 +111,7 @@ public class EdMilker
|
|||
{ return new MilkerTileEntity(); }
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
|
||||
{
|
||||
if(world.isRemote()) return ActionResultType.SUCCESS;
|
||||
|
|
|
@ -124,6 +124,7 @@ public class EdMineralSmelter
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
|
||||
{
|
||||
if(player.isSneaking()) return ActionResultType.PASS;
|
||||
|
|
|
@ -150,6 +150,7 @@ public class EdPlacer
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
|
||||
{
|
||||
if(world.isRemote()) return ActionResultType.SUCCESS;
|
||||
|
|
|
@ -56,6 +56,7 @@ public class EdRailingBlock extends DecorBlock.HorizontalFourWayWaterLoggable im
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
|
||||
{
|
||||
if(player.getHeldItem(hand).getItem() != asItem()) return ActionResultType.PASS;
|
||||
|
|
|
@ -51,7 +51,7 @@ public class EdSolarPanel
|
|||
// Block
|
||||
//--------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public static class SolarPanelBlock extends DecorBlock.Normal implements IDecorBlock
|
||||
public static class SolarPanelBlock extends DecorBlock.Cutout implements IDecorBlock
|
||||
{
|
||||
public static final IntegerProperty EXPOSITION = IntegerProperty.create("exposition", 0, 4);
|
||||
|
||||
|
@ -75,6 +75,7 @@ public class EdSolarPanel
|
|||
{ return new EdSolarPanel.SolarPanelTileEntity(); }
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
|
||||
{
|
||||
if(world.isRemote()) return ActionResultType.SUCCESS;
|
||||
|
|
|
@ -51,6 +51,7 @@ public class EdStraightPoleBlock extends DecorBlock.DirectedWaterLoggable implem
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
|
||||
{
|
||||
if((hit.getFace().getAxis() == state.get(FACING).getAxis())) return ActionResultType.PASS;
|
||||
|
|
|
@ -93,6 +93,7 @@ public class EdTreeCutter
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
|
||||
{
|
||||
if(world.isRemote()) return ActionResultType.SUCCESS;
|
||||
|
|
|
@ -72,7 +72,7 @@ public class EdWasteIncinerator
|
|||
// Block
|
||||
//--------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public static class WasteIncineratorBlock extends DecorBlock.Normal implements IDecorBlock
|
||||
public static class WasteIncineratorBlock extends DecorBlock.Cutout implements IDecorBlock
|
||||
{
|
||||
public static final BooleanProperty LIT = FurnaceBlock.LIT;
|
||||
|
||||
|
@ -136,7 +136,7 @@ public class EdWasteIncinerator
|
|||
if(!(te instanceof WasteIncineratorTileEntity)) return stacks;
|
||||
if(!explosion) {
|
||||
ItemStack stack = new ItemStack(this, 1);
|
||||
CompoundNBT te_nbt = ((WasteIncineratorTileEntity) te).reset_getnbt();
|
||||
CompoundNBT te_nbt = ((WasteIncineratorTileEntity) te).getnbt();
|
||||
if(!te_nbt.isEmpty()) {
|
||||
CompoundNBT nbt = new CompoundNBT();
|
||||
nbt.put("tedata", te_nbt);
|
||||
|
@ -145,12 +145,13 @@ public class EdWasteIncinerator
|
|||
stacks.add(stack);
|
||||
} else {
|
||||
for(ItemStack stack: ((WasteIncineratorTileEntity)te).stacks_) stacks.add(stack);
|
||||
((WasteIncineratorTileEntity)te).reset_getnbt();
|
||||
((WasteIncineratorTileEntity)te).getnbt();
|
||||
}
|
||||
return stacks;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
|
||||
{
|
||||
if(world.isRemote()) return ActionResultType.SUCCESS;
|
||||
|
@ -214,13 +215,8 @@ public class EdWasteIncinerator
|
|||
public WasteIncineratorTileEntity(TileEntityType<?> te_type)
|
||||
{ super(te_type); reset(); }
|
||||
|
||||
public CompoundNBT reset_getnbt()
|
||||
{
|
||||
CompoundNBT nbt = new CompoundNBT();
|
||||
writenbt(nbt);
|
||||
reset();
|
||||
return nbt;
|
||||
}
|
||||
public CompoundNBT getnbt()
|
||||
{ return writenbt(new CompoundNBT()); }
|
||||
|
||||
protected void reset()
|
||||
{
|
||||
|
@ -238,10 +234,11 @@ public class EdWasteIncinerator
|
|||
energy_stored_ = compound.getInt("Energy");
|
||||
}
|
||||
|
||||
protected void writenbt(CompoundNBT compound)
|
||||
protected CompoundNBT writenbt(CompoundNBT nbt)
|
||||
{
|
||||
compound.putInt("Energy", MathHelper.clamp(energy_stored_,0 , MAX_ENERGY_BUFFER));
|
||||
ItemStackHelper.saveAllItems(compound, stacks_);
|
||||
nbt.putInt("Energy", MathHelper.clamp(energy_stored_,0 , MAX_ENERGY_BUFFER));
|
||||
ItemStackHelper.saveAllItems(nbt, stacks_);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
// TileEntity ------------------------------------------------------------------------------
|
||||
|
@ -252,7 +249,7 @@ public class EdWasteIncinerator
|
|||
|
||||
@Override
|
||||
public CompoundNBT write(CompoundNBT nbt)
|
||||
{ super.write(nbt); writenbt(nbt); return nbt; }
|
||||
{ super.write(nbt); return writenbt(nbt); }
|
||||
|
||||
@Override
|
||||
public void remove()
|
||||
|
|
|
@ -20,7 +20,6 @@ import net.minecraft.state.DirectionProperty;
|
|||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.world.IWorld;
|
||||
|
@ -29,7 +28,6 @@ import net.minecraft.world.server.ServerWorld;
|
|||
import net.minecraft.loot.LootParameters;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
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;
|
||||
|
@ -102,26 +100,13 @@ public class StandardBlocks
|
|||
|
||||
public static class BaseBlock extends Block implements IStandardBlock
|
||||
{
|
||||
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
|
||||
public final long config;
|
||||
private final VoxelShape vshape;
|
||||
|
||||
public BaseBlock(long conf, Block.Properties properties)
|
||||
{ this(conf, properties, Auxiliaries.getPixeledAABB(0, 0, 0, 16, 16,16 )); }
|
||||
|
||||
public BaseBlock(long conf, Block.Properties properties, AxisAlignedBB aabb)
|
||||
{ this(conf, properties, VoxelShapes.create(aabb)); }
|
||||
|
||||
public BaseBlock(long conf, Block.Properties properties, AxisAlignedBB[] aabbs)
|
||||
{ this(conf, properties, Arrays.stream(aabbs).map(aabb->VoxelShapes.create(aabb)).reduce(VoxelShapes.empty(), (shape, aabb)->VoxelShapes.combine(shape, aabb, IBooleanFunction.OR))); }
|
||||
|
||||
public BaseBlock(long conf, Block.Properties properties, VoxelShape voxel_shape)
|
||||
{
|
||||
super(properties);
|
||||
config = conf;
|
||||
vshape = voxel_shape;
|
||||
BlockState state = getStateContainer().getBaseState();
|
||||
if((conf & CFG_WATERLOGGABLE)!=0) state = state.with(WATERLOGGED, false);
|
||||
setDefaultState(state);
|
||||
}
|
||||
|
||||
|
@ -129,16 +114,6 @@ public class StandardBlocks
|
|||
public long config()
|
||||
{ return config; }
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
|
||||
{ return ActionResultType.PASS; }
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void tick(BlockState state, ServerWorld world, BlockPos pos, Random rnd)
|
||||
{}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(ItemStack stack, @Nullable IBlockReader world, List<ITextComponent> tooltip, ITooltipFlag flag)
|
||||
|
@ -148,42 +123,11 @@ public class StandardBlocks
|
|||
public RenderTypeHint getRenderTypeHint()
|
||||
{ return getRenderTypeHint(config); }
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public VoxelShape getShape(BlockState state, IBlockReader source, BlockPos pos, ISelectionContext selectionContext)
|
||||
{ return vshape; }
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public VoxelShape getCollisionShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext selectionContext)
|
||||
{ return vshape; }
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean allowsMovement(BlockState state, IBlockReader world, BlockPos pos, PathType type)
|
||||
{ return ((config & CFG_AI_PASSABLE)==0) ? false : super.allowsMovement(state, world, pos, type); }
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context)
|
||||
{
|
||||
BlockState state = super.getStateForPlacement(context);
|
||||
if((config & CFG_WATERLOGGABLE)!=0) {
|
||||
FluidState fs = context.getWorld().getFluidState(context.getPos());
|
||||
state = state.with(WATERLOGGED,fs.getFluid()==Fluids.WATER);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSpawnInBlock()
|
||||
{ return false; }
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public PushReaction getPushReaction(BlockState state)
|
||||
{ return PushReaction.NORMAL; }
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void onReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean isMoving)
|
||||
|
@ -205,6 +149,61 @@ public class StandardBlocks
|
|||
boolean is_explosion = (explosion_radius!=null) && (explosion_radius > 0);
|
||||
return dropList(state, world, te, is_explosion);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Cutout extends BaseBlock implements IStandardBlock
|
||||
{
|
||||
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
|
||||
private final VoxelShape vshape;
|
||||
|
||||
public Cutout(long conf, Block.Properties properties)
|
||||
{ this(conf, properties, Auxiliaries.getPixeledAABB(0, 0, 0, 16, 16,16 )); }
|
||||
|
||||
public Cutout(long conf, Block.Properties properties, AxisAlignedBB aabb)
|
||||
{ this(conf, properties, VoxelShapes.create(aabb)); }
|
||||
|
||||
public Cutout(long conf, Block.Properties properties, AxisAlignedBB[] aabbs)
|
||||
{ this(conf, properties, Arrays.stream(aabbs).map(aabb->VoxelShapes.create(aabb)).reduce(VoxelShapes.empty(), (shape, aabb)->VoxelShapes.combine(shape, aabb, IBooleanFunction.OR))); }
|
||||
|
||||
public Cutout(long conf, Block.Properties properties, VoxelShape voxel_shape)
|
||||
{
|
||||
super(conf, properties);
|
||||
vshape = voxel_shape;
|
||||
BlockState state = getStateContainer().getBaseState();
|
||||
if((conf & CFG_WATERLOGGABLE)!=0) state = state.with(WATERLOGGED, false);
|
||||
setDefaultState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public VoxelShape getShape(BlockState state, IBlockReader source, BlockPos pos, ISelectionContext selectionContext)
|
||||
{ return vshape; }
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public VoxelShape getCollisionShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext selectionContext)
|
||||
{ return vshape; }
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context)
|
||||
{
|
||||
BlockState state = super.getStateForPlacement(context);
|
||||
if((config & CFG_WATERLOGGABLE)!=0) {
|
||||
FluidState fs = context.getWorld().getFluidState(context.getPos());
|
||||
state = state.with(WATERLOGGED,fs.getFluid()==Fluids.WATER);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSpawnInBlock()
|
||||
{ return false; }
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public PushReaction getPushReaction(BlockState state)
|
||||
{ return PushReaction.NORMAL; }
|
||||
|
||||
@Override
|
||||
public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos)
|
||||
|
@ -236,7 +235,7 @@ public class StandardBlocks
|
|||
}
|
||||
}
|
||||
|
||||
public static class WaterLoggable extends BaseBlock implements IWaterLoggable, IStandardBlock
|
||||
public static class WaterLoggable extends Cutout implements IWaterLoggable, IStandardBlock
|
||||
{
|
||||
public WaterLoggable(long config, Block.Properties properties)
|
||||
{ super(config|CFG_WATERLOGGABLE, properties); }
|
||||
|
@ -255,7 +254,7 @@ public class StandardBlocks
|
|||
{ super.fillStateContainer(builder); builder.add(WATERLOGGED); }
|
||||
}
|
||||
|
||||
public static class Directed extends BaseBlock implements IStandardBlock
|
||||
public static class Directed extends Cutout implements IStandardBlock
|
||||
{
|
||||
public static final DirectionProperty FACING = DirectionalBlock.FACING;
|
||||
protected final ArrayList<VoxelShape> vshapes;
|
||||
|
@ -330,7 +329,7 @@ public class StandardBlocks
|
|||
}
|
||||
}
|
||||
|
||||
public static class Horizontal extends BaseBlock implements IStandardBlock
|
||||
public static class Horizontal extends Cutout implements IStandardBlock
|
||||
{
|
||||
public static final DirectionProperty HORIZONTAL_FACING = HorizontalBlock.HORIZONTAL_FACING;
|
||||
protected final ArrayList<VoxelShape> vshapes;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"variants": {
|
||||
"": [ { "model": "engineersdecor:block/roof/dark_shingle_roof_block_model" } ]
|
||||
"": { "model": "engineersdecor:block/roof/dark_shingle_roof_block_model" }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
{
|
||||
"variants": {
|
||||
"": [
|
||||
{ "model": "engineersdecor:block/roof/dark_shingle_roof_chimney_model" }
|
||||
]
|
||||
"": { "model": "engineersdecor:block/roof/dark_shingle_roof_chimney_model" }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,17 +3,14 @@
|
|||
"facing=south,open=false,powered=false": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_closed", "y":180 },
|
||||
"facing=west,open=false,powered=false": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_closed", "y":270 },
|
||||
"facing=east,open=false,powered=false": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_closed", "y":90 },
|
||||
|
||||
"facing=north,open=true,powered=false": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_open" },
|
||||
"facing=south,open=true,powered=false": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_open", "y":180 },
|
||||
"facing=west,open=true,powered=false": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_open", "y":270 },
|
||||
"facing=east,open=true,powered=false": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_open", "y":90 },
|
||||
|
||||
"facing=north,open=false,powered=true": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_closed" },
|
||||
"facing=south,open=false,powered=true": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_closed", "y":180 },
|
||||
"facing=west,open=false,powered=true": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_closed", "y":270 },
|
||||
"facing=east,open=false,powered=true": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_closed", "y":90 },
|
||||
|
||||
"facing=north,open=true,powered=true": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_open" },
|
||||
"facing=south,open=true,powered=true": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_open", "y":180 },
|
||||
"facing=west,open=true,powered=true": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_open", "y":270 },
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
"facing=east,half=upper,hinge=left,open=true": { "model": "engineersdecor:block/door/metal_sliding_door_model_top_open" , "y": 270 },
|
||||
"facing=east,half=upper,hinge=right,open=false": { "model": "engineersdecor:block/door/metal_sliding_door_model_top_closed" , "y": 90 },
|
||||
"facing=east,half=upper,hinge=right,open=true": { "model": "engineersdecor:block/door/metal_sliding_door_model_top_open" , "y": 90 },
|
||||
|
||||
"facing=north,half=lower,hinge=left,open=false": { "model": "engineersdecor:block/door/metal_sliding_door_model_bottom_closed", "y": 180 },
|
||||
"facing=north,half=lower,hinge=left,open=true": { "model": "engineersdecor:block/door/metal_sliding_door_model_bottom_open" , "y": 180 },
|
||||
"facing=north,half=lower,hinge=right,open=false":{ "model": "engineersdecor:block/door/metal_sliding_door_model_bottom_closed", "y": 0 },
|
||||
|
@ -16,7 +15,6 @@
|
|||
"facing=north,half=upper,hinge=left,open=true": { "model": "engineersdecor:block/door/metal_sliding_door_model_top_open" , "y": 180 },
|
||||
"facing=north,half=upper,hinge=right,open=false":{ "model": "engineersdecor:block/door/metal_sliding_door_model_top_closed" , "y": 0 },
|
||||
"facing=north,half=upper,hinge=right,open=true": { "model": "engineersdecor:block/door/metal_sliding_door_model_top_open" , "y": 0 },
|
||||
|
||||
"facing=south,half=lower,hinge=left,open=false": { "model": "engineersdecor:block/door/metal_sliding_door_model_bottom_closed", "y": 0 },
|
||||
"facing=south,half=lower,hinge=left,open=true": { "model": "engineersdecor:block/door/metal_sliding_door_model_bottom_open" , "y": 0 },
|
||||
"facing=south,half=lower,hinge=right,open=false":{ "model": "engineersdecor:block/door/metal_sliding_door_model_bottom_closed", "y": 180 },
|
||||
|
@ -25,7 +23,6 @@
|
|||
"facing=south,half=upper,hinge=left,open=true": { "model": "engineersdecor:block/door/metal_sliding_door_model_top_open" , "y": 0 },
|
||||
"facing=south,half=upper,hinge=right,open=false":{ "model": "engineersdecor:block/door/metal_sliding_door_model_top_closed" , "y": 180 },
|
||||
"facing=south,half=upper,hinge=right,open=true": { "model": "engineersdecor:block/door/metal_sliding_door_model_top_open" , "y": 180 },
|
||||
|
||||
"facing=west,half=lower,hinge=left,open=false": { "model": "engineersdecor:block/door/metal_sliding_door_model_bottom_closed", "y": 90 },
|
||||
"facing=west,half=lower,hinge=left,open=true": { "model": "engineersdecor:block/door/metal_sliding_door_model_bottom_open" , "y": 90 },
|
||||
"facing=west,half=lower,hinge=right,open=false": { "model": "engineersdecor:block/door/metal_sliding_door_model_bottom_closed", "y": 270 },
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
"facing=west,open=true,segment=0": { "model": "engineersdecor:block/fence/steel_mesh_fence_gate_bottom_model_open", "y":270 },
|
||||
"facing=east,open=false,segment=0": { "model": "engineersdecor:block/fence/steel_mesh_fence_gate_bottom_model" , "y":90 },
|
||||
"facing=east,open=true,segment=0": { "model": "engineersdecor:block/fence/steel_mesh_fence_gate_bottom_model_open", "y":90 },
|
||||
|
||||
"facing=north,open=false,segment=1": { "model": "engineersdecor:block/fence/steel_mesh_fence_gate_top_model" },
|
||||
"facing=north,open=true,segment=1": { "model": "engineersdecor:block/fence/steel_mesh_fence_gate_top_model_open" },
|
||||
"facing=south,open=false,segment=1": { "model": "engineersdecor:block/fence/steel_mesh_fence_gate_top_model" , "y":180 },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue