mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-08-10 17:55:44 +00:00
Merge pull request #3026 from legendarydoge30/gdfgdf
Added a lot of RoR support to the battery socket and PA, added extra ports to PA, updated calculator
This commit is contained in:
commit
7741714ce0
@ -9,6 +9,7 @@ import com.hbm.main.MainRegistry;
|
|||||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.albion.TileEntityPASource;
|
import com.hbm.tileentity.machine.albion.TileEntityPASource;
|
||||||
|
|
||||||
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@ -43,9 +44,8 @@ public class BlockPASource extends BlockDummyable implements ITooltipProvider {
|
|||||||
@Override
|
@Override
|
||||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||||
super.fillSpace(world, x, y, z, dir, o);
|
super.fillSpace(world, x, y, z, dir, o);
|
||||||
|
|
||||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
|
||||||
|
|
||||||
|
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||||
this.makeExtra(world, x + rot.offsetX * 4, y, z + rot.offsetZ * 4);
|
this.makeExtra(world, x + rot.offsetX * 4, y, z + rot.offsetZ * 4);
|
||||||
this.makeExtra(world, x + dir.offsetX, y, z + dir.offsetZ);
|
this.makeExtra(world, x + dir.offsetX, y, z + dir.offsetZ);
|
||||||
this.makeExtra(world, x + dir.offsetX + rot.offsetX * 2, y, z + dir.offsetZ + rot.offsetZ * 2);
|
this.makeExtra(world, x + dir.offsetX + rot.offsetX * 2, y, z + dir.offsetZ + rot.offsetZ * 2);
|
||||||
@ -53,6 +53,9 @@ public class BlockPASource extends BlockDummyable implements ITooltipProvider {
|
|||||||
this.makeExtra(world, x - dir.offsetX, y, z - dir.offsetZ);
|
this.makeExtra(world, x - dir.offsetX, y, z - dir.offsetZ);
|
||||||
this.makeExtra(world, x - dir.offsetX + rot.offsetX * 2, y, z - dir.offsetZ + rot.offsetZ * 2);
|
this.makeExtra(world, x - dir.offsetX + rot.offsetX * 2, y, z - dir.offsetZ + rot.offsetZ * 2);
|
||||||
this.makeExtra(world, x - dir.offsetX - rot.offsetX * 2, y, z - dir.offsetZ - rot.offsetZ * 2);
|
this.makeExtra(world, x - dir.offsetX - rot.offsetX * 2, y, z - dir.offsetZ - rot.offsetZ * 2);
|
||||||
|
this.makeExtra(world, x,y - 1, z);
|
||||||
|
this.makeExtra(world, x + rot.offsetX * 2, y - 1, z + rot.offsetZ * 2);
|
||||||
|
this.makeExtra(world, x - rot.offsetX * 2, y - 1, z - rot.offsetZ * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -48,7 +48,7 @@ public class GUICalculator extends GuiScreen {
|
|||||||
if (!inputField.textboxKeyTyped(p_73869_1_, p_73869_2_))
|
if (!inputField.textboxKeyTyped(p_73869_1_, p_73869_2_))
|
||||||
super.keyTyped(p_73869_1_, p_73869_2_);
|
super.keyTyped(p_73869_1_, p_73869_2_);
|
||||||
|
|
||||||
String input = inputField.getText().replaceAll("[^\\d+\\-*/^!.()\\sA-Za-z]+", "");
|
String input = inputField.getText().replaceAll("[^\\d+\\-*/%^!.()\\sA-Za-z]+", "");
|
||||||
|
|
||||||
if (p_73869_1_ == 13 || p_73869_1_ == 10) { // when pressing enter (CR or LF)
|
if (p_73869_1_ == 13 || p_73869_1_ == 10) { // when pressing enter (CR or LF)
|
||||||
if (selectedHist != -1) {
|
if (selectedHist != -1) {
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import com.hbm.tileentity.machine.albion.TileEntityPASource.Particle;
|
|||||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
|
|
||||||
|
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||||
import cpw.mods.fml.common.Optional;
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -31,7 +32,7 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||||
public class TileEntityPADetector extends TileEntityCooledBase implements IGUIProvider, IParticleUser, SimpleComponent, CompatHandler.OCComponent {
|
public class TileEntityPADetector extends TileEntityCooledBase implements IGUIProvider, IParticleUser, SimpleComponent, CompatHandler.OCComponent, IRORValueProvider {
|
||||||
|
|
||||||
public static final long usage = 100_000;
|
public static final long usage = 100_000;
|
||||||
|
|
||||||
@ -186,6 +187,22 @@ public class TileEntityPADetector extends TileEntityCooledBase implements IGUIPr
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getFunctionInfo() {
|
||||||
|
return new String[] {
|
||||||
|
PREFIX_VALUE + "temperature",
|
||||||
|
PREFIX_VALUE + "pfmcold",
|
||||||
|
PREFIX_VALUE + "pfm"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String provideRORValue(String name) {
|
||||||
|
if((PREFIX_VALUE + "temperature").equals(name)) return "" + (int) this.temperature;
|
||||||
|
if((PREFIX_VALUE + "pfmcold").equals(name)) return "" + coolantTanks[0].getFill();
|
||||||
|
if((PREFIX_VALUE + "pfm").equals(name)) return "" + coolantTanks[1].getFill();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockPos getExitPos(Particle particle) {
|
public BlockPos getExitPos(Particle particle) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import com.hbm.util.EnumUtil;
|
|||||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
|
|
||||||
|
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||||
import api.hbm.redstoneoverradio.IRORInteractive;
|
import api.hbm.redstoneoverradio.IRORInteractive;
|
||||||
import cpw.mods.fml.common.Optional;
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
@ -35,7 +36,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||||
public class TileEntityPADipole extends TileEntityCooledBase implements IGUIProvider, IControlReceiver, IParticleUser, OCComponent, SimpleComponent, IRORInteractive {
|
public class TileEntityPADipole extends TileEntityCooledBase implements IGUIProvider, IControlReceiver, IParticleUser, OCComponent, SimpleComponent, IRORInteractive, IRORValueProvider {
|
||||||
|
|
||||||
public int dirLower;
|
public int dirLower;
|
||||||
public int dirUpper;
|
public int dirUpper;
|
||||||
@ -391,10 +392,21 @@ public class TileEntityPADipole extends TileEntityCooledBase implements IGUIProv
|
|||||||
@Override
|
@Override
|
||||||
public String[] getFunctionInfo() {
|
public String[] getFunctionInfo() {
|
||||||
return new String[] {
|
return new String[] {
|
||||||
PREFIX_FUNCTION + "setthreshold" + NAME_SEPARATOR + "threshold",
|
PREFIX_VALUE + "temperature",
|
||||||
|
PREFIX_VALUE + "pfmcold",
|
||||||
|
PREFIX_VALUE + "pfm",
|
||||||
|
PREFIX_FUNCTION + "setthreshold" + NAME_SEPARATOR + "threshold"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String provideRORValue(String name) {
|
||||||
|
if((PREFIX_VALUE + "temperature").equals(name)) return "" + (int) this.temperature;
|
||||||
|
if((PREFIX_VALUE + "pfmcold").equals(name)) return "" + coolantTanks[0].getFill();
|
||||||
|
if((PREFIX_VALUE + "pfm").equals(name)) return "" + coolantTanks[1].getFill();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String runRORFunction(String name, String[] params) {
|
public String runRORFunction(String name, String[] params) {
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import com.hbm.util.EnumUtil;
|
|||||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
|
|
||||||
|
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||||
import cpw.mods.fml.common.Optional;
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -27,7 +28,7 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||||
public class TileEntityPAQuadrupole extends TileEntityCooledBase implements IGUIProvider, IParticleUser, SimpleComponent, CompatHandler.OCComponent {
|
public class TileEntityPAQuadrupole extends TileEntityCooledBase implements IGUIProvider, IParticleUser, SimpleComponent, CompatHandler.OCComponent, IRORValueProvider {
|
||||||
|
|
||||||
public static final long usage = 100_000;
|
public static final long usage = 100_000;
|
||||||
public static final int focusGain = 100;
|
public static final int focusGain = 100;
|
||||||
@ -137,6 +138,22 @@ public class TileEntityPAQuadrupole extends TileEntityCooledBase implements IGUI
|
|||||||
return new GUIPAQuadrupole(player.inventory, this);
|
return new GUIPAQuadrupole(player.inventory, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getFunctionInfo() {
|
||||||
|
return new String[] {
|
||||||
|
PREFIX_VALUE + "temperature",
|
||||||
|
PREFIX_VALUE + "pfmcold",
|
||||||
|
PREFIX_VALUE + "pfm"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String provideRORValue(String name) {
|
||||||
|
if((PREFIX_VALUE + "temperature").equals(name)) return "" + (int) this.temperature;
|
||||||
|
if((PREFIX_VALUE + "pfmcold").equals(name)) return "" + coolantTanks[0].getFill();
|
||||||
|
if((PREFIX_VALUE + "pfm").equals(name)) return "" + coolantTanks[1].getFill();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Optional.Method(modid = "OpenComputers")
|
@Optional.Method(modid = "OpenComputers")
|
||||||
public String getComponentName() {
|
public String getComponentName() {
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import com.hbm.tileentity.machine.albion.TileEntityPASource.Particle;
|
|||||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
|
|
||||||
|
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||||
import cpw.mods.fml.common.Optional;
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -24,7 +25,7 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||||
public class TileEntityPARFC extends TileEntityCooledBase implements IGUIProvider, IParticleUser, SimpleComponent, CompatHandler.OCComponent {
|
public class TileEntityPARFC extends TileEntityCooledBase implements IGUIProvider, IParticleUser, SimpleComponent, CompatHandler.OCComponent, IRORValueProvider {
|
||||||
|
|
||||||
public static final long usage = 250_000;
|
public static final long usage = 250_000;
|
||||||
public static final int momentumGain = 100;
|
public static final int momentumGain = 100;
|
||||||
@ -129,6 +130,22 @@ public class TileEntityPARFC extends TileEntityCooledBase implements IGUIProvide
|
|||||||
return new GUIPARFC(player.inventory, this);
|
return new GUIPARFC(player.inventory, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getFunctionInfo() {
|
||||||
|
return new String[] {
|
||||||
|
PREFIX_VALUE + "temperature",
|
||||||
|
PREFIX_VALUE + "pfmcold",
|
||||||
|
PREFIX_VALUE + "pfm"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String provideRORValue(String name) {
|
||||||
|
if((PREFIX_VALUE + "temperature").equals(name)) return "" + (int) this.temperature;
|
||||||
|
if((PREFIX_VALUE + "pfmcold").equals(name)) return "" + coolantTanks[0].getFill();
|
||||||
|
if((PREFIX_VALUE + "pfm").equals(name)) return "" + coolantTanks[1].getFill();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Optional.Method(modid = "OpenComputers")
|
@Optional.Method(modid = "OpenComputers")
|
||||||
public String getComponentName() {
|
public String getComponentName() {
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.hbm.tileentity.machine.albion;
|
package com.hbm.tileentity.machine.albion;
|
||||||
|
|
||||||
|
import api.hbm.redstoneoverradio.IRORInteractive;
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.handler.CompatHandler;
|
import com.hbm.handler.CompatHandler;
|
||||||
import com.hbm.interfaces.IControlReceiver;
|
import com.hbm.interfaces.IControlReceiver;
|
||||||
@ -12,6 +13,8 @@ import com.hbm.util.EnumUtil;
|
|||||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
|
|
||||||
|
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||||
|
import api.hbm.redstoneoverradio.IRORInteractive;
|
||||||
import cpw.mods.fml.common.Optional;
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -32,7 +35,7 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||||
public class TileEntityPASource extends TileEntityCooledBase implements IGUIProvider, IConditionalInvAccess, IControlReceiver, SimpleComponent, CompatHandler.OCComponent {
|
public class TileEntityPASource extends TileEntityCooledBase implements IGUIProvider, IConditionalInvAccess, IControlReceiver, SimpleComponent, CompatHandler.OCComponent, IRORValueProvider, IRORInteractive {
|
||||||
|
|
||||||
public static final long usage = 100_000;
|
public static final long usage = 100_000;
|
||||||
public Particle particle;
|
public Particle particle;
|
||||||
@ -81,7 +84,7 @@ public class TileEntityPASource extends TileEntityCooledBase implements IGUIProv
|
|||||||
|
|
||||||
int steps = 1;
|
int steps = 1;
|
||||||
if(this.particle != null) steps = 1 + MathHelper.clamp_int(this.particle.momentum / 1_000, 0, 9);
|
if(this.particle != null) steps = 1 + MathHelper.clamp_int(this.particle.momentum / 1_000, 0, 9);
|
||||||
|
|
||||||
for(int i = 0; i < steps; i++) {
|
for(int i = 0; i < steps; i++) {
|
||||||
if(particle != null) {
|
if(particle != null) {
|
||||||
this.state = PAState.RUNNING;
|
this.state = PAState.RUNNING;
|
||||||
@ -164,6 +167,9 @@ public class TileEntityPASource extends TileEntityCooledBase implements IGUIProv
|
|||||||
new DirPos(xCoord - dir.offsetX * 2 + rot.offsetX * 2, yCoord, zCoord - dir.offsetZ * 2 + rot.offsetZ * 2, dir.getOpposite()),
|
new DirPos(xCoord - dir.offsetX * 2 + rot.offsetX * 2, yCoord, zCoord - dir.offsetZ * 2 + rot.offsetZ * 2, dir.getOpposite()),
|
||||||
new DirPos(xCoord - dir.offsetX * 2 - rot.offsetX * 2, yCoord, zCoord - dir.offsetZ * 2 - rot.offsetZ * 2, dir.getOpposite()),
|
new DirPos(xCoord - dir.offsetX * 2 - rot.offsetX * 2, yCoord, zCoord - dir.offsetZ * 2 - rot.offsetZ * 2, dir.getOpposite()),
|
||||||
new DirPos(xCoord + rot.offsetX * 5, yCoord, zCoord + rot.offsetZ * 5, rot),
|
new DirPos(xCoord + rot.offsetX * 5, yCoord, zCoord + rot.offsetZ * 5, rot),
|
||||||
|
new DirPos(xCoord, yCoord-2, zCoord, dir),
|
||||||
|
new DirPos(xCoord + rot.offsetX * 2, yCoord-2, zCoord + rot.offsetZ * 2, dir),
|
||||||
|
new DirPos(xCoord - rot.offsetX * 2, yCoord-2, zCoord - rot.offsetZ * 2, dir),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,4 +454,40 @@ public class TileEntityPASource extends TileEntityCooledBase implements IGUIProv
|
|||||||
if(this.defocus < 0) this.defocus = 0;
|
if(this.defocus < 0) this.defocus = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getFunctionInfo() {
|
||||||
|
return new String[] {
|
||||||
|
PREFIX_VALUE + "status",
|
||||||
|
PREFIX_VALUE + "momentum",
|
||||||
|
PREFIX_VALUE + "defocus",
|
||||||
|
PREFIX_VALUE + "temperature",
|
||||||
|
PREFIX_VALUE + "pfmcold",
|
||||||
|
PREFIX_VALUE + "pfm",
|
||||||
|
PREFIX_FUNCTION + "cancel"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String provideRORValue(String name) {
|
||||||
|
if((PREFIX_VALUE + "status").equals(name)) return "" + this.state;
|
||||||
|
if((PREFIX_VALUE + "momentum").equals(name)) return "" + this.lastSpeed;
|
||||||
|
if((PREFIX_VALUE + "defocus").equals(name)) {
|
||||||
|
return this.particle != null ? "" + this.particle.defocus : "0";
|
||||||
|
}
|
||||||
|
if((PREFIX_VALUE + "temperature").equals(name)) return "" + (int) this.temperature;
|
||||||
|
if((PREFIX_VALUE + "pfmcold").equals(name)) return "" + coolantTanks[0].getFill();
|
||||||
|
if((PREFIX_VALUE + "pfm").equals(name)) return "" + coolantTanks[1].getFill();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String runRORFunction(String name, String[] params) {
|
||||||
|
|
||||||
|
if ((PREFIX_FUNCTION + "cancel").equals(name)) {
|
||||||
|
particle = null;
|
||||||
|
state = PAState.IDLE;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,10 +46,10 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||||||
public class TileEntityBatterySocket extends TileEntityBatteryBase implements IRORValueProvider, IRORInteractive, IInfoProviderEC {
|
public class TileEntityBatterySocket extends TileEntityBatteryBase implements IRORValueProvider, IRORInteractive, IInfoProviderEC {
|
||||||
|
|
||||||
public boolean frame = false;
|
public boolean frame = false;
|
||||||
|
|
||||||
public static BulletConfig discharge;
|
public static BulletConfig discharge;
|
||||||
public static BiConsumer<EntityBulletBeamBase, MovingObjectPosition> BEAM_DISCHARGE_HIT = (beam, mop) -> {
|
public static BiConsumer<EntityBulletBeamBase, MovingObjectPosition> BEAM_DISCHARGE_HIT = (beam, mop) -> {
|
||||||
|
|
||||||
if(mop.typeOfHit == mop.typeOfHit.BLOCK) {
|
if(mop.typeOfHit == mop.typeOfHit.BLOCK) {
|
||||||
beam.worldObj.func_147480_a(mop.blockX, mop.blockY, mop.blockZ, false);
|
beam.worldObj.func_147480_a(mop.blockX, mop.blockY, mop.blockZ, false);
|
||||||
explodeDischarge(beam.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
|
explodeDischarge(beam.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
|
||||||
@ -59,7 +59,7 @@ public class TileEntityBatterySocket extends TileEntityBatteryBase implements IR
|
|||||||
explodeDischarge(beam.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
|
explodeDischarge(beam.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static void explodeDischarge(World world, double x, double y, double z) {
|
public static void explodeDischarge(World world, double x, double y, double z) {
|
||||||
ExplosionVNT vnt = new ExplosionVNT(world, x, y, z, 5F);
|
ExplosionVNT vnt = new ExplosionVNT(world, x, y, z, 5F);
|
||||||
vnt.setEntityProcessor(new EntityProcessorCrossSmooth(1, 20).setDamageClass(DamageClass.ELECTRIC));
|
vnt.setEntityProcessor(new EntityProcessorCrossSmooth(1, 20).setDamageClass(DamageClass.ELECTRIC));
|
||||||
@ -68,7 +68,7 @@ public class TileEntityBatterySocket extends TileEntityBatteryBase implements IR
|
|||||||
vnt.explode();
|
vnt.explode();
|
||||||
world.playSoundEffect(x, y, z, "hbm:entity.ufoBlast", 5.0F, 0.9F + world.rand.nextFloat() * 0.2F);
|
world.playSoundEffect(x, y, z, "hbm:entity.ufoBlast", 5.0F, 0.9F + world.rand.nextFloat() * 0.2F);
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
discharge = new BulletConfig().setupDamageClass(DamageClass.ELECTRIC).setBeam().setSpread(0.0F).setLife(3).setThresholdNegation(20F).setArmorPiercing(0.5F).setRenderRotations(false).setDoesPenetrate(true)
|
discharge = new BulletConfig().setupDamageClass(DamageClass.ELECTRIC).setBeam().setSpread(0.0F).setLife(3).setThresholdNegation(20F).setArmorPiercing(0.5F).setRenderRotations(false).setDoesPenetrate(true)
|
||||||
.setOnBeamImpact(BEAM_DISCHARGE_HIT);
|
.setOnBeamImpact(BEAM_DISCHARGE_HIT);
|
||||||
@ -83,7 +83,7 @@ public class TileEntityBatterySocket extends TileEntityBatteryBase implements IR
|
|||||||
public int damageTimer;
|
public int damageTimer;
|
||||||
public int damageTarget;
|
public int damageTarget;
|
||||||
public double scPowerMult = 1D;
|
public double scPowerMult = 1D;
|
||||||
|
|
||||||
public TileEntityBatterySocket() {
|
public TileEntityBatterySocket() {
|
||||||
super(1);
|
super(1);
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ public class TileEntityBatterySocket extends TileEntityBatteryBase implements IR
|
|||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
|
||||||
if(!worldObj.isRemote) {
|
if(!worldObj.isRemote) {
|
||||||
|
|
||||||
if(hasSCLoaded()) {
|
if(hasSCLoaded()) {
|
||||||
if(this.damageTarget == 0) pickNewSCTarget();
|
if(this.damageTarget == 0) pickNewSCTarget();
|
||||||
this.damageTimer++;
|
this.damageTimer++;
|
||||||
@ -114,30 +114,30 @@ public class TileEntityBatterySocket extends TileEntityBatteryBase implements IR
|
|||||||
|
|
||||||
this.log[19] = avg;
|
this.log[19] = avg;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if(worldObj.getTotalWorldTime() % 20 == 0) {
|
if(worldObj.getTotalWorldTime() % 20 == 0) {
|
||||||
frame = !worldObj.getBlock(xCoord, yCoord + 2, zCoord).isAir(worldObj, xCoord, yCoord + 2, zCoord);
|
frame = !worldObj.getBlock(xCoord, yCoord + 2, zCoord).isAir(worldObj, xCoord, yCoord + 2, zCoord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean hasSCLoaded() {
|
protected boolean hasSCLoaded() {
|
||||||
return slots[0] != null && slots[0].getItem() == ModItems.battery_sc && slots[0].getItemDamage() != EnumBatterySC.EMPTY.ordinal();
|
return slots[0] != null && slots[0].getItem() == ModItems.battery_sc && slots[0].getItemDamage() != EnumBatterySC.EMPTY.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void pickNewSCTarget() {
|
protected void pickNewSCTarget() {
|
||||||
this.damageTimer = 0;
|
this.damageTimer = 0;
|
||||||
//this.damageTarget = 100;
|
//this.damageTarget = 100;
|
||||||
this.damageTarget = 1200 + worldObj.rand.nextInt(2400); // 1-3 minutes;
|
this.damageTarget = 1200 + worldObj.rand.nextInt(2400); // 1-3 minutes;
|
||||||
this.markChanged();
|
this.markChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void discharge() {
|
protected void discharge() {
|
||||||
pickNewSCTarget();
|
pickNewSCTarget();
|
||||||
|
|
||||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
|
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
|
||||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||||
|
|
||||||
double x = xCoord + 0.5 - dir.offsetX * 0.5 + rot.offsetX * 0.5;
|
double x = xCoord + 0.5 - dir.offsetX * 0.5 + rot.offsetX * 0.5;
|
||||||
double y = yCoord + 1;
|
double y = yCoord + 1;
|
||||||
double z = zCoord + 0.5 - dir.offsetZ * 0.5 + rot.offsetX * 0.5;
|
double z = zCoord + 0.5 - dir.offsetZ * 0.5 + rot.offsetX * 0.5;
|
||||||
@ -156,15 +156,15 @@ public class TileEntityBatterySocket extends TileEntityBatteryBase implements IR
|
|||||||
initialDelta.multiply(1.125D / dominantAxis); // move 1.125 blocks outwards
|
initialDelta.multiply(1.125D / dominantAxis); // move 1.125 blocks outwards
|
||||||
sub.setPosition(xCoord + initialDelta.xCoord, yCoord + initialDelta.yCoord, zCoord + initialDelta.zCoord);
|
sub.setPosition(xCoord + initialDelta.xCoord, yCoord + initialDelta.yCoord, zCoord + initialDelta.zCoord);
|
||||||
Vec3NT actualDelta = new Vec3NT(target.posX - sub.posX, target.posY + target.height / 2 - sub.posY, target.posZ - sub.posZ);
|
Vec3NT actualDelta = new Vec3NT(target.posX - sub.posX, target.posY + target.height / 2 - sub.posY, target.posZ - sub.posZ);
|
||||||
|
|
||||||
sub.setRotationsFromVector(actualDelta);
|
sub.setRotationsFromVector(actualDelta);
|
||||||
sub.performHitscanExternal(actualDelta.lengthVector());
|
sub.performHitscanExternal(actualDelta.lengthVector());
|
||||||
worldObj.spawnEntityInWorld(sub);
|
worldObj.spawnEntityInWorld(sub);
|
||||||
}
|
}
|
||||||
|
|
||||||
explodeDischarge(worldObj, x + worldObj.rand.nextGaussian() * 0.5, y + worldObj.rand.nextGaussian() * 0.5, z + worldObj.rand.nextGaussian() * 0.5);
|
explodeDischarge(worldObj, x + worldObj.rand.nextGaussian() * 0.5, y + worldObj.rand.nextGaussian() * 0.5, z + worldObj.rand.nextGaussian() * 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void fluctuate() {
|
protected void fluctuate() {
|
||||||
double steppy = 1D / 100D;
|
double steppy = 1D / 100D;
|
||||||
this.scPowerMult += (steppy * (worldObj.rand.nextDouble() * 2 - 1));
|
this.scPowerMult += (steppy * (worldObj.rand.nextDouble() * 2 - 1));
|
||||||
@ -233,18 +233,18 @@ public class TileEntityBatterySocket extends TileEntityBatteryBase implements IR
|
|||||||
return power;
|
return power;
|
||||||
}
|
}
|
||||||
@Override public long getMaxPower() { return maxPowerFromStack(slots[0]); }
|
@Override public long getMaxPower() { return maxPowerFromStack(slots[0]); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPower(long power) {
|
public void setPower(long power) {
|
||||||
if(slots[0] == null || !(slots[0].getItem() instanceof IBatteryItem)) return;
|
if(slots[0] == null || !(slots[0].getItem() instanceof IBatteryItem)) return;
|
||||||
((IBatteryItem) slots[0].getItem()).setCharge(slots[0], power);
|
((IBatteryItem) slots[0].getItem()).setCharge(slots[0], power);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long powerFromStack(ItemStack stack) {
|
public static long powerFromStack(ItemStack stack) {
|
||||||
if(stack == null || !(stack.getItem() instanceof IBatteryItem)) return 0;
|
if(stack == null || !(stack.getItem() instanceof IBatteryItem)) return 0;
|
||||||
return ((IBatteryItem) stack.getItem()).getCharge(stack);
|
return ((IBatteryItem) stack.getItem()).getCharge(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long maxPowerFromStack(ItemStack stack) {
|
public static long maxPowerFromStack(ItemStack stack) {
|
||||||
if(stack == null || !(stack.getItem() instanceof IBatteryItem)) return 0;
|
if(stack == null || !(stack.getItem() instanceof IBatteryItem)) return 0;
|
||||||
return ((IBatteryItem) stack.getItem()).getMaxCharge(stack);
|
return ((IBatteryItem) stack.getItem()).getMaxCharge(stack);
|
||||||
@ -319,6 +319,7 @@ public class TileEntityBatterySocket extends TileEntityBatteryBase implements IR
|
|||||||
public String[] getFunctionInfo() {
|
public String[] getFunctionInfo() {
|
||||||
return new String[] {
|
return new String[] {
|
||||||
PREFIX_VALUE + "fill",
|
PREFIX_VALUE + "fill",
|
||||||
|
PREFIX_VALUE + "maxfill",
|
||||||
PREFIX_VALUE + "fillpercent",
|
PREFIX_VALUE + "fillpercent",
|
||||||
PREFIX_VALUE + "delta",
|
PREFIX_VALUE + "delta",
|
||||||
PREFIX_FUNCTION + "setmode" + NAME_SEPARATOR + "mode (0-3)",
|
PREFIX_FUNCTION + "setmode" + NAME_SEPARATOR + "mode (0-3)",
|
||||||
@ -332,6 +333,7 @@ public class TileEntityBatterySocket extends TileEntityBatteryBase implements IR
|
|||||||
@Override
|
@Override
|
||||||
public String provideRORValue(String name) {
|
public String provideRORValue(String name) {
|
||||||
if((PREFIX_VALUE + "fill").equals(name)) return "" + this.getPower();
|
if((PREFIX_VALUE + "fill").equals(name)) return "" + this.getPower();
|
||||||
|
if((PREFIX_VALUE + "maxfill").equals(name)) return "" + this.getMaxPower();
|
||||||
if((PREFIX_VALUE + "fillpercent").equals(name)) return "" + this.getPower() * 100 / (Math.max(this.getMaxPower(), 1));
|
if((PREFIX_VALUE + "fillpercent").equals(name)) return "" + this.getPower() * 100 / (Math.max(this.getMaxPower(), 1));
|
||||||
if((PREFIX_VALUE + "delta").equals(name)) return "" + delta;
|
if((PREFIX_VALUE + "delta").equals(name)) return "" + delta;
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -21,7 +21,7 @@ public class Calculator {
|
|||||||
for (int i = 0; i < tokens.length; i++) {
|
for (int i = 0; i < tokens.length; i++) {
|
||||||
if (tokens[i] == ' ') continue;
|
if (tokens[i] == ' ') continue;
|
||||||
|
|
||||||
if (tokens[i] >= '0' && tokens[i] <= '9' || tokens[i] == '.' || (tokens[i] == '-' && (i == 0 || "+-*/^(".contains(String.valueOf(tokens[i - 1]))))) {
|
if (tokens[i] >= '0' && tokens[i] <= '9' || tokens[i] == '.' || (tokens[i] == '-' && (i == 0 || "+-*/%^(".contains(String.valueOf(tokens[i - 1]))))) {
|
||||||
StringBuilder buffer = new StringBuilder();
|
StringBuilder buffer = new StringBuilder();
|
||||||
if (tokens[i] == '-') {
|
if (tokens[i] == '-') {
|
||||||
buffer.append('-'); // for negative numbers
|
buffer.append('-'); // for negative numbers
|
||||||
@ -37,7 +37,7 @@ public class Calculator {
|
|||||||
operators.pop();
|
operators.pop();
|
||||||
if (!operators.isEmpty() && operators.peek().length() > 1)
|
if (!operators.isEmpty() && operators.peek().length() > 1)
|
||||||
values.push(evaluateFunction(operators.pop(), values.pop()));
|
values.push(evaluateFunction(operators.pop(), values.pop()));
|
||||||
} else if (tokens[i] == '+' || tokens[i] == '-' || tokens[i] == '*' || tokens[i] == '/' || tokens[i] == '^') {
|
} else if (tokens[i] == '+' || tokens[i] == '-' || tokens[i] == '*' || tokens[i] == '/' || tokens[i] == '%' || tokens[i] == '^') {
|
||||||
while (!operators.isEmpty() && hasPrecedence(String.valueOf(tokens[i]), operators.peek()))
|
while (!operators.isEmpty() && hasPrecedence(String.valueOf(tokens[i]), operators.peek()))
|
||||||
values.push(evaluateOperator(operators.pop().charAt(0), values.pop(), values.pop()));
|
values.push(evaluateOperator(operators.pop().charAt(0), values.pop(), values.pop()));
|
||||||
operators.push(Character.toString(tokens[i]));
|
operators.push(Character.toString(tokens[i]));
|
||||||
@ -67,6 +67,7 @@ public class Calculator {
|
|||||||
case '-': return y - x;
|
case '-': return y - x;
|
||||||
case '*': return y * x;
|
case '*': return y * x;
|
||||||
case '/': return y / x;
|
case '/': return y / x;
|
||||||
|
case '%': return y % x;
|
||||||
|
|
||||||
case '^': return Math.pow(y, x); // should not happen here, but oh well
|
case '^': return Math.pow(y, x); // should not happen here, but oh well
|
||||||
}
|
}
|
||||||
@ -102,7 +103,7 @@ public class Calculator {
|
|||||||
char secondChar = second.charAt(0);
|
char secondChar = second.charAt(0);
|
||||||
|
|
||||||
if (secondChar == '(' || secondChar == ')') return false;
|
if (secondChar == '(' || secondChar == ')') return false;
|
||||||
else return (firstChar != '*' && firstChar != '/' && firstChar != '^') || (secondChar != '+' && secondChar != '-');
|
else return (firstChar != '*' && firstChar != '/' && firstChar != '%' && firstChar != '^') || (secondChar != '+' && secondChar != '-');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the input with all powers evaluated */
|
/** Returns the input with all powers evaluated */
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 10 KiB |
Loading…
x
Reference in New Issue
Block a user