pump fixes, finished telex

This commit is contained in:
Boblet 2023-09-11 15:47:25 +02:00
parent 37eb69e47d
commit 2ee2bda4e9
5 changed files with 64 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import com.hbm.blocks.ILookOverlay;
import com.hbm.blocks.ITooltipProvider;
import com.hbm.blocks.ModBlocks;
import com.hbm.tileentity.TileEntityProxyCombo;
import com.hbm.tileentity.machine.TileEntityMachinePumpBase;
import com.hbm.tileentity.machine.TileEntityMachinePumpElectric;
import com.hbm.tileentity.machine.TileEntityMachinePumpSteam;
import com.hbm.util.BobMathUtil;
@ -75,6 +76,8 @@ public class MachinePump extends BlockDummyable implements ITooltipProvider, ILo
return;
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
if(!(te instanceof TileEntityMachinePumpBase)) return;
List<String> text = new ArrayList();
@ -95,6 +98,10 @@ public class MachinePump extends BlockDummyable implements ITooltipProvider, ILo
text.add("&[" + (BobMathUtil.getBlink() ? 0xff0000 : 0xffff00) + "&]! ! ! ALTITUDE ! ! !");
}
if(!((TileEntityMachinePumpBase) te).onGround) {
text.add("&[" + (BobMathUtil.getBlink() ? 0xff0000 : 0xffff00) + "&]! ! ! NO VALID GROUND ! ! !");
}
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
}
}

View File

@ -254,6 +254,7 @@ public class CraftingManager {
addRecipeAuto(new ItemStack(ModBlocks.radio_torch_sender, 4), new Object[] { "G", "R", "I", 'G', "dustGlowstone", 'R', Blocks.redstone_torch, 'I', NETHERQUARTZ.gem() });
addRecipeAuto(new ItemStack(ModBlocks.radio_torch_receiver, 4), new Object[] { "G", "R", "I", 'G', "dustGlowstone", 'R', Blocks.redstone_torch, 'I', IRON.ingot() });
addRecipeAuto(new ItemStack(ModBlocks.radio_torch_counter, 4), new Object[] { "G", "R", "I", 'G', "dustGlowstone", 'R', Blocks.redstone_torch, 'I', ModItems.circuit_aluminium });
addRecipeAuto(new ItemStack(ModBlocks.radio_telex, 2), new Object[] { "SCR", "W#W", "WWW", 'S', ModBlocks.radio_torch_sender, 'C', ModItems.crt_display, 'R', ModBlocks.radio_torch_receiver, 'W', KEY_PLANKS, '#', ModItems.circuit_aluminium });
addRecipeAuto(new ItemStack(ModBlocks.conveyor, 16), new Object[] { "LLL", "I I", "LLL", 'L', Items.leather, 'I', IRON.ingot() });
addRecipeAuto(new ItemStack(ModBlocks.conveyor, 16), new Object[] { "RSR", "I I", "RSR", 'I', IRON.ingot(), 'R', DictFrame.fromOne(ModItems.plant_item, EnumPlantType.ROPE), 'S', IRON.plate() });

View File

@ -1,5 +1,8 @@
package com.hbm.tileentity.machine;
import java.util.HashSet;
import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.lib.Library;
import com.hbm.main.MainRegistry;
@ -10,16 +13,34 @@ import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.fluid.IFluidStandardTransceiver;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
public abstract class TileEntityMachinePumpBase extends TileEntityLoadedBase implements IFluidStandardTransceiver, INBTPacketReceiver {
public static final HashSet<Block> validBlocks = new HashSet();
static {
validBlocks.add(Blocks.grass);
validBlocks.add(Blocks.dirt);
validBlocks.add(Blocks.sand);
validBlocks.add(Blocks.mycelium);
validBlocks.add(ModBlocks.waste_earth);
validBlocks.add(ModBlocks.dirt_dead);
validBlocks.add(ModBlocks.dirt_oily);
validBlocks.add(ModBlocks.sand_dirty);
validBlocks.add(ModBlocks.sand_dirty_red);
}
public FluidTank water;
public boolean isOn = false;
public float rotor;
public float lastRotor;
public boolean onGround = false;
public int groundCheckDelay = 0;
public void updateEntity() {
@ -29,8 +50,14 @@ public abstract class TileEntityMachinePumpBase extends TileEntityLoadedBase imp
if(water.getFill() > 0) this.sendFluid(water, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
if(groundCheckDelay > 0) {
groundCheckDelay--;
} else {
onGround = this.checkGround();
}
this.isOn = false;
if(this.canOperate() && yCoord <= 70) {
if(this.canOperate() && yCoord <= 70 && onGround) {
this.isOn = true;
this.operate();
}
@ -52,9 +79,34 @@ public abstract class TileEntityMachinePumpBase extends TileEntityLoadedBase imp
}
}
protected boolean checkGround() {
if(worldObj.provider.hasNoSky) return false;
int validBlocks = 0;
int invalidBlocks = 0;
for(int x = -1; x <= 1; x++) {
for(int y = -1; y >= -4; y--) {
for(int z = -1; z <= 1; z++) {
Block b = worldObj.getBlock(xCoord + x, yCoord + y, zCoord + z);
if(y == -1 && !b.isNormalCube()) return false; // first layer has to be full solid
if(this.validBlocks.contains(b)) validBlocks++;
else invalidBlocks ++;
}
}
}
return validBlocks >= invalidBlocks; // valid block count has to be at least 50%
}
protected NBTTagCompound getSync() {
NBTTagCompound data = new NBTTagCompound();
data.setBoolean("isOn", isOn);
data.setBoolean("onGround", onGround);
water.writeToNBT(data, "w");
return data;
}
@ -62,6 +114,7 @@ public abstract class TileEntityMachinePumpBase extends TileEntityLoadedBase imp
@Override
public void networkUnpack(NBTTagCompound nbt) {
this.isOn = nbt.getBoolean("isOn");
this.onGround = nbt.getBoolean("onGround");
water.readFromNBT(nbt, "w");
}

View File

@ -4278,6 +4278,7 @@ tile.pwr_port.name=PWR Zugangsport
tile.pwr_port.desc=Erlaubt IO für Items und Flüssigkeiten$Platzierung: Hülle
tile.pwr_reflector.name=PWR Neutronenreflektor
tile.pwr_reflector.desc=Reflektier Neutronen auf Brennstäbe zurück$Platzierung: Hülle, für höhere Reaktivität$Gültiger Block für Hülle
tile.radio_telex.name=Telex-Maschine
tile.radio_torch_counter.name=Redstone-over-Radio Itemzähler
tile.radio_torch_counter.desc=Kann auf ebenen Flächen oder Komparator-kompatiblen Blöcken platziert werden$Signal basiert auf Anzahl passender Items
tile.radio_torch_receiver.name=Redstone-over-Radio Empfänger

View File

@ -5258,6 +5258,7 @@ tile.pwr_port.name=PWR Access Port
tile.pwr_port.desc=Allows item and fluid IO$Placement: Casing
tile.pwr_reflector.name=PWR Neutron Reflector
tile.pwr_reflector.desc=Reflects neutrons back to fuel rods$Placement: Grid, for increased reactivity$Valid casing material
tile.radio_telex.name=Telex Machine
tile.radio_torch_counter.name=Redstone-over-Radio Item Counter
tile.radio_torch_counter.desc=Placable on flat surfaces or comparator-compatible blocks$Bases signal on the amount of matching items
tile.radio_torch_receiver.name=Redstone-over-Radio Receiver