Pole and T-Support directional auto placement added (issue #139). Door shapes improved. Crafting Table JEI slot count fixed. Window placement handling improved.

This commit is contained in:
stfwi 2020-12-05 13:45:19 +01:00
parent ed30ee49df
commit 552acd6baa
33 changed files with 244 additions and 93 deletions

View file

@ -2,7 +2,7 @@
org.gradle.daemon=false org.gradle.daemon=false
org.gradle.jvmargs=-Xmx8G org.gradle.jvmargs=-Xmx8G
version_minecraft=1.16.4 version_minecraft=1.16.4
version_forge_minecraft=1.16.4-35.0.2 version_forge_minecraft=1.16.4-35.1.10
version_fml_mappings=20201028-1.16.3 version_fml_mappings=20201028-1.16.3
version_jei=1.16.4:7.6.0.58 version_jei=1.16.4:7.6.0.58
version_engineersdecor=1.1.4 version_engineersdecor=1.1.5

View file

@ -1,6 +1,7 @@
{ {
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/", "homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
"1.16.4": { "1.16.4": {
"1.1.5": "[F] Fixed Crafting Table JEI storage slot count.\n[F] Fixed Factory Hopper removed item collection dupe bug (issue #146, thx FatheredPuma81).\n[F] Increased device GUI access ranges beyond the player block selection range.\n[A] Window placement handling improved.\n[M] Steel/Wood Pole and Double-T support placement improved (issue #139, thx Biviho).\n[M] Metal Sliding Door bottom/top shape when opened added.",
"1.1.4": "[R] Release build v1.1.4.\n[F] Solar Panel balancing threshold tuned.\n[F] Fixed Catwalk default state (issue #140, thx hvdklauw).\n[M] Updated lang ru_ru file (PR#137, Smollet777).\n[M] Factory Dropper: Added Ignore-External-Redstone mode.", "1.1.4": "[R] Release build v1.1.4.\n[F] Solar Panel balancing threshold tuned.\n[F] Fixed Catwalk default state (issue #140, thx hvdklauw).\n[M] Updated lang ru_ru file (PR#137, Smollet777).\n[M] Factory Dropper: Added Ignore-External-Redstone mode.",
"1.1.4-b2": "[A] Steel Catwalks added (top and bottom aligned).\n[A] Steel Railings added.\n[F] Fixed Empty Fluid Barrel crafting crash (ty inflamedsebi).\n[A] Added Solar Panel power balancing.\n[M] GUI Button tooltip delay reduced to 800ms.\n[M] Hopper and Placer: Added \"Redstone ignored\" mode, changed icons from signal-like to Redstone-Torch-like.\n[M] Treated Wood Ladder now crafted from Old Industrial Wood, as Treated Wood Sticks now count as normal Sticks.", "1.1.4-b2": "[A] Steel Catwalks added (top and bottom aligned).\n[A] Steel Railings added.\n[F] Fixed Empty Fluid Barrel crafting crash (ty inflamedsebi).\n[A] Added Solar Panel power balancing.\n[M] GUI Button tooltip delay reduced to 800ms.\n[M] Hopper and Placer: Added \"Redstone ignored\" mode, changed icons from signal-like to Redstone-Torch-like.\n[M] Treated Wood Ladder now crafted from Old Industrial Wood, as Treated Wood Sticks now count as normal Sticks.",
"1.1.4-b1": "[U] Ported to 1.16.4.", "1.1.4-b1": "[U] Ported to 1.16.4.",
@ -19,7 +20,7 @@
"1.1.2-b1": "[U] Ported to MC1.16.2." "1.1.2-b1": "[U] Ported to MC1.16.2."
}, },
"promos": { "promos": {
"1.16.4-recommended": "1.1.4", "1.16.4-recommended": "1.1.5",
"1.16.4-latest": "1.1.4" "1.16.4-latest": "1.1.5"
} }
} }

View file

@ -11,6 +11,13 @@ Mod sources for Minecraft version 1.16.x.
## Version history ## Version history
- v1.1.5 [F] Fixed Crafting Table JEI storage slot count.
[F] Fixed Factory Hopper removed item collection dupe bug (issue #146, thx FatheredPuma81).
[F] Increased device GUI access ranges beyond the player block selection range.
[A] Window placement handling improved.
[M] Steel/Wood Pole and Double-T support placement improved (issue #139, thx Biviho).
[M] Metal Sliding Door bottom/top shape when opened added.
- v1.1.4 [R] Release build v1.1.4. - v1.1.4 [R] Release build v1.1.4.
[F] Solar Panel balancing threshold tuned. [F] Solar Panel balancing threshold tuned.
[F] Fixed Catwalk default state (issue #140, thx hvdklauw). [F] Fixed Catwalk default state (issue #140, thx hvdklauw).

View file

@ -311,8 +311,20 @@ public class ModContent
public static final EdDoorBlock METAL_SLIDING_DOOR = (EdDoorBlock)(new EdDoorBlock( public static final EdDoorBlock METAL_SLIDING_DOOR = (EdDoorBlock)(new EdDoorBlock(
DecorBlock.CFG_TRANSLUCENT|DecorBlock.CFG_HORIZIONTAL, DecorBlock.CFG_TRANSLUCENT|DecorBlock.CFG_HORIZIONTAL,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1.5f, 12f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1.5f, 12f).sound(SoundType.METAL).notSolid(),
Auxiliaries.getPixeledAABB(15,0,7, 16,16,9), new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB( 0,0,7, 16,16,9), Auxiliaries.getPixeledAABB(15, 0.0,6, 16,16.0,10),
Auxiliaries.getPixeledAABB( 0,15.5,6, 16,16.0,10),
},
new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(15, 0.0,6, 16,16.0,10),
Auxiliaries.getPixeledAABB( 0, 0.0,6, 16, 0.3,10),
},
new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB( 0,0,7, 16,16,9)
},
new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB( 0,0,7, 16,16,9)
},
SoundEvents.BLOCK_IRON_DOOR_OPEN, SoundEvents.BLOCK_IRON_DOOR_CLOSE SoundEvents.BLOCK_IRON_DOOR_OPEN, SoundEvents.BLOCK_IRON_DOOR_CLOSE
)).setRegistryName(new ResourceLocation(MODID, "metal_sliding_door")); )).setRegistryName(new ResourceLocation(MODID, "metal_sliding_door"));
@ -342,6 +354,8 @@ public class ModContent
public static final EdDoorBlock OLD_INDUSTRIAL_WOOD_DOOR = (EdDoorBlock)(new EdDoorBlock( public static final EdDoorBlock OLD_INDUSTRIAL_WOOD_DOOR = (EdDoorBlock)(new EdDoorBlock(
DecorBlock.CFG_DEFAULT, DecorBlock.CFG_DEFAULT,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1.5f, 12f).sound(SoundType.WOOD).notSolid(), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1.5f, 12f).sound(SoundType.WOOD).notSolid(),
Auxiliaries.getPixeledAABB(15,0, 0, 16,16,16),
Auxiliaries.getPixeledAABB( 0,0,13, 16,16,16),
SoundEvents.BLOCK_WOODEN_DOOR_OPEN, SoundEvents.BLOCK_WOODEN_DOOR_CLOSE SoundEvents.BLOCK_WOODEN_DOOR_OPEN, SoundEvents.BLOCK_WOODEN_DOOR_CLOSE
)).setRegistryName(new ResourceLocation(MODID, "old_industrial_wood_door")); )).setRegistryName(new ResourceLocation(MODID, "old_industrial_wood_door"));
@ -444,14 +458,13 @@ public class ModContent
public static final EdWindowBlock TREATED_WOOD_WINDOW = (EdWindowBlock)(new EdWindowBlock( public static final EdWindowBlock TREATED_WOOD_WINDOW = (EdWindowBlock)(new EdWindowBlock(
DecorBlock.CFG_LOOK_PLACEMENT, DecorBlock.CFG_LOOK_PLACEMENT,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f) Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD).notSolid(),
.sound(SoundType.GLASS).notSolid().setBlocksVision((s,w,p)->false),
Auxiliaries.getPixeledAABB(0,0,7, 16,16,9) Auxiliaries.getPixeledAABB(0,0,7, 16,16,9)
)).setRegistryName(new ResourceLocation(MODID, "treated_wood_window")); )).setRegistryName(new ResourceLocation(MODID, "treated_wood_window"));
public static final EdWindowBlock STEEL_FRAMED_WINDOW = (EdWindowBlock)(new EdWindowBlock( public static final EdWindowBlock STEEL_FRAMED_WINDOW = (EdWindowBlock)(new EdWindowBlock(
DecorBlock.CFG_LOOK_PLACEMENT, DecorBlock.CFG_LOOK_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.GLASS).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
Auxiliaries.getPixeledAABB(0,0,7.5, 16,16,8.5) Auxiliaries.getPixeledAABB(0,0,7.5, 16,16,8.5)
)).setRegistryName(new ResourceLocation(MODID, "steel_framed_window")); )).setRegistryName(new ResourceLocation(MODID, "steel_framed_window"));
@ -460,43 +473,50 @@ public class ModContent
public static final EdStraightPoleBlock TREATED_WOOD_POLE = (EdStraightPoleBlock)(new EdStraightPoleBlock( public static final EdStraightPoleBlock TREATED_WOOD_POLE = (EdStraightPoleBlock)(new EdStraightPoleBlock(
DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD).notSolid(), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD).notSolid(),
Auxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16) Auxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16),
null
)).setRegistryName(new ResourceLocation(MODID, "treated_wood_pole")); )).setRegistryName(new ResourceLocation(MODID, "treated_wood_pole"));
public static final EdStraightPoleBlock TREATED_WOOD_POLE_HEAD = (EdStraightPoleBlock)(new EdStraightPoleBlock( public static final EdStraightPoleBlock TREATED_WOOD_POLE_HEAD = (EdStraightPoleBlock)(new EdStraightPoleBlock(
DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD).notSolid(), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD).notSolid(),
Auxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16) Auxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16),
TREATED_WOOD_POLE
)).setRegistryName(new ResourceLocation(MODID, "treated_wood_pole_head")); )).setRegistryName(new ResourceLocation(MODID, "treated_wood_pole_head"));
public static final EdStraightPoleBlock TREATED_WOOD_POLE_SUPPORT = (EdStraightPoleBlock)(new EdStraightPoleBlock( public static final EdStraightPoleBlock TREATED_WOOD_POLE_SUPPORT = (EdStraightPoleBlock)(new EdStraightPoleBlock(
DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD).notSolid(), Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 15f).sound(SoundType.WOOD).notSolid(),
Auxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16) Auxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16),
TREATED_WOOD_POLE
)).setRegistryName(new ResourceLocation(MODID, "treated_wood_pole_support")); )).setRegistryName(new ResourceLocation(MODID, "treated_wood_pole_support"));
public static final EdStraightPoleBlock THIN_STEEL_POLE = (EdStraightPoleBlock)(new EdStraightPoleBlock( public static final EdStraightPoleBlock THIN_STEEL_POLE = (EdStraightPoleBlock)(new EdStraightPoleBlock(
DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
Auxiliaries.getPixeledAABB(6,6,0, 10,10,16) Auxiliaries.getPixeledAABB(6,6,0, 10,10,16),
null
)).setRegistryName(new ResourceLocation(MODID, "thin_steel_pole")); )).setRegistryName(new ResourceLocation(MODID, "thin_steel_pole"));
public static final EdStraightPoleBlock THIN_STEEL_POLE_HEAD = (EdStraightPoleBlock)(new EdStraightPoleBlock( public static final EdStraightPoleBlock THIN_STEEL_POLE_HEAD = (EdStraightPoleBlock)(new EdStraightPoleBlock(
DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
Auxiliaries.getPixeledAABB(6,6,0, 10,10,16) Auxiliaries.getPixeledAABB(6,6,0, 10,10,16),
THIN_STEEL_POLE
)).setRegistryName(new ResourceLocation(MODID, "thin_steel_pole_head")); )).setRegistryName(new ResourceLocation(MODID, "thin_steel_pole_head"));
public static final EdStraightPoleBlock THICK_STEEL_POLE = (EdStraightPoleBlock)(new EdStraightPoleBlock( public static final EdStraightPoleBlock THICK_STEEL_POLE = (EdStraightPoleBlock)(new EdStraightPoleBlock(
DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
Auxiliaries.getPixeledAABB(5,5,0, 11,11,16) Auxiliaries.getPixeledAABB(5,5,0, 11,11,16),
null
)).setRegistryName(new ResourceLocation(MODID, "thick_steel_pole")); )).setRegistryName(new ResourceLocation(MODID, "thick_steel_pole"));
public static final EdStraightPoleBlock THICK_STEEL_POLE_HEAD = (EdStraightPoleBlock)(new EdStraightPoleBlock( public static final EdStraightPoleBlock THICK_STEEL_POLE_HEAD = (EdStraightPoleBlock)(new EdStraightPoleBlock(
DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME, DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(), Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
Auxiliaries.getPixeledAABB(5,5,0, 11,11,16) Auxiliaries.getPixeledAABB(5,5,0, 11,11,16),
THICK_STEEL_POLE
)).setRegistryName(new ResourceLocation(MODID, "thick_steel_pole_head")); )).setRegistryName(new ResourceLocation(MODID, "thick_steel_pole_head"));
public static final EdHorizontalSupportBlock STEEL_DOUBLE_T_SUPPORT = (EdHorizontalSupportBlock)(new EdHorizontalSupportBlock( public static final EdHorizontalSupportBlock STEEL_DOUBLE_T_SUPPORT = (EdHorizontalSupportBlock)(new EdHorizontalSupportBlock(

View file

@ -124,9 +124,10 @@ public class EdBreaker
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
{ {
if(world.isRemote()) return ActionResultType.SUCCESS;
TileEntity te = world.getTileEntity(pos); TileEntity te = world.getTileEntity(pos);
if(te instanceof BreakerTileEntity) ((BreakerTileEntity)te).state_message(player); if(te instanceof BreakerTileEntity) ((BreakerTileEntity)te).state_message(player);
return ActionResultType.SUCCESS; return ActionResultType.CONSUME;
} }
} }

View file

@ -57,8 +57,9 @@ public class EdChair
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{ {
if(!sitting_enabled) return ActionResultType.PASS; if(!sitting_enabled) return ActionResultType.PASS;
if(!world.isRemote) EntityChair.sit(world, player, pos); if(world.isRemote()) return ActionResultType.SUCCESS;
return ActionResultType.SUCCESS; EntityChair.sit(world, player, pos);
return ActionResultType.CONSUME;
} }
@Override @Override

View file

@ -57,7 +57,7 @@ public class EdChimneyBlock extends DecorBlock.Normal implements IDecorBlock
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{ world.setBlockState(pos, state.with(POWER, (state.get(POWER)+1) & 0xf), 1|2); return ActionResultType.SUCCESS; } { world.setBlockState(pos, state.with(POWER, (state.get(POWER)+1) & 0xf), 1|2); return ActionResultType.func_233537_a_(world.isRemote()); }
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")

View file

@ -99,12 +99,12 @@ public class EdCraftingTable
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{ {
if(world.isRemote) return ActionResultType.SUCCESS; if(world.isRemote()) return ActionResultType.SUCCESS;
final TileEntity te = world.getTileEntity(pos); final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof CraftingTableTileEntity)) return ActionResultType.FAIL; if(!(te instanceof CraftingTableTileEntity)) return ActionResultType.FAIL;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL; if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te); NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
return ActionResultType.SUCCESS; return ActionResultType.CONSUME;
} }
@Override @Override
@ -283,7 +283,7 @@ public class EdCraftingTable
@Override @Override
public boolean isUsableByPlayer(PlayerEntity player) public boolean isUsableByPlayer(PlayerEntity player)
{ return getPos().distanceSq(player.getPosition()) < 36; } { return ((getWorld().getTileEntity(getPos()) == this)) && (getPos().distanceSq(player.getPosition()) < 64); }
@Override @Override
public void openInventory(PlayerEntity player) public void openInventory(PlayerEntity player)

