From 91ca8b69b5e2a9610411a5e6b1fac66d3663de15 Mon Sep 17 00:00:00 2001 From: Tec Date: Thu, 13 Jan 2022 22:27:27 +0100 Subject: cherry pick This should make the EM anomaly and projectile as it was --- .../tectech/compatibility/gtpp/GtppAtomLoader.java | 53 ++--- .../openComputers/AvrArchitecture.java | 2 +- .../entity/projectiles/projectileEM.java | 105 ++++----- .../tileentity/turret/TileTurretHeadEM.java | 11 +- .../definitions/AspectDefinitionCompat.java | 30 --- .../definitions/AspectDefinitionCompatEnabled.java | 81 ------- .../definitions/dComplexAspectDefinition.java | 8 +- .../definitions/ePrimalAspectDefinition.java | 7 +- .../definitions/iElementalAspect.java | 8 - .../transformations/AspectDefinitionCompat.java | 29 +++ .../AspectDefinitionCompatEnabled.java | 81 +++++++ .../thing/metaTileEntity/multi/EssentiaCompat.java | 10 +- .../multi/EssentiaCompatEnabled.java | 33 +-- .../GT_MetaTileEntity_EM_essentiaDequantizer.java | 126 +++++++---- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 69 +++--- .../github/technus/tectech/loader/MainLoader.java | 6 +- .../tectech/loader/thing/MachineLoader.java | 13 +- .../tectech/mechanics/anomaly/AnomalyHandler.java | 247 +++++++++++++-------- .../tectech/mechanics/anomaly/CancerCommand.java | 10 +- .../tectech/mechanics/anomaly/ChargeCommand.java | 10 +- .../core/transformations/bTransformationInfo.java | 53 +++-- .../definitions/complex/dAtomDefinition.java | 163 +++++++------- .../definitions/complex/dHadronDefinition.java | 4 +- .../GT_MetaTileEntity_Hatch_OverflowElemental.java | 10 +- .../multi/GT_MetaTileEntity_EM_decay.java | 2 +- .../multi/GT_MetaTileEntity_EM_quantizer.java | 61 +++-- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 2 +- .../thing/tileEntity/ReactorSimTileEntity.java | 2 +- 28 files changed, 657 insertions(+), 579 deletions(-) delete mode 100644 src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompat.java delete mode 100644 src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompatEnabled.java delete mode 100644 src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/iElementalAspect.java create mode 100644 src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java create mode 100644 src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java (limited to 'src') diff --git a/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java b/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java index bf96d61795..72cee6d7aa 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.compatibility.gtpp; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo; import gregtech.api.enums.OrePrefixes; import net.minecraftforge.fluids.FluidStack; @@ -66,34 +67,34 @@ public class GtppAtomLoader implements Runnable{ } //endregion - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144), getFluid("NEON",144)); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144), getFluid("NEON",144)); generate("GERMANIUM",true,true); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("GERMANIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("SELENIUM"),1); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144), getFluid("BROMINE",144)); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144), getFluid("KRYPTON",144)); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ZIRCONIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("TECHNETIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RUTHENIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHODIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("IODINE"),1); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),getFluid("XENON",144)); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("HAFNIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHENIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("THALLIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("GERMANIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("SELENIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144), getFluid("BROMINE",144)); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144), getFluid("KRYPTON",144)); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ZIRCONIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("TECHNETIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RUTHENIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHODIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("IODINE"),1); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),getFluid("XENON",144)); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("HAFNIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHENIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("THALLIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("POLONIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(85), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ASTATINE"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FRANCIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RADIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ACTINIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("PROTACTINIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("NEPTUNIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("POLONIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(85), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ASTATINE"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FRANCIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RADIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ACTINIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("PROTACTINIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("NEPTUNIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(96), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CURIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(97), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("BERKELIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(98), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CALIFORNIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(99), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("EINSTEINIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(100), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FERMIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(96), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CURIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(97), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("BERKELIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(98), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CALIFORNIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(99), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("EINSTEINIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(100), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FERMIUM"),1); } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/openComputers/AvrArchitecture.java b/src/main/java/com/github/technus/tectech/compatibility/openComputers/AvrArchitecture.java index 2842a71df3..595d814fc5 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openComputers/AvrArchitecture.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openComputers/AvrArchitecture.java @@ -21,7 +21,7 @@ import li.cil.oc.api.machine.Signal; import li.cil.oc.common.SaveHandler; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import org.apache.commons.io.IOUtils; +import org.apache.commons.compress.utils.IOUtils; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java index 92acd71ecd..a0b6106151 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java @@ -1,10 +1,8 @@ package com.github.technus.tectech.compatibility.openmodularturrets.entity.projectiles; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition; import gregtech.api.GregTech_API; import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; @@ -18,8 +16,6 @@ import openmodularturrets.tileentity.turretbase.TurretBase; import openmodularturrets.util.PlayerUtil; import openmodularturrets.util.TurretHeadUtil; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; - /** * Created by Bass on 27/07/2017. @@ -33,6 +29,7 @@ public class projectileEM extends LaserProjectile { private int ampLevel; private float massFactor; + private double mass,charge; public projectileEM(World par1World) { super(par1World); @@ -51,6 +48,8 @@ public class projectileEM extends LaserProjectile { super(par1World, turretBase); this.turretBase = turretBase; if(projectileContent != null){ + mass=projectileContent.getMass(); + charge=projectileContent.getCharge(); massFactor =(float) (projectileContent.definition.getMass()/ dHadronDefinition.hadron_n_.getMass()); if(projectileContent.definition.getType()>1 || projectileContent.definition.getType()<-1) { @@ -66,66 +65,70 @@ public class projectileEM extends LaserProjectile { gravity = Math.min(0.0025F / Math.abs(projectileContent.definition.getCharge()), massFactor / 100f); } } - //todo make the recipe require some overflow hatches - - //todo add more subspace pollution } @Override protected void onImpact(MovingObjectPosition movingobjectposition) { if(ticksExisted > 1) { - if(movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { - Block hitBlock = worldObj.getBlock(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ); - if(hitBlock != null){ - if (hitBlock.getMaterial().isSolid() && TecTech.configTecTech.ENABLE_TURRET_EXPLOSIONS && antiMatter) { - worldObj.playSoundEffect(posX, posY, posZ, "openmodularturrets:laserHit", ConfigHandler.getTurretSoundVolume(), TecTech.RANDOM.nextFloat() + 0.5F); - GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1.0F, - movingobjectposition.blockX, - movingobjectposition.blockY, - movingobjectposition.blockZ); - worldObj.createExplosion(null, - movingobjectposition.blockX + 0.5D, - movingobjectposition.blockY + 0.5D, - movingobjectposition.blockZ + 0.5D, - (strange ?10:1) * TecTech.configTecTech.TURRET_EXPLOSION_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1) * (ticksExisted/250f), true); - } else { - return; - } - } - } - - if(movingobjectposition.entityHit != null && !worldObj.isRemote) { + if(!worldObj.isRemote){ worldObj.playSoundEffect(posX, posY, posZ, "openmodularturrets:laserHit", ConfigHandler.getTurretSoundVolume(), TecTech.RANDOM.nextFloat() + 0.5F); - if(movingobjectposition.entityHit != null && !worldObj.isRemote) { - float damage = (strange ?10:1) * TecTech.configTecTech.TURRET_DAMAGE_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1); - - if(movingobjectposition.entityHit instanceof EntityPlayer) { - if(canDamagePlayer((EntityPlayer)movingobjectposition.entityHit)) { + switch (movingobjectposition.typeOfHit){ + case BLOCK: + Block hitBlock = worldObj.getBlock(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ); + if(hitBlock != null){ + if (TecTech.configTecTech.ENABLE_TURRET_EXPLOSIONS && antiMatter && hitBlock.getMaterial().isSolid()) { + GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1.0F, + movingobjectposition.blockX, + movingobjectposition.blockY, + movingobjectposition.blockZ); + worldObj.createExplosion(null, + movingobjectposition.blockX + 0.5D, + movingobjectposition.blockY + 0.5D, + movingobjectposition.blockZ + 0.5D, + TecTech.configTecTech.TURRET_EXPLOSION_FACTOR * (strange ? 10 : 1) * massFactor * (isAmped ? ampLevel * .1f + 1 : 1) * (ticksExisted / 250f), true); + } else { + return; + } + } + break; + case ENTITY: + float damage = (strange ?10:1) * TecTech.configTecTech.TURRET_DAMAGE_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1); + + if(movingobjectposition.entityHit instanceof EntityPlayer) { + EntityPlayer player=(EntityPlayer)movingobjectposition.entityHit; + if(canDamagePlayer(player)) { + movingobjectposition.entityHit.setFire((strange ?10:1)*2); + movingobjectposition.entityHit.attackEntityFrom(new NormalDamageSource("laser"), damage); + if(antiMatter) { + movingobjectposition.entityHit.hurtResistantTime = 0; + } + if(strange){ + TecTech.anomalyHandler.addCancer(player,mass); + } + if(charge!=0) { + TecTech.anomalyHandler.addCharge(player,charge); + } + } + } else { movingobjectposition.entityHit.setFire((strange ?10:1)*2); movingobjectposition.entityHit.attackEntityFrom(new NormalDamageSource("laser"), damage); if(antiMatter) { movingobjectposition.entityHit.hurtResistantTime = 0; } } - } else { - movingobjectposition.entityHit.setFire((strange ?10:1)*2); - movingobjectposition.entityHit.attackEntityFrom(new NormalDamageSource("laser"), damage); - if(antiMatter) { - movingobjectposition.entityHit.hurtResistantTime = 0; + + if (TecTech.configTecTech.ENABLE_TURRET_EXPLOSIONS && antiMatter) { + GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1.0F, + (int)movingobjectposition.entityHit.posX, + (int)movingobjectposition.entityHit.posY, + (int)movingobjectposition.entityHit.posZ); + worldObj.createExplosion(null, + movingobjectposition.entityHit.posX, + movingobjectposition.entityHit.posY, + movingobjectposition.entityHit.posZ, + (strange ?10:1) * TecTech.configTecTech.TURRET_EXPLOSION_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1) * (ticksExisted/250f), true); } - } - - if (TecTech.configTecTech.ENABLE_TURRET_EXPLOSIONS && antiMatter) { - GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1.0F, - (int)movingobjectposition.entityHit.posX, - (int)movingobjectposition.entityHit.posY, - (int)movingobjectposition.entityHit.posZ); - worldObj.createExplosion(null, - movingobjectposition.entityHit.posX, - movingobjectposition.entityHit.posY, - movingobjectposition.entityHit.posZ, - (strange ?10:1) * TecTech.configTecTech.TURRET_EXPLOSION_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1) * (ticksExisted/250f), true); - } + break; } } setDead(); diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java index 1c8d476a36..fd039a0630 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java @@ -5,8 +5,6 @@ import com.github.technus.tectech.compatibility.openmodularturrets.entity.projec import com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turretbase.TileTurretBaseEM; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition; import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; import net.minecraft.entity.Entity; import net.minecraft.item.Item; @@ -17,7 +15,8 @@ import openmodularturrets.handler.ConfigHandler; import openmodularturrets.tileentity.turrets.TurretHead; import openmodularturrets.util.TurretHeadUtil; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.*; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_DIMINISHED; /** * Created by Bass on 27/07/2017. @@ -72,8 +71,8 @@ public class TileTurretHeadEM extends TurretHead{ public final TurretProjectile createProjectile(World world, Entity target, ItemStack ammo) { while(hatchContentPointer!=null && hatchContentPointer.hasStacks()) { cElementalInstanceStack stack = hatchContentPointer.get(TecTech.RANDOM.nextInt(hatchContentPointer.size())); - if(stack.amount defToAspect = new HashMap<>(); - public static final HashMap aspectToDef = new HashMap<>(); - - public void run(){} - - Object getAspect(cElementalDefinition definition){ - return null; - } - - String getAspectTag(cElementalDefinition definition){ - return null; - } - - iElementalDefinition getDefinition(String aspect){ - return null; - } -} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompatEnabled.java deleted file mode 100644 index 3cb2eafccd..0000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompatEnabled.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; - -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import thaumcraft.api.aspects.Aspect; - -import java.util.ArrayList; - -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition.*; -import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; - -/** - * Created by Tec on 21.05.2017. - */ -public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat { - @Override - public void run(){ - defToAspect.put(magic_air,"aer"); - defToAspect.put(magic_earth,"terra"); - defToAspect.put(magic_fire,"ignis"); - defToAspect.put(magic_water,"aqua"); - defToAspect.put(magic_order,"ordo"); - defToAspect.put(magic_entropy,"perditio"); - - aspectToDef.put("aer",magic_air); - aspectToDef.put("terra",magic_earth); - aspectToDef.put("ignis",magic_fire); - aspectToDef.put("aqua",magic_water); - aspectToDef.put("ordo",magic_order); - aspectToDef.put("perditio",magic_entropy); - - ArrayList list=Aspect.getCompoundAspects(); - Aspect[] array= list.toArray(new Aspect[0]); - while (!list.isEmpty()) { - for (Aspect aspect : array) { - if (list.contains(aspect)) { - Aspect[] content = aspect.getComponents(); - if (content.length != 2) { - list.remove(aspect); - }else if(aspectToDef.containsKey(content[0].getTag()) && aspectToDef.containsKey(content[1].getTag())){ - try { - dComplexAspectDefinition newAspect; - if(content[0].getTag().equals(content[1].getTag())){ - newAspect = new dComplexAspectDefinition(aspectToDef.get(content[0].getTag()).getStackForm(2) - ); - }else{ - newAspect = new dComplexAspectDefinition(aspectToDef.get(content[0].getTag()).getStackForm(1), aspectToDef.get(content[1].getTag()).getStackForm(1) - ); - } - aspectToDef.put(aspect.getTag(),newAspect); - defToAspect.put(newAspect,aspect.getTag()); - }catch (tElementalException e) { - /**/ - }finally { - list.remove(aspect); - } - } - } - } - } - - STACKS_REGISTERED.addAll(defToAspect.keySet()); - } - - @Override - Aspect getAspect(cElementalDefinition definition) { - return Aspect.getAspect(defToAspect.get(definition)); - } - - @Override - String getAspectTag(cElementalDefinition definition) { - return defToAspect.get(definition); - } - - @Override - iElementalDefinition getDefinition(String aspect) { - return aspectToDef.get(aspect); - } - -} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java index ddef29b214..8f570c1247 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat; import com.github.technus.tectech.util.Util; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; @@ -24,7 +25,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 06.05.2017. */ -public final class dComplexAspectDefinition extends cElementalDefinition implements iElementalAspect { +public final class dComplexAspectDefinition extends cElementalDefinition { private final int hash; public final double mass; @@ -252,11 +253,6 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme return null; } - @Override - public Object materializeIntoAspect() { - return AspectDefinitionCompat.aspectDefinitionCompat.getAspect(this); - } - @Override public iElementalDefinition getAnti() { return null; diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java index 02e7d2fe21..9c6d107bff 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java @@ -8,7 +8,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 06.05.2017. */ -public final class ePrimalAspectDefinition extends cElementalPrimitive implements iElementalAspect { +public final class ePrimalAspectDefinition extends cElementalPrimitive { public static final ePrimalAspectDefinition magic_air = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Air"), "a`", 1e1D, 35), magic_earth = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Earth"), "e`", 1e9D, 34), @@ -35,11 +35,6 @@ public final class ePrimalAspectDefinition extends cElementalPrimitive implement return translateToLocal("tt.keyword.Primal") + ": " + name; } - @Override - public Object materializeIntoAspect() { - return AspectDefinitionCompat.aspectDefinitionCompat.getAspect(this); - } - @Override public boolean isTimeSpanHalfLife() { return false; diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/iElementalAspect.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/iElementalAspect.java deleted file mode 100644 index 3cb2d8e5e8..0000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/iElementalAspect.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; - -/** - * Created by Tec on 21.05.2017. - */ -public interface iElementalAspect { - Object materializeIntoAspect(); -} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java new file mode 100644 index 0000000000..343071e26e --- /dev/null +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java @@ -0,0 +1,29 @@ +package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations; + + +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; + +import java.util.HashMap; + +/** + * Created by Tec on 21.05.2017. + */ +public class AspectDefinitionCompat { + public static AspectDefinitionCompat aspectDefinitionCompat; + public final HashMap defToAspect = new HashMap<>(); + public final HashMap aspectToDef = new HashMap<>(); + + public void run(){} + + public Object getAspect(iElementalDefinition definition){ + return null; + } + + public String getAspectTag(iElementalDefinition definition){ + return null; + } + + public iElementalDefinition getDefinition(String aspect){ + return null; + } +} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java new file mode 100644 index 0000000000..446e9b66d5 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java @@ -0,0 +1,81 @@ +package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations; + +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import thaumcraft.api.aspects.Aspect; + +import java.util.ArrayList; + +import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition.*; +import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; + +/** + * Created by Tec on 21.05.2017. + */ +public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat { + @Override + public void run(){ + defToAspect.put(magic_air,"aer"); + defToAspect.put(magic_earth,"terra"); + defToAspect.put(magic_fire,"ignis"); + defToAspect.put(magic_water,"aqua"); + defToAspect.put(magic_order,"ordo"); + defToAspect.put(magic_entropy,"perditio"); + + aspectToDef.put("aer",magic_air); + aspectToDef.put("terra",magic_earth); + aspectToDef.put("ignis",magic_fire); + aspectToDef.put("aqua",magic_water); + aspectToDef.put("ordo",magic_order); + aspectToDef.put("perditio",magic_entropy); + + ArrayList list=Aspect.getCompoundAspects(); + Aspect[] array= list.toArray(new Aspect[0]); + while (!list.isEmpty()) { + for (Aspect aspect : array) { + if (list.contains(aspect)) { + Aspect[] content = aspect.getComponents(); + if (content.length != 2) { + list.remove(aspect); + }else if(aspectToDef.containsKey(content[0].getTag()) && aspectToDef.containsKey(content[1].getTag())){ + try { + dComplexAspectDefinition newAspect; + if(content[0].getTag().equals(content[1].getTag())){ + newAspect = new dComplexAspectDefinition( + aspectToDef.get(content[0].getTag()).getStackForm(2)); + }else{ + newAspect = new dComplexAspectDefinition( + aspectToDef.get(content[0].getTag()).getStackForm(1), + aspectToDef.get(content[1].getTag()).getStackForm(1)); + } + aspectToDef.put(aspect.getTag(),newAspect); + defToAspect.put(newAspect,aspect.getTag()); + }catch (tElementalException e) { + /**/ + }finally { + list.remove(aspect); + } + } + } + } + } + + STACKS_REGISTERED.addAll(defToAspect.keySet()); + } + + @Override + public Aspect getAspect(iElementalDefinition definition) { + return Aspect.getAspect(defToAspect.get(definition)); + } + + @Override + public String getAspectTag(iElementalDefinition definition) { + return defToAspect.get(definition); + } + + @Override + public iElementalDefinition getDefinition(String aspect) { + return aspectToDef.get(aspect); + } +} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java index e77cab2734..63f55912a6 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import net.minecraft.tileentity.TileEntity; @@ -18,11 +18,15 @@ public class EssentiaCompat { return null; } - public boolean putElementalInstanceStack(TileEntity conatainer, cElementalInstanceStack stack){ + public String getEssentiaName(iElementalDefinition stack){ + return null; + } + + public boolean putInContainer(TileEntity container, String name){ return false; } - public cElementalInstanceStack getFromContainer(TileEntity container){ + public iElementalDefinition getFromContainer(TileEntity container){ return null; } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java index 484377b179..03ff92b4e0 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java @@ -1,8 +1,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.iElementalAspect; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import net.minecraft.tileentity.TileEntity; import thaumcraft.api.aspects.Aspect; @@ -11,7 +9,7 @@ import thaumcraft.api.aspects.IAspectContainer; import thaumcraft.common.tiles.TileEssentiaReservoir; import thaumcraft.common.tiles.TileJarFillable; -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.AspectDefinitionCompat.aspectToDef; +import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat.aspectDefinitionCompat; /** * Created by Tec on 21.05.2017. @@ -30,22 +28,28 @@ public class EssentiaCompatEnabled extends EssentiaCompat { } @Override - public boolean putElementalInstanceStack(TileEntity container,cElementalInstanceStack stack){ - if(container==null || container.isInvalid()) { + public String getEssentiaName(iElementalDefinition stack) { + return aspectDefinitionCompat.defToAspect.get(stack); + } + + @Override + public boolean putInContainer(TileEntity container, String aspectName) { + if (container == null || container.isInvalid() || aspectName == null || aspectName.isEmpty()) { return false; } - if(container instanceof IAspectContainer && stack.definition instanceof iElementalAspect){ - Aspect aspect=(Aspect) ((iElementalAspect) stack.definition).materializeIntoAspect(); - if(aspect!=null){ - ((IAspectContainer) container).addToContainer(aspect,1); - return true; + if (container instanceof IAspectContainer) { + Aspect aspect = Aspect.getAspect(aspectName); + if(aspect==null){ + return false; } + int remaining=((IAspectContainer) container).addToContainer(aspect, 1); + return remaining==0; } return false; } @Override - public cElementalInstanceStack getFromContainer(TileEntity container){ + public iElementalDefinition getFromContainer(TileEntity container){ if(container==null || container.isInvalid()) { return null; } @@ -55,10 +59,7 @@ public class EssentiaCompatEnabled extends EssentiaCompat { Aspect[] aspectsArr= aspects.getAspects(); if(aspectsArr!=null && aspectsArr[0]!=null){ if (((IAspectContainer) container).takeFromContainer(aspectsArr[0],1)){ - cElementalDefinition def=aspectToDef.get(aspectsArr[0].getTag()); - if(def!=null){ - return new cElementalInstanceStack(def,1); - } + return aspectDefinitionCompat.aspectToDef.get(aspectsArr[0].getTag()); } } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index 8e8aee4795..c11a68b5d0 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -1,35 +1,38 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.mechanics.structure.Structure; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.util.CommonValues; -import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; +import thaumcraft.api.aspects.Aspect; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_DIMINISHED; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.util.CommonValues.V; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; +import static gregtech.api.enums.GT_Values.E; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -38,32 +41,31 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure //use multi A energy inputs, use less power the longer it runs + private static final String[][] shape = new String[][]{ + {" ", " . ", " ",}, + {"0A0", E, "0A0",}, + {"121", "232", "121",}, + {"\"\"\"", "\"2\"", "\"\"\"",}, + {"202", "0!0", "202",}, + }; + private static final Block[] blockType = new Block[]{QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMeta = new byte[]{0, 0, 4, 8}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_essentiaDequantizer::addClassicToMachineList, + GT_MetaTileEntity_EM_essentiaDequantizer::addElementalInputToMachineList, + GT_MetaTileEntity_EM_essentiaDequantizer::addElementalMufflerToMachineList); + private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; + private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.hint.1"),//2 - Elemental Input Hatch - translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.hint.2"),//3 - Elemental Overflow Hatches or Molecular Casing + translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.hint.2"),//3 - Elemental Overflow Hatches or Elemental Casing translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.hint.3"),//General - Some sort of Essentia Storage }; - private static final IStructureDefinition STRUCTURE_DEFINITION = - StructureDefinition.builder() - .addShape("main", new String[][]{ - {"DDD", "D~D", "DDD"}, - {"E E", " ", "E E"}, - {"ABA", "BCB", "ABA"}, - {"FFF", "FBF", "FFF"}, - {"BEB", "EGE", "BEB"} - }) - .addElement('A', ofBlock(sBlockCasingsTT, 0)) - .addElement('B', ofBlock(sBlockCasingsTT, 4)) - .addElement('C', ofBlock(sBlockCasingsTT, 8)) - .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_essentiaDequantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) - .addElement('E', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_essentiaDequantizer::addElementalMufflerToMachineList, textureOffset + 4, 3, sBlockCasingsTT, 4)) - .addElement('G', ofHatchAdder(GT_MetaTileEntity_EM_essentiaDequantizer::addElementalInputToMachineList, textureOffset + 4, 2)) - .build(); - + private String outputEssentiaName; //endregion public GT_MetaTileEntity_EM_essentiaDequantizer(int aID, String aName, String aNameRegional) { @@ -81,7 +83,7 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return essentiaContainerCompat.check(this) && structureCheck_EM("main", 1, 1, 0); + return essentiaContainerCompat.check(this) && structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); } @Override @@ -91,24 +93,49 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ stopMachine(); return false; } + cElementalInstanceStackMap inputHatchContainer = eInputHatches.get(0).getContainerHandler(); - if (inputHatchContainer.hasStacks()) { - cElementalInstanceStack stack = inputHatchContainer.getFirst(); - inputHatchContainer.removeAmount(false, new cElementalInstanceStack(stack.definition, 1)); - if (!essentiaContainerCompat.putElementalInstanceStack(container, stack)) { - cleanStackEM_EM(stack); - } - mMaxProgresstime = 20; - mEfficiencyIncrease = 10000; - eAmpereFlow = 1; - if (stack.definition instanceof ePrimalAspectDefinition) { - mEUt = (int) -V[8]; + if (inputHatchContainer == null || !inputHatchContainer.hasStacks()) { + return false; + } + + cElementalInstanceStack stack = inputHatchContainer.get(TecTech.RANDOM.nextInt(inputHatchContainer.size())); + if (stack.amount < AVOGADRO_CONSTANT_DIMINISHED) { + cleanStackEM_EM(inputHatchContainer.remove(stack.definition)); + mEUt = (int) -V[6]; + } else { + outputEssentiaName = essentiaContainerCompat.getEssentiaName(stack.definition); + Aspect aspect = Aspect.getAspect(outputEssentiaName); + if (aspect == null) { + outputEssentiaName = null; + cleanStackEM_EM(inputHatchContainer.remove(stack.definition)); + mEUt = (int) -V[7]; } else { - mEUt = (int) -V[10]; + inputHatchContainer.removeAmount(false, stack.definition.getStackForm(AVOGADRO_CONSTANT)); + if (aspect.isPrimal()) { + mEUt = (int) -V[8]; + } else { + mEUt = (int) -V[10]; + } + } + } + mMaxProgresstime = 20; + mEfficiencyIncrease = 10000; + eAmpereFlow = 1; + return true; + } + + @Override + public void outputAfterRecipe_EM() { + TileEntity container = essentiaContainerCompat.getContainer(this); + if (container == null) { + stopMachine(); + }else{ + if(!essentiaContainerCompat.putInContainer(container,outputEssentiaName)){ + stopMachine(); } - return true; } - return false; + outputEssentiaName=null; } @Override @@ -143,16 +170,23 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ iGregTechTileEntity.getWorld().setBlock(iGregTechTileEntity.getXCoord() + xDir, iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, TT_Container_Casings.sHintCasingsTT, 12, 2); } } - structureBuild_EM("main", 1, 1, 0, hintsOnly, stackSize); + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, getExtendedFacing(), hintsOnly); } @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; + public String[] getStructureDescription(ItemStack stackSize) { + return description; } @Override - public String[] getStructureDescription(ItemStack stackSize) { - return description; + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setString("eOutputEssentia",outputEssentiaName); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + outputEssentiaName=aNBT.getString("eOutputEssentia"); } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index 1e23408a0b..74dff47aa4 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -2,34 +2,35 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.mechanics.structure.Structure; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.util.CommonValues; -import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.util.CommonValues.V; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; +import static gregtech.api.enums.GT_Values.E; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -38,31 +39,29 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure //use multi A energy inputs, use less power the longer it runs + private static final String[][] shape = new String[][]{ + {" ", " . ", " ",}, + {"0A0", E, "0A0",}, + {"121", "232", "121",}, + {"\"\"\"", "\"1\"", "\"\"\"",}, + {"010", "1!1", "010",}, + }; + private static final Block[] blockType = new Block[]{QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMeta = new byte[]{0, 4, 0, 8}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_essentiaQuantizer::addClassicToMachineList, + GT_MetaTileEntity_EM_essentiaQuantizer::addElementalOutputToMachineList, + GT_MetaTileEntity_EM_essentiaQuantizer::addElementalMufflerToMachineList); + private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; + private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.hint.1"),//2 - Elemental Output Hatch - translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.hint.2"),//3 - Elemental Overflow Hatches or Molecular Casing + translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.hint.2"),//3 - Elemental Overflow Hatches or Elemental Casing translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.hint.3"),//General - Some sort of Essentia Storage }; - - private static final IStructureDefinition STRUCTURE_DEFINITION = - StructureDefinition.builder() - .addShape("main", new String[][]{ - {"FFF", "F~F", "FFF"}, - {"E E", " ", "E E"}, - {"BAB", "ACA", "BAB"}, - {"DDD", "DBD", "DDD"}, - {"EBE", "BGB", "EBE"} - }) - .addElement('A', ofBlock(sBlockCasingsTT, 0)) - .addElement('B', ofBlock(sBlockCasingsTT, 4)) - .addElement('C', ofBlock(sBlockCasingsTT, 8)) - .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_essentiaQuantizer::addElementalMufflerToMachineList, textureOffset + 4, 3, sBlockCasingsTT, 4)) - .addElement('E', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_essentiaQuantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) - .addElement('G', ofHatchAdder(GT_MetaTileEntity_EM_essentiaQuantizer::addElementalOutputToMachineList, textureOffset + 4, 2)) - .build(); //endregion public GT_MetaTileEntity_EM_essentiaQuantizer(int aID, String aName, String aNameRegional) { @@ -80,21 +79,20 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return essentiaContainerCompat.check(this) && structureCheck_EM("main", 1, 1, 0); + return essentiaContainerCompat.check(this) && structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); } @Override public boolean checkRecipe_EM(ItemStack itemStack) { - TileEntity container = essentiaContainerCompat.getContainer(this); - cElementalInstanceStack newStack = essentiaContainerCompat.getFromContainer(container); - if (newStack != null) { + iElementalDefinition definition = essentiaContainerCompat.getFromContainer(essentiaContainerCompat.getContainer(this)); + if (definition != null) { mMaxProgresstime = 20; mEfficiencyIncrease = 10000; eAmpereFlow = 1; outputEM = new cElementalInstanceStackMap[]{ - new cElementalInstanceStackMap(newStack) + new cElementalInstanceStackMap(new cElementalInstanceStack(definition,AVOGADRO_CONSTANT)) }; - if (newStack.definition instanceof ePrimalAspectDefinition) { + if (definition instanceof ePrimalAspectDefinition) { mEUt = (int) -V[8]; } else { mEUt = (int) -V[10]; @@ -146,12 +144,7 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu iGregTechTileEntity.getWorld().setBlock(iGregTechTileEntity.getXCoord() + xDir, iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, TT_Container_Casings.sHintCasingsTT, 12, 2); } } - structureBuild_EM("main", 1, 1, 0, hintsOnly, stackSize); - } - - @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index 8a03bd67b8..02fae0e194 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -2,8 +2,8 @@ package com.github.technus.tectech.loader; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.AspectDefinitionCompat; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.AspectDefinitionCompatEnabled; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompatEnabled; import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat; import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompatEnabled; import com.github.technus.tectech.loader.gui.CreativeTabTecTech; @@ -40,7 +40,7 @@ import java.util.HashSet; import static com.github.technus.tectech.util.CommonValues.*; import static com.github.technus.tectech.TecTech.*; -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.AspectDefinitionCompat.aspectDefinitionCompat; +import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat.aspectDefinitionCompat; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; diff --git a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java index 0bf8c57f24..91dbffa71f 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java @@ -15,6 +15,7 @@ import cpw.mods.fml.common.Loader; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.thing.CustomItemList.*; @@ -73,22 +74,22 @@ public class MachineLoader implements Runnable { // =================================================================================================== eM_muffler_UV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15020, "hatch.emmuffler.tier.08", "UV Overflow Output Hatch", 8, 1e10f).getStackForm(1L)); + 15020, "hatch.emmuffler.tier.08", "UV Overflow Output Hatch", 8, 1e10f*AVOGADRO_CONSTANT).getStackForm(1L)); eM_muffler_UHV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15021, "hatch.emmuffler.tier.09", "UHV Overflow Output Hatch", 9, 5e10f).getStackForm(1L)); + 15021, "hatch.emmuffler.tier.09", "UHV Overflow Output Hatch", 9, 5e10f*AVOGADRO_CONSTANT).getStackForm(1L)); eM_muffler_UEV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15022, "hatch.emmuffler.tier.10", "UEV Overflow Output Hatch", 10, 25e10f).getStackForm(1L)); + 15022, "hatch.emmuffler.tier.10", "UEV Overflow Output Hatch", 10, 25e10f*AVOGADRO_CONSTANT).getStackForm(1L)); eM_muffler_UIV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15023, "hatch.emmuffler.tier.11", "UIV Overflow Output Hatch", 11, 125e10f).getStackForm(1L)); + 15023, "hatch.emmuffler.tier.11", "UIV Overflow Output Hatch", 11, 125e10f*AVOGADRO_CONSTANT).getStackForm(1L)); eM_muffler_UMV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15024, "hatch.emmuffler.tier.12", "UMV Overflow Output Hatch", 12, 125e11f).getStackForm(1L)); + 15024, "hatch.emmuffler.tier.12", "UMV Overflow Output Hatch", 12, 125e11f*AVOGADRO_CONSTANT).getStackForm(1L)); eM_muffler_UXV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15025, "hatch.emmuffler.tier.13", "UXV Overflow Output Hatch", 13, 125e12f).getStackForm(1L)); + 15025, "hatch.emmuffler.tier.13", "UXV Overflow Output Hatch", 13, 125e12f*AVOGADRO_CONSTANT).getStackForm(1L)); // =================================================================================================== diff --git a/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java b/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java index dd388bc233..0e1771e88d 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java +++ b/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java @@ -1,7 +1,6 @@ package com.github.technus.tectech.mechanics.anomaly; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.Util; import com.github.technus.tectech.loader.MainLoader; import com.github.technus.tectech.loader.NetworkDispatcher; import com.github.technus.tectech.mechanics.data.ChunkDataHandler; @@ -9,6 +8,7 @@ import com.github.technus.tectech.mechanics.data.ChunkDataMessage; import com.github.technus.tectech.mechanics.data.IChunkMetaDataHandler; import com.github.technus.tectech.mechanics.data.PlayerDataMessage; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; +import com.github.technus.tectech.util.Util; import cpw.mods.fml.common.gameevent.TickEvent; import gregtech.api.GregTech_API; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -20,6 +20,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; +import net.minecraft.tileentity.TileEntity; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; @@ -28,15 +29,20 @@ import net.minecraftforge.event.world.ChunkEvent; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Map; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; public class AnomalyHandler implements IChunkMetaDataHandler { - public static final double SWAP_THRESHOLD = dAtomDefinition.getSomethingHeavy().getMass() * 10000D; - public static final int COUNT_DIV=32; - public static final double PER_PARTICLE=SWAP_THRESHOLD/COUNT_DIV; - public static final String INTENSITY = "intensity",SPACE_CANCER="space_cancer", SPACE_CHARGE ="space_charge"; - public static final int MEAN_DELAY =50; - private static final float CHARGE_EFFECTIVENESS = 10; - private static final float CHARGE_EXPLOSIVENESS = 5; + private static final double SWAP_THRESHOLD = dAtomDefinition.getSomethingHeavy().getMass() * 1000D * AVOGADRO_CONSTANT_144;//can be const as it is computed later... + private static final int COUNT_DIV=32; + private static final double PER_PARTICLE=SWAP_THRESHOLD/COUNT_DIV; + private static final String INTENSITY = "intensity",SPACE_CANCER="space_cancer", SPACE_CHARGE ="space_charge"; + private static final int MEAN_DELAY =50; + private static final double CANCER_EFFECTIVENESS = 1/AVOGADRO_CONSTANT; + private static final double CHARGE_EFFECTIVENESS = 10/AVOGADRO_CONSTANT; + private static final double CHARGE_EXPLOSIVENESS = 5/AVOGADRO_CONSTANT; private boolean fixMe=false; private final ArrayList playersWithCharge = new ArrayList<>(); @@ -62,8 +68,9 @@ public class AnomalyHandler implements IChunkMetaDataHandler { public void tickWorld(HashMap data, TickEvent.WorldTickEvent aEvent) { if (TecTech.RANDOM.nextInt(MEAN_DELAY) == 0) { int dim = aEvent.world.provider.dimensionId; - data.get(dim).forEach((chunkCoordIntPair, compound) -> { - if (compound.getDouble(INTENSITY) >= SWAP_THRESHOLD) { + ChunkDataHandler.ChunkHashMap chunkHashMap = data.get(dim); + chunkHashMap.forEach((chunkCoordIntPair, compound) -> { + if (compound.getDouble(INTENSITY) > SWAP_THRESHOLD) { Chunk chunk = aEvent.world.getChunkFromChunkCoords(chunkCoordIntPair.chunkXPos, chunkCoordIntPair.chunkZPos); if (chunk.isChunkLoaded) { worldDataArrayList.add(chunk); @@ -72,21 +79,25 @@ public class AnomalyHandler implements IChunkMetaDataHandler { }); if (worldDataArrayList.size() >= 2) { Chunk a = worldDataArrayList.remove(TecTech.RANDOM.nextInt(worldDataArrayList.size())); - Chunk b = worldDataArrayList.remove(TecTech.RANDOM.nextInt(worldDataArrayList.size())); - double avg = .5 * (data.get(dim).get(a.getChunkCoordIntPair()).getDouble(INTENSITY) + - data.get(dim).get(b.getChunkCoordIntPair()).getDouble(INTENSITY)); - data.get(dim).get(a.getChunkCoordIntPair()).setDouble(INTENSITY, Math.min(SWAP_THRESHOLD, avg * (TecTech.RANDOM.nextFloat() + .5F) * 0.5F)); - data.get(dim).get(b.getChunkCoordIntPair()).setDouble(INTENSITY, Math.min(SWAP_THRESHOLD, avg * (TecTech.RANDOM.nextFloat() + .5F) * 0.5F)); - data.get(dim).markForTransmissionToClient(a.getChunkCoordIntPair()); - data.get(dim).markForTransmissionToClient(b.getChunkCoordIntPair()); - swapSomething(a, b, (float) Math.min(Math.log10(avg), 20)); + Chunk b = worldDataArrayList.get(TecTech.RANDOM.nextInt(worldDataArrayList.size())); + ChunkCoordIntPair aCoords = a.getChunkCoordIntPair(); + ChunkCoordIntPair bCoords = b.getChunkCoordIntPair(); + + double newValue = (chunkHashMap.get(aCoords).getDouble(INTENSITY) + + chunkHashMap.get(bCoords).getDouble(INTENSITY))/2-SWAP_THRESHOLD/8; + float split=TecTech.RANDOM.nextFloat(); + + chunkHashMap.get(aCoords).setDouble(INTENSITY, newValue * split); + chunkHashMap.get(bCoords).setDouble(INTENSITY, newValue * (1-split)); + chunkHashMap.markForTransmissionToClient(aCoords); + chunkHashMap.markForTransmissionToClient(bCoords); + swapSomething(a, b, newValue); } worldDataArrayList.clear(); } for (Object o : aEvent.world.playerEntities) { if (o instanceof EntityPlayer && !((EntityPlayer) o).capabilities.isCreativeMode) { - float charge = TecTech.playerPersistence.getDataOrSetToNewTag((EntityPlayer) o).getFloat(SPACE_CHARGE); - if (charge != 0) { + if (getCharge((EntityPlayer) o) != 0) { playersWithCharge.add((EntityPlayer) o); } } @@ -94,25 +105,25 @@ public class AnomalyHandler implements IChunkMetaDataHandler { if (playersWithCharge.size() > 0) { outer: for (EntityPlayer other : playersWithCharge) { - float fieldOther = TecTech.playerPersistence.getDataOrSetToNewTag(other).getFloat(SPACE_CHARGE); + double fieldOther = getCharge(other); for (EntityPlayer player : playersWithCharge) { if (other == player) { continue outer; } - float field = TecTech.playerPersistence.getDataOrSetToNewTag(player).getFloat(SPACE_CHARGE); - float difference = Math.abs(field - fieldOther); - if (difference != 0) { + double field = getCharge(player); + double absDifference = Math.abs(field - fieldOther); + if (absDifference != 0) { if (player.getDistanceSqToEntity(other) < 1) { - float avg = (fieldOther + field) / 2; - addAnomaly(other.worldObj.provider.dimensionId, new ChunkCoordIntPair(other.chunkCoordX, other.chunkCoordZ), Math.min(SWAP_THRESHOLD, PER_PARTICLE * difference)); - other.worldObj.createExplosion(other, other.posX, other.posY, other.posZ, Math.min(CHARGE_EXPLOSIVENESS * difference, 25), true); - player.worldObj.createExplosion(player, player.posX, player.posY, player.posZ, Math.min(CHARGE_EXPLOSIVENESS * difference, 25), true); - TecTech.playerPersistence.getDataOrSetToNewTag(player).setFloat(SPACE_CHARGE, avg); - TecTech.playerPersistence.getDataOrSetToNewTag(other).setFloat(SPACE_CHARGE, avg); - TecTech.playerPersistence.saveData(player); - TecTech.playerPersistence.saveData(other); - NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(player)); - NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(other)); + double avg = (fieldOther + field) / 2; + //addAnomaly(other.worldObj.provider.dimensionId, new ChunkCoordIntPair(other.chunkCoordX, other.chunkCoordZ), Math.min(SWAP_THRESHOLD, PER_PARTICLE * absDifference)); + if(TecTech.configTecTech.BOOM_ENABLE){ + other.worldObj.createExplosion(other, other.posX, other.posY, other.posZ,(float) Math.min(CHARGE_EXPLOSIVENESS * absDifference, 25), true); + player.worldObj.createExplosion(player, player.posX, player.posY, player.posZ, (float) Math.min(CHARGE_EXPLOSIVENESS * absDifference, 25), true); + } + GT_Utility.sendSoundToPlayers(other.worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1, (int)other.posX, (int)other.posY, (int)other.posZ); + GT_Utility.sendSoundToPlayers(player.worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1, (int)player.posX, (int)player.posY, (int)player.posZ); + setCharge(player,avg); + setCharge(other,avg); } } } @@ -121,8 +132,9 @@ public class AnomalyHandler implements IChunkMetaDataHandler { } } - private void swapSomething(Chunk a,Chunk b,float power) { - for (int i = 0; i < 64; i++) { + private void swapSomething(Chunk a,Chunk b,double mass) { + float explosionPower=(float) Math.log(mass/AVOGADRO_CONSTANT); + for (int i = 0; i < Math.min((int)explosionPower,64); i++) { int x = TecTech.RANDOM.nextInt(16); int y = TecTech.RANDOM.nextInt(a.worldObj.getActualHeight()); int z = TecTech.RANDOM.nextInt(16); @@ -143,12 +155,14 @@ public class AnomalyHandler implements IChunkMetaDataHandler { a.worldObj.setBlockToAir((a.xPosition << 4) + x, y, (a.zPosition << 4) + z); b.worldObj.setBlockToAir((b.xPosition << 4) + x, y, (b.zPosition << 4) + z); } - if (TecTech.RANDOM.nextBoolean()) { - a.worldObj.createExplosion(null, (a.xPosition << 4) + x + .5, y + .5, (a.zPosition << 4) + z + .5, power, true); + if(TecTech.configTecTech.BOOM_ENABLE){ + if (TecTech.RANDOM.nextBoolean()) { + a.worldObj.createExplosion(null, (a.xPosition << 4) + x + .5, y + .5, (a.zPosition << 4) + z + .5, explosionPower*TecTech.RANDOM.nextFloat(), true); + } GT_Utility.sendSoundToPlayers(a.worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1, (a.xPosition << 4) + x, y, (a.zPosition << 4) + z); - } - if (TecTech.RANDOM.nextBoolean()) { - b.worldObj.createExplosion(null, (b.xPosition << 4) + x + .5, y + .5, (b.zPosition << 4) + z + .5, power, true); + if (TecTech.RANDOM.nextBoolean()) { + b.worldObj.createExplosion(null, (b.xPosition << 4) + x + .5, y + .5, (b.zPosition << 4) + z + .5, explosionPower*TecTech.RANDOM.nextFloat(), true); + } GT_Utility.sendSoundToPlayers(b.worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1, (b.xPosition << 4) + x, y, (b.zPosition << 4) + z); } } @@ -156,13 +170,13 @@ public class AnomalyHandler implements IChunkMetaDataHandler { int z = (b.xPosition - a.xPosition) << 4; List aE = a.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, Util.fromChunk(a)); List bE = b.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, Util.fromChunk(b)); - aE.forEach(o -> { + for (EntityLivingBase entityLivingBase : aE) { if (TecTech.RANDOM.nextBoolean()) { - o.setPositionAndUpdate(o.posX + x, o.posY, o.posZ + z); - o.attackEntityFrom(MainLoader.subspace,8+TecTech.RANDOM.nextInt(8)); - if(o instanceof EntityPlayer){ - EntityPlayer player=((EntityPlayer) o); - if(!player.capabilities.isCreativeMode) { + if (entityLivingBase instanceof EntityPlayer) { + EntityPlayer player = ((EntityPlayer) entityLivingBase); + if (!player.capabilities.isCreativeMode) { + player.setPositionAndUpdate(entityLivingBase.posX + x, entityLivingBase.posY, entityLivingBase.posZ + z); + player.attackEntityFrom(MainLoader.subspace, 8 + TecTech.RANDOM.nextInt((int) (explosionPower / 4))); player.addPotionEffect(new PotionEffect(Potion.hunger.id, 1200)); player.addPotionEffect(new PotionEffect(Potion.weakness.id, 1000)); player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 800)); @@ -171,36 +185,35 @@ public class AnomalyHandler implements IChunkMetaDataHandler { player.addPotionEffect(new PotionEffect(Potion.poison.id, 200)); player.addPotionEffect(new PotionEffect(Potion.blindness.id, 100)); player.addPotionEffect(new PotionEffect(Potion.wither.id, 60)); - TecTech.playerPersistence.getDataOrSetToNewTag(player).setFloat(SPACE_CHARGE, - TecTech.playerPersistence.getDataOrSetToNewTag(player).getFloat(SPACE_CHARGE)-(float)Math.abs(TecTech.RANDOM.nextGaussian())); - TecTech.playerPersistence.saveData(player); - NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(player)); + addCharge(player, -mass * TecTech.RANDOM.nextFloat()); } + } else { + entityLivingBase.setPositionAndUpdate(entityLivingBase.posX + x, entityLivingBase.posY, entityLivingBase.posZ + z); + entityLivingBase.attackEntityFrom(MainLoader.subspace, 8 + TecTech.RANDOM.nextInt((int) (explosionPower / 4))); } } - }); - bE.forEach(o -> { + } + for (EntityLivingBase o : bE) { if (TecTech.RANDOM.nextBoolean()) { - o.setPositionAndUpdate(o.posX - x, o.posY, o.posZ - z); - o.attackEntityFrom(MainLoader.subspace,8+TecTech.RANDOM.nextInt(8)); - if(o instanceof EntityPlayer){ - EntityPlayer player=((EntityPlayer) o); - if(!player.capabilities.isCreativeMode) { + if (o instanceof EntityPlayer) { + EntityPlayer player = ((EntityPlayer) o); + if (!player.capabilities.isCreativeMode) { + player.setPositionAndUpdate(o.posX - x, o.posY, o.posZ - z); + player.attackEntityFrom(MainLoader.subspace, 8 + TecTech.RANDOM.nextInt((int) -(explosionPower / 4))); player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 800)); player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 600)); player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 400)); player.addPotionEffect(new PotionEffect(Potion.jump.id, 200)); player.addPotionEffect(new PotionEffect(Potion.resistance.id, 100)); player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 60)); - TecTech.playerPersistence.getDataOrSetToNewTag(player).setFloat(SPACE_CHARGE, - TecTech.playerPersistence.getDataOrSetToNewTag(player).getFloat(SPACE_CHARGE)+(float)Math.abs(TecTech.RANDOM.nextGaussian())); - - TecTech.playerPersistence.saveData(player); - NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(player)); + addCharge(player, mass * TecTech.RANDOM.nextFloat()); } + } else { + o.setPositionAndUpdate(o.posX + x, o.posY, o.posZ + z); + o.attackEntityFrom(MainLoader.subspace, 8 + TecTech.RANDOM.nextInt((int) (explosionPower / 4))); } } - }); + } } @Override @@ -218,38 +231,36 @@ public class AnomalyHandler implements IChunkMetaDataHandler { } } - data.get(player.worldObj.provider.dimensionId).forEach((chunkCoordIntPair, dat) -> { + for (Map.Entry entry : data.get(player.worldObj.provider.dimensionId).entrySet()) { + ChunkCoordIntPair chunkCoordIntPair = entry.getKey(); + NBTTagCompound dat = entry.getValue(); if (Math.abs(chunkCoordIntPair.getCenterXPos() - player.posX) + Math.abs(chunkCoordIntPair.getCenterZPosition() - player.posZ) < 256) { - for (int i = 0, pow = (int) Math.min(32, dat.getDouble(INTENSITY) / PER_PARTICLE); i < pow; i++) { + for (int i = 0, pow = (int) Math.min(COUNT_DIV, dat.getDouble(INTENSITY) / PER_PARTICLE); i < pow; i++) { TecTech.proxy.em_particle(player.worldObj, chunkCoordIntPair.getCenterXPos() + TecTech.RANDOM.nextGaussian() * 32D, player.posY + TecTech.RANDOM.nextFloat() * 128D - 64D, chunkCoordIntPair.getCenterZPosition() + TecTech.RANDOM.nextGaussian() * 32D); } } - }); + } } else if (TecTech.RANDOM.nextInt(50) == 0) { EntityPlayer player = aEvent.player; ChunkCoordIntPair pair = new ChunkCoordIntPair(player.chunkCoordX, player.chunkCoordZ); NBTTagCompound compound = data.get(player.worldObj.provider.dimensionId).get(pair); NBTTagCompound playerTag = TecTech.playerPersistence.getDataOrSetToNewTag(player); boolean saveRequired = false; - if(player.capabilities.isCreativeMode){ - if (playerTag.getDouble(SPACE_CANCER) != 0) { - playerTag.setDouble(SPACE_CANCER, 0); - saveRequired = true; - } - }else { + if (!player.capabilities.isCreativeMode) { + double cancer=getCancer(player); if (compound != null) { int badness = (int) Math.min(COUNT_DIV, compound.getDouble(INTENSITY) / PER_PARTICLE); if (badness > 0) { - playerTag.setDouble(SPACE_CANCER, Math.min(2, playerTag.getDouble(SPACE_CANCER) + 9.765625E-4f * badness)); + playerTag.setDouble(SPACE_CANCER, Math.min(2, cancer + 9.765625E-4f * badness)); player.attackEntityFrom(MainLoader.subspace,Math.max(1,badness/8f)); saveRequired = true; } } else if (playerTag.getDouble(SPACE_CANCER) > 0 && !player.isDead) { if (player.ticksExisted % 10 == 0) { - playerTag.setDouble(SPACE_CANCER, Math.max(0, playerTag.getDouble(SPACE_CANCER) - 7.6293945E-5f)); + playerTag.setDouble(SPACE_CANCER, Math.max(0, cancer - 7.6293945E-5f)); saveRequired = true; } } @@ -267,29 +278,26 @@ public class AnomalyHandler implements IChunkMetaDataHandler { EntityPlayer player=TecTech.proxy.getPlayer(); if(player!=null) { if(!player.capabilities.isCreativeMode) { - NBTTagCompound tagCompound = TecTech.playerPersistence.getDataOrSetToNewTag(player); - if (tagCompound != null) { - float cancer = tagCompound.getFloat(SPACE_CANCER); - if (cancer > 0) { - player.setInvisible(fixMe = TecTech.RANDOM.nextFloat() * 2 < cancer); - player.setAngles((TecTech.RANDOM.nextFloat() - .5F) * 36 * cancer, (TecTech.RANDOM.nextFloat() - .5F) * 36 * cancer); - cancer*=cancer/2F; - if (cancer > 1.75f) { - player.setVelocity((TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer); - } else { - player.addVelocity((TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer); - } + double cancer = getCancer(player)*CANCER_EFFECTIVENESS; + if (cancer > 0) { + player.setInvisible(fixMe = TecTech.RANDOM.nextFloat() * 2 < cancer); + player.setAngles((TecTech.RANDOM.nextFloat() - .5F) * 36 * (float) cancer, (TecTech.RANDOM.nextFloat() - .5F) * 36 * (float) cancer); + cancer*=cancer/2F; + if (cancer > 1.75f) { + player.setVelocity((TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer); + } else { + player.addVelocity((TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer); } } - float charge = TecTech.playerPersistence.getDataOrSetToNewTag(player).getFloat(SPACE_CHARGE); + double charge = getCharge(player); if(charge!=0) { for (Object o : player.worldObj.playerEntities) { if (o instanceof EntityPlayer && !((EntityPlayer) o).capabilities.isCreativeMode) { EntityPlayer otherPlayer=(EntityPlayer)o; - float chargeOther = TecTech.playerPersistence.getDataOrSetToNewTag(otherPlayer).getFloat(SPACE_CHARGE); + double chargeOther = getCharge(otherPlayer); if (chargeOther != 0 && player != o) { - float reaction = chargeOther * charge; + double reaction = chargeOther * charge; if (reaction !=0) { double distanceSq = otherPlayer.getDistanceSqToEntity(player); if (distanceSq >= 1) { @@ -328,19 +336,25 @@ public class AnomalyHandler implements IChunkMetaDataHandler { return 100; } - public void addAnomaly(IGregTechTileEntity iGregTechTileEntity, double amount) { - if (iGregTechTileEntity.isServerSide()) { - World w = iGregTechTileEntity.getWorld(); + public void addAnomaly(IGregTechTileEntity gtTile, double amount) { + addAnomaly(gtTile.getWorld(),gtTile.getXCoord(),gtTile.getZCoord(),amount); + } + + public void addAnomaly(TileEntity tileEntity, double amount) { + addAnomaly(tileEntity.getWorldObj(),tileEntity.xCoord,tileEntity.zCoord,amount); + } + + public void addAnomaly(World w,int x,int z, double amount) { + if (!w.isRemote) { addAnomaly(w.provider.dimensionId, new ChunkCoordIntPair( - iGregTechTileEntity.getXCoord() >> 4, - iGregTechTileEntity.getZCoord() >> 4), + x >> 4, + z >> 4), amount); } } public void addAnomaly(int world, ChunkCoordIntPair chunk, double amount) { - amount=Math.abs(amount); NBTTagCompound old = TecTech.chunkDataHandler.getChunkData(this, world, chunk); if (old == null) { NBTTagCompound data = new NBTTagCompound(); @@ -351,4 +365,45 @@ public class AnomalyHandler implements IChunkMetaDataHandler { } TecTech.chunkDataHandler.getChunkData(this, world).markForTransmissionToClient(chunk); } + + public double getCharge(EntityPlayer player){ + return getDouble(player,SPACE_CHARGE); + } + + public void setCharge(EntityPlayer player, double amount){ + setDouble(player,SPACE_CHARGE,amount); + } + + public void addCharge(EntityPlayer player, double amount){ + addDouble(player,SPACE_CHARGE,amount); + } + + public double getCancer(EntityPlayer player){ + return getDouble(player,SPACE_CANCER); + } + + public void setCancer(EntityPlayer player, double amount){ + setDouble(player,SPACE_CANCER,amount); + } + + public void addCancer(EntityPlayer player, double amount){ + addDouble(player,SPACE_CANCER,amount); + } + + public double getDouble(EntityPlayer player,String name){ + return TecTech.playerPersistence.getDataOrSetToNewTag(player).getDouble(name); + } + + public void setDouble(EntityPlayer player,String name, double amount){ + TecTech.playerPersistence.getDataOrSetToNewTag(player).setDouble(name, amount); + TecTech.playerPersistence.saveData(player); + NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(player)); + } + + public void addDouble(EntityPlayer player,String name, double amount){ + NBTTagCompound data = TecTech.playerPersistence.getDataOrSetToNewTag(player); + data.setDouble(name, amount+data.getDouble(name)); + TecTech.playerPersistence.saveData(player); + NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(player)); + } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java b/src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java index a153671a59..bb61f50aab 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java +++ b/src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java @@ -1,19 +1,14 @@ package com.github.technus.tectech.mechanics.anomaly; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.loader.NetworkDispatcher; -import com.github.technus.tectech.mechanics.data.PlayerDataMessage; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChatComponentText; import java.util.ArrayList; import java.util.List; -import static com.github.technus.tectech.mechanics.anomaly.AnomalyHandler.SPACE_CANCER; - public class CancerCommand implements ICommand { ArrayList aliases=new ArrayList<>(); @@ -39,13 +34,10 @@ public class CancerCommand implements ICommand { return; } EntityPlayerMP player=(EntityPlayerMP)sender; - NBTTagCompound playerTag = TecTech.playerPersistence.getDataOrSetToNewTag(player); if(player.capabilities.isCreativeMode){ sender.addChatMessage(new ChatComponentText("Doesn't really work in creative mode!")); }else { - playerTag.setDouble(SPACE_CANCER, amount); - TecTech.playerPersistence.saveData(player); - NetworkDispatcher.INSTANCE.sendTo(new PlayerDataMessage.PlayerDataData(player), player); + TecTech.anomalyHandler.setCancer(player,amount); sender.addChatMessage(new ChatComponentText("Cancer set to: "+amount)); } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/anomaly/ChargeCommand.java b/src/main/java/com/github/technus/tectech/mechanics/anomaly/ChargeCommand.java index da365a92f8..4190cd0dba 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/anomaly/ChargeCommand.java +++ b/src/main/java/com/github/technus/tectech/mechanics/anomaly/ChargeCommand.java @@ -1,19 +1,14 @@ package com.github.technus.tectech.mechanics.anomaly; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.loader.NetworkDispatcher; -import com.github.technus.tectech.mechanics.data.PlayerDataMessage; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChatComponentText; import java.util.ArrayList; import java.util.List; -import static com.github.technus.tectech.mechanics.anomaly.AnomalyHandler.SPACE_CHARGE; - public class ChargeCommand implements ICommand { ArrayList aliases=new ArrayList<>(); @@ -33,13 +28,10 @@ public class ChargeCommand implements ICommand { return; } EntityPlayerMP player=(EntityPlayerMP)sender; - NBTTagCompound playerTag = TecTech.playerPersistence.getDataOrSetToNewTag(player); if(player.capabilities.isCreativeMode){ sender.addChatMessage(new ChatComponentText("Doesn't really work in creative mode!")); }else { - playerTag.setDouble(SPACE_CHARGE, amount); - TecTech.playerPersistence.saveData(player); - NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(player)); + TecTech.anomalyHandler.setCharge(player,amount); sender.addChatMessage(new ChatComponentText("Charge set to: "+amount)); } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java index ec5391a0b4..69a4b9683c 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java @@ -2,7 +2,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.transformation import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import com.github.technus.tectech.util.DoubleCount; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import net.minecraft.item.ItemStack; @@ -10,36 +9,64 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; -import java.util.Collections; import java.util.HashMap; import java.util.Map; import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; +import static java.lang.Math.pow; /** * Created by Tec on 26.05.2017. */ public class bTransformationInfo { + /** + * Atom count per Mol + */ public static final double AVOGADRO_CONSTANT =6.02214076e23D; - public static final double AVOGADRO_CONSTANT_UNCERTAINTY =(144*1000)/AVOGADRO_CONSTANT; - public static final double AVOGADRO_CONSTANT_EPSILON = AVOGADRO_CONSTANT / (144 * 1000); - public static final double AVOGADRO_CONSTANT_KIND_OF_SMALLER =AVOGADRO_CONSTANT-AVOGADRO_CONSTANT_EPSILON; - public static final double AVOGADRO_CONSTANT_KIND_OF_BIGGER =AVOGADRO_CONSTANT+AVOGADRO_CONSTANT_EPSILON; + /** + * Min. chance of existing + */ + public static final double AVOGADRO_CONSTANT_UNCERTAINTY =(144*1000) / AVOGADRO_CONSTANT; + /** + * Quantity considered to be indifferent when computing stuff + */ + public static final double AVOGADRO_CONSTANT_EPSILON = AVOGADRO_CONSTANT / pow(2,48); + public static final double AVOGADRO_CONSTANT_DIMINISHED = AVOGADRO_CONSTANT - AVOGADRO_CONSTANT_EPSILON; public static final double AVOGADRO_CONSTANT_144 = AVOGADRO_CONSTANT *144D; + public static final double AVOGADRO_CONSTANT_144_DIMINISHED = AVOGADRO_CONSTANT_144 - AVOGADRO_CONSTANT_EPSILON*144D; public static final double AVOGADRO_CONSTANT_1000 = AVOGADRO_CONSTANT *1000D; + public static final double AVOGADRO_CONSTANT_1000_DIMINISHED = AVOGADRO_CONSTANT_1000 - AVOGADRO_CONSTANT_EPSILON*1000D; - public static final Map fluidQuantization=new HashMap<>(32); - public static final Map itemQuantization=new HashMap<>(32); - public static final Map oredictQuantization=new HashMap<>(32); + public static bTransformationInfo TRANSFORMATION_INFO = new bTransformationInfo(); + + public Map fluidQuantization; + public Map itemQuantization; + public Map oredictQuantization; public Map fluidDequantization; public Map itemDequantization; public Map oredictDequantization; - public bTransformationInfo(int fluidCap,int itemCap, int oreCap){ - fluidDequantization = fluidCap > 0 ? new HashMap<>(fluidCap) : Collections.emptyMap(); - itemDequantization = itemCap > 0 ? new HashMap<>(itemCap) : Collections.emptyMap(); - oredictDequantization = oreCap > 0 ? new HashMap<>(oreCap) : Collections.emptyMap(); + private bTransformationInfo() { + this( + new HashMap<>(16), new HashMap<>(16), new HashMap<>(64), + new HashMap<>(16), new HashMap<>(16), new HashMap<>(64) + ); + } + + public bTransformationInfo( + Map fluidQuantization, + Map itemQuantization, + Map oredictQuantization, + Map fluidDequantization, + Map itemDequantization, + Map oredictDequantization) { + this.fluidQuantization = fluidQuantization; + this.itemQuantization = itemQuantization; + this.oredictQuantization = oredictQuantization; + this.fluidDequantization = fluidDequantization; + this.itemDequantization = itemDequantization; + this.oredictDequantization = oredictDequantization; } public void addFluid(iHasElementalDefinition em, FluidStack fluidStack){ diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java index 965c46cef6..e97d5994e9 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java @@ -42,7 +42,6 @@ public final class dAtomDefinition extends cElementalDefinition { private static final byte BYTE_OFFSET=32; private final int hash; - public static final bTransformationInfo TRANSFORMATION_INFO = new bTransformationInfo(16,0,64); public static double refMass, refUnstableMass; private static final byte nbtType = (byte) 'a'; @@ -1319,17 +1318,17 @@ public final class dAtomDefinition extends cElementalDefinition { @Override public aFluidDequantizationInfo someAmountIntoFluidStack() { - return TRANSFORMATION_INFO.fluidDequantization.get(this); + return bTransformationInfo.TRANSFORMATION_INFO.fluidDequantization.get(this); } @Override public aItemDequantizationInfo someAmountIntoItemsStack() { - return TRANSFORMATION_INFO.itemDequantization.get(this); + return bTransformationInfo.TRANSFORMATION_INFO.itemDequantization.get(this); } @Override public aOredictDequantizationInfo someAmountIntoOredictStack() { - return TRANSFORMATION_INFO.oredictDequantization.get(this); + return bTransformationInfo.TRANSFORMATION_INFO.oredictDequantization.get(this); } private static final class Nomenclature { @@ -1475,119 +1474,119 @@ public final class dAtomDefinition extends cElementalDefinition { /*----STABLE ATOMS----**/ refMass = getFirstStableIsotope(1).getMass() * AVOGADRO_CONSTANT_144; - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(1), AVOGADRO_CONSTANT_144),Materials.Hydrogen.mGas,144); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(2), AVOGADRO_CONSTANT_144),Materials.Helium.mGas, 144); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(3), AVOGADRO_CONSTANT_144), dust, Materials.Lithium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(4), AVOGADRO_CONSTANT_144), dust, Materials.Beryllium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(5), AVOGADRO_CONSTANT_144), dust, Materials.Boron,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(6), AVOGADRO_CONSTANT_144), dust, Materials.Carbon,1); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(7), AVOGADRO_CONSTANT_144),Materials.Nitrogen.mGas, 144); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(8), AVOGADRO_CONSTANT_144),Materials.Oxygen.mGas, 144); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(9), AVOGADRO_CONSTANT_144),Materials.Fluorine.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(1), AVOGADRO_CONSTANT_144),Materials.Hydrogen.mGas,144); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(2), AVOGADRO_CONSTANT_144),Materials.Helium.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(3), AVOGADRO_CONSTANT_144), dust, Materials.Lithium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(4), AVOGADRO_CONSTANT_144), dust, Materials.Beryllium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(5), AVOGADRO_CONSTANT_144), dust, Materials.Boron,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(6), AVOGADRO_CONSTANT_144), dust, Materials.Carbon,1); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(7), AVOGADRO_CONSTANT_144),Materials.Nitrogen.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(8), AVOGADRO_CONSTANT_144),Materials.Oxygen.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(9), AVOGADRO_CONSTANT_144),Materials.Fluorine.mGas, 144); //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144),Materials.Neon.mGas.getID(), 144); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(11), AVOGADRO_CONSTANT_144), dust, Materials.Sodium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(12), AVOGADRO_CONSTANT_144), dust, Materials.Magnesium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(13), AVOGADRO_CONSTANT_144), dust, Materials.Aluminium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(14), AVOGADRO_CONSTANT_144), dust, Materials.Silicon,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(15), AVOGADRO_CONSTANT_144), dust, Materials.Phosphorus,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(16), AVOGADRO_CONSTANT_144), dust, Materials.Sulfur,1); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(17), AVOGADRO_CONSTANT_144),Materials.Argon.mGas, 144); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(19), AVOGADRO_CONSTANT_144), dust, Materials.Potassium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(20), AVOGADRO_CONSTANT_144), dust, Materials.Calcium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(21), AVOGADRO_CONSTANT_144), dust, Materials.Scandium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(22), AVOGADRO_CONSTANT_144), dust, Materials.Titanium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(23), AVOGADRO_CONSTANT_144), dust, Materials.Vanadium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(24), AVOGADRO_CONSTANT_144), dust, Materials.Chrome,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(25), AVOGADRO_CONSTANT_144), dust, Materials.Manganese,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(26), AVOGADRO_CONSTANT_144), dust, Materials.Iron,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(27), AVOGADRO_CONSTANT_144), dust, Materials.Cobalt,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(28), AVOGADRO_CONSTANT_144), dust, Materials.Nickel,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(29), AVOGADRO_CONSTANT_144), dust, Materials.Copper,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(30), AVOGADRO_CONSTANT_144), dust, Materials.Zinc,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(31), AVOGADRO_CONSTANT_144), dust, Materials.Gallium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(11), AVOGADRO_CONSTANT_144), dust, Materials.Sodium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(12), AVOGADRO_CONSTANT_144), dust, Materials.Magnesium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(13), AVOGADRO_CONSTANT_144), dust, Materials.Aluminium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(14), AVOGADRO_CONSTANT_144), dust, Materials.Silicon,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(15), AVOGADRO_CONSTANT_144), dust, Materials.Phosphorus,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(16), AVOGADRO_CONSTANT_144), dust, Materials.Sulfur,1); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(17), AVOGADRO_CONSTANT_144),Materials.Argon.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(19), AVOGADRO_CONSTANT_144), dust, Materials.Potassium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(20), AVOGADRO_CONSTANT_144), dust, Materials.Calcium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(21), AVOGADRO_CONSTANT_144), dust, Materials.Scandium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(22), AVOGADRO_CONSTANT_144), dust, Materials.Titanium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(23), AVOGADRO_CONSTANT_144), dust, Materials.Vanadium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(24), AVOGADRO_CONSTANT_144), dust, Materials.Chrome,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(25), AVOGADRO_CONSTANT_144), dust, Materials.Manganese,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(26), AVOGADRO_CONSTANT_144), dust, Materials.Iron,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(27), AVOGADRO_CONSTANT_144), dust, Materials.Cobalt,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(28), AVOGADRO_CONSTANT_144), dust, Materials.Nickel,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(29), AVOGADRO_CONSTANT_144), dust, Materials.Copper,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(30), AVOGADRO_CONSTANT_144), dust, Materials.Zinc,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(31), AVOGADRO_CONSTANT_144), dust, Materials.Gallium,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Germanium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(33), AVOGADRO_CONSTANT_144), dust, Materials.Arsenic,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(33), AVOGADRO_CONSTANT_144), dust, Materials.Arsenic,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Selenium,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Bromine,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Krypton,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(37), AVOGADRO_CONSTANT_144), dust, Materials.Rubidium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(38), AVOGADRO_CONSTANT_144), dust, Materials.Strontium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(39), AVOGADRO_CONSTANT_144), dust, Materials.Yttrium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(37), AVOGADRO_CONSTANT_144), dust, Materials.Rubidium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(38), AVOGADRO_CONSTANT_144), dust, Materials.Strontium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(39), AVOGADRO_CONSTANT_144), dust, Materials.Yttrium,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Zirconium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(41), AVOGADRO_CONSTANT_144), dust, Materials.Niobium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(42), AVOGADRO_CONSTANT_144), dust, Materials.Molybdenum,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(41), AVOGADRO_CONSTANT_144), dust, Materials.Niobium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(42), AVOGADRO_CONSTANT_144), dust, Materials.Molybdenum,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Technetium,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Ruthenium,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhodium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(46), AVOGADRO_CONSTANT_144), dust, Materials.Palladium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(47), AVOGADRO_CONSTANT_144), dust, Materials.Silver,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(48), AVOGADRO_CONSTANT_144), dust, Materials.Cadmium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(49), AVOGADRO_CONSTANT_144), dust, Materials.Indium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(50), AVOGADRO_CONSTANT_144), dust, Materials.Tin,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(51), AVOGADRO_CONSTANT_144), dust, Materials.Antimony,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(52), AVOGADRO_CONSTANT_144), dust, Materials.Tellurium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(46), AVOGADRO_CONSTANT_144), dust, Materials.Palladium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(47), AVOGADRO_CONSTANT_144), dust, Materials.Silver,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(48), AVOGADRO_CONSTANT_144), dust, Materials.Cadmium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(49), AVOGADRO_CONSTANT_144), dust, Materials.Indium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(50), AVOGADRO_CONSTANT_144), dust, Materials.Tin,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(51), AVOGADRO_CONSTANT_144), dust, Materials.Antimony,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(52), AVOGADRO_CONSTANT_144), dust, Materials.Tellurium,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Iodine,1); //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),Materials.Xenon.mGas.getID(), 144); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(55), AVOGADRO_CONSTANT_144), dust, Materials.Caesium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(56), AVOGADRO_CONSTANT_144), dust, Materials.Barium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(57), AVOGADRO_CONSTANT_144), dust, Materials.Lanthanum,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(58), AVOGADRO_CONSTANT_144), dust, Materials.Cerium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(59), AVOGADRO_CONSTANT_144), dust, Materials.Praseodymium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(60), AVOGADRO_CONSTANT_144), dust, Materials.Neodymium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(61), AVOGADRO_CONSTANT_144), dust, Materials.Promethium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(62), AVOGADRO_CONSTANT_144), dust, Materials.Samarium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(63), AVOGADRO_CONSTANT_144), dust, Materials.Europium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(64), AVOGADRO_CONSTANT_144), dust, Materials.Gadolinium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(65), AVOGADRO_CONSTANT_144), dust, Materials.Terbium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(66), AVOGADRO_CONSTANT_144), dust, Materials.Dysprosium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(67), AVOGADRO_CONSTANT_144), dust, Materials.Holmium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(68), AVOGADRO_CONSTANT_144), dust, Materials.Erbium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(69), AVOGADRO_CONSTANT_144), dust, Materials.Thulium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(70), AVOGADRO_CONSTANT_144), dust, Materials.Ytterbium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(71), AVOGADRO_CONSTANT_144), dust, Materials.Lutetium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(55), AVOGADRO_CONSTANT_144), dust, Materials.Caesium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(56), AVOGADRO_CONSTANT_144), dust, Materials.Barium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(57), AVOGADRO_CONSTANT_144), dust, Materials.Lanthanum,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(58), AVOGADRO_CONSTANT_144), dust, Materials.Cerium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(59), AVOGADRO_CONSTANT_144), dust, Materials.Praseodymium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(60), AVOGADRO_CONSTANT_144), dust, Materials.Neodymium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(61), AVOGADRO_CONSTANT_144), dust, Materials.Promethium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(62), AVOGADRO_CONSTANT_144), dust, Materials.Samarium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(63), AVOGADRO_CONSTANT_144), dust, Materials.Europium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(64), AVOGADRO_CONSTANT_144), dust, Materials.Gadolinium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(65), AVOGADRO_CONSTANT_144), dust, Materials.Terbium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(66), AVOGADRO_CONSTANT_144), dust, Materials.Dysprosium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(67), AVOGADRO_CONSTANT_144), dust, Materials.Holmium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(68), AVOGADRO_CONSTANT_144), dust, Materials.Erbium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(69), AVOGADRO_CONSTANT_144), dust, Materials.Thulium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(70), AVOGADRO_CONSTANT_144), dust, Materials.Ytterbium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(71), AVOGADRO_CONSTANT_144), dust, Materials.Lutetium,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Hafnum,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(73), AVOGADRO_CONSTANT_144), dust, Materials.Tantalum,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(74), AVOGADRO_CONSTANT_144), dust, Materials.Tungsten,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(73), AVOGADRO_CONSTANT_144), dust, Materials.Tantalum,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(74), AVOGADRO_CONSTANT_144), dust, Materials.Tungsten,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhenium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(76), AVOGADRO_CONSTANT_144), dust, Materials.Osmium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(77), AVOGADRO_CONSTANT_144), dust, Materials.Iridium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(78), AVOGADRO_CONSTANT_144), dust, Materials.Platinum,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(79), AVOGADRO_CONSTANT_144), dust, Materials.Gold,1); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(80), AVOGADRO_CONSTANT_144),Materials.Mercury.mFluid, 144); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(76), AVOGADRO_CONSTANT_144), dust, Materials.Osmium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(77), AVOGADRO_CONSTANT_144), dust, Materials.Iridium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(78), AVOGADRO_CONSTANT_144), dust, Materials.Platinum,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(79), AVOGADRO_CONSTANT_144), dust, Materials.Gold,1); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(80), AVOGADRO_CONSTANT_144),Materials.Mercury.mFluid, 144); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Thallium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(82), AVOGADRO_CONSTANT_144), dust, Materials.Lead,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(82), AVOGADRO_CONSTANT_144), dust, Materials.Lead,1); /*----UNSTABLE ATOMS----**/ refUnstableMass = getFirstStableIsotope(82).getMass() * AVOGADRO_CONSTANT_144; - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(83), AVOGADRO_CONSTANT_144), dust, Materials.Bismuth,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(83), AVOGADRO_CONSTANT_144), dust, Materials.Bismuth,1); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Polonium,1); //transformation.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(85),AVOGADRO_CONSTANT_144),Materials.Astatine.mPlasma.getID(), 144); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(86), AVOGADRO_CONSTANT_144),Materials.Radon.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(86), AVOGADRO_CONSTANT_144),Materials.Radon.mGas, 144); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Francium,1); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Radium,1); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Actinium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(90), AVOGADRO_CONSTANT_144), dust, Materials.Thorium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(90), AVOGADRO_CONSTANT_144), dust, Materials.Thorium,1); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Protactinium,1); ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(92),AVOGADRO_CONSTANT_144), dust, Materials.Uranium,1); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Neptunium,1); ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(94),AVOGADRO_CONSTANT_144), dust, Materials.Plutonium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(95), AVOGADRO_CONSTANT_144), dust, Materials.Americium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(95), AVOGADRO_CONSTANT_144), dust, Materials.Americium,1); try { dAtomDefinition temp; - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(deuterium.definition, AVOGADRO_CONSTANT_144),Materials.Deuterium.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(deuterium.definition, AVOGADRO_CONSTANT_144),Materials.Deuterium.mGas, 144); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(tritium.definition, AVOGADRO_CONSTANT_144),Materials.Tritium.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(tritium.definition, AVOGADRO_CONSTANT_144),Materials.Tritium.mGas, 144); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(helium_3.definition, AVOGADRO_CONSTANT_144),Materials.Helium_3.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(helium_3.definition, AVOGADRO_CONSTANT_144),Materials.Helium_3.mGas, 144); temp=new dAtomDefinition( new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 92), new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92), new cElementalDefinitionStack(dHadronDefinition.hadron_n, 146) ); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium/*238*/,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium/*238*/,1); double tempMass=temp.getMass(); @@ -1596,7 +1595,7 @@ public final class dAtomDefinition extends cElementalDefinition { new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92), new cElementalDefinitionStack(dHadronDefinition.hadron_n, 143) ); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium235,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium235,1); TecTech.LOGGER.info("Diff Mass U : "+(tempMass-temp.getMass())); @@ -1605,14 +1604,14 @@ public final class dAtomDefinition extends cElementalDefinition { new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), new cElementalDefinitionStack(dHadronDefinition.hadron_n, 145) ); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium/*239*/,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium/*239*/,1); somethingHeavy=new dAtomDefinition( new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 94), new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), new cElementalDefinitionStack(dHadronDefinition.hadron_n, 147) ); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(somethingHeavy, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium241,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(somethingHeavy, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium241,1); TecTech.LOGGER.info("Diff Mass Pu: "+(somethingHeavy.getMass()-temp.getMass())); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java index c5efaf1403..4ea5eb3776 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java @@ -25,7 +25,7 @@ import java.util.Map; import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition.getNbtTagCompound; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.TRANSFORMATION_INFO; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.TRANSFORMATION_INFO; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; import static gregtech.api.enums.OrePrefixes.dust; @@ -467,7 +467,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi //Added to atom map, but should be in its own cElementalDefinitionStack neutrons=new cElementalDefinitionStack(hadron_n, 1000* AVOGADRO_CONSTANT_144); TRANSFORMATION_INFO.oredictDequantization.put(neutrons.definition,new aOredictDequantizationInfo(neutrons, dust, Materials.Neutronium,1)); - bTransformationInfo.oredictQuantization.put( + TRANSFORMATION_INFO.oredictQuantization.put( OreDictionary.getOreID(OrePrefixes.ingotHot.name()+Materials.Neutronium.mName), new aOredictQuantizationInfo(OrePrefixes.ingotHot,Materials.Neutronium,1 ,neutrons) ); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java index ff9aca01ee..2a04af23d1 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.util.Util; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -29,9 +29,9 @@ import org.apache.commons.lang3.reflect.FieldUtils; import java.util.Locale; +import static com.github.technus.tectech.loader.MainLoader.elementalPollution; import static com.github.technus.tectech.util.CommonValues.DISPERSE_AT; import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.loader.MainLoader.elementalPollution; import static gregtech.api.enums.Dyes.MACHINE_METAL; import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity; import static net.minecraft.util.StatCollector.translateToLocal; @@ -149,10 +149,10 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity if (aBaseMetaTileEntity.isServerSide() && aTick % 20 == DISPERSE_AT) { if (aBaseMetaTileEntity.isActive()) { if (overflowMatter > overflowDisperse) { - TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity, overflowDisperse); + TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity, overflowDisperse/(Math.pow(2,mTier))); overflowMatter -= overflowDisperse; } else { - TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity, overflowMatter); + TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity, overflowMatter/(Math.pow(2,mTier))); overflowMatter = 0; aBaseMetaTileEntity.setActive(false); aBaseMetaTileEntity.setLightValue((byte) 0); @@ -227,7 +227,7 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity @Override public void onRemoval() { if (isValidMetaTileEntity(this) && getBaseMetaTileEntity().isActive()) { - TecTech.anomalyHandler.addAnomaly(getBaseMetaTileEntity(), overflowMatter * 8D); + TecTech.anomalyHandler.addAnomaly(getBaseMetaTileEntity(), overflowMatter); if (TecTech.configTecTech.BOOM_ENABLE) { getBaseMetaTileEntity().doExplosion(V[15]); } else { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index 3fdf841b52..97b4a7786e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -53,7 +53,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase private static Textures.BlockIcons.CustomIcon ScreenON; public static final double URANIUM_INGOT_MASS_DIFF = 1.6114516E10* AVOGADRO_CONSTANT; - private static final double URANIUM_MASS_TO_EU_PARTIAL = ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/nuclear") * 3_000_000.0 / URANIUM_INGOT_MASS_DIFF; + private static final double URANIUM_MASS_TO_EU_PARTIAL = ConfigUtil.getDouble(MainConfig.get(), "balance/energy/generator/nuclear") * 3_000_000.0 / URANIUM_INGOT_MASS_DIFF; public static final double URANIUM_MASS_TO_EU_INSTANT = URANIUM_MASS_TO_EU_PARTIAL * 20; private String clientLocale = "en_US"; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java index 5b6b2c18e7..c3e35ba90c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java @@ -2,24 +2,24 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidQuantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemQuantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictQuantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo; +import com.github.technus.tectech.mechanics.structure.Structure; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.util.CommonValues; -import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; @@ -31,18 +31,16 @@ import java.util.ArrayList; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.DEFAULT_ENERGY_LEVEL; import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.TRANSFORMATION_INFO; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refMass; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refUnstableMass; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullFluid; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.util.Util.isInputEqual; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -51,21 +49,21 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure //use multi A energy inputs, use less power the longer it runs - private static final IStructureDefinition STRUCTURE_DEFINITION = - StructureDefinition.builder() - .addShape("main", transpose(new String[][]{ - {"CCC","BAB","EEE","DBD"}, - {"C~C","ABA","EBE","BFB"}, - {"CCC","BAB","EEE","DBD"} - })) - .addElement('A', ofBlock(sBlockCasingsTT, 0)) - .addElement('B', ofBlock(sBlockCasingsTT, 4)) - .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_quantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) - .addElement('D', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_quantizer::addElementalMufflerToMachineList, textureOffset + 4, 3, sBlockCasingsTT, 4)) - .addElement('F', ofHatchAdder(GT_MetaTileEntity_EM_quantizer::addElementalOutputToMachineList,textureOffset + 4, 2)) - .build(); - + private static final String[][] shape = new String[][]{ + {" ", " . ", " ",}, + {"010", "101", "010",}, + {"\"\"\"", "\"0\"", "\"\"\"",}, + {"202", "0!0", "202",}, + }; + private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE}; + private static final byte[] blockMeta = new byte[]{4, 0, 0}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_quantizer::addClassicToMachineList, + GT_MetaTileEntity_EM_quantizer::addElementalOutputToMachineList, + GT_MetaTileEntity_EM_quantizer::addElementalMufflerToMachineList); + private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; + private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.mattertoem.hint.0"),//1 - Classic Hatches or High Power Casing @@ -89,7 +87,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM("main", 1, 1, 0); + return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); } @Override @@ -100,9 +98,9 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (inI.length > 0) { for (ItemStack is : inI) { //ITEM STACK quantization - aItemQuantizationInfo aIQI = bTransformationInfo.itemQuantization.get(new aItemQuantizationInfo(is, false, null)); + aItemQuantizationInfo aIQI = TRANSFORMATION_INFO.itemQuantization.get(new aItemQuantizationInfo(is, false, null)); if (aIQI == null) { - aIQI = bTransformationInfo.itemQuantization.get(new aItemQuantizationInfo(is, true, null));//todo check if works? + aIQI = TRANSFORMATION_INFO.itemQuantization.get(new aItemQuantizationInfo(is, true, null));//todo check if works? } if (aIQI == null) { //ORE DICT quantization //todo fix for uranium? @@ -111,7 +109,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (DEBUG_MODE) { TecTech.LOGGER.info("Quantifier-Ore-recipe " + is.getItem().getUnlocalizedName() + '.' + is.getItemDamage() + ' ' + OreDictionary.getOreName(ID)); } - aOredictQuantizationInfo aOQI = bTransformationInfo.oredictQuantization.get(ID); + aOredictQuantizationInfo aOQI = TRANSFORMATION_INFO.oredictQuantization.get(ID); if (aOQI == null) { continue; } @@ -138,7 +136,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock FluidStack[] inF = storedFluids.toArray(nullFluid); if (inF.length > 0) { for (FluidStack fs : inF) { - aFluidQuantizationInfo aFQI = bTransformationInfo.fluidQuantization.get(fs.getFluid().getID()); + aFluidQuantizationInfo aFQI = TRANSFORMATION_INFO.fluidQuantization.get(fs.getFluid().getID()); if (aFQI == null) { continue; } @@ -201,12 +199,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - structureBuild_EM("main", 1, 1, 0, hintsOnly, stackSize); - } - - @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java index a0755b947b..30c9c509ec 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java @@ -2098,13 +2098,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt @Override public void doExplosion(long aExplosionPower) { - explodeMultiblock(); if (!TecTech.configTecTech.BOOM_ENABLE) { TecTech.proxy.broadcast("Multi DoExplosion BOOM! " + getBaseMetaTileEntity().getXCoord() + ' ' + getBaseMetaTileEntity().getYCoord() + ' ' + getBaseMetaTileEntity().getZCoord()); StackTraceElement[] ste = Thread.currentThread().getStackTrace(); TecTech.proxy.broadcast("Multi DoExplosion BOOM! " + ste[2].toString()); return; } + explodeMultiblock(); super.doExplosion(aExplosionPower); }//Redirecting to explodemultiblock //endregion 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 index 4d66b28ca6..55fa327364 100644 --- a/src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java +++ b/src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java @@ -89,7 +89,7 @@ public class ReactorSimTileEntity extends TileEntityNuclearReactorElectric { @Override public double getReactorEUEnergyOutput() { - return (double)(getReactorEnergyOutput() * 5.0F * ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/nuclear")); + return getReactorEnergyOutput() * 5.0F * ConfigUtil.getDouble(MainConfig.get(), "balance/energy/generator/nuclear"); } //public List getSubTiles() { -- cgit