From e9b9841481c94606c786c4e911edfb6d42cdee4f Mon Sep 17 00:00:00 2001 From: Technus Date: Fri, 29 Sep 2017 20:41:49 +0200 Subject: MOre BLue! --- .../assets/gregtech/textures/gui/Parametrizer.png | Bin 1832 -> 262972 bytes .../assets/gregtech/textures/gui/Uncertainty.png | Bin 3039 -> 262972 bytes .../textures/gui/multimachines/EMDisplay.png | Bin 262931 -> 262931 bytes 3 files changed, 0 insertions(+), 0 deletions(-) diff --git a/src/main/resources/assets/gregtech/textures/gui/Parametrizer.png b/src/main/resources/assets/gregtech/textures/gui/Parametrizer.png index ad3c655e46..f0fb76ad0f 100644 Binary files a/src/main/resources/assets/gregtech/textures/gui/Parametrizer.png and b/src/main/resources/assets/gregtech/textures/gui/Parametrizer.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/Uncertainty.png b/src/main/resources/assets/gregtech/textures/gui/Uncertainty.png index 6b8dd0aa2a..8afdd68ccc 100644 Binary files a/src/main/resources/assets/gregtech/textures/gui/Uncertainty.png and b/src/main/resources/assets/gregtech/textures/gui/Uncertainty.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/multimachines/EMDisplay.png b/src/main/resources/assets/gregtech/textures/gui/multimachines/EMDisplay.png index b2e184022e..95aa09beae 100644 Binary files a/src/main/resources/assets/gregtech/textures/gui/multimachines/EMDisplay.png and b/src/main/resources/assets/gregtech/textures/gui/multimachines/EMDisplay.png differ -- cgit From 621a8c21271056182a95b75a3d6e883a6d9b4a36 Mon Sep 17 00:00:00 2001 From: Technus Date: Sat, 30 Sep 2017 21:38:14 +0200 Subject: update gt5u --- build.properties | 4 ++-- .../metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/build.properties b/build.properties index 0635e9681a..b2fa89c4d4 100644 --- a/build.properties +++ b/build.properties @@ -6,8 +6,8 @@ ic2.version=2.2.790-experimental codechickenlib.version=1.1.3.140 codechickencore.version=1.0.7.47 nei.version=1.0.5.120 -gregtech.jenkinsbuild=851 -gregtech.version=5.09.32.04 +gregtech.jenkinsbuild=856 +gregtech.version=5.09.32.05 cofhcore.cf=2246/920 cofhcore.version=[1.7.10]3.0.3-303-dev cofhlib.cf=2246/918 diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java index 2c99e1a5d9..7526063046 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java @@ -205,10 +205,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt protected boolean areChunksAroundLoaded_EM(){ if(isValidMetaTileEntity(this) && getBaseMetaTileEntity().isServerSide()){ IGregTechTileEntity base=getBaseMetaTileEntity(); - final int x=base.getXCoord(); - final int y=base.getYCoord(); - final int z=base.getZCoord(); - return base.getWorld().checkChunksExist(x-48,y-48,z-48,x+48,y+48,z+48); + return base.getWorld().doChunksNearChunkExist(base.getXCoord(),base.getYCoord(),base.getZCoord(),3); //todo check if it is actually checking if chunks are loaded }else return false; } -- cgit From a2ff6acf323a87eb8015de845a5482fb268ba337 Mon Sep 17 00:00:00 2001 From: Technus Date: Sat, 30 Sep 2017 23:40:11 +0200 Subject: First draft of reactor sim. --- .../technus/tectech/loader/ThingsLoader.java | 4 + .../tectech/thing/block/ReactorSimBlock.java | 90 +++ .../tectech/thing/block/ReactorSimItem.java | 29 + .../thing/tileEntity/ReactorSimTileEntity.java | 698 +++++++++++++++++++++ .../textures/blocks/blockReactorSimulator.png | Bin 0 -> 1147 bytes 5 files changed, 821 insertions(+) create mode 100644 src/main/java/com/github/technus/tectech/thing/block/ReactorSimBlock.java create mode 100644 src/main/java/com/github/technus/tectech/thing/block/ReactorSimItem.java create mode 100644 src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java create mode 100644 src/main/resources/assets/tectech/textures/blocks/blockReactorSimulator.png diff --git a/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java b/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java index 7411bc9335..d957152db5 100644 --- a/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java @@ -3,6 +3,7 @@ package com.github.technus.tectech.loader; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.block.QuantumStuffBlock; +import com.github.technus.tectech.thing.block.ReactorSimBlock; import com.github.technus.tectech.thing.casing.GT_Block_CasingsTT; import com.github.technus.tectech.thing.casing.GT_Block_HintTT; import com.github.technus.tectech.thing.casing.TT_Container_Casings; @@ -37,6 +38,9 @@ public class ThingsLoader implements Runnable { TecTech.Logger.info("TurretBaseEM registered"); } + ReactorSimBlock.run(); + TecTech.Logger.info("Reactor Simulator registered"); + ConstructableTriggerItem.run(); ParametrizerMemoryCard.run(); TecTech.Logger.info("Useful item registered"); diff --git a/src/main/java/com/github/technus/tectech/thing/block/ReactorSimBlock.java b/src/main/java/com/github/technus/tectech/thing/block/ReactorSimBlock.java new file mode 100644 index 0000000000..2b3d78cd49 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/block/ReactorSimBlock.java @@ -0,0 +1,90 @@ +package com.github.technus.tectech.thing.block; + +import com.github.technus.tectech.thing.tileEntity.ReactorSimTileEntity; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ic2.core.IC2; +import ic2.core.IHasGui; +import ic2.core.block.TileEntityBlock; +import net.minecraft.block.Block; +import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +import static com.github.technus.tectech.auxiliary.Reference.MODID; + +/** + * Created by danie_000 on 30.09.2017. + */ +public class ReactorSimBlock extends Block implements ITileEntityProvider { + public static ReactorSimBlock INSTANCE; + public static IIcon stuff; + + public ReactorSimBlock() { + super(Material.iron); + this.setBlockBounds(0, 0, 0, 1, 1, 1); + setBlockName("reactorSim"); + setHarvestLevel("wrench", 3); + setHardness(50); + setResistance(30); + setLightOpacity(0); + setStepSound(Block.soundTypeMetal); + setBlockTextureName(MODID + ":blockReactorSimulator"); + } + + @Override + public boolean isOpaqueCube() { + return true; + } + + @Override + public boolean getCanBlockGrass() { + return true; + } + + @Override + public boolean canBeReplacedByLeaves(IBlockAccess world, int x, int y, int z) { + return false; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister p_149651_1_) { + super.registerBlockIcons(p_149651_1_); + stuff = this.blockIcon; + } + + public static void run() { + INSTANCE = new ReactorSimBlock(); + GameRegistry.registerBlock(INSTANCE, ReactorSimItem.class, INSTANCE.getUnlocalizedName()); + GameRegistry.registerTileEntity(ReactorSimTileEntity.class,MODID+"_reactorSim"); + } + + @Override + public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { + return new ReactorSimTileEntity(); + } + + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float a, float b, float c) { + if(entityPlayer.isSneaking()) { + return false; + } else { + TileEntity te = world.getTileEntity(x,y,z); + return te instanceof IHasGui && (!IC2.platform.isSimulating() || IC2.platform.launchGui(entityPlayer, (IHasGui) te)); + } + } + + public void onNeighborBlockChange(World world, int x, int y, int z, Block srcBlock) { + TileEntity te = world.getTileEntity(x,y,z); + if(te instanceof TileEntityBlock) { + ((TileEntityBlock)te).onNeighborUpdate(srcBlock); + } + + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/block/ReactorSimItem.java b/src/main/java/com/github/technus/tectech/thing/block/ReactorSimItem.java new file mode 100644 index 0000000000..c21820eea5 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/block/ReactorSimItem.java @@ -0,0 +1,29 @@ +package com.github.technus.tectech.thing.block; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +import java.util.List; + +import static com.github.technus.tectech.CommonValues.TEC_MARK_GENERAL; + +/** + * Created by danie_000 on 30.09.2017. + */ +public class ReactorSimItem extends ItemBlock { + public static QuantumGlassItem INSTANCE; + + public ReactorSimItem(Block b) { + super(b); + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { + aList.add(TEC_MARK_GENERAL); + aList.add("ReactorSimulator 9001"); + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Explodes, but not as much..."); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java b/src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java new file mode 100644 index 0000000000..63d1d61bfa --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java @@ -0,0 +1,698 @@ +package com.github.technus.tectech.thing.tileEntity; + +import com.github.technus.tectech.auxiliary.Reference; +import ic2.api.energy.event.EnergyTileUnloadEvent; +import ic2.api.reactor.IReactorComponent; +import ic2.core.IC2; +import ic2.core.block.reactor.tileentity.TileEntityNuclearReactorElectric; +import ic2.core.init.MainConfig; +import ic2.core.util.ConfigUtil; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; + +/** + * Created by danie_000 on 30.09.2017. + */ +public class ReactorSimTileEntity extends TileEntityNuclearReactorElectric { + private boolean hadRedstone =true; + + public ReactorSimTileEntity() { + super(); + //this.updateTicker = IC2.random.nextInt(this.getTickRate()); + //this.inputTank = new FluidTank(10000); + //this.outputTank = new FluidTank(10000); + //this.reactorSlot = new InvSlotReactor(this, "reactor", 0, 54); + //this.coolantinputSlot = new InvSlotConsumableLiquidByList(this, "coolantinputSlot", 55, InvSlot.Access.I, 1, InvSlot.InvSide.ANY, InvSlotConsumableLiquid.OpType.Drain, BlocksItems.getFluid(InternalName.fluidCoolant)); + //this.hotcoolinputSlot = new InvSlotConsumableLiquidByTank(this, "hotcoolinputSlot", 56, InvSlot.Access.I, 1, InvSlot.InvSide.ANY, InvSlotConsumableLiquid.OpType.Fill, this.outputTank); + //this.coolantoutputSlot = new InvSlotOutput(this, "coolantoutputSlot", 57, 1); + //this.hotcoolantoutputSlot = new InvSlotOutput(this, "hotcoolantoutputSlot", 58, 1); + } + + @Override + public void onLoaded() { + super.onLoaded(); + if(IC2.platform.isSimulating() && this.addedToEnergyNet) { + MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); + //this.addedToEnergyNet = false; + } + } + + public void onUnloaded() { + addedToEnergyNet=false; + super.onUnloaded(); + } + + @Override + public String getInventoryName() { + return "Nuclear Reactor Simulator"; + } + + //public int gaugeHeatScaled(int i) { + // return i * this.heat / (this.maxHeat / 100 * 85); + //} + + //public void readFromNBT(NBTTagCompound nbttagcompound) { + // super.readFromNBT(nbttagcompound); + // //this.heat = nbttagcompound.getInteger("heat"); + // //this.inputTank.readFromNBT(nbttagcompound.getCompoundTag("inputTank")); + // //this.outputTank.readFromNBT(nbttagcompound.getCompoundTag("outputTank")); + // //this.output = (float)nbttagcompound.getShort("output"); + //} + + //public void writeToNBT(NBTTagCompound nbttagcompound) { + // super.writeToNBT(nbttagcompound); + // //NBTTagCompound inputTankTag = new NBTTagCompound(); + // //this.inputTank.writeToNBT(inputTankTag); + // //nbttagcompound.setTag("inputTank", inputTankTag); + // //NBTTagCompound outputTankTag = new NBTTagCompound(); + // //this.outputTank.writeToNBT(outputTankTag); + // //nbttagcompound.setTag("outputTank", outputTankTag); + // //nbttagcompound.setInteger("heat", this.heat); + // //nbttagcompound.setShort("output", (short)((int)this.getReactorEnergyOutput())); + //} + + //public void setRedstoneSignal(boolean redstone) { + // this.redstone = redstone; + //} + + //public void drawEnergy(double amount) { + //} + + //public float sendEnergy(float send) { + // return 0.0F; + //} + + @Override + public boolean emitsEnergyTo(TileEntity receiver, ForgeDirection direction) { + return false; + } + + @Override + public double getOfferedEnergy() { + return 0; + } + + //public int getSourceTier() { + // return 4; + //} + + @Override + public double getReactorEUEnergyOutput() { + return (double)(this.getReactorEnergyOutput() * 5.0F * ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/nuclear")); + } + + //public List getSubTiles() { + // if(this.subTiles == null) { + // this.subTiles = new ArrayList(); + // this.subTiles.add(this); + // Direction[] arr$ = Direction.directions; + // int len$ = arr$.length; + // + // for(int i$ = 0; i$ < len$; ++i$) { + // Direction dir = arr$[i$]; + // TileEntity te = dir.applyToTileEntity(this); + // if(te instanceof TileEntityReactorChamberElectric && !te.isInvalid()) { + // this.subTiles.add(te); + // } + // } + // } + // + // return this.subTiles; + //} + + //private void processfluidsSlots() { + // RecipeOutput outputinputSlot = this.processInputSlot(true); + // if(outputinputSlot != null) { + // this.processInputSlot(false); + // List outputoutputSlot = outputinputSlot.items; + // this.coolantoutputSlot.add(outputoutputSlot); + // } + // + // RecipeOutput outputoutputSlot1 = this.processOutputSlot(true); + // if(outputoutputSlot1 != null) { + // this.processOutputSlot(false); + // List processResult = outputoutputSlot1.items; + // this.hotcoolantoutputSlot.add(processResult); + // } + // + //} + + //public void refreshChambers() { + // if(this.addedToEnergyNet) { + // MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); + // } + // + // this.subTiles = null; + // if(this.addedToEnergyNet) { + // MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); + // } + // + //} + + @Override + protected void updateEntityServer() { + if(this.updateTicker++ % this.getTickRate() == 0) { + if (!worldObj.isRemote && this.worldObj.doChunksNearChunkExist(this.xCoord, this.yCoord, this.zCoord, 2)) { + if(hadRedstone && !receiveredstone()) hadRedstone=false; + else if(!hadRedstone && receiveredstone()){ + doUpdates(); + hadRedstone=true; + } + markDirty(); + } + } + } + + //public void dropAllUnfittingStuff() { + // int i; + // ItemStack stack; + // for(i = 0; i < this.reactorSlot.size(); ++i) { + // stack = this.reactorSlot.get(i); + // if(stack != null && !this.isUsefulItem(stack, false)) { + // this.reactorSlot.put(i, null); + // this.eject(stack); + // } + // } + // + // for(i = this.reactorSlot.size(); i < this.reactorSlot.rawSize(); ++i) { + // stack = this.reactorSlot.get(i); + // this.reactorSlot.put(i, null); + // this.eject(stack); + // } + // + //} + + //public boolean isUsefulItem(ItemStack stack, boolean forInsertion) { + // Item item = stack.getItem(); + // return (item instanceof IReactorComponent || (item == Ic2Items.TritiumCell.getItem() || item == Ic2Items.reactorDepletedUraniumSimple.getItem() || item == Ic2Items.reactorDepletedUraniumDual.getItem() || item == Ic2Items.reactorDepletedUraniumQuad.getItem() || item == Ic2Items.reactorDepletedMOXSimple.getItem() || item == Ic2Items.reactorDepletedMOXDual.getItem() || item == Ic2Items.reactorDepletedMOXQuad.getItem())); + //} + + //public void eject(ItemStack drop) { + // if(IC2.platform.isSimulating() && drop != null) { + // float f = 0.7F; + // double d = (double)(this.worldObj.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + // double d1 = (double)(this.worldObj.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + // double d2 = (double)(this.worldObj.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + // EntityItem entityitem = new EntityItem(this.worldObj, (double)this.xCoord + d, (double)this.yCoord + d1, (double)this.zCoord + d2, drop); + // entityitem.delayBeforeCanPickup = 10; + // this.worldObj.spawnEntityInWorld(entityitem); + // } + //} + + @Override + public boolean calculateHeatEffects() { + if(this.heat >= 4000 && IC2.platform.isSimulating()) { + float power = (float)this.heat / (float)this.maxHeat; + if(power >= 1.0F) { + this.explode();//ding + return true; + } else { + //int[] coord; + //Block block; + //Material mat; + //if(power >= 0.85F && this.worldObj.rand.nextFloat() <= 0.2F * this.hem) { + // coord = this.getRandCoord(2); + // if(coord != null) { + // block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); + // if(block.isAir(this.worldObj, coord[0], coord[1], coord[2])) { + // this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.fire, 0, 7); + // } else if(block.getBlockHardness(this.worldObj, coord[0], coord[1], coord[2]) >= 0.0F && this.worldObj.getTileEntity(coord[0], coord[1], coord[2]) == null) { + // mat = block.getMaterial(); + // if(mat != Material.rock && mat != Material.iron && mat != Material.lava && mat != Material.ground && mat != Material.clay) { + // this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.fire, 0, 7); + // } else { + // this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.flowing_lava, 15, 7); + // } + // } + // } + //} + // + //if(power >= 0.7F) { + // List var5 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox((double)(this.xCoord - 3), (double)(this.yCoord - 3), (double)(this.zCoord - 3), (double)(this.xCoord + 4), (double)(this.yCoord + 4), (double)(this.zCoord + 4))); + // + // for(int var6 = 0; var6 < var5.size(); ++var6) { + // Entity var7 = (Entity)var5.get(var6); + // var7.attackEntityFrom(IC2DamageSource.radiation, (float)((int)((float)this.worldObj.rand.nextInt(4) * this.hem))); + // } + //} + // + //if(power >= 0.5F && this.worldObj.rand.nextFloat() <= this.hem) { + // coord = this.getRandCoord(2); + // if(coord != null) { + // block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); + // if(block.getMaterial() == Material.water) { + // this.worldObj.setBlockToAir(coord[0], coord[1], coord[2]); + // } + // } + //} + // + //if(power >= 0.4F && this.worldObj.rand.nextFloat() <= this.hem) { + // coord = this.getRandCoord(2); + // if(coord != null && this.worldObj.getTileEntity(coord[0], coord[1], coord[2]) == null) { + // block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); + // mat = block.getMaterial(); + // if(mat == Material.wood || mat == Material.leaves || mat == Material.cloth) { + // this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.fire, 0, 7); + // } + // } + //} + return false; + } + } + return false; + } + + //public int[] getRandCoord(int radius) { + // if(radius <= 0) { + // return null; + // } else { + // int[] c = new int[]{this.xCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius, this.yCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius, this.zCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius}; + // return c[0] == this.xCoord && c[1] == this.yCoord && c[2] == this.zCoord?null:c; + // } + //} + + //public void processChambers() { + // short size = this.getReactorSize(); + // + // for(int pass = 0; pass < 2; ++pass) { + // for(int y = 0; y < 6; ++y) { + // for(int x = 0; x < size; ++x) { + // ItemStack stack = this.reactorSlot.get(x, y); + // if(stack != null && stack.getItem() instanceof IReactorComponent) { + // IReactorComponent comp = (IReactorComponent)stack.getItem(); + // comp.processChamber(this, stack, x, y, pass == 0); + // } + // } + // } + // } + // + //} + + //public boolean produceEnergy() { + // return this.receiveredstone() && ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/generator") > 0.0F; + //} + + //NO need + //public boolean receiveredstone() { + // return this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord) || this.redstone; + //} + + //public short getReactorSize() { + // if(this.worldObj == null) { + // return 9; + // } else { + // short cols = 3; + // Direction[] arr$ = Direction.directions; + // int len$ = arr$.length; + // + // for(int i$ = 0; i$ < len$; ++i$) { + // Direction direction = arr$[i$]; + // TileEntity target = direction.applyToTileEntity(this); + // if(target instanceof TileEntityReactorChamberElectric) { + // ++cols; + // } + // } + // + // return cols; + // } + //} + + //public int getTickRate() { + // return 20; + //} + + //public ContainerBase getGuiContainer(EntityPlayer entityPlayer) { + // return new ContainerNuclearReactor(entityPlayer, this); + //} + + //@SideOnly(Side.CLIENT) + //public GuiScreen getGui(EntityPlayer entityPlayer, boolean isAdmin) { + // return new GuiNuclearReactor(new ContainerNuclearReactor(entityPlayer, this)); + //} + + //public void onGuiClosed(EntityPlayer entityPlayer) {} + + //new method + private void doUpdates(){ + heat=0; + do{ + dropAllUnfittingStuff(); + output = 0.0F; + maxHeat = 10000; + hem = 1.0F; + processChambers(); + }while(!calculateHeatEffects() && output>0); + } + + //region no need to change + //public void onNetworkUpdate(String field) { + // if(field.equals("output")) { + // if(this.output > 0.0F) { + // if(this.lastOutput <= 0.0F) { + // if(this.audioSourceMain == null) { + // this.audioSourceMain = IC2.audioManager.createSource(this, PositionSpec.Center, "Generators/NuclearReactor/NuclearReactorLoop.ogg", true, false, IC2.audioManager.getDefaultVolume()); + // } + // + // if(this.audioSourceMain != null) { + // this.audioSourceMain.play(); + // } + // } + // + // if(this.output < 40.0F) { + // if(this.lastOutput <= 0.0F || this.lastOutput >= 40.0F) { + // if(this.audioSourceGeiger != null) { + // this.audioSourceGeiger.remove(); + // } + // + // this.audioSourceGeiger = IC2.audioManager.createSource(this, PositionSpec.Center, "Generators/NuclearReactor/GeigerLowEU.ogg", true, false, IC2.audioManager.getDefaultVolume()); + // if(this.audioSourceGeiger != null) { + // this.audioSourceGeiger.play(); + // } + // } + // } else if(this.output < 80.0F) { + // if(this.lastOutput < 40.0F || this.lastOutput >= 80.0F) { + // if(this.audioSourceGeiger != null) { + // this.audioSourceGeiger.remove(); + // } + // + // this.audioSourceGeiger = IC2.audioManager.createSource(this, PositionSpec.Center, "Generators/NuclearReactor/GeigerMedEU.ogg", true, false, IC2.audioManager.getDefaultVolume()); + // if(this.audioSourceGeiger != null) { + // this.audioSourceGeiger.play(); + // } + // } + // } else if(this.output >= 80.0F && this.lastOutput < 80.0F) { + // if(this.audioSourceGeiger != null) { + // this.audioSourceGeiger.remove(); + // } + // + // this.audioSourceGeiger = IC2.audioManager.createSource(this, PositionSpec.Center, "Generators/NuclearReactor/GeigerHighEU.ogg", true, false, IC2.audioManager.getDefaultVolume()); + // if(this.audioSourceGeiger != null) { + // this.audioSourceGeiger.play(); + // } + // } + // } else if(this.lastOutput > 0.0F) { + // if(this.audioSourceMain != null) { + // this.audioSourceMain.stop(); + // } + // + // if(this.audioSourceGeiger != null) { + // this.audioSourceGeiger.stop(); + // } + // } + // + // this.lastOutput = this.output; + // } + // + // super.onNetworkUpdate(field); + //} + + //public float getWrenchDropRate() { + // return 1F; + //} + + //public ChunkCoordinates getPosition() { + // return new ChunkCoordinates(this.xCoord, this.yCoord, this.zCoord); + //} + + //public World getWorld() { + // return this.worldObj; + //} + + //public int getHeat() { + // return this.heat; + //} + + //public void setHeat(int heat1) { + // this.heat = heat1; + //} + + //public int addHeat(int amount) { + // this.heat += amount; + // return this.heat; + //} + + //public ItemStack getItemAt(int x, int y) { + // return x >= 0 && x < this.getReactorSize() && y >= 0 && y < 6?this.reactorSlot.get(x, y):null; + //} + + //public void setItemAt(int x, int y, ItemStack item) { + // if(x >= 0 && x < this.getReactorSize() && y >= 0 && y < 6) { + // this.reactorSlot.put(x, y, item); + // } + //} + + @Override + public void explode() { + getWorld().playSoundEffect(xCoord,yCoord,zCoord, Reference.MODID+":microwave_ding", 1, 1); + } + + @Override + public void addEmitHeat(int heat) {} + + //region no need + //public int getMaxHeat() { + // return this.maxHeat; + //} + + //public void setMaxHeat(int newMaxHeat) { + // this.maxHeat = newMaxHeat; + //} + + //public float getHeatEffectModifier() { + // return this.hem; + //} + + //public void setHeatEffectModifier(float newHEM) { + // this.hem = newHEM; + //} + + //public float getReactorEnergyOutput() { + // return this.output; + //} + + //public float addOutput(float energy) { + // return this.output += energy; + //} + + //PRIVATE not used + //private RecipeOutput processInputSlot(boolean simulate) { + // if(!this.coolantinputSlot.isEmpty()) { + // MutableObject output = new MutableObject(); + // if(this.coolantinputSlot.transferToTank(this.inputTank, output, simulate) && (output.getValue() == null || this.coolantoutputSlot.canAdd((ItemStack)output.getValue()))) { + // if(output.getValue() == null) { + // return new RecipeOutput(null); + // } + // + // return new RecipeOutput(null, (ItemStack)output.getValue()); + // } + // } + // + // return null; + //} + + //private RecipeOutput processOutputSlot(boolean simulate) { + // if(!this.hotcoolinputSlot.isEmpty()) { + // MutableObject output = new MutableObject(); + // if(this.hotcoolinputSlot.transferFromTank(this.outputTank, output, simulate) && (output.getValue() == null || this.hotcoolantoutputSlot.canAdd((ItemStack)output.getValue()))) { + // if(output.getValue() == null) { + // return new RecipeOutput(null); + // } + // + // return new RecipeOutput(null, (ItemStack)output.getValue()); + // } + // } + // + // return null; + //} + + @Override + public boolean isFluidCooled() { + return false; + } + + //!!!Private - removed use cases + //private void movefluidinWorld(boolean out) { + // if(out) { + // if(this.inputTank.getFluidAmount() < 1000 && this.outputTank.getFluidAmount() < 1000) { + // this.inputTank.setFluid(null); + // this.outputTank.setFluid(null); + // } else { + // for(int coolantFluid = 1; coolantFluid < 4; ++coolantFluid) { + // for(int coolantBlock = 1; coolantBlock < 4; ++coolantBlock) { + // for(int hotCoolantFluid = 1; hotCoolantFluid < 4; ++hotCoolantFluid) { + // if(this.surroundings[coolantBlock][coolantFluid][hotCoolantFluid] instanceof BlockAir) { + // if(this.inputTank.getFluidAmount() >= 1000) { + // this.worldObj.setBlock(coolantBlock + this.xCoord - 2, coolantFluid + this.yCoord - 2, hotCoolantFluid + this.zCoord - 2, this.inputTank.getFluid().getFluid().getBlock()); + // this.inputTank.drain(1000, true); + // } else if(this.outputTank.getFluidAmount() >= 1000) { + // this.worldObj.setBlock(coolantBlock + this.xCoord - 2, coolantFluid + this.yCoord - 2, hotCoolantFluid + this.zCoord - 2, this.outputTank.getFluid().getFluid().getBlock()); + // this.outputTank.drain(1000, true); + // } + // } + // } + // } + // } + // + // if(this.inputTank.getFluidAmount() < 1000) { + // this.inputTank.setFluid(null); + // } + // + // if(this.outputTank.getFluidAmount() < 1000) { + // this.outputTank.setFluid(null); + // } + // } + // } else { + // Fluid var9 = BlocksItems.getFluid(InternalName.fluidCoolant); + // Block var10 = BlocksItems.getFluidBlock(InternalName.fluidCoolant); + // Fluid var11 = BlocksItems.getFluid(InternalName.fluidHotCoolant); + // Block hotCoolantBlock = BlocksItems.getFluidBlock(InternalName.fluidHotCoolant); + // + // for(int yoffset = 1; yoffset < 4; ++yoffset) { + // for(int xoffset = 1; xoffset < 4; ++xoffset) { + // for(int zoffset = 1; zoffset < 4; ++zoffset) { + // if(this.surroundings[xoffset][yoffset][zoffset] == var10) { + // this.worldObj.setBlock(xoffset + this.xCoord - 2, yoffset + this.yCoord - 2, zoffset + this.zCoord - 2, Blocks.air); + // this.inputTank.fill(new FluidStack(var9, 1000), true); + // } else if(this.surroundings[xoffset][yoffset][zoffset] == hotCoolantBlock) { + // this.worldObj.setBlock(xoffset + this.xCoord - 2, yoffset + this.yCoord - 2, zoffset + this.zCoord - 2, Blocks.air); + // this.outputTank.fill(new FluidStack(var11, 1000), true); + // } + // } + // } + // } + // } + // + //} + + //!!!! PRIVATE - removed use cases + //private boolean readyforpressurizedreactor() { + // Block coolantBlock = BlocksItems.getFluidBlock(InternalName.fluidCoolant); + // Block hotCoolantBlock = BlocksItems.getFluidBlock(InternalName.fluidHotCoolant); + // + // int xoffset; + // int yoffset; + // int zoffset; + // for(xoffset = -2; xoffset < 3; ++xoffset) { + // for(yoffset = -2; yoffset < 3; ++yoffset) { + // for(zoffset = -2; zoffset < 3; ++zoffset) { + // if(this.worldObj.isAirBlock(xoffset + this.xCoord, yoffset + this.yCoord, zoffset + this.zCoord)) { + // this.surroundings[xoffset + 2][yoffset + 2][zoffset + 2] = Blocks.air; + // } else { + // Block block = this.worldObj.getBlock(xoffset + this.xCoord, yoffset + this.yCoord, zoffset + this.zCoord); + // if((block == coolantBlock || block == hotCoolantBlock) && this.worldObj.getBlockMetadata(xoffset + this.xCoord, yoffset + this.yCoord, zoffset + this.zCoord) != 0) { + // this.surroundings[xoffset + 2][yoffset + 2][zoffset + 2] = Blocks.air; + // } else { + // this.surroundings[xoffset + 2][yoffset + 2][zoffset + 2] = block; + // } + // } + // } + // } + // } + // + // for(xoffset = 1; xoffset < 4; ++xoffset) { + // for(yoffset = 1; yoffset < 4; ++yoffset) { + // for(zoffset = 1; zoffset < 4; ++zoffset) { + // if(!(this.surroundings[xoffset][yoffset][zoffset] instanceof BlockGenerator) && !(this.surroundings[xoffset][yoffset][zoffset] instanceof BlockReactorChamber) && this.surroundings[xoffset][yoffset][zoffset] != coolantBlock && this.surroundings[xoffset][yoffset][zoffset] != hotCoolantBlock && !(this.surroundings[xoffset][yoffset][zoffset] instanceof BlockAir)) { + // return false; + // } + // } + // } + // } + // + // for(xoffset = 0; xoffset < 5; ++xoffset) { + // for(yoffset = 0; yoffset < 5; ++yoffset) { + // if(!(this.surroundings[xoffset][4][yoffset] instanceof BlockReactorVessel) && !(this.surroundings[xoffset][4][yoffset] instanceof BlockReactorAccessHatch) && !(this.surroundings[xoffset][4][yoffset] instanceof BlockReactorRedstonePort) && !(this.surroundings[xoffset][4][yoffset] instanceof BlockReactorFluidPort)) { + // return false; + // } + // + // if(!(this.surroundings[xoffset][0][yoffset] instanceof BlockReactorVessel) && !(this.surroundings[xoffset][0][yoffset] instanceof BlockReactorAccessHatch) && !(this.surroundings[xoffset][0][yoffset] instanceof BlockReactorRedstonePort) && !(this.surroundings[xoffset][0][yoffset] instanceof BlockReactorFluidPort)) { + // return false; + // } + // + // if(!(this.surroundings[0][xoffset][yoffset] instanceof BlockReactorVessel) && !(this.surroundings[0][xoffset][yoffset] instanceof BlockReactorAccessHatch) && !(this.surroundings[0][xoffset][yoffset] instanceof BlockReactorRedstonePort) && !(this.surroundings[0][xoffset][yoffset] instanceof BlockReactorFluidPort)) { + // return false; + // } + // + // if(!(this.surroundings[4][xoffset][yoffset] instanceof BlockReactorVessel) && !(this.surroundings[4][xoffset][yoffset] instanceof BlockReactorAccessHatch) && !(this.surroundings[4][xoffset][yoffset] instanceof BlockReactorRedstonePort) && !(this.surroundings[4][xoffset][yoffset] instanceof BlockReactorFluidPort)) { + // return false; + // } + // + // if(!(this.surroundings[yoffset][xoffset][0] instanceof BlockReactorVessel) && !(this.surroundings[yoffset][xoffset][0] instanceof BlockReactorAccessHatch) && !(this.surroundings[yoffset][xoffset][0] instanceof BlockReactorRedstonePort) && !(this.surroundings[yoffset][xoffset][0] instanceof BlockReactorFluidPort)) { + // return false; + // } + // + // if(!(this.surroundings[yoffset][xoffset][4] instanceof BlockReactorVessel) && !(this.surroundings[yoffset][xoffset][4] instanceof BlockReactorAccessHatch) && !(this.surroundings[yoffset][xoffset][4] instanceof BlockReactorRedstonePort) && !(this.surroundings[yoffset][xoffset][4] instanceof BlockReactorFluidPort)) { + // return false; + // } + // } + // } + // + // return true; + //} + + //public int gaugeLiquidScaled(int i, int tank) { + // switch(tank) { + // case 0: + // if(this.inputTank.getFluidAmount() <= 0) { + // return 0; + // } + // + // return this.inputTank.getFluidAmount() * i / this.inputTank.getCapacity(); + // case 1: + // if(this.outputTank.getFluidAmount() <= 0) { + // return 0; + // } + // + // return this.outputTank.getFluidAmount() * i / this.outputTank.getCapacity(); + // default: + // return 0; + // } + //} + + //public FluidTank getinputtank() { + // return this.inputTank; + //} + + //public FluidTank getoutputtank() { + // return this.outputTank; + //} + + //public FluidTankInfo[] getTankInfo(ForgeDirection from) { + // return new FluidTankInfo[]{this.inputTank.getInfo(), this.outputTank.getInfo()}; + //} + + @Override + public boolean canFill(ForgeDirection from, Fluid fluid) { + return false; + } + + @Override + public boolean canDrain(ForgeDirection from, Fluid fluid) { + return false; + } + + @Override + public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { + return 0; + } + + @Override + public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { + return null; + } + + @Override + public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { + return null; + } + + @Override + public int getInventoryStackLimit() { + return 1; + } +} diff --git a/src/main/resources/assets/tectech/textures/blocks/blockReactorSimulator.png b/src/main/resources/assets/tectech/textures/blocks/blockReactorSimulator.png new file mode 100644 index 0000000000..92c6a3691c Binary files /dev/null and b/src/main/resources/assets/tectech/textures/blocks/blockReactorSimulator.png differ -- cgit From 59b07e92fc5aac0b2b83a53cec325dfb1892759c Mon Sep 17 00:00:00 2001 From: Technus Date: Sun, 1 Oct 2017 15:22:23 +0200 Subject: Use new and better XSTR with locked seed. --- src/main/java/com/github/technus/tectech/TecTech.java | 3 +-- src/main/java/com/github/technus/tectech/XSTR.java | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index 114c2fb19b..3f3d486af4 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -38,11 +38,11 @@ public class TecTech { @Instance(Reference.MODID) public static TecTech instance; + public static final XSTR Rnd = XSTR.XSTR_INSTANCE; public static final LogHelper Logger = new LogHelper(Reference.MODID); private static IngameErrorLog Module_AdminErrorLogs = null; public static MainLoader GTCustomLoader = null; public static TecTechConfig ModConfig; - public static XSTR Rnd = null; public static CreativeTabs mainTab = null; public static boolean hasCOFH = false, hasThaumcraft = false; @@ -57,7 +57,6 @@ public class TecTech { @EventHandler public void PreLoad(FMLPreInitializationEvent PreEvent) { Logger.setDebugOutput(true); - Rnd = new XSTR(); ModConfig = new TecTechConfig(PreEvent.getModConfigurationDirectory(), Reference.COLLECTIONNAME, Reference.MODID); diff --git a/src/main/java/com/github/technus/tectech/XSTR.java b/src/main/java/com/github/technus/tectech/XSTR.java index 4fa4b98fbd..611d350ce7 100644 --- a/src/main/java/com/github/technus/tectech/XSTR.java +++ b/src/main/java/com/github/technus/tectech/XSTR.java @@ -43,6 +43,12 @@ public class XSTR extends Random { private static final long SEEDER_INCREMENT = 0xbb67ae8584caa73bL; private static final double DOUBLE_UNIT = 0x1.0p-53; // 1.0 / (1L << 53) private static final float FLOAT_UNIT = 0x1.0p-24f; // 1.0f / (1 << 24) + public final static XSTR XSTR_INSTANCE=new XSTR(){ + @Override + public synchronized void setSeed(long seed) { + throw new NoSuchMethodError("This is meant to be shared!, leave seed state alone!"); + } + }; /* MODIFIED BY: Robotia -- cgit From fa6890e35ec827417f837c857215ee5d7b62f116 Mon Sep 17 00:00:00 2001 From: Technus Date: Wed, 4 Oct 2017 05:54:15 +0200 Subject: Fix static XSTR --- src/main/java/com/github/technus/tectech/XSTR.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/github/technus/tectech/XSTR.java b/src/main/java/com/github/technus/tectech/XSTR.java index 611d350ce7..e6e62e99a5 100644 --- a/src/main/java/com/github/technus/tectech/XSTR.java +++ b/src/main/java/com/github/technus/tectech/XSTR.java @@ -43,10 +43,12 @@ public class XSTR extends Random { private static final long SEEDER_INCREMENT = 0xbb67ae8584caa73bL; private static final double DOUBLE_UNIT = 0x1.0p-53; // 1.0 / (1L << 53) private static final float FLOAT_UNIT = 0x1.0p-24f; // 1.0f / (1 << 24) + private static final AtomicLong seedUniquifier = new AtomicLong(8682522807148012L); public final static XSTR XSTR_INSTANCE=new XSTR(){ @Override public synchronized void setSeed(long seed) { - throw new NoSuchMethodError("This is meant to be shared!, leave seed state alone!"); + if(!Thread.currentThread().getStackTrace()[2].getClassName().equals(Random.class.getName())) + throw new NoSuchMethodError("This is meant to be shared!, leave seed state alone!"); } }; @@ -64,9 +66,6 @@ public class XSTR extends Random { this(seedUniquifier() ^ System.nanoTime()); } - private static final AtomicLong seedUniquifier - = new AtomicLong(8682522807148012L); - private static long seedUniquifier() { // L'Ecuyer, "Tables of Linear Congruential Generators of // Different Sizes and Good Lattice Structure", 1999 -- cgit From 8651c8daa6fe175589812395f642ddb0f805a27c Mon Sep 17 00:00:00 2001 From: Dream-Master Date: Sat, 7 Oct 2017 09:29:10 +0200 Subject: bump version for update --- build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.properties b/build.properties index b2fa89c4d4..c9ab2285a7 100644 --- a/build.properties +++ b/build.properties @@ -1,6 +1,6 @@ minecraft.version=1.7.10 forge.version=10.13.4.1614-1.7.10 -tectech.version=3.5.1 +tectech.version=3.5.2 ic2.version=2.2.790-experimental codechickenlib.version=1.1.3.140 -- cgit From 67e3729f16c7a2b681fb7dbfe9734d2736d77b16 Mon Sep 17 00:00:00 2001 From: Technus Date: Sun, 8 Oct 2017 09:30:14 +0200 Subject: tweak multi base eu code --- .../multi/GT_MetaTileEntity_MultiblockBase_EM.java | 101 +++++++++++++++------ 1 file changed, 72 insertions(+), 29 deletions(-) diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java index 7526063046..061fb5b688 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java @@ -88,9 +88,11 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt protected long eMaxAmpereFlow = 0;//don't modify! unless YOU REALLY HAVE TO private long maxEUinputMin = 0, maxEUinputMax = 0; - public long eAmpereFlow = 1; - public long eRequiredData = 0; - protected long eAvailableData = 0; + + public long eAmpereFlow = 1; // analogue of EU/t but for amperes used (so eu/t is actually eu*A/t) USE ONLY POSITIVE NUMBERS! + + public long eRequiredData = 0; // data required to operate + protected long eAvailableData = 0; // data being available private boolean explodedThisTick=false; @@ -740,17 +742,41 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt @Override public boolean onRunningTick(ItemStack aStack) { - if (eRequiredData > eAvailableData || - (this.mEUt < 0 && !this.drainEnergyInput_EM((long) (-this.mEUt) * getMaxEfficiency(aStack) / (long) Math.max(1000, this.mEfficiency), eAmpereFlow))) { + if (eRequiredData > eAvailableData) { + energyFlow(aStack,false); stopMachine(); return false; } - if (this.mEUt > 0) + return energyFlow(aStack,true); + } + + //new method + private boolean energyFlow(ItemStack aStack,boolean allowProduction) { + long temp = mEUt * eAmpereFlow;//quick scope sign + if (allowProduction && temp > 0) { this.addEnergyOutput_EM((long) mEUt * (long) mEfficiency / getMaxEfficiency(aStack), eAmpereFlow); + } else if (temp < 0) { + if (!this.drainEnergyInput_EM((long) (-mEUt) * getMaxEfficiency(aStack) / Math.max(1000L, this.mEfficiency), eAmpereFlow)) { + stopMachine(); + return false; + } + } return true; } //region energy + public final boolean energyFlowWithoutEffieciencyComputation(int eu,long ampere) { + long temp = eu * ampere;//quick scope sign + if (temp > 0) { + this.addEnergyOutput_EM(eu, ampere); + } else if (temp < 0) { + if (!this.drainEnergyInput_EM(-eu, ampere)) { + stopMachine(); + return false; + } + } + return true; + } @Override public final long maxEUStore() { @@ -777,17 +803,23 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt public final boolean addEnergyOutput(long EU) { if (EU <= 0L) return true; for (GT_MetaTileEntity_Hatch tHatch : eDynamoMulti) - if (isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(EU, false)) - return true; + if (isValidMetaTileEntity(tHatch)){ + if(tHatch.maxEUOutput()EU && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(EU, false)) return true; for (GT_MetaTileEntity_Hatch tHatch : mEnergyHatches) - if (isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(EU, false)) + if (isValidMetaTileEntity(tHatch) && tHatch.maxEUInput()>EU && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(EU, false)) return true; return false; } - //new method - public final boolean drainEnergyInput_EM(long EU, long Amperes) { - if (EU <= 0L || Amperes <= 0) return true; + private boolean drainEnergyInput_EM(long EU, long Amperes) { + if(EU<0) EU=-EU; + if(Amperes<0) Amperes=-Amperes; long euVar = EU * Amperes; - if (euVar > getEUVar() || - EU > maxEUinputMax || - (euVar - 1) / maxEUinputMin + 1 > eMaxAmpereFlow) {// euVar==0? --> (euVar - 1) / maxEUinputMin + 1 = 1! + if (euVar > getEUVar() || //not enough power + EU > maxEUinputMax || //TIER IS BASED ON BEST HATCH! not total EU input + (euVar - 1) / maxEUinputMin + 1 > eMaxAmpereFlow) {// euVar==0? --> (euVar - 1) / maxEUinputMin + 1 = 1! //if not too much A if (DEBUG_MODE) { TecTech.Logger.debug("L1 " + euVar + " " + getEUVar() + " " + (euVar > getEUVar())); TecTech.Logger.debug("L2 " + EU + " " + maxEUinputMax + " " + (EU > maxEUinputMax)); @@ -857,8 +889,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } //new method - public final boolean overclockAndPutValuesIn_EM(long EU, int time) {//TODO rewise - if (EU == 0) { + public final boolean overclockAndPutValuesIn_EM(long EU, int time) {//TODO revise + if (EU == 0L) { mEUt = 0; mMaxProgresstime = time; return true; @@ -880,7 +912,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return true; }//Use in EM check recipe return statement if you want overclocking - @Override + @Override // same as gt sum of all hatches public final long getMaxInputVoltage() { long rVoltage = 0; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) @@ -890,6 +922,16 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return rVoltage; } + //new Method + public final long getMaxInputEnergy(){ + long energy = 0; + for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) + if (isValidMetaTileEntity(tHatch)) energy += tHatch.maxEUInput(); + for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) + if (isValidMetaTileEntity(tHatch)) energy += tHatch.maxEUInput() * tHatch.Amperes; + return energy; + } + //new Method public final int getMaxEnergyInputTier_EM() { return Util.getTier(maxEUinputMax); @@ -899,6 +941,11 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt public final int getMinEnergyInputTier_EM() { return Util.getTier(maxEUinputMin); } + + public final long getMaxAmpereFlowAtMinTierOfEnergyHatches(){ + return eAmpereFlow; + } + //endregion //new Method @@ -1034,11 +1081,6 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt public final void explodeMultiblock() { if(explodedThisTick)return; extraExplosions_EM(); - explodeMultiblock_EM(); - explodedThisTick=true; - } - - private void explodeMultiblock_EM(){ if (!TecTech.ModConfig.BOOM_ENABLE) { TecTech.proxy.broadcast("Multi Explode BOOM! " + getBaseMetaTileEntity().getXCoord() + " " + getBaseMetaTileEntity().getYCoord() + " " + getBaseMetaTileEntity().getZCoord()); StackTraceElement[] ste = Thread.currentThread().getStackTrace(); @@ -1065,6 +1107,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt for (MetaTileEntity tTileEntity : eInputData) tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); for (MetaTileEntity tTileEntity : eOutputData) tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); getBaseMetaTileEntity().doExplosion(V[15]); + explodedThisTick=true; } @Override -- cgit From e444f29ee44754d31cce701a757adbe6ac0477b1 Mon Sep 17 00:00:00 2001 From: Technus Date: Sun, 8 Oct 2017 09:34:49 +0200 Subject: remove unnecessary sign change --- .../metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java index 061fb5b688..3596b9128b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java @@ -756,7 +756,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (allowProduction && temp > 0) { this.addEnergyOutput_EM((long) mEUt * (long) mEfficiency / getMaxEfficiency(aStack), eAmpereFlow); } else if (temp < 0) { - if (!this.drainEnergyInput_EM((long) (-mEUt) * getMaxEfficiency(aStack) / Math.max(1000L, this.mEfficiency), eAmpereFlow)) { + if (!this.drainEnergyInput_EM((long) mEUt * getMaxEfficiency(aStack) / Math.max(1000L, this.mEfficiency), eAmpereFlow)) { stopMachine(); return false; } @@ -770,7 +770,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (temp > 0) { this.addEnergyOutput_EM(eu, ampere); } else if (temp < 0) { - if (!this.drainEnergyInput_EM(-eu, ampere)) { + if (!this.drainEnergyInput_EM(eu, ampere)) { stopMachine(); return false; } -- cgit