View file

@ -16,6 +16,9 @@ import wile.engineersdecor.libmc.blocks.StandardDoorBlock;
public class EdDoorBlock extends StandardDoorBlock implements IDecorBlock public class EdDoorBlock extends StandardDoorBlock implements IDecorBlock
{ {
public EdDoorBlock(long config, Block.Properties properties, AxisAlignedBB[] open_aabbs_top, AxisAlignedBB[] open_aabbs_bottom, AxisAlignedBB[] closed_aabbs_top, AxisAlignedBB[] closed_aabbs_bottom, SoundEvent open_sound, SoundEvent close_sound)
{ super(config, properties, open_aabbs_top, open_aabbs_bottom, closed_aabbs_top, closed_aabbs_bottom, open_sound, close_sound); }
public EdDoorBlock(long config, Block.Properties properties, AxisAlignedBB open_aabb, AxisAlignedBB closed_aabb, SoundEvent open_sound, SoundEvent close_sound) public EdDoorBlock(long config, Block.Properties properties, AxisAlignedBB open_aabb, AxisAlignedBB closed_aabb, SoundEvent open_sound, SoundEvent close_sound)
{ super(config, properties, open_aabb, closed_aabb, open_sound, close_sound); } { super(config, properties, open_aabb, closed_aabb, open_sound, close_sound); }
@ -24,4 +27,9 @@ public class EdDoorBlock extends StandardDoorBlock implements IDecorBlock
public EdDoorBlock(long config, Block.Properties properties) public EdDoorBlock(long config, Block.Properties properties)
{ super(config, properties); } { super(config, properties); }
//@Override
//@SuppressWarnings("deprecation")
//public VoxelShape getCollisionShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext context)
//{ return state.get(OPEN) ? VoxelShapes.empty() : super.getCollisionShape(state, world, pos, context); }
} }

View file

@ -81,7 +81,7 @@ public class EdDoubleGateBlock extends DecorBlock.HorizontalWaterLoggable implem
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{ {
if((rayTraceResult.getFace()==Direction.UP) || (rayTraceResult.getFace()==Direction.DOWN) && (player.getHeldItem(hand).getItem()==this.asItem())) return ActionResultType.PASS; if((rayTraceResult.getFace()==Direction.UP) || (rayTraceResult.getFace()==Direction.DOWN) && (player.getHeldItem(hand).getItem()==this.asItem())) return ActionResultType.PASS;
if(world.isRemote) return ActionResultType.SUCCESS; if(world.isRemote()) return ActionResultType.SUCCESS;
final boolean open = !state.get(OPEN); final boolean open = !state.get(OPEN);
world.setBlockState(pos, state.with(OPEN, open),2|8|16); world.setBlockState(pos, state.with(OPEN, open),2|8|16);
if(state.get(SEGMENT) == SEGMENT_UPPER) { if(state.get(SEGMENT) == SEGMENT_UPPER) {
@ -92,7 +92,7 @@ public class EdDoubleGateBlock extends DecorBlock.HorizontalWaterLoggable implem
if(adjacent.getBlock()==this) world.setBlockState(pos.up(), adjacent.with(OPEN, open), 2|8|16); if(adjacent.getBlock()==this) world.setBlockState(pos.up(), adjacent.with(OPEN, open), 2|8|16);
} }
world.playSound(null, pos, open?SoundEvents.BLOCK_IRON_DOOR_OPEN:SoundEvents.BLOCK_IRON_DOOR_CLOSE, SoundCategory.BLOCKS, 0.7f, 1.4f); world.playSound(null, pos, open?SoundEvents.BLOCK_IRON_DOOR_OPEN:SoundEvents.BLOCK_IRON_DOOR_CLOSE, SoundCategory.BLOCKS, 0.7f, 1.4f);
return ActionResultType.SUCCESS; return ActionResultType.CONSUME;
} }
@Override @Override

View file

@ -169,12 +169,12 @@ public class EdDropper
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{ {
if(world.isRemote) return ActionResultType.SUCCESS; if(world.isRemote()) return ActionResultType.SUCCESS;
final TileEntity te = world.getTileEntity(pos); final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof EdDropper.DropperTileEntity)) return ActionResultType.FAIL; if(!(te instanceof EdDropper.DropperTileEntity)) return ActionResultType.FAIL;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL; if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te); NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
return ActionResultType.SUCCESS; return ActionResultType.CONSUME;
} }
@Override @Override
@ -405,7 +405,7 @@ public class EdDropper
@Override @Override
public boolean isUsableByPlayer(PlayerEntity player) public boolean isUsableByPlayer(PlayerEntity player)
{ return getPos().distanceSq(player.getPosition()) < 36; } { return ((getWorld().getTileEntity(getPos()) == this)) && (getPos().distanceSq(player.getPosition()) < 64); }
@Override @Override
public void openInventory(PlayerEntity player) public void openInventory(PlayerEntity player)

View file

@ -81,13 +81,13 @@ public class EdElectricalFurnace
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{ {
if(world.isRemote) return ActionResultType.SUCCESS; if(world.isRemote()) return ActionResultType.SUCCESS;
final TileEntity te = world.getTileEntity(pos); final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof EdElectricalFurnace.ElectricalFurnaceTileEntity)) return ActionResultType.FAIL; if(!(te instanceof EdElectricalFurnace.ElectricalFurnaceTileEntity)) return ActionResultType.FAIL;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL; if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te); NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
player.addStat(Stats.INTERACT_WITH_FURNACE); player.addStat(Stats.INTERACT_WITH_FURNACE);
return ActionResultType.SUCCESS; return ActionResultType.CONSUME;
} }
@Override @Override

