Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
e0a245c60e
|
@ -11,10 +11,16 @@ import me.rigamortis.seppuku.api.util.MathUtil;
|
||||||
import me.rigamortis.seppuku.api.util.RenderUtil;
|
import me.rigamortis.seppuku.api.util.RenderUtil;
|
||||||
import me.rigamortis.seppuku.api.value.OptionalValue;
|
import me.rigamortis.seppuku.api.value.OptionalValue;
|
||||||
import me.rigamortis.seppuku.impl.module.player.FreeCamModule;
|
import me.rigamortis.seppuku.impl.module.player.FreeCamModule;
|
||||||
import net.minecraft.block.*;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockAir;
|
||||||
|
import net.minecraft.block.BlockLiquid;
|
||||||
|
import net.minecraft.block.BlockObsidian;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.item.EntityItem;
|
||||||
|
import net.minecraft.entity.item.EntityXPOrb;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
|
@ -74,8 +80,6 @@ public final class ObsidianReplaceModule extends Module {
|
||||||
if (pos != null) {
|
if (pos != null) {
|
||||||
final double dist = mc.player.getDistance(pos.getX(), pos.getY(), pos.getZ());
|
final double dist = mc.player.getDistance(pos.getX(), pos.getY(), pos.getZ());
|
||||||
if (dist <= 5.0f) {
|
if (dist <= 5.0f) {
|
||||||
final Block block = mc.world.getBlockState(pos).getBlock();
|
|
||||||
if (block instanceof BlockAir || block instanceof BlockLiquid) {
|
|
||||||
if (this.valid(pos)) {
|
if (this.valid(pos)) {
|
||||||
this.place(pos);
|
this.place(pos);
|
||||||
valid = true;
|
valid = true;
|
||||||
|
@ -83,7 +87,6 @@ public final class ObsidianReplaceModule extends Module {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (valid) {
|
if (valid) {
|
||||||
mc.player.inventory.currentItem = this.lastSlot;
|
mc.player.inventory.currentItem = this.lastSlot;
|
||||||
|
@ -112,15 +115,12 @@ public final class ObsidianReplaceModule extends Module {
|
||||||
if (pos != null) {
|
if (pos != null) {
|
||||||
final double dist = mc.player.getDistance(pos.getX(), pos.getY(), pos.getZ());
|
final double dist = mc.player.getDistance(pos.getX(), pos.getY(), pos.getZ());
|
||||||
if (dist <= 5.0f) {
|
if (dist <= 5.0f) {
|
||||||
final Block block = mc.world.getBlockState(pos).getBlock();
|
|
||||||
if (block instanceof BlockAir || block instanceof BlockLiquid) {
|
|
||||||
if (this.valid(pos)) {
|
if (this.valid(pos)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,6 +337,16 @@ public final class ObsidianReplaceModule extends Module {
|
||||||
private boolean valid(BlockPos pos) {
|
private boolean valid(BlockPos pos) {
|
||||||
final Block block = mc.world.getBlockState(pos).getBlock();
|
final Block block = mc.world.getBlockState(pos).getBlock();
|
||||||
|
|
||||||
|
if (!(block instanceof BlockAir) && !(block instanceof BlockLiquid)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<Entity> invalidEntities = mc.world.getEntitiesInAABBexcluding(null,
|
||||||
|
new AxisAlignedBB(pos), entity -> !(entity instanceof EntityItem) &&
|
||||||
|
!(entity instanceof EntityXPOrb));
|
||||||
|
if (!invalidEntities.isEmpty())
|
||||||
|
return false;
|
||||||
|
|
||||||
final Block up = mc.world.getBlockState(pos.add(0, 1, 0)).getBlock();
|
final Block up = mc.world.getBlockState(pos.add(0, 1, 0)).getBlock();
|
||||||
final Block down = mc.world.getBlockState(pos.add(0, -1, 0)).getBlock();
|
final Block down = mc.world.getBlockState(pos.add(0, -1, 0)).getBlock();
|
||||||
final Block north = mc.world.getBlockState(pos.add(0, 0, -1)).getBlock();
|
final Block north = mc.world.getBlockState(pos.add(0, 0, -1)).getBlock();
|
||||||
|
@ -344,14 +354,11 @@ public final class ObsidianReplaceModule extends Module {
|
||||||
final Block east = mc.world.getBlockState(pos.add(1, 0, 0)).getBlock();
|
final Block east = mc.world.getBlockState(pos.add(1, 0, 0)).getBlock();
|
||||||
final Block west = mc.world.getBlockState(pos.add(-1, 0, 0)).getBlock();
|
final Block west = mc.world.getBlockState(pos.add(-1, 0, 0)).getBlock();
|
||||||
|
|
||||||
return (block instanceof BlockAir)
|
return ((up != Blocks.AIR && !(up instanceof BlockLiquid))
|
||||||
&& mc.world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(pos)).isEmpty()
|
|| (down != Blocks.AIR && !(down instanceof BlockLiquid))
|
||||||
&& ((up != null && up != Blocks.AIR && !(up instanceof BlockLiquid))
|
|| (north != Blocks.AIR && !(north instanceof BlockLiquid))
|
||||||
|| (down != null && down != Blocks.AIR && !(down instanceof BlockLiquid))
|
|| (south != Blocks.AIR && !(south instanceof BlockLiquid))
|
||||||
|| (north != null && north != Blocks.AIR && !(north instanceof BlockLiquid))
|
|| (east != Blocks.AIR && !(east instanceof BlockLiquid))
|
||||||
|| (south != null && south != Blocks.AIR && !(south instanceof BlockLiquid))
|
|| (west != Blocks.AIR && !(west instanceof BlockLiquid)));
|
||||||
|| (east != null && east != Blocks.AIR && !(east instanceof BlockLiquid))
|
|
||||||
|| (west != null && west != Blocks.AIR && !(west instanceof BlockLiquid)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue