some fixes

This commit is contained in:
Boblet 2023-01-09 14:44:20 +01:00
parent f210605feb
commit c69e85c9e9
3 changed files with 60 additions and 31 deletions

View File

@ -278,6 +278,7 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
if(bedrockOre == null) { if(bedrockOre == null) {
breakBlocks(ring); breakBlocks(ring);
buildWall(ring + 1, ring == radius && this.enableWalling); buildWall(ring + 1, ring == radius && this.enableWalling);
if(ring == radius) mineOuterOres(ring + 1);
tryCollect(radius); tryCollect(radius);
} else { } else {
collectBedrock(bedrockOre); collectBedrock(bedrockOre);
@ -384,38 +385,47 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
} }
public void tryMineAtLocation(int x ,int y, int z) { public void tryMineAtLocation(int x ,int y, int z) {
Block b = worldObj.getBlock(x, y, z);
if(this.enableVeinMiner && this.getInstalledDrill().vein) { if(this.enableVeinMiner && this.getInstalledDrill().vein) {
/* doing this isn't terribly accurate but just for figuring out if there's OD it works */ if(isOre(x, y, z, b)) {
Item blockItem = Item.getItemFromBlock(worldObj.getBlock(x, y, z)); minX = x;
minY = y;
if(blockItem != null) { minZ = z;
List<String> names = ItemStackUtil.getOreDictNames(new ItemStack(blockItem)); maxX = x;
maxY = y;
maxZ = z;
breakRecursively(x, y, z, 10);
recursionBrake.clear();
for(String name : names) { /* move all excavated items to the last drillable position which is also within collection range */
if(name.startsWith("ore")) { List<EntityItem> items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX + 1, maxY + 1, maxZ + 1));
minX = x; for(EntityItem item : items) item.setPosition(x + 0.5, y + 0.5, z + 0.5);
minY = y;
minZ = z; return;
maxX = x; }
maxY = y; }
maxZ = z; breakSingleBlock(b, x, y, z);
breakRecursively(x, y, z, 15); }
recursionBrake.clear();
protected boolean isOre(int x ,int y, int z, Block b) {
/* move all excavated items to the last drillable position which is also within collection range */
List<EntityItem> items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX + 1, maxY + 1, maxZ + 1)); /* doing this isn't terribly accurate but just for figuring out if there's OD it works */
for(EntityItem item : items) item.setPosition(x + 0.5, y + 0.5, z + 0.5); Item blockItem = Item.getItemFromBlock(b);
return; if(blockItem != null) {
} List<String> names = ItemStackUtil.getOreDictNames(new ItemStack(blockItem));
for(String name : names) {
if(name.startsWith("ore")) {
return true;
} }
} }
} }
Block b = worldObj.getBlock(x, y, z); return false;
breakSingleBlock(b, x, y, z);
} }
private HashSet<BlockPos> recursionBrake = new HashSet(); private HashSet<BlockPos> recursionBrake = new HashSet();
@ -522,6 +532,23 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
} }
} }
} }
protected void mineOuterOres(int ring) {
int y = getY();
for(int x = xCoord - ring; x <= xCoord + ring; x++) {
for(int z = zCoord - ring; z <= zCoord + ring; z++) {
if(ring == 1 || (x == xCoord - ring || x == xCoord + ring || z == zCoord - ring || z == zCoord + ring)) {
Block b = worldObj.getBlock(x, y, z);
if(!this.shouldIgnoreBlock(b, x, y, z) && this.isOre(x, y, z, b)) {
tryMineAtLocation(x, y, z);
}
}
}
}
}
protected void tryEjectBuffer() { protected void tryEjectBuffer() {
@ -685,7 +712,7 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
} }
public boolean shouldIgnoreBlock(Block block, int x, int y, int z) { public boolean shouldIgnoreBlock(Block block, int x, int y, int z) {
return block.isAir(worldObj, x, y, z) || block.getBlockHardness(worldObj, x, y, z) < 0 || block.getMaterial().isLiquid() || block == Blocks.bedrock; return block.isAir(worldObj, x, y, z) || block.getMaterial() == ModBlocks.materialGas || block.getBlockHardness(worldObj, x, y, z) < 0 || block.getMaterial().isLiquid() || block == Blocks.bedrock;
} }
@Override @Override

View File

@ -273,6 +273,7 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM
@Override @Override
public void onMelt(int reduce) { public void onMelt(int reduce) {
boolean moderated = this.isModerated();
int h = RBMKDials.getColumnHeight(worldObj); int h = RBMKDials.getColumnHeight(worldObj);
reduce = MathHelper.clamp_int(reduce, 1, h); reduce = MathHelper.clamp_int(reduce, 1, h);
@ -307,9 +308,7 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM
this.standardMelt(reduce); this.standardMelt(reduce);
} }
spawnDebris(DebrisType.ELEMENT); if(moderated) {
if(this.isModerated()) {
int count = 2 + worldObj.rand.nextInt(2); int count = 2 + worldObj.rand.nextInt(2);
@ -318,6 +317,8 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM
} }
} }
spawnDebris(DebrisType.ELEMENT);
if(this.getBlockMetadata() == RBMKBase.DIR_NORMAL_LID.ordinal() + RBMKBase.offset) if(this.getBlockMetadata() == RBMKBase.DIR_NORMAL_LID.ordinal() + RBMKBase.offset)
spawnDebris(DebrisType.LID); spawnDebris(DebrisType.LID);
} }

View File

@ -9,6 +9,7 @@ import com.hbm.util.NoteBuilder.Note;
import com.hbm.util.NoteBuilder.Octave; import com.hbm.util.NoteBuilder.Octave;
import com.hbm.util.Tuple.Pair; import com.hbm.util.Tuple.Pair;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World; import net.minecraft.world.World;
public class RTTYSystem { public class RTTYSystem {
@ -45,8 +46,7 @@ public class RTTYSystem {
} }
HashMap<Pair<World, String>, RTTYChannel> toAdd = new HashMap(); HashMap<Pair<World, String>, RTTYChannel> toAdd = new HashMap();
for(Entry<Pair<World, String>, RTTYChannel> entry : broadcast.entrySet()) { for(World world : MinecraftServer.getServer().worldServers) {
World world = entry.getKey().getKey();
RTTYChannel chan = new RTTYChannel(); RTTYChannel chan = new RTTYChannel();
chan.timeStamp = world.getTotalWorldTime(); chan.timeStamp = world.getTotalWorldTime();
chan.signal = getTestSender(chan.timeStamp); chan.signal = getTestSender(chan.timeStamp);
@ -69,6 +69,7 @@ public class RTTYSystem {
PRINT_BUFFER //print message, literally, it makes a paper printout PRINT_BUFFER //print message, literally, it makes a paper printout
} }
/* Song of Storms at 300 BPM */
public static Object getTestSender(long timeStamp) { public static Object getTestSender(long timeStamp) {
int tempo = 4; int tempo = 4;