View file

@ -187,12 +187,12 @@ public class EdFluidBarrel
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{ {
if(player.getHeldItem(hand).getItem() == asItem()) return ActionResultType.PASS; // Pass that to block placement. if(player.getHeldItem(hand).getItem() == asItem()) return ActionResultType.PASS; // Pass that to block placement.
if(world.isRemote) return ActionResultType.SUCCESS; if(world.isRemote()) return ActionResultType.SUCCESS;
TileEntity te = world.getTileEntity(pos); TileEntity te = world.getTileEntity(pos);
if(!(te instanceof FluidBarrelTileEntity)) return ActionResultType.FAIL; if(!(te instanceof FluidBarrelTileEntity)) return ActionResultType.FAIL;
if(!((FluidBarrelTileEntity)te).handlePlayerInteraction(state, world, pos, player, hand)) return ActionResultType.PASS; if(!((FluidBarrelTileEntity)te).handlePlayerInteraction(state, world, pos, player, hand)) return ActionResultType.PASS;
world.getPendingBlockTicks().scheduleTick(pos, this, 4); world.getPendingBlockTicks().scheduleTick(pos, this, 4);
return ActionResultType.SUCCESS; return ActionResultType.CONSUME;
} }
@Override @Override

View file

@ -146,7 +146,7 @@ public class EdFluidFunnel
if(world.isRemote) return ActionResultType.SUCCESS; if(world.isRemote) return ActionResultType.SUCCESS;
TileEntity te = world.getTileEntity(pos); TileEntity te = world.getTileEntity(pos);
if(!(te instanceof FluidFunnelTileEntity)) return ActionResultType.FAIL; if(!(te instanceof FluidFunnelTileEntity)) return ActionResultType.FAIL;
return FluidUtil.interactWithFluidHandler(player, hand, world, pos, rayTraceResult.getFace()) ? ActionResultType.SUCCESS : ActionResultType.FAIL; return FluidUtil.interactWithFluidHandler(player, hand, world, pos, rayTraceResult.getFace()) ? ActionResultType.CONSUME : ActionResultType.FAIL;
} }
@Override @Override

View file

@ -110,17 +110,17 @@ public class EdFreezer
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{ {
if(player.isSneaking()) return ActionResultType.PASS; if(player.isSneaking()) return ActionResultType.PASS;
if(world.isRemote) return ActionResultType.SUCCESS; if(world.isRemote()) return ActionResultType.SUCCESS;
FreezerTileEntity te = getTe(world, pos); FreezerTileEntity te = getTe(world, pos);
if(te==null) return ActionResultType.FAIL; if(te==null) return ActionResultType.FAIL;
final ItemStack stack = player.getHeldItem(hand); final ItemStack stack = player.getHeldItem(hand);
boolean dirty = false; boolean dirty = false;
if(Fluidics.manualFluidHandlerInteraction(world, pos, null, player, hand)) { if(Fluidics.manualFluidHandlerInteraction(world, pos, null, player, hand)) {
world.playSound(null, pos, SoundEvents.ITEM_BUCKET_EMPTY, SoundCategory.BLOCKS, 0.5f, 1.4f); world.playSound(null, pos, SoundEvents.ITEM_BUCKET_EMPTY, SoundCategory.BLOCKS, 0.5f, 1.4f);
return ActionResultType.SUCCESS; return ActionResultType.CONSUME;
} }
if(stack.getItem()==Items.WATER_BUCKET) { if(stack.getItem()==Items.WATER_BUCKET) {
return ActionResultType.SUCCESS; // would be already handled return ActionResultType.CONSUME; // would be already handled
} else if(stack.isEmpty()) { } else if(stack.isEmpty()) {
ItemStack ice = te.getIceItem(true); ItemStack ice = te.getIceItem(true);
if(!ice.isEmpty()) { if(!ice.isEmpty()) {
@ -129,7 +129,7 @@ public class EdFreezer
} else { } else {
world.playSound(null, pos, SoundEvents.BLOCK_IRON_TRAPDOOR_OPEN, SoundCategory.BLOCKS, 0.2f, 0.02f); world.playSound(null, pos, SoundEvents.BLOCK_IRON_TRAPDOOR_OPEN, SoundCategory.BLOCKS, 0.2f, 0.02f);
} }
return ActionResultType.SUCCESS; return ActionResultType.CONSUME;
} else { } else {
return ActionResultType.PASS; return ActionResultType.PASS;
} }

View file

@ -157,13 +157,13 @@ public class EdFurnace
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{ {
if(world.isRemote) return ActionResultType.SUCCESS; if(world.isRemote()) return ActionResultType.SUCCESS;
final TileEntity te = world.getTileEntity(pos); final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof FurnaceTileEntity)) return ActionResultType.FAIL; if(!(te instanceof FurnaceTileEntity)) return ActionResultType.FAIL;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL; if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te); NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
player.addStat(Stats.INTERACT_WITH_FURNACE); player.addStat(Stats.INTERACT_WITH_FURNACE);
return ActionResultType.SUCCESS; return ActionResultType.CONSUME;
} }
@Override @Override
@ -398,7 +398,7 @@ public class EdFurnace
@Override @Override
public boolean isUsableByPlayer(PlayerEntity player) public boolean isUsableByPlayer(PlayerEntity player)
{ return getPos().distanceSq(player.getPosition()) < 36; } { return ((getWorld().getTileEntity(getPos()) == this)) && (getPos().distanceSq(player.getPosition()) < 64); }
@Override @Override
public void openInventory(PlayerEntity player) public void openInventory(PlayerEntity player)

View file

@ -78,11 +78,11 @@ public class EdHatchBlock extends DecorBlock.HorizontalWaterLoggable implements
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{ {
if(world.isRemote) return ActionResultType.CONSUME; if(world.isRemote()) return ActionResultType.SUCCESS;
boolean open = !state.get(OPEN); boolean open = !state.get(OPEN);
world.setBlockState(pos, state.with(OPEN, open), 1|2); world.setBlockState(pos, state.with(OPEN, open), 1|2);
world.playSound(null, pos, open?SoundEvents.BLOCK_IRON_DOOR_OPEN:SoundEvents.BLOCK_IRON_DOOR_CLOSE, SoundCategory.BLOCKS, 0.7f, 1.4f); world.playSound(null, pos, open?SoundEvents.BLOCK_IRON_DOOR_OPEN:SoundEvents.BLOCK_IRON_DOOR_CLOSE, SoundCategory.BLOCKS, 0.7f, 1.4f);
return ActionResultType.SUCCESS; return ActionResultType.CONSUME;
} }
@Override @Override

View file

@ -146,12 +146,12 @@ public class EdHopper
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{ {
if(world.isRemote) return ActionResultType.SUCCESS; if(world.isRemote()) return ActionResultType.SUCCESS;
final TileEntity te = world.getTileEntity(pos); final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof HopperTileEntity)) return ActionResultType.FAIL; if(!(te instanceof HopperTileEntity)) return ActionResultType.FAIL;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL; if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te); NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
return ActionResultType.SUCCESS; return ActionResultType.CONSUME;
} }
@Override @Override
@ -377,7 +377,7 @@ public class EdHopper
@Override @Override
public boolean isUsableByPlayer(PlayerEntity player) public boolean isUsableByPlayer(PlayerEntity player)
{ return getPos().distanceSq(player.getPosition()) < 36; } { return ((getWorld().getTileEntity(getPos()) == this)) && (getPos().distanceSq(player.getPosition()) < 64); }
@Override @Override
public void openInventory(PlayerEntity player) public void openInventory(PlayerEntity player)
@ -616,20 +616,24 @@ public class EdHopper
rpos = new Vector3d(0.5+pos.getX(),-1.5+pos.getY(),0.5+pos.getZ()); rpos = new Vector3d(0.5+pos.getX(),-1.5+pos.getY(),0.5+pos.getZ());
collection_volume = (new AxisAlignedBB(pos.down(2))).grow(0.1+collection_range_, 1, 0.1+collection_range_); collection_volume = (new AxisAlignedBB(pos.down(2))).grow(0.1+collection_range_, 1, 0.1+collection_range_);
} }
final List<ItemEntity> items = world.getEntitiesWithinAABB(ItemEntity.class, collection_volume); final List<ItemEntity> items = world.getEntitiesWithinAABB(ItemEntity.class, collection_volume, e->(e.isAlive() && e.isOnGround()));
if(items.size() <= 0) return false; if(items.size() <= 0) return false;
final int max_to_collect = 3; final int max_to_collect = 3;
int n_collected = 0; int n_collected = 0;
for(ItemEntity ie:items) { for(ItemEntity ie:items) {
boolean is_direct_collection_tange = ie.getDistanceSq(rpos)<0.7; boolean is_direct_collection_tange = ie.getDistanceSq(rpos)<0.7;
if(!is_direct_collection_tange && (ie.cannotPickup() || (!ie.isOnGround()))) continue; if(!is_direct_collection_tange && (ie.cannotPickup())) continue;
ItemStack stack = ie.getItem(); ItemStack stack = ie.getItem();
if(stack.isEmpty()) continue;
int n_accepted = try_insert_into_hopper(stack); int n_accepted = try_insert_into_hopper(stack);
if(n_accepted <= 0) continue; if(n_accepted <= 0) continue;
if(n_accepted == stack.getCount()) { if(n_accepted >= stack.getCount()) {
stack.setCount(0);
ie.setItem(stack);
ie.remove(); ie.remove();
} else { } else {
stack.shrink(n_accepted); stack.shrink(n_accepted);
ie.setItem(stack);
} }
if((!is_direct_collection_tange) && (++n_collected >= max_to_collect)) break; if((!is_direct_collection_tange) && (++n_collected >= max_to_collect)) break;
} }

View file

@ -12,11 +12,15 @@ package wile.engineersdecor.blocks;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.EntitySpawnPlacementRegistry; import net.minecraft.entity.EntitySpawnPlacementRegistry;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.DirectionalPlaceContext;
import net.minecraft.item.ItemStack;
import net.minecraft.state.BooleanProperty; import net.minecraft.state.BooleanProperty;
import net.minecraft.state.IntegerProperty; import net.minecraft.state.IntegerProperty;
import net.minecraft.state.StateContainer; import net.minecraft.state.StateContainer;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.util.math.shapes.IBooleanFunction; import net.minecraft.util.math.shapes.IBooleanFunction;
@ -29,6 +33,7 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import wile.engineersdecor.ModContent; import wile.engineersdecor.ModContent;
import wile.engineersdecor.libmc.detail.Auxiliaries; import wile.engineersdecor.libmc.detail.Auxiliaries;
import wile.engineersdecor.libmc.detail.Inventories;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.HashMap; import java.util.HashMap;
@ -123,10 +128,27 @@ public class EdHorizontalSupportBlock extends DecorBlock.WaterLoggable implement
public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos) public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos)
{ return temp_block_update_until_better(state, world, pos); } { return temp_block_update_until_better(state, world, pos); }
@Deprecated @Override
@SuppressWarnings("deprecation") public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
{ world.setBlockState(pos, temp_block_update_until_better(state, world, pos)); } ItemStack held_stack = player.getHeldItem(hand);
if((held_stack.isEmpty()) || (held_stack.getItem() != this.asItem())) return ActionResultType.PASS;
if(!(hit.getFace().getAxis().isVertical())) return ActionResultType.PASS;
final Direction placement_direction = player.getHorizontalFacing();
final BlockPos adjacent_pos = pos.offset(placement_direction);
final BlockState adjacent = world.getBlockState(adjacent_pos);
final BlockItemUseContext ctx = new DirectionalPlaceContext(world, adjacent_pos, placement_direction, player.getHeldItem(hand), placement_direction.getOpposite());
if(!adjacent.isReplaceable(ctx)) return ActionResultType.func_233537_a_(world.isRemote());
final BlockState new_state = getStateForPlacement(ctx);
if(new_state == null) return ActionResultType.FAIL;
if(!world.setBlockState(adjacent_pos, new_state, 1|2)) return ActionResultType.FAIL;
world.playSound(player, pos, SoundEvents.BLOCK_METAL_PLACE, SoundCategory.BLOCKS, 1f, 1f);
if(!player.isCreative()) {
held_stack.shrink(1);
Inventories.setItemInPlayerHand(player, hand, held_stack);
}
return ActionResultType.func_233537_a_(world.isRemote());
}
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")

View file

@ -149,12 +149,12 @@ public class EdLabeledCrate
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{ {
if(world.isRemote) return ActionResultType.SUCCESS; if(world.isRemote()) return ActionResultType.SUCCESS;
final TileEntity te = world.getTileEntity(pos); final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof LabeledCrateTileEntity)) return ActionResultType.SUCCESS; if(!(te instanceof LabeledCrateTileEntity)) return ActionResultType.FAIL;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.SUCCESS; if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te); NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
return ActionResultType.SUCCESS; return ActionResultType.CONSUME;
} }
@Override @Override
@ -373,7 +373,7 @@ public class EdLabeledCrate
@Override @Override
public boolean isUsableByPlayer(PlayerEntity player) public boolean isUsableByPlayer(PlayerEntity player)
{ return getPos().distanceSq(player.getPosition()) < 36; } { return ((getWorld().getTileEntity(getPos()) == this)) && (getPos().distanceSq(player.getPosition()) < 64); }
@Override @Override
public void openInventory(PlayerEntity player) public void openInventory(PlayerEntity player)

View file

