diff --git a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/block/backward/BWBlock.java b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/block/backward/BWBlock.java index 04b346843..284017c89 100644 --- a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/block/backward/BWBlock.java +++ b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/block/backward/BWBlock.java @@ -70,9 +70,10 @@ public BWBlock(net.minecraft.block.Block block, World world, Vector3D pos) { this.mcBlock = block; components.add(new BWBlockTransform(this, world, pos)); components.add(new BlockProperty.Opacity()).setOpacity(() -> mcBlock.getMaterial().isOpaque() ? 1 : 0); - Optional.of(components.add(new BlockProperty.Replaceable())) - .filter(r -> block != Blocks.air) - .ifPresent(r -> r.setReplaceable(() -> mcBlock.isReplaceable(blockAccess(), xi(), yi(), zi()))); + BlockProperty.Replaceable replaceable = components.add(new BlockProperty.Replaceable()); + if (block != Blocks.air) { + replaceable.setReplaceable(() -> mcBlock.canPlaceBlockAt((net.minecraft.world.World) blockAccess(), xi(), yi(), zi())); + } BlockProperty.BlockSound blockSound = components.add(new BlockProperty.BlockSound()); blockSound.setBlockSound(BlockProperty.BlockSound.BlockSoundTrigger.PLACE, new Sound("", mcBlock.stepSound.func_150496_b())); diff --git a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/block/forward/FWBlock.java b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/block/forward/FWBlock.java index aac40a30a..3b4e8bf29 100644 --- a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/block/forward/FWBlock.java +++ b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/block/forward/FWBlock.java @@ -494,6 +494,21 @@ public void renderItem(ItemRenderType type, ItemStack item, Object... data) { @Override public float getExplosionResistance(Entity expEntity, World world, int x, int y, int z, double explosionX, double p_explosionresistance, double explosionY) { // TODO: Maybe do something withPriority these parameters. + + // This number was calculated from the blast resistance of Stone, + // which requires exactly one cubic meter of TNT to get blown up. + // + // 1. During construction, the setResistance method is called + // on minecraft:stone with a value of 10. + // + // 2. The setResistance method multiplies that by 3 and assigns + // the result to the blockResistance instance variable. + // + // 3. Finally, the getExplosionResistance method divides the + // blockResistance instance variable by 5 and returns the result. + // + // From this we see that minecraft:stone’s final blast resistance is 6. + return (float) getBlockInstance(world, new Vector3D(x, y, z)).getResistance() * 6; } diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/block/backward/BWBlock.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/block/backward/BWBlock.java index 839543baa..a8c34fc54 100644 --- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/block/backward/BWBlock.java +++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/block/backward/BWBlock.java @@ -75,9 +75,10 @@ public BWBlock(net.minecraft.block.Block block, World world, Vector3D pos) { this.mcBlock = block; components.add(new BWBlockTransform(this, world, pos)); components.add(new BlockProperty.Opacity()).setOpacity(() -> mcBlock.getMaterial().isOpaque() ? 1 : 0); - Optional.of(components.add(new BlockProperty.Replaceable())) - .filter(r -> block != Blocks.air) - .ifPresent(r -> r.setReplaceable(() -> mcBlock.isReplaceable((net.minecraft.world.World) blockAccess(), blockPos()))); + BlockProperty.Replaceable replaceable = components.add(new BlockProperty.Replaceable()); + if (block != Blocks.air) { + replaceable.setReplaceable(() -> mcBlock.canPlaceBlockAt((net.minecraft.world.World) blockAccess(), blockPos())); + } BlockProperty.BlockSound blockSound = components.add(new BlockProperty.BlockSound()); blockSound.setBlockSound(BlockProperty.BlockSound.BlockSoundTrigger.PLACE, new Sound("", mcBlock.stepSound.getPlaceSound())); @@ -171,7 +172,7 @@ public boolean shouldDisplacePlacement() { return false; } - if (mcBlock == Blocks.vine || mcBlock == Blocks.tallgrass || mcBlock == Blocks.deadbush || mcBlock.isReplaceable((net.minecraft.world.World) WorldConverter.instance().toNative(world()), new BlockPos(x(), y(), z()))) { + if (mcBlock == Blocks.vine || mcBlock == Blocks.tallgrass || mcBlock == Blocks.deadbush || mcBlock.isReplaceable((net.minecraft.world.World) blockAccess(), blockPos())) { return false; } return super.shouldDisplacePlacement(); diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/block/forward/FWBlock.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/block/forward/FWBlock.java index a737fa190..1417d0e38 100644 --- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/block/forward/FWBlock.java +++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/block/forward/FWBlock.java @@ -384,6 +384,21 @@ public String getLocalizedName() { @Override public float getExplosionResistance(World world, BlockPos pos, Entity exploder, Explosion explosion) { // TODO: Maybe do something withPriority these parameters. + + // This number was calculated from the blast resistance of Stone, + // which requires exactly one cubic meter of TNT to get blown up. + // + // 1. During construction, the setResistance method is called + // on minecraft:stone with a value of 10. + // + // 2. The setResistance method multiplies that by 3 and assigns + // the result to the blockResistance instance variable. + // + // 3. Finally, the getExplosionResistance method divides the + // blockResistance instance variable by 5 and returns the result. + // + // From this we see that minecraft:stone’s final blast resistance is 6. + return (float) getBlockInstance(world, VectorConverter.instance().toNova(pos)).getResistance() * 6; }