@ -109,16 +109,16 @@ public class EdMilker
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
{ {
if(world.isRemote) return ActionResultType.SUCCESS; if(world.isRemote()) return ActionResultType.SUCCESS;
MilkerTileEntity te = getTe(world, pos); MilkerTileEntity te = getTe(world, pos);
if(te==null) return ActionResultType.FAIL; if(te==null) return ActionResultType.FAIL;
final ItemStack in_stack = player.getHeldItem(hand); final ItemStack in_stack = player.getHeldItem(hand);
final ItemStack out_stack = MilkerTileEntity.milk_filled_container_item(in_stack); final ItemStack out_stack = MilkerTileEntity.milk_filled_container_item(in_stack);
if(in_stack.isEmpty()) { if(in_stack.isEmpty()) {
te.state_message(player); te.state_message(player);
return ActionResultType.SUCCESS; return ActionResultType.CONSUME;
} else if(out_stack.isEmpty() && (te.fluid_handler()!=null)) { } else if(out_stack.isEmpty() && (te.fluid_handler()!=null)) {
return FluidUtil.interactWithFluidHandler(player, hand, te.fluid_handler()) ? ActionResultType.SUCCESS : ActionResultType.FAIL; return FluidUtil.interactWithFluidHandler(player, hand, te.fluid_handler()) ? ActionResultType.CONSUME : ActionResultType.FAIL;
} else { } else {
boolean drained = false; boolean drained = false;
IItemHandler player_inventory = new PlayerMainInvWrapper(player.inventory); IItemHandler player_inventory = new PlayerMainInvWrapper(player.inventory);
@ -141,7 +141,7 @@ public class EdMilker
world.playSound(null, pos, SoundEvents.ITEM_BUCKET_FILL, SoundCategory.BLOCKS, 0.8f, 1f); world.playSound(null, pos, SoundEvents.ITEM_BUCKET_FILL, SoundCategory.BLOCKS, 0.8f, 1f);
} }
} }
return ActionResultType.SUCCESS; return ActionResultType.CONSUME;
} }
@Nullable @Nullable

View file

@ -117,7 +117,7 @@ public class EdMineralSmelter
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{ {
if(player.isSneaking()) return ActionResultType.PASS; if(player.isSneaking()) return ActionResultType.PASS;
if(world.isRemote) return ActionResultType.SUCCESS; if(world.isRemote()) return ActionResultType.SUCCESS;
MineralSmelterTileEntity te = getTe(world, pos); MineralSmelterTileEntity te = getTe(world, pos);
if(te==null) return ActionResultType.FAIL; if(te==null) return ActionResultType.FAIL;
final ItemStack stack = player.getHeldItem(hand); final ItemStack stack = player.getHeldItem(hand);
@ -163,7 +163,7 @@ public class EdMineralSmelter
dirty = true; dirty = true;
} }
if(dirty) player.inventory.markDirty(); if(dirty) player.inventory.markDirty();
return ActionResultType.SUCCESS; return ActionResultType.CONSUME;
} }
@Override @Override
@ -398,7 +398,7 @@ public class EdMineralSmelter
@Override @Override
public boolean isUsableByPlayer(PlayerEntity player) public boolean isUsableByPlayer(PlayerEntity player)
{ return ((world.getTileEntity(pos) == this) && (player.getDistanceSq(pos.getX()+0.5d, pos.getY()+0.5d, pos.getZ()+0.5d) <= 64.0d)); } { return ((getWorld().getTileEntity(getPos()) == this)) && (getPos().distanceSq(player.getPosition()) < 64); }
@Override @Override
public void openInventory(PlayerEntity player) public void openInventory(PlayerEntity player)

View file

@ -143,12 +143,12 @@ public class EdPlacer
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{ {
if(world.isRemote) return ActionResultType.SUCCESS; if(world.isRemote()) return ActionResultType.SUCCESS;
final TileEntity te = world.getTileEntity(pos); final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof PlacerTileEntity)) return ActionResultType.FAIL; if(!(te instanceof PlacerTileEntity)) return ActionResultType.FAIL;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL; if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te); NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
return ActionResultType.SUCCESS; return ActionResultType.CONSUME;
} }
@Override @Override
@ -346,7 +346,7 @@ public class EdPlacer
@Override @Override
public boolean isUsableByPlayer(PlayerEntity player) public boolean isUsableByPlayer(PlayerEntity player)
{ return getPos().distanceSq(player.getPosition()) < 36; } { return ((getWorld().getTileEntity(getPos()) == this)) && (getPos().distanceSq(player.getPosition()) < 64); }
@Override @Override
public void openInventory(PlayerEntity player) public void openInventory(PlayerEntity player)

View file

@ -60,7 +60,7 @@ public class EdRailingBlock extends DecorBlock.HorizontalFourWayWaterLoggable im
{ {
if(player.getHeldItem(hand).getItem() != asItem()) return ActionResultType.PASS; if(player.getHeldItem(hand).getItem() != asItem()) return ActionResultType.PASS;
Direction face = hit.getFace(); Direction face = hit.getFace();
if(!face.getAxis().isHorizontal()) return world.isRemote() ? ActionResultType.SUCCESS : ActionResultType.CONSUME; if(!face.getAxis().isHorizontal()) return ActionResultType.func_233537_a_(world.isRemote());
final Vector3d rhv = hit.getHitVec().subtract(Vector3d.copyCentered(hit.getPos())); final Vector3d rhv = hit.getHitVec().subtract(Vector3d.copyCentered(hit.getPos()));
if(rhv.mul(Vector3d.copy(face.getDirectionVec())).scale(2).lengthSquared() < 0.99) face = face.getOpposite(); // click on railing, not the outer side. if(rhv.mul(Vector3d.copy(face.getDirectionVec())).scale(2).lengthSquared() < 0.99) face = face.getOpposite(); // click on railing, not the outer side.
BooleanProperty railing = getDirectionProperty(face); BooleanProperty railing = getDirectionProperty(face);
@ -72,7 +72,7 @@ public class EdRailingBlock extends DecorBlock.HorizontalFourWayWaterLoggable im
} else { } else {
EdCatwalkBlock.place_consume(state, world, pos, player, hand, add ? 1 : -1); EdCatwalkBlock.place_consume(state, world, pos, player, hand, add ? 1 : -1);
} }
return world.isRemote() ? ActionResultType.SUCCESS : ActionResultType.CONSUME; return ActionResultType.func_233537_a_(world.isRemote());
} }
// -- IDecorBlock // -- IDecorBlock

View file

@ -72,9 +72,10 @@ public class EdSolarPanel
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
{ {
if(world.isRemote()) return ActionResultType.SUCCESS;
TileEntity te = world.getTileEntity(pos); TileEntity te = world.getTileEntity(pos);
if(te instanceof SolarPanelTileEntity) ((SolarPanelTileEntity)te).state_message(player); if(te instanceof SolarPanelTileEntity) ((SolarPanelTileEntity)te).state_message(player);
return ActionResultType.SUCCESS; return ActionResultType.CONSUME;
} }
} }

View file

@ -10,18 +10,29 @@ package wile.engineersdecor.blocks;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItem;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.DirectionalPlaceContext;
import net.minecraft.item.ItemStack;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.util.Direction;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import wile.engineersdecor.libmc.detail.Inventories;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Arrays;
public class EdStraightPoleBlock extends DecorBlock.DirectedWaterLoggable implements IDecorBlock public class EdStraightPoleBlock extends DecorBlock.DirectedWaterLoggable implements IDecorBlock
{ {
public EdStraightPoleBlock(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB) private final EdStraightPoleBlock default_pole;
{ super(config, builder, unrotatedAABB); }
public EdStraightPoleBlock(long config, Block.Properties builder, final AxisAlignedBB unrotatedAABB, @Nullable EdStraightPoleBlock defaultPole)
{ super(config, builder, unrotatedAABB); default_pole=(defaultPole==null) ? (this) : (defaultPole); }
@Override @Override
@Nullable @Nullable
@ -38,4 +49,33 @@ public class EdStraightPoleBlock extends DecorBlock.DirectedWaterLoggable implem
} }
return state; return state;
} }
@Override
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;
final ItemStack held_stack = player.getHeldItem(hand);
if((held_stack.isEmpty()) || (!(held_stack.getItem() instanceof BlockItem))) return ActionResultType.PASS;
if(!(((BlockItem)(held_stack.getItem())).getBlock() instanceof EdStraightPoleBlock)) return ActionResultType.PASS;
if(held_stack.getItem() != default_pole.asItem()) return ActionResultType.func_233537_a_(world.isRemote());
final Block held_block = ((BlockItem)(held_stack.getItem())).getBlock();
final Direction block_direction = state.get(FACING);
final Vector3d block_vec = Vector3d.copy(state.get(FACING).getDirectionVec());
final double colinearity = 1.0-block_vec.crossProduct(player.getLookVec()).length();
final Direction placement_direction = Arrays.stream(Direction.getFacingDirections(player)).filter(d->d.getAxis()==block_direction.getAxis()).findFirst().orElse(Direction.NORTH);
final BlockPos adjacent_pos = pos.offset(placement_direction);
final BlockState adjacent = world.getBlockState(adjacent_pos);
final BlockItemUseContext ctx = new DirectionalPlaceContext(world, adjacent_pos, placement_direction, player.getHeldItem(hand), placement_direction.getOpposite());
if(!adjacent.isReplaceable(ctx)) return ActionResultType.func_233537_a_(world.isRemote());
final BlockState new_state = held_block.getStateForPlacement(ctx);
if(new_state == null) return ActionResultType.FAIL;
if(!world.setBlockState(adjacent_pos, new_state, 1|2)) return ActionResultType.FAIL;
world.playSound(player, pos, SoundEvents.BLOCK_METAL_PLACE, SoundCategory.BLOCKS, 1f, 1f);
if(!player.isCreative()) {
held_stack.shrink(1);
Inventories.setItemInPlayerHand(player, hand, held_stack);
}
return ActionResultType.func_233537_a_(world.isRemote());
}
} }

View file

@ -78,10 +78,11 @@ public class EdTestBlock
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
{ {
if(world.isRemote()) return ActionResultType.SUCCESS;
TileEntity te = world.getTileEntity(pos); TileEntity te = world.getTileEntity(pos);
if(!(te instanceof TestTileEntity)) return ActionResultType.SUCCESS; if(!(te instanceof TestTileEntity)) return ActionResultType.FAIL;
((TestTileEntity)te).activated(player, hand, hit); ((TestTileEntity)te).activated(player, hand, hit);
return ActionResultType.SUCCESS; return ActionResultType.CONSUME;
} }
} }

View file

@ -90,9 +90,10 @@ public class EdTreeCutter
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
{ {
if(world.isRemote()) return ActionResultType.SUCCESS;
TileEntity te = world.getTileEntity(pos); TileEntity te = world.getTileEntity(pos);
if(te instanceof TreeCutterTileEntity) ((TreeCutterTileEntity)te).state_message(player); if(te instanceof TreeCutterTileEntity) ((TreeCutterTileEntity)te).state_message(player);
return ActionResultType.SUCCESS; return ActionResultType.CONSUME;
} }
} }

View file

@ -144,12 +144,12 @@ public class EdWasteIncinerator
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{ {
if(world.isRemote) return ActionResultType.SUCCESS; if(world.isRemote()) return ActionResultType.SUCCESS;
final TileEntity te = world.getTileEntity(pos); final TileEntity te = world.getTileEntity(pos);
if(!(te instanceof WasteIncineratorTileEntity)) return ActionResultType.FAIL; if(!(te instanceof WasteIncineratorTileEntity)) return ActionResultType.FAIL;
if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL; if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL;
NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te); NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te);
return ActionResultType.SUCCESS; return ActionResultType.CONSUME;
} }
@Override @Override
@ -317,7 +317,7 @@ public class EdWasteIncinerator
@Override @Override
public boolean isUsableByPlayer(PlayerEntity player) public boolean isUsableByPlayer(PlayerEntity player)
{ return getPos().distanceSq(player.getPosition()) < 36; } { return ((getWorld().getTileEntity(getPos()) == this)) && (getPos().distanceSq(player.getPosition()) < 64); }
@Override @Override
public void openInventory(PlayerEntity player) public void openInventory(PlayerEntity player)

View file

@ -10,13 +10,19 @@ package wile.engineersdecor.blocks;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.BlockItemUseContext;
import net.minecraft.util.Direction; import net.minecraft.item.DirectionalPlaceContext;
import net.minecraft.util.*;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Arrays;
public class EdWindowBlock extends DecorBlock.DirectedWaterLoggable implements IDecorBlock public class EdWindowBlock extends DecorBlock.DirectedWaterLoggable implements IDecorBlock
@ -47,6 +53,27 @@ public class EdWindowBlock extends DecorBlock.DirectedWaterLoggable implements I
return super.getStateForPlacement(context).with(FACING, facing); return super.getStateForPlacement(context).with(FACING, facing);
} }
@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;
final Direction facing = state.get(FACING);
if(facing.getAxis() != hit.getFace().getAxis()) return ActionResultType.PASS;
Arrays.stream(Direction.getFacingDirections(player))
.filter(d->d.getAxis() != facing.getAxis())
.filter(d->world.getBlockState(pos.offset(d)).isReplaceable((new DirectionalPlaceContext(world, pos.offset(d), facing.getOpposite(), player.getHeldItem(hand), facing))))
.findFirst().ifPresent((d)->{
BlockState st = getDefaultState()
.with(FACING, facing)
.with(WATERLOGGED,world.getBlockState(pos.offset(d)).getFluidState().getFluid()==Fluids.WATER);
world.setBlockState(pos.offset(d), st, 1|2);
world.playSound(player, pos, SoundEvents.BLOCK_METAL_PLACE, SoundCategory.BLOCKS, 1f, 1f);
}
);
return ActionResultType.func_233537_a_(world.isRemote());
}
@Override @Override
public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos) public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos)
{ return true; } { return true; }

View file

@ -22,6 +22,8 @@ import net.minecraft.item.BlockItem;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import wile.engineersdecor.blocks.EdCraftingTable.CraftingTableTileEntity;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -42,7 +44,7 @@ public class JEIPlugin implements mezz.jei.api.IModPlugin
registration.addRecipeTransferHandler( registration.addRecipeTransferHandler(
EdCraftingTable.CraftingTableContainer.class, EdCraftingTable.CraftingTableContainer.class,
VanillaRecipeCategoryUid.CRAFTING, VanillaRecipeCategoryUid.CRAFTING,
1, 9, 10, 44 1, 9, 10, 36+CraftingTableTileEntity.NUM_OF_STORAGE_SLOTS
); );
} catch(Throwable e) { } catch(Throwable e) {
ModEngineersDecor.logger().warn("Exception in JEI crafting table handler registration: '" + e.getMessage() + "'."); ModEngineersDecor.logger().warn("Exception in JEI crafting table handler registration: '" + e.getMessage() + "'.");

View file

@ -22,6 +22,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.client.util.ITooltipFlag; import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockRayTraceResult; 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.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.util.math.shapes.VoxelShapes;
@ -39,23 +40,30 @@ import java.util.List;
public class StandardDoorBlock extends DoorBlock implements StandardBlocks.IStandardBlock public class StandardDoorBlock extends DoorBlock implements StandardBlocks.IStandardBlock
{ {
private final long config_; private final long config_;
protected final VoxelShape shapes_[][][]; protected final VoxelShape shapes_[][][][];
protected final SoundEvent open_sound_; protected final SoundEvent open_sound_;
protected final SoundEvent close_sound_; protected final SoundEvent close_sound_;
public StandardDoorBlock(long config, Block.Properties properties, AxisAlignedBB open_aabb, AxisAlignedBB closed_aabb, SoundEvent open_sound, SoundEvent close_sound) public StandardDoorBlock(long config, Block.Properties properties, AxisAlignedBB[] open_aabbs_top, AxisAlignedBB[] open_aabbs_bottom, AxisAlignedBB[] closed_aabbs_top, AxisAlignedBB[] closed_aabbs_bottom, SoundEvent open_sound, SoundEvent close_sound)
{ {
super(properties); super(properties);
VoxelShape shapes[][][] = new VoxelShape[Direction.values().length][2][2]; VoxelShape shapes[][][][] = new VoxelShape[Direction.values().length][2][2][2];
for(Direction facing: Direction.values()) { for(Direction facing: Direction.values()) {
for(boolean open: new boolean[]{false,true}) { for(boolean open: new boolean[]{false,true}) {
for(boolean hinge_right: new boolean[]{false,true}) { for(DoubleBlockHalf half: new DoubleBlockHalf[]{DoubleBlockHalf.UPPER,DoubleBlockHalf.LOWER}) {
if(facing.getAxis() == Axis.Y) { for(boolean hinge_right: new boolean[]{false,true}) {
shapes[facing.ordinal()][open?1:0][hinge_right?1:0] = VoxelShapes.fullCube(); VoxelShape shape = VoxelShapes.empty();
} else { if(facing.getAxis() == Axis.Y) {
AxisAlignedBB aabb = Auxiliaries.getRotatedAABB(open ? open_aabb : closed_aabb, facing, true); shape = VoxelShapes.fullCube();
if(!hinge_right) aabb = Auxiliaries.getMirroredAABB(aabb, facing.rotateY().getAxis()); } else {
shapes[facing.ordinal()][open?1:0][hinge_right?1:0] = VoxelShapes.create(aabb); final AxisAlignedBB[] aabbs = (open)?((half==DoubleBlockHalf.UPPER) ? open_aabbs_top : open_aabbs_bottom) : ((half==DoubleBlockHalf.UPPER) ? closed_aabbs_top : closed_aabbs_bottom);
for(AxisAlignedBB e:aabbs) {
AxisAlignedBB aabb = Auxiliaries.getRotatedAABB(e, facing, true);
if(!hinge_right) aabb = Auxiliaries.getMirroredAABB(aabb, facing.rotateY().getAxis());
shape = VoxelShapes.combineAndSimplify(shape, VoxelShapes.create(aabb), IBooleanFunction.OR);
}
}
shapes[facing.ordinal()][open?1:0][hinge_right?1:0][half==DoubleBlockHalf.UPPER?0:1] = shape;
} }
} }
} }
@ -66,6 +74,9 @@ public class StandardDoorBlock extends DoorBlock implements StandardBlocks.IStan
close_sound_ = close_sound; close_sound_ = close_sound;
} }
public StandardDoorBlock(long config, Block.Properties properties, AxisAlignedBB open_aabb, AxisAlignedBB closed_aabb, SoundEvent open_sound, SoundEvent close_sound)
{ this(config, properties, new AxisAlignedBB[]{open_aabb}, new AxisAlignedBB[]{open_aabb}, new AxisAlignedBB[]{closed_aabb}, new AxisAlignedBB[]{closed_aabb}, open_sound, close_sound); }
public StandardDoorBlock(long config, Block.Properties properties, SoundEvent open_sound, SoundEvent close_sound) public StandardDoorBlock(long config, Block.Properties properties, SoundEvent open_sound, SoundEvent close_sound)
{ {
this( this(
@ -120,9 +131,11 @@ public class StandardDoorBlock extends DoorBlock implements StandardBlocks.IStan
public boolean canCreatureSpawn(BlockState state, IBlockReader world, BlockPos pos, EntitySpawnPlacementRegistry.PlacementType type, @Nullable EntityType<?> entityType) public boolean canCreatureSpawn(BlockState state, IBlockReader world, BlockPos pos, EntitySpawnPlacementRegistry.PlacementType type, @Nullable EntityType<?> entityType)
{ return false; } { return false; }
@Override
public VoxelShape getShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext context) public VoxelShape getShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext context)
{ return shapes_[state.get(FACING).ordinal()][state.get(OPEN)?1:0][state.get(HINGE)==DoorHingeSide.RIGHT?1:0]; } { return shapes_[state.get(FACING).ordinal()][state.get(OPEN)?1:0][state.get(HINGE)==DoorHingeSide.RIGHT?1:0][state.get(HALF)==DoubleBlockHalf.UPPER?0:1]; }
@Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
{ {
boolean open = !state.get(OPEN); boolean open = !state.get(OPEN);
@ -130,9 +143,10 @@ public class StandardDoorBlock extends DoorBlock implements StandardBlocks.IStan
world.setBlockState(pos, state, 2|8); world.setBlockState(pos, state, 2|8);
sound(world, pos, open); sound(world, pos, open);
actuate_adjacent_wing(state, world, pos, open); actuate_adjacent_wing(state, world, pos, open);
return world.isRemote ? ActionResultType.SUCCESS : ActionResultType.CONSUME; return ActionResultType.func_233537_a_(world.isRemote());
} }
@Override
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving)
{ {
boolean powered = world.isBlockPowered(pos) || world.isBlockPowered(pos.offset(state.get(HALF) == DoubleBlockHalf.LOWER ? Direction.UP : Direction.DOWN)); boolean powered = world.isBlockPowered(pos) || world.isBlockPowered(pos.offset(state.get(HALF) == DoubleBlockHalf.LOWER ? Direction.UP : Direction.DOWN));

View file

@ -393,6 +393,7 @@ public class Inventories
{ ItemHandlerHelper.giveItemToPlayer(entity, stack); } { ItemHandlerHelper.giveItemToPlayer(entity, stack); }
public static void setItemInPlayerHand(PlayerEntity player, Hand hand, ItemStack stack) { public static void setItemInPlayerHand(PlayerEntity player, Hand hand, ItemStack stack) {
if(stack.isEmpty()) stack = ItemStack.EMPTY;
if(hand == Hand.MAIN_HAND) { if(hand == Hand.MAIN_HAND) {
player.inventory.mainInventory.set(player.inventory.currentItem, stack); player.inventory.mainInventory.set(player.inventory.currentItem, stack);
} else { } else {