diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index ee68c7123..03bb454ed 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -12,20 +12,11 @@ import com.github.technus.tectech.loader.MainLoader; import com.github.technus.tectech.loader.TecTechConfig; -import com.github.technus.tectech.loader.gui.CreativeTabEM; import com.github.technus.tectech.loader.gui.CreativeTabTecTech; -import com.github.technus.tectech.mechanics.anomaly.AnomalyHandler; -import com.github.technus.tectech.mechanics.anomaly.CancerCommand; -import com.github.technus.tectech.mechanics.anomaly.ChargeCommand; -import com.github.technus.tectech.mechanics.anomaly.MassCommand; import com.github.technus.tectech.mechanics.commands.ConvertFloat; import com.github.technus.tectech.mechanics.commands.ConvertInteger; import com.github.technus.tectech.mechanics.data.ChunkDataHandler; import com.github.technus.tectech.mechanics.data.PlayerPersistence; -import com.github.technus.tectech.mechanics.elementalMatter.core.commands.EMGive; -import com.github.technus.tectech.mechanics.elementalMatter.core.commands.EMList; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; import com.github.technus.tectech.mechanics.enderStorage.EnderWorldSavedData; import com.github.technus.tectech.nei.IMCForNEI; import com.github.technus.tectech.proxy.CommonProxy; @@ -35,12 +26,7 @@ import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.SidedProxy; -import cpw.mods.fml.common.event.FMLInitializationEvent; -import cpw.mods.fml.common.event.FMLLoadCompleteEvent; -import cpw.mods.fml.common.event.FMLPostInitializationEvent; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import cpw.mods.fml.common.event.FMLServerAboutToStartEvent; -import cpw.mods.fml.common.event.FMLServerStartingEvent; +import cpw.mods.fml.common.event.*; import eu.usrv.yamcore.auxiliary.IngameErrorLog; import eu.usrv.yamcore.auxiliary.LogHelper; import gregtech.GT_Mod; @@ -71,19 +57,14 @@ public class TecTech { public static final XSTR RANDOM = XSTR.XSTR_INSTANCE; public static final LogHelper LOGGER = new LogHelper(Reference.MODID); public static CreativeTabTecTech creativeTabTecTech; - public static CreativeTabEM creativeTabEM; private static IngameErrorLog moduleAdminErrorLogs; public static TecTechConfig configTecTech; public static EnderWorldSavedData enderWorldSavedData; public static ChunkDataHandler chunkDataHandler; - public static AnomalyHandler anomalyHandler; public static PlayerPersistence playerPersistence; - public static final EMDefinitionsRegistry definitionsRegistry = new EMDefinitionsRegistry(); - public static final EMTransformationRegistry transformationInfo = new EMTransformationRegistry(); - /** * For Loader.isModLoaded checks during the runtime */ @@ -228,29 +209,20 @@ public Object[] toArray(Object[] a) { } } - MainLoader.load(definitionsRegistry); + MainLoader.load(); MainLoader.addAfterGregTechPostLoadRunner(); IMCForNEI.IMCSender(); } @Mod.EventHandler public void PostLoad(FMLPostInitializationEvent PostEvent) { - MainLoader.postLoad(definitionsRegistry, transformationInfo); - - chunkDataHandler.registerChunkMetaDataHandler(anomalyHandler = new AnomalyHandler()); + MainLoader.postLoad(); } @Mod.EventHandler public void serverLoad(FMLServerStartingEvent pEvent) { pEvent.registerServerCommand(new ConvertInteger()); pEvent.registerServerCommand(new ConvertFloat()); - pEvent.registerServerCommand(new EMList()); - if (DEBUG_MODE) { - pEvent.registerServerCommand(new EMGive()); - pEvent.registerServerCommand(new CancerCommand()); - pEvent.registerServerCommand(new ChargeCommand()); - pEvent.registerServerCommand(new MassCommand()); - } } @Mod.EventHandler 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 deleted file mode 100644 index c7f7574d2..000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java +++ /dev/null @@ -1,203 +0,0 @@ -package com.github.technus.tectech.compatibility.gtpp; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.getBestUnstableIsotope; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.getFirstStableIsotope; - -import java.lang.reflect.Method; - -import net.minecraftforge.fluids.FluidStack; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; - -import gregtech.api.enums.OrePrefixes; - -public class GtppAtomLoader { - - // region reflect a bit - private Class ELEMENT; - private Object ELEMENT_INSTANCE; - private Method getUnlocalizedName, getFluid, generate; - - private String getUnlocalizedName(String elementName) { - try { - return (String) getUnlocalizedName.invoke(ELEMENT.getField(elementName).get(ELEMENT_INSTANCE)); - } catch (Exception e) { - throw new Error(e); - } - } - - private FluidStack getFluid(String elementName, int fluidAmount) { - try { - return (FluidStack) getFluid.invoke(ELEMENT.getField(elementName).get(ELEMENT_INSTANCE), fluidAmount); - } catch (Exception e) { - throw new Error(e); - } - } - - private void generate(String elementName, boolean generateAll, boolean generateBlastRecipes) { - try { - generate.invoke( - null, - ELEMENT.getField(elementName).get(ELEMENT_INSTANCE), - generateAll, - generateBlastRecipes); - } catch (Exception e) { - throw new Error(e); - } - } - // endregion - - public void setTransformations(EMTransformationRegistry transformationInfo) { - // region reflect a bit - try { - ELEMENT = Class.forName("gtPlusPlus.core.material.ELEMENT"); - ELEMENT_INSTANCE = ELEMENT.getMethod("getInstance").invoke(null); - - Class clazz = Class.forName("gtPlusPlus.core.material.Material"); - getUnlocalizedName = clazz.getMethod("getUnlocalizedName"); - try { - getFluid = clazz.getMethod("getFluidStack", int.class); - } catch (Exception e) { - getFluid = clazz.getMethod("getFluid", int.class); - } - - clazz = Class.forName("gtPlusPlus.core.material.MaterialGenerator"); - generate = clazz.getMethod( - "generate", - Class.forName("gtPlusPlus.core.material.Material"), - boolean.class, - boolean.class); - } catch (Exception e) { - throw new Error(e); - } - // endregion - - transformationInfo.addFluid( - new EMDefinitionStack(getFirstStableIsotope(10), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - getFluid("NEON", 144)); - generate("GERMANIUM", true, true); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(32), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - OrePrefixes.dust, - getUnlocalizedName("GERMANIUM"), - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(34), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - OrePrefixes.dust, - getUnlocalizedName("SELENIUM"), - 1); - transformationInfo.addFluid( - new EMDefinitionStack(getFirstStableIsotope(35), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - getFluid("BROMINE", 144)); - transformationInfo.addFluid( - new EMDefinitionStack(getFirstStableIsotope(36), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - getFluid("KRYPTON", 144)); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(40), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - OrePrefixes.dust, - getUnlocalizedName("ZIRCONIUM"), - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(43), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - OrePrefixes.dust, - getUnlocalizedName("TECHNETIUM"), - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(44), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - OrePrefixes.dust, - getUnlocalizedName("RUTHENIUM"), - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(45), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - OrePrefixes.dust, - getUnlocalizedName("RHODIUM"), - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(53), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - OrePrefixes.dust, - getUnlocalizedName("IODINE"), - 1); - transformationInfo.addFluid( - new EMDefinitionStack(getFirstStableIsotope(54), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - getFluid("XENON", 144)); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(72), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - OrePrefixes.dust, - getUnlocalizedName("HAFNIUM"), - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(75), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - OrePrefixes.dust, - getUnlocalizedName("RHENIUM"), - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(81), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - OrePrefixes.dust, - getUnlocalizedName("THALLIUM"), - 1); - - transformationInfo.addOredict( - new EMDefinitionStack(getBestUnstableIsotope(84), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - OrePrefixes.dust, - getUnlocalizedName("POLONIUM"), - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getBestUnstableIsotope(85), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - OrePrefixes.dust, - getUnlocalizedName("ASTATINE"), - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getBestUnstableIsotope(87), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - OrePrefixes.dust, - getUnlocalizedName("FRANCIUM"), - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getBestUnstableIsotope(88), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - OrePrefixes.dust, - getUnlocalizedName("RADIUM"), - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getBestUnstableIsotope(89), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - OrePrefixes.dust, - getUnlocalizedName("ACTINIUM"), - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getBestUnstableIsotope(91), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - OrePrefixes.dust, - getUnlocalizedName("PROTACTINIUM"), - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getBestUnstableIsotope(93), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - OrePrefixes.dust, - getUnlocalizedName("NEPTUNIUM"), - 1); - - transformationInfo.addOredict( - new EMDefinitionStack(getBestUnstableIsotope(96), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - OrePrefixes.dust, - getUnlocalizedName("CURIUM"), - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getBestUnstableIsotope(97), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - OrePrefixes.dust, - getUnlocalizedName("BERKELIUM"), - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getBestUnstableIsotope(98), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - OrePrefixes.dust, - getUnlocalizedName("CALIFORNIUM"), - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getBestUnstableIsotope(99), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - OrePrefixes.dust, - getUnlocalizedName("EINSTEINIUM"), - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getBestUnstableIsotope(100), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - OrePrefixes.dust, - getUnlocalizedName("FERMIUM"), - 1); - } -} diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/TT_turret_loader.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/TT_turret_loader.java deleted file mode 100644 index 4323c3bba..000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/TT_turret_loader.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.github.technus.tectech.compatibility.openmodularturrets; - -import net.minecraft.item.Item; -import net.minecraftforge.client.MinecraftForgeClient; - -import com.github.technus.tectech.compatibility.openmodularturrets.blocks.turretheads.TurretHeadEM; -import com.github.technus.tectech.compatibility.openmodularturrets.blocks.turretheads.TurretHeadItemRenderEM; -import com.github.technus.tectech.compatibility.openmodularturrets.blocks.turretheads.TurretHeadRenderEM; -import com.github.technus.tectech.compatibility.openmodularturrets.entity.projectiles.projectileEM; -import com.github.technus.tectech.compatibility.openmodularturrets.entity.projectiles.projectileRenderEM; -import com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turret.TileTurretHeadEM; - -import cpw.mods.fml.client.registry.ClientRegistry; -import cpw.mods.fml.client.registry.RenderingRegistry; - -public class TT_turret_loader implements Runnable { - - @Override - public void run() { - TurretHeadRenderEM turretHeadRenderEM = new TurretHeadRenderEM(); - ClientRegistry.bindTileEntitySpecialRenderer(TileTurretHeadEM.class, turretHeadRenderEM); - MinecraftForgeClient.registerItemRenderer( - Item.getItemFromBlock(TurretHeadEM.INSTANCE), - new TurretHeadItemRenderEM(turretHeadRenderEM, new TileTurretHeadEM())); - - RenderingRegistry.registerEntityRenderingHandler(projectileEM.class, new projectileRenderEM()); - } -} diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseEM.java deleted file mode 100644 index 6da5055e0..000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseEM.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.github.technus.tectech.compatibility.openmodularturrets.blocks.turretbases; - -import static com.github.technus.tectech.TecTech.creativeTabTecTech; - -import net.minecraft.block.Block; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -import com.github.technus.tectech.Reference; -import com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turretbase.TileTurretBaseEM; - -import cpw.mods.fml.common.registry.GameRegistry; -import openmodularturrets.blocks.turretbases.BlockAbstractTurretBase; -import openmodularturrets.handler.ConfigHandler; - -/** - * Created by Tec on 27/07/2017. - */ -public class TurretBaseEM extends BlockAbstractTurretBase { - - private final int MaxCharge = ConfigHandler.getBaseTierFiveMaxCharge(); - private final int MaxIO = ConfigHandler.getBaseTierFiveMaxIo(); - public static TurretBaseEM INSTANCE; - - public TurretBaseEM() { - setCreativeTab(creativeTabTecTech); - setResistance(16); - setBlockName("turretBaseEM"); - setStepSound(Block.soundTypeMetal); - setBlockTextureName(Reference.MODID + ":turretBaseEM"); - } - - @Override - public TileEntity createNewTileEntity(World worldIn, int meta) { - return new TileTurretBaseEM(MaxCharge, MaxIO); - } - - @Override - public void registerBlockIcons(IIconRegister reg) { - super.registerBlockIcons(reg); - blockIcon = reg.registerIcon(Reference.MODID + ":turretBaseEM"); - } - - public static void run() { - INSTANCE = new TurretBaseEM(); - GameRegistry.registerBlock(INSTANCE, TurretBaseItemEM.class, INSTANCE.getUnlocalizedName()); - GameRegistry.registerTileEntity(TileTurretBaseEM.class, "TileTurretBaseEM"); - } -} diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseItemEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseItemEM.java deleted file mode 100644 index 4a1a35019..000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseItemEM.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.github.technus.tectech.compatibility.openmodularturrets.blocks.turretbases; - -import static net.minecraft.util.StatCollector.translateToLocal; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -import com.github.technus.tectech.util.CommonValues; - -/** - * Created by Tec on 28/07/2017. - */ -public class TurretBaseItemEM extends ItemBlock { - - public TurretBaseItemEM(Block block) { - super(block); - } - - @Override - public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List list, boolean p_77624_4_) { - list.add(CommonValues.TEC_MARK_EM); - list.add(""); - list.add(EnumChatFormatting.AQUA + "--" + translateToLocal("tooptip.energy.label") + "--"); - list.add(translateToLocal("tooltip.rf.max") + ": " + EnumChatFormatting.WHITE + 1000000000); - list.add(translateToLocal("tooltip.rf.io") + ": " + EnumChatFormatting.WHITE + 50000); - list.add(""); - list.add(EnumChatFormatting.GREEN + "--" + translateToLocal("tooltip.extras.label") + "--"); - list.add(translateToLocal("tooltip.extras.addons.2")); - list.add(translateToLocal("tooltip.extras.upgrade.2")); - list.add(""); - list.add(EnumChatFormatting.DARK_GRAY + translateToLocal("flavour.base.0")); - } -} diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadEM.java deleted file mode 100644 index b410f483c..000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadEM.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.github.technus.tectech.compatibility.openmodularturrets.blocks.turretheads; - -import static com.github.technus.tectech.TecTech.creativeTabTecTech; - -import net.minecraft.block.Block; -import net.minecraft.block.ITileEntityProvider; -import net.minecraft.block.material.Material; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turret.TileTurretHeadEM; - -import cpw.mods.fml.common.registry.GameRegistry; -import openmodularturrets.tileentity.turretbase.TurretBase; - -/** - * Created by Tec on 27/07/2017. - */ -public class TurretHeadEM extends Block implements ITileEntityProvider { - - public static TurretHeadEM INSTANCE; - - public TurretHeadEM() { - super(Material.glass); - setCreativeTab(creativeTabTecTech); - setBlockUnbreakable(); - setResistance(6000000.0F); - setStepSound(Block.soundTypeMetal); - setBlockBounds(0.2F, 0.0F, 0.2F, 0.8F, 1F, 0.8F); - setBlockName("turretHeadEM"); - // this.setBlockTextureName(Reference.MODID+":turretHeadEM"); - } - - @Override - public int getRenderType() { - return -1; - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - public boolean canPlaceBlockAt(World worldIn, int x, int y, int z) { - return worldIn.getTileEntity(x + 1, y, z) instanceof TurretBase - || worldIn.getTileEntity(x - 1, y, z) instanceof TurretBase - || worldIn.getTileEntity(x, y + 1, z) instanceof TurretBase - || worldIn.getTileEntity(x, y - 1, z) instanceof TurretBase - || worldIn.getTileEntity(x, y, z + 1) instanceof TurretBase - || worldIn.getTileEntity(x, y, z - 1) instanceof TurretBase; - } - - @Override - public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) { - return false; - } - - @Override - public TileEntity createNewTileEntity(World worldIn, int meta) { - return new TileTurretHeadEM(); - } - - public static void run() { - INSTANCE = new TurretHeadEM(); - GameRegistry.registerBlock(INSTANCE, TurretHeadItemEM.class, INSTANCE.getUnlocalizedName()); - GameRegistry.registerTileEntity(TileTurretHeadEM.class, "TileTurretHeadEM"); - } -} diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadItemEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadItemEM.java deleted file mode 100644 index f32029460..000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadItemEM.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.github.technus.tectech.compatibility.openmodularturrets.blocks.turretheads; - -import static com.github.technus.tectech.util.CommonValues.TEC_MARK_EM; -import static net.minecraft.util.StatCollector.translateToLocal; - -import java.text.DecimalFormat; -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -import openmodularturrets.handler.ConfigHandler; - -/** - * Created by Tec on 28/07/2017. - */ -public class TurretHeadItemEM extends ItemBlock { - - private static final DecimalFormat df = new DecimalFormat("0.0"); - - public TurretHeadItemEM(Block block) { - super(block); - } - - @Override - public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List list, boolean p_77624_4_) { - list.add(TEC_MARK_EM); - list.add(""); - list.add(EnumChatFormatting.GOLD + "--" + translateToLocal("tooltip.info") + "--"); - list.add(translateToLocal("tooltip.tier") + ": " + EnumChatFormatting.WHITE + '5'); - list.add( - translateToLocal("tooltip.range") + ": " - + EnumChatFormatting.WHITE - + ConfigHandler.getLaserTurretSettings().getRange()); - list.add( - translateToLocal("tooltip.accuracy") + ": " - + EnumChatFormatting.WHITE - + translateToLocal("turret.accuracy.high")); - list.add( - translateToLocal("tooltip.ammo") + ": " + EnumChatFormatting.WHITE + translateToLocal("turret.ammo.4")); - list.add( - translateToLocal("tooltip.tierRequired") + ": " - + EnumChatFormatting.WHITE - + translateToLocal("base.tier.5")); - list.add(""); - list.add(EnumChatFormatting.DARK_PURPLE + "--" + translateToLocal("tooltip.damage.label") + "--"); - list.add( - translateToLocal("tooltip.damage.stat") + ": " - + EnumChatFormatting.WHITE - + (float) ConfigHandler.getLaserTurretSettings().getDamage() / 2.0F - + ' ' - + translateToLocal("tooltip.health")); - list.add(translateToLocal("tooltip.aoe") + ": " + EnumChatFormatting.WHITE + '0'); - list.add( - translateToLocal("tooltip.firerate") + ": " - + EnumChatFormatting.WHITE - + df.format(20.0F / (float) ConfigHandler.getLaserTurretSettings().getFireRate())); - list.add( - translateToLocal("tooltip.energy.stat") + ": " - + EnumChatFormatting.WHITE - + ConfigHandler.getLaserTurretSettings().getPowerUsage() - + " RF"); - list.add(""); - list.add(EnumChatFormatting.DARK_GRAY + translateToLocal("flavour.turret.4")); - } -} diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadItemRenderEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadItemRenderEM.java deleted file mode 100644 index 4fdc41326..000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadItemRenderEM.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.github.technus.tectech.compatibility.openmodularturrets.blocks.turretheads; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.client.IItemRenderer; - -import org.lwjgl.opengl.GL11; - -import com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turret.TileTurretHeadEM; - -import openmodularturrets.client.render.models.ModelLaserTurret; - -/** - * Created by Tec on 30.07.2017. - */ -public class TurretHeadItemRenderEM implements IItemRenderer { - - private final TurretHeadRenderEM turretRenderer; - private final TileTurretHeadEM turretTileEntity; - private final ModelLaserTurret model; - - public TurretHeadItemRenderEM(TurretHeadRenderEM turretRenderer, TileTurretHeadEM turretTileEntity) { - this.turretRenderer = turretRenderer; - this.turretTileEntity = turretTileEntity; - model = new ModelLaserTurret(); - } - - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) { - return true; - } - - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { - return true; - } - - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - GL11.glPushMatrix(); - GL11.glTranslated(-0.5D, -0.5D, -0.5D); - turretRenderer.renderTileEntityAt(turretTileEntity, 0.0D, 0.0D, 0.0D, 0.0F); - GL11.glPopMatrix(); - } -} diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadRenderEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadRenderEM.java deleted file mode 100644 index d73d9b29b..000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadRenderEM.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.github.technus.tectech.compatibility.openmodularturrets.blocks.turretheads; - -import openmodularturrets.client.render.renderers.blockitem.LaserTurretRenderer; - -/** - * Created by Tec on 28/07/2017. - */ -public class TurretHeadRenderEM extends LaserTurretRenderer { -} 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 deleted file mode 100644 index eec1121ff..000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java +++ /dev/null @@ -1,192 +0,0 @@ -package com.github.technus.tectech.compatibility.openmodularturrets.entity.projectiles; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; - -import gregtech.api.enums.SoundResource; -import gregtech.api.util.GT_Utility; -import openmodularturrets.entity.projectiles.LaserProjectile; -import openmodularturrets.entity.projectiles.damagesources.NormalDamageSource; -import openmodularturrets.handler.ConfigHandler; -import openmodularturrets.tileentity.turretbase.TurretBase; -import openmodularturrets.util.PlayerUtil; -import openmodularturrets.util.TurretHeadUtil; - -/** - * Created by Bass on 27/07/2017. - */ -public class projectileEM extends LaserProjectile { - - public float gravity = 0; - private TurretBase turretBase; - - private boolean strange, antiMatter, isAmped; - - private int ampLevel; - - private float massFactor; - private double mass, charge; - - public projectileEM(World par1World) { - super(par1World); - } - - public projectileEM(World par1World, TurretBase turretBase) { - super(par1World, turretBase); - int amp = TurretHeadUtil.getAmpLevel(turretBase); - if (amp > 0) { - this.isAmped = true; - this.ampLevel = amp; - } - } - - public projectileEM(World par1World, TurretBase turretBase, EMInstanceStack projectileContent) { - super(par1World, turretBase); - this.turretBase = turretBase; - if (projectileContent != null) { - mass = projectileContent.getMass(); - charge = projectileContent.getCharge(); - massFactor = (float) (projectileContent.getDefinition().getMass() / EMHadronDefinition.hadron_n_.getMass()); - - if (projectileContent.getDefinition().getGeneration() > 1 - || projectileContent.getDefinition().getGeneration() < -1) { - strange = true; - } - if (projectileContent.getDefinition().getGeneration() < 0) { - antiMatter = true; - } - - if (projectileContent.getDefinition().getCharge() == 0) { - gravity = massFactor / 100f; - } else { - gravity = Math - .min(0.0025F / Math.abs(projectileContent.getDefinition().getCharge()), massFactor / 100f); - } - } - } - - @Override - protected void onImpact(MovingObjectPosition movingobjectposition) { - if (ticksExisted > 1) { - if (!worldObj.isRemote) { - worldObj.playSoundEffect( - posX, - posY, - posZ, - "openmodularturrets:laserHit", - ConfigHandler.getTurretSoundVolume(), - TecTech.RANDOM.nextFloat() + 0.5F); - 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, - SoundResource.IC2_MACHINES_MACHINE_OVERLOAD, - 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; - } - } - - if (TecTech.configTecTech.ENABLE_TURRET_EXPLOSIONS && antiMatter) { - GT_Utility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_MACHINES_MACHINE_OVERLOAD, - 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; - default: - break; - } - } - setDead(); - } - } - - public boolean canDamagePlayer(EntityPlayer entityPlayer) { - return ConfigHandler.turretDamageTrustedPlayers || this.turretBase.getTrustedPlayer(entityPlayer.getUniqueID()) - == null - && !PlayerUtil.getPlayerUIDUnstable(this.turretBase.getOwner()).equals(entityPlayer.getUniqueID()); - } - - @Override - public void onEntityUpdate() { - if (ticksExisted >= 75) { - setDead(); - } - } - - @Override - protected float getGravityVelocity() { - return gravity; - } -} diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileRenderEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileRenderEM.java deleted file mode 100644 index 3c4ff2bcc..000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileRenderEM.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.github.technus.tectech.compatibility.openmodularturrets.entity.projectiles; - -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.entity.Render; -import net.minecraft.entity.Entity; -import net.minecraft.util.MathHelper; -import net.minecraft.util.ResourceLocation; - -import org.lwjgl.opengl.GL11; - -import com.github.technus.tectech.Reference; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -/** - * Created by Tec on 29.07.2017. - */ -@SideOnly(Side.CLIENT) -public class projectileRenderEM extends Render { - - private static final ResourceLocation textures = new ResourceLocation( - Reference.MODID + ":textures/entity/projectileEM.png"); - - private void render(projectileEM entity, double par2, double par4, double par6, float par9) { - bindEntityTexture(entity); - GL11.glPushMatrix(); - GL11.glTranslatef((float) par2, (float) par4 + 0.3F, (float) par6); - GL11.glRotatef( - entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * par9 - 90.0F, - 0.0F, - 1.0F, - 0.0F); - GL11.glRotatef( - entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * par9, - 0.0F, - 0.0F, - 1.0F); - Tessellator var18 = Tessellator.instance; - byte b0 = 0; - float f2 = 0.0F; - float f3 = 0.5F; - float f4 = (float) (b0 * 10) / 32.0F; - float f5 = (float) (5 + b0 * 10) / 32.0F; - float f10 = 0.05625F; - GL11.glEnable('\u803a'); - float f11 = -par9; - if (f11 > 0.0F) { - float f = -MathHelper.sin(f11 * 3.0F) * f11; - GL11.glRotatef(f, 0.0F, 0.0F, 1.0F); - } - - GL11.glDisable(2896); - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F); - GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); - GL11.glScalef(f10, f10, f10); - GL11.glTranslatef(0.0F, 0.0F, 0.0F); - GL11.glNormal3f(f10, 0.0F, 0.0F); - - for (int var19 = 0; var19 < 4; ++var19) { - GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); - GL11.glNormal3f(0.0F, 0.0F, f10); - var18.startDrawingQuads(); - var18.addVertexWithUV(-16.0D, -2.0D, 0.0D, (double) f2, (double) f4); - var18.addVertexWithUV(16.0D, -2.0D, 0.0D, (double) f3, (double) f4); - var18.addVertexWithUV(16.0D, 2.0D, 0.0D, (double) f3, (double) f5); - var18.addVertexWithUV(-16.0D, 2.0D, 0.0D, (double) f2, (double) f5); - var18.draw(); - } - - GL11.glEnable(2896); - GL11.glDisable('\u803a'); - GL11.glPopMatrix(); - } - - @Override - protected ResourceLocation getEntityTexture(Entity par1Entity) { - return textures; - } - - @Override - public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { - render((projectileEM) par1Entity, par2, par4, par6, par9); - } -} 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 deleted file mode 100644 index 62177c16d..000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turret; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; - -import net.minecraft.entity.Entity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import com.github.technus.tectech.compatibility.openmodularturrets.entity.projectiles.projectileEM; -import com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turretbase.TileTurretBaseEM; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; - -import openmodularturrets.entity.projectiles.TurretProjectile; -import openmodularturrets.handler.ConfigHandler; -import openmodularturrets.tileentity.turrets.TurretHead; -import openmodularturrets.util.TurretHeadUtil; - -/** - * Created by Bass on 27/07/2017. - */ -public class TileTurretHeadEM extends TurretHead { - - private EMInstanceStackMap hatchContentPointer; - - @Override - public int getTurretRange() { - return ConfigHandler.getLaserTurretSettings().getRange() << 1; - } - - @Override - public int getTurretPowerUsage() { - return ConfigHandler.getLaserTurretSettings().getPowerUsage() << 4; - } - - @Override - public int getTurretFireRate() { - return (int) Math.ceil(ConfigHandler.getLaserTurretSettings().getFireRate() / 2f); - } - - @Override - public double getTurretAccuracy() { - return (int) Math.ceil(ConfigHandler.getLaserTurretSettings().getAccuracy() / 10.0F); - } - - @Override - public void updateEntity() { - if (!worldObj.isRemote && base instanceof TileTurretBaseEM) { - hatchContentPointer = ((TileTurretBaseEM) base).getContainerHandler(); - } - super.updateEntity(); - } - - @Override - public boolean requiresAmmo() { - return hatchContentPointer == null || hatchContentPointer.isEmpty(); - } - - @Override - public boolean requiresSpecificAmmo() { - return true; // to enable failure in shooting when there is no EM to use - } - - @Override - public Item getAmmo() { - return DebugElementalInstanceContainer_EM.INSTANCE; // Placeholder item that cannot be achieved, yet still - // usable for debug - } - - @Override - public final TurretProjectile createProjectile(World world, Entity target, ItemStack ammo) { - if (hatchContentPointer == null || hatchContentPointer.isEmpty()) { - return new projectileEM(world, TurretHeadUtil.getTurretBase(worldObj, xCoord, yCoord, zCoord), null); - } - EMInstanceStack stack = hatchContentPointer.getRandom(); - double amount = Math.min(EM_COUNT_PER_MATERIAL_AMOUNT, stack.getAmount()); - hatchContentPointer.removeAmount(stack.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT); - stack = stack.clone(); - stack.setAmount(amount); - return new projectileEM(world, TurretHeadUtil.getTurretBase(worldObj, xCoord, yCoord, zCoord), stack); - } - - @Override - public String getLaunchSoundEffect() { - return "laser"; - } -} diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java deleted file mode 100644 index 023249a80..000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turretbase; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; - -import cpw.mods.fml.common.Optional; -import gregtech.api.enums.Mods; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import openmodularturrets.tileentity.turretbase.TurretBaseTierFiveTileEntity; - -/** - * Created by Bass on 27/07/2017. - */ -public class TileTurretBaseEM extends TurretBaseTierFiveTileEntity { - - public TileTurretBaseEM(int MaxEnergyStorage, int MaxIO) { - super(MaxEnergyStorage, MaxIO); - } - - @Override - @Optional.Method(modid = Mods.Names.OPEN_COMPUTERS) - public String getComponentName() { - return "turretBaseEM"; - } - - public final EMInstanceStackMap getContainerHandler() { - World worldIn = getWorldObj(); - TileEntity te; - if ((te = worldIn.getTileEntity(xCoord + 1, yCoord, zCoord)) instanceof IGregTechTileEntity - && ((IGregTechTileEntity) te).getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_InputElemental) { - return getFromHatch( - (GT_MetaTileEntity_Hatch_InputElemental) ((IGregTechTileEntity) te).getMetaTileEntity()); - } - - if ((te = worldIn.getTileEntity(xCoord - 1, yCoord, zCoord)) instanceof IGregTechTileEntity - && ((IGregTechTileEntity) te).getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_InputElemental) { - return getFromHatch( - (GT_MetaTileEntity_Hatch_InputElemental) ((IGregTechTileEntity) te).getMetaTileEntity()); - } - - if ((te = worldIn.getTileEntity(xCoord, yCoord + 1, zCoord)) instanceof IGregTechTileEntity - && ((IGregTechTileEntity) te).getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_InputElemental) { - return getFromHatch( - (GT_MetaTileEntity_Hatch_InputElemental) ((IGregTechTileEntity) te).getMetaTileEntity()); - } - - if ((te = worldIn.getTileEntity(xCoord, yCoord - 1, zCoord)) instanceof IGregTechTileEntity - && ((IGregTechTileEntity) te).getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_InputElemental) { - return getFromHatch( - (GT_MetaTileEntity_Hatch_InputElemental) ((IGregTechTileEntity) te).getMetaTileEntity()); - } - - if ((te = worldIn.getTileEntity(xCoord, yCoord, zCoord + 1)) instanceof IGregTechTileEntity - && ((IGregTechTileEntity) te).getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_InputElemental) { - return getFromHatch( - (GT_MetaTileEntity_Hatch_InputElemental) ((IGregTechTileEntity) te).getMetaTileEntity()); - } - - if ((te = worldIn.getTileEntity(xCoord, yCoord, zCoord - 1)) instanceof IGregTechTileEntity - && ((IGregTechTileEntity) te).getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_InputElemental) { - return getFromHatch( - (GT_MetaTileEntity_Hatch_InputElemental) ((IGregTechTileEntity) te).getMetaTileEntity()); - } - - return null; - } - - private EMInstanceStackMap getFromHatch(GT_MetaTileEntity_Hatch_InputElemental hatch) { - hatch.onValueUpdate((byte) 4); - hatch.onTexturePageUpdate((byte) 8); - return hatch.getContentHandler(); - } -} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMComplexAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMComplexAspectDefinition.java deleted file mode 100644 index 3e2181d04..000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMComplexAspectDefinition.java +++ /dev/null @@ -1,233 +0,0 @@ -package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; -import static net.minecraft.util.StatCollector.translateToLocal; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat; -import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMComplexTemplate; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; - -/** - * Created by Tec on 06.05.2017. - */ -public final class EMComplexAspectDefinition extends EMComplexTemplate { - - private final int hash; - private final double mass; - - private static final String nbtType = "`"; - - private final EMConstantStackMap aspectStacks; - - public EMComplexAspectDefinition(EMDefinitionStack... aspects) throws EMException { - this(true, new EMConstantStackMap(aspects)); - } - - public EMComplexAspectDefinition(EMConstantStackMap aspects) throws EMException { - this(true, aspects); - } - - private EMComplexAspectDefinition(boolean check, EMConstantStackMap aspects) throws EMException { - if (check && !canTheyBeTogether(aspects)) { - throw new EMException("Complex Aspect Definition error"); - } - aspectStacks = aspects; - float mass = 0; - for (EMDefinitionStack stack : aspects.valuesToArray()) { - mass += stack.getMass(); - } - this.mass = mass; - hash = super.hashCode(); - } - - // public but u can just try{}catch(){} the constructor it still calls this method - private static boolean canTheyBeTogether(EMConstantStackMap stacks) { - long amount = 0; - for (EMDefinitionStack aspects : stacks.valuesToArray()) { - if (!(aspects.getDefinition() instanceof EMComplexAspectDefinition) - && !(aspects.getDefinition() instanceof EMPrimalAspectDefinition)) { - return false; - } - if ((int) aspects.getAmount() != aspects.getAmount()) { - throw new ArithmeticException("Amount cannot be safely converted to int!"); - } - amount += aspects.getAmount(); - } - return amount == 2; - } - - @Override - public String getLocalizedTypeName() { - return translateToLocal("tt.keyword.Aspect"); - } - - @Override - public String getShortLocalizedName() { - String name = AspectDefinitionCompat.aspectDefinitionCompat.getAspectLocalizedName(this); - if (name != null) { - return name.substring(0, 1).toUpperCase() + name.substring(1); - } else { - return getSymbol(); - } - } - - @Override - public String getSymbol() { - StringBuilder symbol = new StringBuilder(8); - for (EMDefinitionStack aspect : aspectStacks.valuesToArray()) { - if (aspect.getDefinition() instanceof EMPrimalAspectDefinition) { - for (int i = 0; i < aspect.getAmount(); i++) { - symbol.append(aspect.getDefinition().getSymbol()); - } - } else { - symbol.append('('); - for (int i = 0; i < aspect.getAmount(); i++) { - symbol.append(aspect.getDefinition().getSymbol()); - } - symbol.append(')'); - } - } - return symbol.toString(); - } - - @Override - public String getShortSymbol() { - StringBuilder symbol = new StringBuilder(8); - for (EMDefinitionStack aspect : aspectStacks.valuesToArray()) { - if (aspect.getDefinition() instanceof EMPrimalAspectDefinition) { - for (int i = 0; i < aspect.getAmount(); i++) { - symbol.append(aspect.getDefinition().getShortSymbol()); - } - } else { - symbol.append('('); - for (int i = 0; i < aspect.getAmount(); i++) { - symbol.append(aspect.getDefinition().getShortSymbol()); - } - symbol.append(')'); - } - } - return symbol.toString(); - } - - @Override - protected String getTagValue() { - return nbtType; - } - - @Override - public double getRawTimeSpan(long currentEnergy) { - return -1; - } - - @Override - public boolean isTimeSpanHalfLife() { - return false; - } - - @Override - public int getCharge() { - return 0; - } - - @Override - public int getGeneration() { - return 0; - } - - @Override - public int getMaxColors() { - return -1; - } - - @Override - public EMConstantStackMap getSubParticles() { - return aspectStacks; - } - - @Override - public EMDecay[] getEnergyInducedDecay(long energyLevel) { - return new EMDecay[] { new EMDecay(0.75F, aspectStacks), deadEnd }; - } - - @Override - public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { - return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); - } - - @Override - public boolean usesSpecialEnergeticDecayHandling() { - return false; - } - - @Override - public boolean usesMultipleDecayCalls(long energyLevel) { - return false; - } - - @Override - public boolean decayMakesEnergy(long energyLevel) { - return false; - } - - @Override - public boolean fusionMakesEnergy(long energyLevel) { - return false; - } - - @Override - public EMDecay[] getNaturalDecayInstant() { - return NO_DECAY; - } - - @Override - public EMDecay[] getDecayArray() { - return NO_DECAY; - } - - @Override - public double getMass() { - return mass; - } - - @Override - public IEMDefinition getAnti() { - return null; - } - - public static void run(EMDefinitionsRegistry registry) { - registry.registerDefinitionClass( - nbtType, - new EMIndirectType( - (definitionsRegistry, nbt) -> new EMComplexAspectDefinition( - EMConstantStackMap.fromNBT(definitionsRegistry, nbt)), - EMComplexAspectDefinition.class, - "tt.keyword.Aspect")); - if (DEBUG_MODE) { - TecTech.LOGGER - .info("Registered Elemental Matter Class: ComplexAspect " + nbtType + ' ' + getClassTypeStatic()); - } - } - - @Override - public int getMatterMassType() { - return getClassTypeStatic(); - } - - public static int getClassTypeStatic() { - return -96; - } - - @Override - public int hashCode() { - return hash; - } -} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java deleted file mode 100644 index e9bb84aaa..000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; -import static net.minecraft.util.StatCollector.translateToLocal; - -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; - -/** - * Created by Tec on 06.05.2017. - */ -public final class EMPrimalAspectDefinition extends EMPrimitiveTemplate { - - public static final EMPrimalAspectDefinition magic_air = new EMPrimalAspectDefinition( - "tt.keyword.Air", - "a`", - 1e1D, - 45, - "a`"), magic_earth = new EMPrimalAspectDefinition("tt.keyword.Earth", "e`", 1e9D, 44, "e`"), - magic_fire = new EMPrimalAspectDefinition("tt.keyword.Fire", "f`", 1e3D, 43, "f`"), - magic_water = new EMPrimalAspectDefinition("tt.keyword.Water", "w`", 1e7D, 42, "w`"), - magic_order = new EMPrimalAspectDefinition("tt.keyword.Order", "o`", 1e5D, 40, "o`"), - magic_entropy = new EMPrimalAspectDefinition("tt.keyword.Chaos", "c`", 1e5D, 41, "c`"); - - private EMPrimalAspectDefinition(String name, String symbol, double mass, int ID, String bind) { - super(name, symbol, 0, mass, 0, -1, ID, bind); - } - - public static void run(EMDefinitionsRegistry registry) { - registry.registerDefinitionClass(new EMType(EMPrimalAspectDefinition.class, "tt.keyword.Primal")); - magic_air.init(registry, null, -1F, -1, -1, NO_DECAY); - magic_earth.init(registry, null, -1F, -1, -1, NO_DECAY); - magic_fire.init(registry, null, -1F, -1, -1, NO_DECAY); - magic_water.init(registry, null, -1F, -1, -1, NO_DECAY); - magic_order.init(registry, null, -1F, -1, -1, NO_DECAY); - magic_entropy.init(registry, null, -1F, -1, -1, NO_DECAY); - } - - @Override - public String getShortLocalizedName() { - String name = AspectDefinitionCompat.aspectDefinitionCompat.getAspectLocalizedName(this); - return name != null ? super.getShortLocalizedName() + " (" + name + ")" : super.getShortLocalizedName(); - } - - @Override - public String getLocalizedTypeName() { - return translateToLocal("tt.keyword.Primal"); - } - - @Override - public boolean isTimeSpanHalfLife() { - return false; - } -} 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 deleted file mode 100644 index 22afee562..000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations; - -import java.util.HashMap; - -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; - -/** - * Created by Tec on 21.05.2017. - */ -public class AspectDefinitionCompat { - - public static AspectDefinitionCompat aspectDefinitionCompat; - private final HashMap defToAspect = new HashMap<>(); - private final HashMap aspectToDef = new HashMap<>(); - - public void run(EMDefinitionsRegistry registry) {} - - public String getAspectTag(IEMDefinition definition) { - return null; - } - - public String getAspectLocalizedName(IEMDefinition definition) { - return null; - } - - public IEMDefinition getDefinition(String aspect) { - return null; - } - - public HashMap getDefToAspect() { - return defToAspect; - } - - public HashMap getAspectToDef() { - return aspectToDef; - } -} 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 deleted file mode 100644 index 2d606790b..000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations; - -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition.magic_air; -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition.magic_earth; -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition.magic_entropy; -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition.magic_fire; -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition.magic_order; -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition.magic_water; - -import java.util.ArrayList; - -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; - -import thaumcraft.api.aspects.Aspect; - -/** - * Created by Tec on 21.05.2017. - */ -public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat { - - @Override - public void run(EMDefinitionsRegistry registry) { - getDefToAspect().put(magic_air, "aer"); - getDefToAspect().put(magic_earth, "terra"); - getDefToAspect().put(magic_fire, "ignis"); - getDefToAspect().put(magic_water, "aqua"); - getDefToAspect().put(magic_order, "ordo"); - getDefToAspect().put(magic_entropy, "perditio"); - - getAspectToDef().put("aer", magic_air); - getAspectToDef().put("terra", magic_earth); - getAspectToDef().put("ignis", magic_fire); - getAspectToDef().put("aqua", magic_water); - getAspectToDef().put("ordo", magic_order); - getAspectToDef().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 (getAspectToDef().containsKey(content[0].getTag()) - && getAspectToDef().containsKey(content[1].getTag())) { - try { - EMComplexAspectDefinition newAspect; - if (content[0].getTag().equals(content[1].getTag())) { - newAspect = new EMComplexAspectDefinition( - getAspectToDef().get(content[0].getTag()).getStackForm(2)); - } else { - newAspect = new EMComplexAspectDefinition( - getAspectToDef().get(content[0].getTag()).getStackForm(1), - getAspectToDef().get(content[1].getTag()).getStackForm(1)); - } - getAspectToDef().put(aspect.getTag(), newAspect); - getDefToAspect().put(newAspect, aspect.getTag()); - registry.registerForDisplay(newAspect); - } catch (EMException e) { - /**/ - } finally { - list.remove(aspect); - } - } - } - } - } - } - - @Override - public String getAspectTag(IEMDefinition definition) { - return getDefToAspect().get(definition); - } - - public String getAspectLocalizedName(IEMDefinition definition) { - Aspect aspect = Aspect.aspects.get(getAspectTag(definition)); - return aspect != null ? aspect.getName() : null; - } - - @Override - public IEMDefinition getDefinition(String aspect) { - return getAspectToDef().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 deleted file mode 100644 index 480bd3b7a..000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; - -import net.minecraft.tileentity.TileEntity; - -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; - -/** - * Created by Tec on 21.05.2017. - */ -public class EssentiaCompat { - - public static EssentiaCompat essentiaContainerCompat; - - public boolean check(T meta, TileEntity te) { - return false; - } - - public TileEntity getContainer(T meta) { - return null; - } - - public String getEssentiaName(IEMDefinition stack) { - return null; - } - - public boolean putInContainer(TileEntity container, String name) { - return false; - } - - public IEMDefinition 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 deleted file mode 100644 index 5e0a71f89..000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; - -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat.aspectDefinitionCompat; - -import net.minecraft.tileentity.TileEntity; - -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; - -import thaumcraft.api.aspects.Aspect; -import thaumcraft.api.aspects.AspectList; -import thaumcraft.api.aspects.IAspectContainer; -import thaumcraft.common.tiles.TileEssentiaReservoir; -import thaumcraft.common.tiles.TileJarFillable; - -/** - * Created by Tec on 21.05.2017. - */ -public class EssentiaCompatEnabled extends EssentiaCompat { - - @Override - public boolean check(T meta, TileEntity te) { - return te instanceof TileEssentiaReservoir || te instanceof TileJarFillable; - } - - @Override - public TileEntity getContainer(T meta) { - TileEntity tile = meta.getBaseMetaTileEntity() - .getTileEntityAtSide(meta.getBaseMetaTileEntity().getBackFacing()); - return tile != null && !tile.isInvalid() && tile instanceof TileEssentiaReservoir - || tile instanceof TileJarFillable ? tile : null; - } - - @Override - public String getEssentiaName(IEMDefinition stack) { - return aspectDefinitionCompat.getDefToAspect().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) { - Aspect aspect = Aspect.getAspect(aspectName); - if (aspect == null) { - return false; - } - int remaining = ((IAspectContainer) container).addToContainer(aspect, 1); - return remaining == 0; - } - return false; - } - - @Override - public IEMDefinition getFromContainer(TileEntity container) { - if (container == null || container.isInvalid()) { - return null; - } - if (container instanceof IAspectContainer) { - AspectList aspects = ((IAspectContainer) container).getAspects(); - if (aspects != null) { - Aspect[] aspectsArr = aspects.getAspects(); - if (aspectsArr != null && aspectsArr[0] != null) { - if (((IAspectContainer) container).takeFromContainer(aspectsArr[0], 1)) { - return aspectDefinitionCompat.getAspectToDef().get(aspectsArr[0].getTag()); - } - } - } - } - return null; - } -} 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 deleted file mode 100644 index c356c4e21..000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ /dev/null @@ -1,236 +0,0 @@ -package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; - -import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_ITEM_DIMINISHED; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; -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 com.gtnewhorizon.structurelib.structure.StructureUtility.ofTileAdder; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; -import static net.minecraft.util.StatCollector.translateToLocal; - -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 com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.thing.block.QuantumGlassBlock; -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.StructureLibAPI; -import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; - -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 gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import thaumcraft.api.aspects.Aspect; - -/** - * Created by danie_000 on 17.12.2016. - */ -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[] 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 Elemental - // Casing - translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.hint.3"), // General - Some sort of Essentia - // Storage - }; - - private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition - .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)) - .addElement('*', ofTileAdder(essentiaContainerCompat::check, StructureLibAPI.getBlockHint(), 12)).build(); - - private String outputEssentiaName = ""; - // endregion - - public GT_MetaTileEntity_EM_essentiaDequantizer(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_essentiaDequantizer(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_essentiaDequantizer(mName); - } - - @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM("main", 1, 1, 0); - } - - @Override - public boolean checkRecipe_EM(ItemStack itemStack) { - TileEntity container = essentiaContainerCompat.getContainer(this); - if (eInputHatches.size() < 1 || container == null) { - stopMachine(); - return false; - } - - EMInstanceStackMap inputHatchContainer = eInputHatches.get(0).getContentHandler(); - if (inputHatchContainer == null || !inputHatchContainer.hasStacks()) { - return false; - } - - EMInstanceStack stack = inputHatchContainer.getRandom(); - if (stack.getAmount() < EM_COUNT_PER_ITEM_DIMINISHED) { - cleanStackEM_EM(inputHatchContainer.removeKey(stack.getDefinition())); - mEUt = (int) -V[6]; - } else { - outputEssentiaName = essentiaContainerCompat.getEssentiaName(stack.getDefinition()); - Aspect aspect = Aspect.getAspect(outputEssentiaName); - if (aspect == null) { - outputEssentiaName = ""; - cleanStackEM_EM(inputHatchContainer.removeKey(stack.getDefinition())); - mEUt = (int) -V[7]; - } else { - inputHatchContainer.removeAmount(stack.getDefinition().getStackForm(EM_COUNT_PER_MATERIAL_AMOUNT)); - 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(); - } - } - outputEssentiaName = ""; - } - - @Override - public GT_Multiblock_Tooltip_Builder createTooltip() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.name")) // Machine Type: - // Essentia - // Dequantizer - .addInfo(translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.desc.0")) // Controller block - // of the - // Essentia Dequantizer - .addInfo(translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.desc.1")) // Transforms - // elemental matter - // back into essentia - .addInfo(translateToLocal("tt.keyword.Structure.StructureTooComplex")) // The structure is too complex! - .addSeparator().beginStructureBlock(3, 3, 5, false) - .addOtherStructurePart( - translateToLocal("tt.keyword.Structure.ElementalInput"), - translateToLocal("tt.keyword.Structure.BackCenter"), - 2) // Elemental Input Hatch: Back center - .addOtherStructurePart( - translateToLocal("tt.keyword.Structure.ElementalOverflow"), - translateToLocal("tt.keyword.Structure.AnyOuterMolecularCasing4th"), - 3) // Elemental Overflow Hatch: Any outer Molecular Casing on the 4th slice - .addOtherStructurePart( - translateToLocal("tt.keyword.Structure.EssentiaStorage"), - translateToLocal("tt.keyword.Structure.AnyHighPowerCasingFront"), - 1) // Essentia Storage: Any High Power Casing on the front side - .addEnergyHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasingFront"), 1) // Energy Hatch: - // Any High Power - // Casing on the - // front side - .addMaintenanceHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasingFront"), 1) // Maintenance - // Hatch: Any - // High Power - // Casing on - // the front - // side - .toolTipFinisher(CommonValues.TEC_MARK_EM); - return tt; - } - - @Override - @SideOnly(Side.CLIENT) - protected ResourceLocation getActivitySound() { - return GT_MetaTileEntity_EM_quantizer.activitySound; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - structureBuild_EM("main", 1, 1, 0, stackSize, hintsOnly); - } - - @Override - public String[] getStructureDescription(ItemStack stackSize) { - return description; - } - - @Override - 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"); - } - - @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; - } -} 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 deleted file mode 100644 index 8e346cd97..000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ /dev/null @@ -1,196 +0,0 @@ -package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; - -import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; -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 com.gtnewhorizon.structurelib.structure.StructureUtility.ofTileAdder; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; -import static net.minecraft.util.StatCollector.translateToLocal; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.ResourceLocation; - -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.thing.block.QuantumGlassBlock; -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.StructureLibAPI; -import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; - -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 gregtech.api.util.GT_Multiblock_Tooltip_Builder; - -/** - * Created by danie_000 on 17.12.2016. - */ -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[] 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 Elemental - // Casing - translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.hint.3"), // General - Some sort of Essentia - // Storage - }; - - private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition - .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)) - .addElement('*', ofTileAdder(essentiaContainerCompat::check, StructureLibAPI.getBlockHint(), 12)).build(); - // endregion - - public GT_MetaTileEntity_EM_essentiaQuantizer(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_essentiaQuantizer(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_essentiaQuantizer(mName); - } - - @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM("main", 1, 1, 0); - } - - @Override - public boolean checkRecipe_EM(ItemStack itemStack) { - IEMDefinition definition = essentiaContainerCompat.getFromContainer(essentiaContainerCompat.getContainer(this)); - if (definition != null) { - mMaxProgresstime = 20; - mEfficiencyIncrease = 10000; - eAmpereFlow = 1; - outputEM = new EMInstanceStackMap[] { - new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_MATERIAL_AMOUNT)) }; - if (definition instanceof EMPrimalAspectDefinition) { - mEUt = (int) -V[8]; - } else { - mEUt = (int) -V[10]; - } - return true; - } - return false; - } - - @Override - public void outputAfterRecipe_EM() { - if (eOutputHatches.size() < 1) { - stopMachine(); - return; - } - eOutputHatches.get(0).getContentHandler().putUnifyAll(outputEM[0]); - outputEM = null; - } - - @Override - public GT_Multiblock_Tooltip_Builder createTooltip() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.name")) // Machine Type: - // Essentia Quantizer - .addInfo(translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.desc.0")) // Controller block - // of the - // Essentia Quantizer - .addInfo(translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.desc.1")) // Transforms - // essentia into - // their elemental form - .addInfo(translateToLocal("tt.keyword.Structure.StructureTooComplex")) // The structure is too complex! - .addSeparator().beginStructureBlock(3, 3, 5, false) - .addOtherStructurePart( - translateToLocal("tt.keyword.Structure.ElementalOutput"), - translateToLocal("tt.keyword.Structure.BackCenter"), - 2) // Elemental Output Hatch: Back center - .addOtherStructurePart( - translateToLocal("tt.keyword.Structure.ElementalOverflow"), - translateToLocal("tt.keyword.Structure.AnyOuterMolecularCasing4th"), - 3) // Elemental Overflow Hatch: Any outer Molecular Casing on the 4th slice - .addOtherStructurePart( - translateToLocal("tt.keyword.Structure.EssentiaStorage"), - translateToLocal("tt.keyword.Structure.AnyHighPowerCasingFront"), - 1) // Essentia Storage: Any High Power Casing on the front side - .addEnergyHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasingFront"), 1) // Energy Hatch: - // Any High Power - // Casing on the - // front side - .addMaintenanceHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasingFront"), 1) // Maintenance - // Hatch: Any - // High Power - // Casing on - // the front - // side - .toolTipFinisher(CommonValues.TEC_MARK_EM); - return tt; - } - - @Override - @SideOnly(Side.CLIENT) - protected ResourceLocation getActivitySound() { - return GT_MetaTileEntity_EM_quantizer.activitySound; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - structureBuild_EM("main", 1, 1, 0, stackSize, hintsOnly); - } - - @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; - } - - @Override - public String[] getStructureDescription(ItemStack stackSize) { - return description; - } -} diff --git a/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java b/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java deleted file mode 100644 index 6a092cb54..000000000 --- a/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.github.technus.tectech.loader; - -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMScalarBosonDefinition; - -/** - * Created by danie_000 on 16.11.2016. - */ -public class ElementalLoader { - - public void run(EMDefinitionsRegistry registry) { - // =================================================================================================== - // Definition init - // =================================================================================================== - - EMPrimitiveDefinition.run(registry); - - EMQuarkDefinition.run(registry); - EMLeptonDefinition.run(registry); - EMNeutrinoDefinition.run(registry); - EMGaugeBosonDefinition.run(registry); - EMScalarBosonDefinition.run(registry); - - EMHadronDefinition.run(registry); - - EMAtomDefinition.run(registry); - - EMPrimalAspectDefinition.run(registry); - EMComplexAspectDefinition.run(registry); - } -} diff --git a/src/main/java/com/github/technus/tectech/loader/EntityLoader.java b/src/main/java/com/github/technus/tectech/loader/EntityLoader.java deleted file mode 100644 index 0c43f3763..000000000 --- a/src/main/java/com/github/technus/tectech/loader/EntityLoader.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.github.technus.tectech.loader; - -import static gregtech.api.enums.Mods.OpenModularTurrets; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.openmodularturrets.entity.projectiles.projectileEM; - -import cpw.mods.fml.common.registry.EntityRegistry; - -/** - * Created by Tec on 30.07.2017. - */ -public class EntityLoader implements Runnable { - - @Override - public void run() { - if (OpenModularTurrets.isModLoaded()) { - EntityRegistry.registerModEntity(projectileEM.class, "projectileEM", 0, TecTech.instance, 16, 5, true); - } - } -} 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 4fcfd42b0..5e8da5e0b 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -2,15 +2,11 @@ import static com.github.technus.tectech.TecTech.LOGGER; import static com.github.technus.tectech.TecTech.configTecTech; -import static com.github.technus.tectech.TecTech.creativeTabEM; import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static com.github.technus.tectech.TecTech.instance; import static com.github.technus.tectech.TecTech.proxy; -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 gregtech.api.enums.Mods.NewHorizonsCoreMod; -import static gregtech.api.enums.Mods.Thaumcraft; import static gregtech.api.enums.Mods.TwilightForest; import java.util.Collection; @@ -22,11 +18,6 @@ import net.minecraftforge.fluids.FluidStack; import com.github.technus.tectech.TecTech; -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.CreativeTabEM; import com.github.technus.tectech.loader.gui.CreativeTabTecTech; import com.github.technus.tectech.loader.gui.ModGuiHandler; import com.github.technus.tectech.loader.recipe.BaseRecipeLoader; @@ -34,11 +25,8 @@ import com.github.technus.tectech.loader.thing.CoverLoader; import com.github.technus.tectech.loader.thing.MachineLoader; import com.github.technus.tectech.loader.thing.ThingsLoader; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.Textures; -import com.github.technus.tectech.thing.metaTileEntity.multi.em_collider.GT_MetaTileEntity_EM_collider; import cpw.mods.fml.common.ProgressManager; import cpw.mods.fml.common.network.NetworkRegistry; @@ -61,7 +49,6 @@ public static void staticLoad() { public static void preLoad() { creativeTabTecTech = new CreativeTabTecTech("TecTech"); - creativeTabEM = new CreativeTabEM("EM"); // set expanded texture arrays for tiers try { @@ -71,20 +58,8 @@ public static void preLoad() { } } - public static void load(EMDefinitionsRegistry definitionsRegistry) { - ProgressManager.ProgressBar progressBarLoad = ProgressManager.push("TecTech Loader", 9); - - progressBarLoad.step("Elemental Things"); - new ElementalLoader().run(definitionsRegistry); - LOGGER.info("Elemental Init Done"); - - progressBarLoad.step("Thaumcraft Compatibility"); - if (Thaumcraft.isModLoaded()) { - essentiaContainerCompat = new EssentiaCompatEnabled(); - } else { - essentiaContainerCompat = new EssentiaCompat(); - } - LOGGER.info("Thaumcraft Compatibility Done"); + public static void load() { + ProgressManager.ProgressBar progressBarLoad = ProgressManager.push("TecTech Loader", 6); progressBarLoad.step("Regular Things"); new ThingsLoader().run(); @@ -98,10 +73,6 @@ public static void load(EMDefinitionsRegistry definitionsRegistry) { new CoverLoader().run(); LOGGER.info("Cover Init Done"); - progressBarLoad.step("Register entities"); - new EntityLoader().run(); - LOGGER.info("Entities registered"); - progressBarLoad.step("Add damage types"); microwaving = new DamageSource("microwaving").setDamageBypassesArmor(); elementalPollution = new DamageSource("elementalPollution").setDamageBypassesArmor(); @@ -120,8 +91,7 @@ public static void load(EMDefinitionsRegistry definitionsRegistry) { ProgressManager.pop(progressBarLoad); } - public static void postLoad(EMDefinitionsRegistry definitionsRegistry, - EMTransformationRegistry transformationInfo) { + public static void postLoad() { ProgressManager.ProgressBar progressBarPostLoad = ProgressManager.push("TecTech Post Loader", 4); progressBarPostLoad.step("Dreamcraft Compatibility"); @@ -138,16 +108,8 @@ public static void postLoad(EMDefinitionsRegistry definitionsRegistry, } } - progressBarPostLoad.step("Thaumcraft Compatibility"); - if (Thaumcraft.isModLoaded()) { - aspectDefinitionCompat = new AspectDefinitionCompatEnabled(); - aspectDefinitionCompat.run(definitionsRegistry); - } else { - aspectDefinitionCompat = new AspectDefinitionCompat(); - } - progressBarPostLoad.step("Recipes"); - new BaseRecipeLoader().run(transformationInfo); + new BaseRecipeLoader().run(); TecTech.LOGGER.info("Recipe Init Done"); if (!configTecTech.DISABLE_BLOCK_HARDNESS_NERF) { @@ -159,7 +121,7 @@ public static void postLoad(EMDefinitionsRegistry definitionsRegistry, TecTech.LOGGER.info("Blocks were not nerfed"); } - ProgressManager.pop(progressBarPostLoad); + // ProgressManager.pop(progressBarPostLoad); } public static void addAfterGregTechPostLoadRunner() { @@ -167,7 +129,6 @@ public static void addAfterGregTechPostLoadRunner() { if (TecTech.configTecTech.NERF_FUSION) { FixBrokenFusionRecipes(); } - GT_MetaTileEntity_EM_collider.setValues(getFuelValue(Materials.Helium.getPlasma(125))); }); } diff --git a/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabEM.java b/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabEM.java deleted file mode 100644 index b62a8fbf5..000000000 --- a/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabEM.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.github.technus.tectech.loader.gui; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; - -import com.github.technus.tectech.thing.item.ElementalDefinitionContainer_EM; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class CreativeTabEM extends CreativeTabs { - - public CreativeTabEM(String name) { - super(name); - } - - @SideOnly(Side.CLIENT) - @Override - public Item getTabIconItem() { - return ElementalDefinitionContainer_EM.INSTANCE; - } -} diff --git a/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java b/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java index 9c4a9d4ae..064be8241 100644 --- a/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java +++ b/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java @@ -7,7 +7,7 @@ import net.minecraft.item.ItemStack; import com.github.technus.tectech.thing.CustomItemList; -import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; +import com.github.technus.tectech.thing.block.QuantumGlassBlock; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -22,7 +22,7 @@ public CreativeTabTecTech(String name) { @SideOnly(Side.CLIENT) @Override public Item getTabIconItem() { - return DebugElementalInstanceContainer_EM.INSTANCE; + return Item.getItemFromBlock(QuantumGlassBlock.INSTANCE); } @Override diff --git a/src/main/java/com/github/technus/tectech/loader/gui/ModGuiHandler.java b/src/main/java/com/github/technus/tectech/loader/gui/ModGuiHandler.java index 398faf98a..9a8731860 100644 --- a/src/main/java/com/github/technus/tectech/loader/gui/ModGuiHandler.java +++ b/src/main/java/com/github/technus/tectech/loader/gui/ModGuiHandler.java @@ -24,7 +24,7 @@ public Object getServerGuiElement(int ID, EntityPlayer player, World world, int @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { if (ID == SCAN_DISPLAY_SCREEN_ID) { - return new ScanDisplayScreen(player); + return new ScanDisplayScreen(); } else if (ID == PROGRAMMER_DISPLAY_SCREEN_ID) { return new GuiScreen(); } diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/Assembler.java b/src/main/java/com/github/technus/tectech/loader/recipe/Assembler.java index bd7a56577..12fddf3ba 100644 --- a/src/main/java/com/github/technus/tectech/loader/recipe/Assembler.java +++ b/src/main/java/com/github/technus/tectech/loader/recipe/Assembler.java @@ -3059,27 +3059,6 @@ public void cleanroomRecipes() { 20, 30720); - // Tunnel - addAssemblerRecipeWithCleanroom( - new ItemStack[] { CustomItemList.DATApipe.get(1), - GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Osmiridium, 4), - GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Osmium, 4), - GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorUHV, 2), - ItemList.Field_Generator_MV.get(1), - GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Ultimate, 1) }, - Materials.Osmium.getMolten(288), - CustomItemList.EMpipe.get(1), - 400, - 500000); - - // Tunnel Casing - addAssemblerRecipeWithCleanroom( - new ItemStack[] { CustomItemList.EMpipe.get(1), ItemList.Casing_LuV.get(1) }, - null, - CustomItemList.EMpipeBlock.get(1), - 20, - 30720); - // Laser addAssemblerRecipeWithCleanroom( new ItemStack[] { CustomItemList.DATApipe.get(1), GT_ModHandler.getIC2Item("reinforcedGlass", 1L), @@ -3164,36 +3143,6 @@ public void cleanroomRecipes() { 1200, 122880); - // Elemental Input - addAssemblerRecipeWithCleanroom( - new ItemStack[] { CustomItemList.eM_Containment.get(1), ItemList.Hatch_Input_UV.get(1), - GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Naquadah, 2), - ItemList.Sensor_UV.get(1) }, - Materials.Osmiridium.getMolten(1296), - CustomItemList.eM_in_UV.get(1), - 800, - 500000); - - // Elemental Output - addAssemblerRecipeWithCleanroom( - new ItemStack[] { CustomItemList.eM_Containment.get(1), ItemList.Hatch_Output_UV.get(1), - GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Naquadah, 2), - ItemList.Emitter_UV.get(1) }, - Materials.Osmiridium.getMolten(1296), - CustomItemList.eM_out_UV.get(1), - 800, - 500000); - - // Overflow - addAssemblerRecipeWithCleanroom( - new ItemStack[] { CustomItemList.eM_Containment.get(1), ItemList.Hatch_Muffler_UV.get(1), - GT_OreDictUnificator.get(OrePrefixes.pipeLarge, Materials.Naquadah, 1), - ItemList.Field_Generator_UV.get(1) }, - Materials.Osmiridium.getMolten(1296), - CustomItemList.eM_muffler_UV.get(1), - 800, - 500000); - // Capacitor Hatch GT_Values.RA.addAssemblerRecipe( new ItemStack[] { ItemList.Hatch_Input_Bus_HV.get(1), diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java index 75094600b..d50f7d410 100644 --- a/src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java @@ -1,14 +1,8 @@ package com.github.technus.tectech.loader.recipe; import static com.github.technus.tectech.TecTech.LOGGER; -import static gregtech.api.enums.Mods.GTPlusPlus; import static gregtech.api.enums.Mods.NewHorizonsCoreMod; -import com.github.technus.tectech.compatibility.gtpp.GtppAtomLoader; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; - import gregtech.api.enums.Materials; import gregtech.api.interfaces.IItemContainer; @@ -39,12 +33,8 @@ public static Materials getOrDefault(String name, Materials def) { return mat == Materials._NULL || mat == null ? def : mat; } - public void run(EMTransformationRegistry transformationInfo) { - EMAtomDefinition.setTransformations(transformationInfo); - EMHadronDefinition.setTransformations(transformationInfo); - if (GTPlusPlus.isModLoaded()) { - new GtppAtomLoader().setTransformations(transformationInfo); - } + public void run() { + // todo: Move those recipes in NHCore if (NewHorizonsCoreMod.isModLoaded()) { new Assembler().run(); @@ -55,6 +45,5 @@ public void run(EMTransformationRegistry transformationInfo) { new ResearchStationAssemblyLine().run(); } - new MachineEMBehaviours(); } } diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/MachineEMBehaviours.java b/src/main/java/com/github/technus/tectech/loader/recipe/MachineEMBehaviours.java deleted file mode 100644 index d05e73547..000000000 --- a/src/main/java/com/github/technus/tectech/loader/recipe/MachineEMBehaviours.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.github.technus.tectech.loader.recipe; - -import static com.github.technus.tectech.loader.recipe.BaseRecipeLoader.getItemContainer; - -import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.Behaviour_Centrifuge; -import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.Behaviour_ElectromagneticSeparator; -import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.Behaviour_Recycler; -import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine; - -import gregtech.api.enums.ItemList; - -public class MachineEMBehaviours implements Runnable { - - @Override - public void run() { - registerMachineEMBehaviours(); - } - - private void registerMachineEMBehaviours() { - GT_MetaTileEntity_EM_machine - .registerBehaviour(() -> new Behaviour_Centrifuge(5), ItemList.Machine_IV_Centrifuge.get(1)); - GT_MetaTileEntity_EM_machine - .registerBehaviour(() -> new Behaviour_Centrifuge(6), getItemContainer("CentrifugeLuV").get(1)); - GT_MetaTileEntity_EM_machine - .registerBehaviour(() -> new Behaviour_Centrifuge(7), getItemContainer("CentrifugeZPM").get(1)); - GT_MetaTileEntity_EM_machine - .registerBehaviour(() -> new Behaviour_Centrifuge(8), getItemContainer("CentrifugeUV").get(1)); - GT_MetaTileEntity_EM_machine - .registerBehaviour(() -> new Behaviour_Centrifuge(9), getItemContainer("CentrifugeUHV").get(1)); - GT_MetaTileEntity_EM_machine - .registerBehaviour(() -> new Behaviour_Centrifuge(10), getItemContainer("CentrifugeUEV").get(1)); - GT_MetaTileEntity_EM_machine - .registerBehaviour(() -> new Behaviour_Centrifuge(11), getItemContainer("CentrifugeUIV").get(1)); - GT_MetaTileEntity_EM_machine - .registerBehaviour(() -> new Behaviour_Centrifuge(12), getItemContainer("CentrifugeUMV").get(1)); - - GT_MetaTileEntity_EM_machine.registerBehaviour( - () -> new Behaviour_ElectromagneticSeparator(5), - ItemList.Machine_IV_ElectromagneticSeparator.get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour( - () -> new Behaviour_ElectromagneticSeparator(6), - getItemContainer("ElectromagneticSeparatorLuV").get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour( - () -> new Behaviour_ElectromagneticSeparator(7), - getItemContainer("ElectromagneticSeparatorZPM").get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour( - () -> new Behaviour_ElectromagneticSeparator(8), - getItemContainer("ElectromagneticSeparatorUV").get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour( - () -> new Behaviour_ElectromagneticSeparator(9), - getItemContainer("ElectromagneticSeparatorUHV").get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour( - () -> new Behaviour_ElectromagneticSeparator(10), - getItemContainer("ElectromagneticSeparatorUEV").get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour( - () -> new Behaviour_ElectromagneticSeparator(11), - getItemContainer("ElectromagneticSeparatorUIV").get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour( - () -> new Behaviour_ElectromagneticSeparator(12), - getItemContainer("ElectromagneticSeparatorUMV").get(1)); - - GT_MetaTileEntity_EM_machine - .registerBehaviour(() -> new Behaviour_Recycler(5), ItemList.Machine_IV_Recycler.get(1)); - GT_MetaTileEntity_EM_machine - .registerBehaviour(() -> new Behaviour_Recycler(6), getItemContainer("RecyclerLuV").get(1)); - GT_MetaTileEntity_EM_machine - .registerBehaviour(() -> new Behaviour_Recycler(7), getItemContainer("RecyclerZPM").get(1)); - GT_MetaTileEntity_EM_machine - .registerBehaviour(() -> new Behaviour_Recycler(8), getItemContainer("RecyclerUV").get(1)); - GT_MetaTileEntity_EM_machine - .registerBehaviour(() -> new Behaviour_Recycler(9), getItemContainer("RecyclerUHV").get(1)); - GT_MetaTileEntity_EM_machine - .registerBehaviour(() -> new Behaviour_Recycler(10), getItemContainer("RecyclerUEV").get(1)); - GT_MetaTileEntity_EM_machine - .registerBehaviour(() -> new Behaviour_Recycler(11), getItemContainer("RecyclerUIV").get(1)); - GT_MetaTileEntity_EM_machine - .registerBehaviour(() -> new Behaviour_Recycler(12), getItemContainer("RecyclerUMV").get(1)); - } -} diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/ResearchStationAssemblyLine.java b/src/main/java/com/github/technus/tectech/loader/recipe/ResearchStationAssemblyLine.java index 5e0297c15..d56aeb788 100644 --- a/src/main/java/com/github/technus/tectech/loader/recipe/ResearchStationAssemblyLine.java +++ b/src/main/java/com/github/technus/tectech/loader/recipe/ResearchStationAssemblyLine.java @@ -27,6 +27,7 @@ import static gregtech.api.util.GT_ModHandler.getModItem; import static gregtech.api.util.GT_RecipeBuilder.MINUTES; +import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; @@ -152,92 +153,6 @@ public void run() { 8_000_000 * 16); } - // Matter Junction - TT_recipeAdder.addResearchableAssemblylineRecipe( - CustomItemList.Machine_Multi_Switch.get(1), - 8000, - 32, - 500000, - 4, - new Object[] { CustomItemList.Machine_Multi_Transformer.get(1), - GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Naquadah, 4), - ItemList.Robot_Arm_LuV.get(2), ItemList.Electric_Piston_LuV.get(2), - new Object[] { "circuitSuperconductor", 2 }, - GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorUHV, 4), }, - new FluidStack[] { Materials.UUMatter.getFluid(1000), Materials.Naquadah.getMolten(1296), - new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), Materials.Osmium.getMolten(1296), }, - CustomItemList.Machine_Multi_EMjunction.get(1), - 12000, - 100000); - - // Matter Quantizer - TT_recipeAdder.addResearchableAssemblylineRecipe( - ItemList.Hatch_Input_UV.get(1), - 12000, - 32, - 500000, - 6, - new Object[] { CustomItemList.Machine_Multi_Transformer.get(1), - GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Naquadah, 4), - ItemList.Emitter_UV.get(2), new Object[] { "circuitSuperconductor", 1 }, - GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorUHV, 2), }, - new FluidStack[] { Materials.UUMatter.getFluid(1000), Materials.Naquadah.getMolten(1296), - new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), Materials.Osmium.getMolten(1296), }, - CustomItemList.Machine_Multi_MatterToEM.get(1), - 12000, - 100000); - - // Matter DeQuantizer - TT_recipeAdder.addResearchableAssemblylineRecipe( - ItemList.Hatch_Output_UV.get(1), - 12000, - 32, - 500000, - 6, - new Object[] { CustomItemList.Machine_Multi_Transformer.get(1), - GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Naquadah, 4), - ItemList.Sensor_UV.get(2), new Object[] { "circuitSuperconductor", 1 }, - GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorUHV, 2), }, - new FluidStack[] { Materials.UUMatter.getFluid(1000), Materials.Naquadah.getMolten(1296), - new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), Materials.Osmium.getMolten(1296), }, - CustomItemList.Machine_Multi_EMToMatter.get(1), - 12000, - 100000); - - // Essentia Quantizer - TT_recipeAdder.addResearchableAssemblylineRecipe( - CustomItemList.Machine_Multi_MatterToEM.get(1), - 15000, - 32, - 500000, - 8, - new Object[] { CustomItemList.Machine_Multi_MatterToEM.get(1), - GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Neutronium, 4), - ItemList.Emitter_UV.get(2), new Object[] { "circuitSuperconductor", 1 }, - GT_OreDictUnificator.get(OrePrefixes.cableGt02, Materials.Draconium, 2), }, - new FluidStack[] { Materials.UUMatter.getFluid(2000), Materials.Void.getMolten(2592), - new FluidStack(FluidRegistry.getFluid("ic2coolant"), 4000), Materials.Osmium.getMolten(1296), }, - CustomItemList.Machine_Multi_EssentiaToEM.get(1), - 24000, - 500000); - - // Essentia DeQuantizer - TT_recipeAdder.addResearchableAssemblylineRecipe( - CustomItemList.Machine_Multi_EMToMatter.get(1), - 15000, - 32, - 500000, - 8, - new Object[] { CustomItemList.Machine_Multi_EMToMatter.get(1), - GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Neutronium, 4), - ItemList.Sensor_UV.get(2), new Object[] { "circuitSuperconductor", 1 }, - GT_OreDictUnificator.get(OrePrefixes.cableGt02, Materials.Draconium, 2), }, - new FluidStack[] { Materials.UUMatter.getFluid(2000), Materials.Void.getMolten(2592), - new FluidStack(FluidRegistry.getFluid("ic2coolant"), 4000), Materials.Osmium.getMolten(1296), }, - CustomItemList.Machine_Multi_EMToEssentia.get(1), - 24000, - 500000); - // EM Scanner TT_recipeAdder.addResearchableAssemblylineRecipe( CustomItemList.Machine_Multi_Research.get(1), @@ -245,7 +160,7 @@ public void run() { 128, 500000, 16, - new Object[] { CustomItemList.Machine_Multi_EMjunction.get(1), CustomItemList.eM_Computer_Bus.get(4), + new Object[] { CustomItemList.Machine_BuckConverter_IV.get(1), CustomItemList.eM_Computer_Bus.get(4), ItemList.Field_Generator_UV.get(4), ItemList.Sensor_UV.get(4), new Object[] { OrePrefixes.circuit.get(Materials.Optical), 4L }, getItemContainer("MysteriousCrystalLens").get(4), @@ -253,7 +168,7 @@ public void run() { new FluidStack[] { Materials.UUMatter.getFluid(2000), Materials.Neutronium.getMolten(2592), new FluidStack(FluidRegistry.getFluid("ic2coolant"), 4000), Materials.Osmiridium.getMolten(1296), }, - CustomItemList.Machine_Multi_Scanner.get(1), + new ItemStack(Items.diamond_axe), 24000, 500000); 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 682820688..5917602f4 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 @@ -1,400 +1,15 @@ package com.github.technus.tectech.loader.thing; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; -import static com.github.technus.tectech.thing.CustomItemList.DATApipe; -import static com.github.technus.tectech.thing.CustomItemList.DATApipeBlock; -import static com.github.technus.tectech.thing.CustomItemList.EMpipe; -import static com.github.technus.tectech.thing.CustomItemList.EMpipeBlock; -import static com.github.technus.tectech.thing.CustomItemList.LASERpipe; -import static com.github.technus.tectech.thing.CustomItemList.LASERpipeBlock; -import static com.github.technus.tectech.thing.CustomItemList.Machine_BuckConverter_IV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_BuckConverter_LuV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_BuckConverter_UEV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_BuckConverter_UHV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_BuckConverter_UIV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_BuckConverter_UMV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_BuckConverter_UV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_BuckConverter_UXV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_BuckConverter_ZPM; -import static com.github.technus.tectech.thing.CustomItemList.Machine_DataReader; -import static com.github.technus.tectech.thing.CustomItemList.Machine_DebugGenny; -import static com.github.technus.tectech.thing.CustomItemList.Machine_DebugPollutor; -import static com.github.technus.tectech.thing.CustomItemList.Machine_DebugWriter; -import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_Annihilation; -import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_Collider; -import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_Computer; -import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_DataBank; -import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_Decay; -import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_EMCrafter; -import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_EMToEssentia; -import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_EMToMatter; -import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_EMjunction; -import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_EMmachine; -import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_EssentiaToEM; -import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_EyeOfHarmony; -import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_Infuser; -import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_MatterToEM; -import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_Microwave; -import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_Research; -import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_Scanner; -import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_Stabilizer; -import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_Switch; -import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_TeslaCoil; -import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_Transformer; -import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_Wormhole; -import static com.github.technus.tectech.thing.CustomItemList.Machine_OwnerDetector; -import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_1by1_EV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_1by1_HV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_1by1_IV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_1by1_LV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_1by1_MV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_2by2_EV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_2by2_HV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_2by2_IV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_2by2_LV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_2by2_MV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_3by3_EV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_3by3_HV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_3by3_IV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_3by3_LV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_3by3_MV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_4by4_EV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_4by4_HV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_4by4_IV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_4by4_LV; -import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_4by4_MV; -import static com.github.technus.tectech.thing.CustomItemList.ParametrizerTXT_Hatch; -import static com.github.technus.tectech.thing.CustomItemList.ParametrizerX_Hatch; -import static com.github.technus.tectech.thing.CustomItemList.Parametrizer_Hatch; -import static com.github.technus.tectech.thing.CustomItemList.UncertaintyX_Hatch; -import static com.github.technus.tectech.thing.CustomItemList.Uncertainty_Hatch; -import static com.github.technus.tectech.thing.CustomItemList.UnusedStuff; -import static com.github.technus.tectech.thing.CustomItemList.capacitor_Hatch; -import static com.github.technus.tectech.thing.CustomItemList.dataInAss_Hatch; -import static com.github.technus.tectech.thing.CustomItemList.dataIn_Hatch; -import static com.github.technus.tectech.thing.CustomItemList.dataOutAss_Hatch; -import static com.github.technus.tectech.thing.CustomItemList.dataOut_Hatch; -import static com.github.technus.tectech.thing.CustomItemList.eM_avr_EV; -import static com.github.technus.tectech.thing.CustomItemList.eM_avr_HV; -import static com.github.technus.tectech.thing.CustomItemList.eM_avr_IV; -import static com.github.technus.tectech.thing.CustomItemList.eM_avr_LuV; -import static com.github.technus.tectech.thing.CustomItemList.eM_avr_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_avr_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_avr_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_avr_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_avr_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_avr_ZPM; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti16_EV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti16_IV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti16_LuV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti16_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti16_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti16_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti16_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti16_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti16_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti16_ZPM; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti4_EV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti4_IV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti4_LuV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti4_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti4_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti4_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti4_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti4_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti4_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti4_ZPM; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti64_EV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti64_IV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti64_LuV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti64_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti64_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti64_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti64_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti64_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti64_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti64_ZPM; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel1_IV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel1_LuV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel1_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel1_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel1_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel1_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel1_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel1_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel1_ZPM; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel2_IV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel2_LuV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel2_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel2_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel2_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel2_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel2_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel2_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel2_ZPM; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel3_IV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel3_LuV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel3_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel3_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel3_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel3_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel3_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel3_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel3_ZPM; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel4_IV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel4_LuV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel4_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel4_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel4_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel4_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel4_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel4_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel4_ZPM; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel5_IV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel5_LuV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel5_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel5_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel5_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel5_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel5_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel5_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel5_ZPM; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel6_IV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel6_LuV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel6_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel6_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel6_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel6_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel6_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel6_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel6_ZPM; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel7_IV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel7_LuV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel7_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel7_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel7_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel7_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel7_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel7_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel7_ZPM; -import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel9001; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti16_EV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti16_IV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti16_LuV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti16_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti16_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti16_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti16_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti16_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti16_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti16_ZPM; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti4_EV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti4_IV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti4_LuV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti4_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti4_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti4_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti4_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti4_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti4_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti4_ZPM; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti64_EV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti64_IV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti64_LuV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti64_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti64_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti64_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti64_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti64_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti64_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti64_ZPM; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel1_IV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel1_LuV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel1_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel1_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel1_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel1_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel1_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel1_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel1_ZPM; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel2_IV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel2_LuV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel2_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel2_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel2_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel2_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel2_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel2_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel2_ZPM; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel3_IV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel3_LuV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel3_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel3_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel3_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel3_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel3_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel3_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel3_ZPM; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel4_IV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel4_LuV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel4_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel4_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel4_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel4_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel4_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel4_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel4_ZPM; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel5_IV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel5_LuV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel5_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel5_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel5_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel5_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel5_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel5_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel5_ZPM; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel6_IV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel6_LuV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel6_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel6_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel6_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel6_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel6_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel6_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel6_ZPM; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel7_IV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel7_LuV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel7_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel7_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel7_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel7_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel7_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel7_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel7_ZPM; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel9001; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti16_EV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti16_IV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti16_LuV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti16_MAX; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti16_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti16_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti16_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti16_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti16_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti16_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti16_ZPM; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti4_EV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti4_IV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti4_LuV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti4_MAX; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti4_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti4_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti4_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti4_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti4_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti4_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti4_ZPM; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti64_EV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti64_IV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti64_LuV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti64_MAX; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti64_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti64_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti64_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti64_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti64_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti64_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti64_ZPM; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessTunnel1_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessTunnel2_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessTunnel3_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessTunnel4_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessTunnel5_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessTunnel6_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessTunnel7_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_in_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_in_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_in_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_in_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_in_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_in_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_muffler_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_muffler_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_muffler_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_muffler_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_muffler_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_muffler_UXV; -import static com.github.technus.tectech.thing.CustomItemList.eM_out_UEV; -import static com.github.technus.tectech.thing.CustomItemList.eM_out_UHV; -import static com.github.technus.tectech.thing.CustomItemList.eM_out_UIV; -import static com.github.technus.tectech.thing.CustomItemList.eM_out_UMV; -import static com.github.technus.tectech.thing.CustomItemList.eM_out_UV; -import static com.github.technus.tectech.thing.CustomItemList.eM_out_UXV; -import static com.github.technus.tectech.thing.CustomItemList.hatch_CreativeData; -import static com.github.technus.tectech.thing.CustomItemList.hatch_CreativeMaintenance; -import static com.github.technus.tectech.thing.CustomItemList.holder_Hatch; -import static com.github.technus.tectech.thing.CustomItemList.rack_Hatch; +import static com.github.technus.tectech.thing.CustomItemList.*; import static com.github.technus.tectech.util.CommonValues.V; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_essentiaDequantizer; -import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_essentiaQuantizer; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Capacitor; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_CreativeData; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_CreativeMaintenance; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoTunnel; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyTunnel; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Holder; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputData; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputDataItems; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputDataItems; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputElemental; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OverflowElemental; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Param; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_ParamText; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Rack; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Uncertainty; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_WirelessMulti; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_EyeOfHarmony; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_annihilation; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_computer; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_dataBank; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_decay; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_dequantizer; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_infuser; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_junction; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_research; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_stabilizer; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_switch; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_transformer; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_wormhole; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_TM_microwave; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_TM_teslaCoil; -import com.github.technus.tectech.thing.metaTileEntity.multi.em_collider.GT_MetaTileEntity_EM_collider; -import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine; -import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_PipeBlock_Data; -import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_PipeBlock_EM; -import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_PipeBlock_Energy; -import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_Data; -import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_EM; -import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_Energy; -import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_BuckConverter; -import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_DataReader; -import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_DebugPollutor; -import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_DebugPowerGenerator; -import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_DebugStructureWriter; -import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_MicroController; -import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_OwnerDetector; -import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_TeslaCoil; +import com.github.technus.tectech.thing.metaTileEntity.hatch.*; +import com.github.technus.tectech.thing.metaTileEntity.multi.*; +import com.github.technus.tectech.thing.metaTileEntity.pipe.*; +import com.github.technus.tectech.thing.metaTileEntity.single.*; /** * Created by danie_000 on 16.11.2016. @@ -403,175 +18,6 @@ public class MachineLoader implements Runnable { @Override public void run() { - // =================================================================================================== - // eM IN - // =================================================================================================== - - eM_in_UV.set( - new GT_MetaTileEntity_Hatch_InputElemental(15000, "hatch.emin.tier.08", "UV Elemental Input Hatch", 8) - .getStackForm(1L)); - - eM_in_UHV.set( - new GT_MetaTileEntity_Hatch_InputElemental(15001, "hatch.emin.tier.09", "UHV Elemental Input Hatch", 9) - .getStackForm(1L)); - - eM_in_UEV.set( - new GT_MetaTileEntity_Hatch_InputElemental(15002, "hatch.emin.tier.10", "UEV Elemental Input Hatch", 10) - .getStackForm(1L)); - - eM_in_UIV.set( - new GT_MetaTileEntity_Hatch_InputElemental(15003, "hatch.emin.tier.11", "UIV Elemental Input Hatch", 11) - .getStackForm(1L)); - - eM_in_UMV.set( - new GT_MetaTileEntity_Hatch_InputElemental(15004, "hatch.emin.tier.12", "UMV Elemental Input Hatch", 12) - .getStackForm(1L)); - - eM_in_UXV.set( - new GT_MetaTileEntity_Hatch_InputElemental(15005, "hatch.emin.tier.13", "UXV Elemental Input Hatch", 13) - .getStackForm(1L)); - - // =================================================================================================== - // eM OUT - // =================================================================================================== - - eM_out_UV.set( - new GT_MetaTileEntity_Hatch_OutputElemental( - 15010, - "hatch.emout.tier.08", - "UV Elemental Output Hatch", - 8).getStackForm(1L)); - - eM_out_UHV.set( - new GT_MetaTileEntity_Hatch_OutputElemental( - 15011, - "hatch.emout.tier.09", - "UHV Elemental Output Hatch", - 9).getStackForm(1L)); - - eM_out_UEV.set( - new GT_MetaTileEntity_Hatch_OutputElemental( - 15012, - "hatch.emout.tier.10", - "UEV Elemental Output Hatch", - 10).getStackForm(1L)); - - eM_out_UIV.set( - new GT_MetaTileEntity_Hatch_OutputElemental( - 15013, - "hatch.emout.tier.11", - "UIV Elemental Output Hatch", - 11).getStackForm(1L)); - - eM_out_UMV.set( - new GT_MetaTileEntity_Hatch_OutputElemental( - 15014, - "hatch.emout.tier.12", - "UMV Elemental Output Hatch", - 12).getStackForm(1L)); - - eM_out_UXV.set( - new GT_MetaTileEntity_Hatch_OutputElemental( - 15015, - "hatch.emout.tier.13", - "UXV Elemental Output Hatch", - 13).getStackForm(1L)); - - // =================================================================================================== - // eM Waste OUT - // =================================================================================================== - - eM_muffler_UV.set( - new GT_MetaTileEntity_Hatch_OverflowElemental( - 15020, - "hatch.emmuffler.tier.08", - "UV Overflow Output Hatch", - 8, - 1e10f * EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L)); - - eM_muffler_UHV.set( - new GT_MetaTileEntity_Hatch_OverflowElemental( - 15021, - "hatch.emmuffler.tier.09", - "UHV Overflow Output Hatch", - 9, - 5e10f * EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L)); - - eM_muffler_UEV.set( - new GT_MetaTileEntity_Hatch_OverflowElemental( - 15022, - "hatch.emmuffler.tier.10", - "UEV Overflow Output Hatch", - 10, - 25e10f * EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L)); - - eM_muffler_UIV.set( - new GT_MetaTileEntity_Hatch_OverflowElemental( - 15023, - "hatch.emmuffler.tier.11", - "UIV Overflow Output Hatch", - 11, - 125e10f * EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L)); - - eM_muffler_UMV.set( - new GT_MetaTileEntity_Hatch_OverflowElemental( - 15024, - "hatch.emmuffler.tier.12", - "UMV Overflow Output Hatch", - 12, - 125e11f * EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L)); - - eM_muffler_UXV.set( - new GT_MetaTileEntity_Hatch_OverflowElemental( - 15025, - "hatch.emmuffler.tier.13", - "UXV Overflow Output Hatch", - 13, - 125e12f * EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L)); - - // =================================================================================================== - // Microcontrollers - // =================================================================================================== - - eM_avr_HV.set( - new GT_MetaTileEntity_MicroController(15030, "machine.avr.tier.08", "HV AVR Micro-controller", 3) - .getStackForm(1L)); - - eM_avr_EV.set( - new GT_MetaTileEntity_MicroController(15031, "machine.avr.tier.08", "EV AVR Micro-controller", 4) - .getStackForm(1L)); - - eM_avr_IV.set( - new GT_MetaTileEntity_MicroController(15032, "machine.avr.tier.08", "IV AVR Micro-controller", 5) - .getStackForm(1L)); - - eM_avr_LuV.set( - new GT_MetaTileEntity_MicroController(15033, "machine.avr.tier.08", "LuV AVR Micro-controller", 6) - .getStackForm(1L)); - - eM_avr_ZPM.set( - new GT_MetaTileEntity_MicroController(15034, "machine.avr.tier.08", "ZPM AVR Micro-controller", 7) - .getStackForm(1L)); - - eM_avr_UV.set( - new GT_MetaTileEntity_MicroController(15035, "machine.avr.tier.08", "UV AVR Micro-controller", 8) - .getStackForm(1L)); - - eM_avr_UHV.set( - new GT_MetaTileEntity_MicroController(15036, "machine.avr.tier.09", "UHV AVR Micro-controller", 9) - .getStackForm(1L)); - - eM_avr_UEV.set( - new GT_MetaTileEntity_MicroController(15037, "machine.avr.tier.10", "UEV AVR Micro-controller", 10) - .getStackForm(1L)); - - eM_avr_UIV.set( - new GT_MetaTileEntity_MicroController(15038, "machine.avr.tier.11", "UIV AVR Micro-controller", 11) - .getStackForm(1L)); - - eM_avr_UMV.set( - new GT_MetaTileEntity_MicroController(15039, "machine.avr.tier.12", "UMV AVR Micro-controller", 12) - .getStackForm(1L)); // =================================================================================================== // Multi AMP Power INPUTS @@ -2246,60 +1692,13 @@ public void run() { Machine_Multi_DataBank.set( new GT_MetaTileEntity_EM_dataBank(15313, "multimachine.em.databank", "Data Bank").getStackForm(1L)); - Machine_Multi_EMjunction.set( - new GT_MetaTileEntity_EM_junction(15320, "multimachine.em.junction", "Matter Junction") - .getStackForm(1L)); - Machine_Multi_MatterToEM.set( - new GT_MetaTileEntity_EM_quantizer(15321, "multimachine.em.mattertoem", "Matter Quantizer") - .getStackForm(1L)); - Machine_Multi_EMToMatter.set( - new GT_MetaTileEntity_EM_dequantizer(15322, "multimachine.em.emtomatter", "Matter Dequantizer") - .getStackForm(1L)); - - // COMPAT - Machine_Multi_EssentiaToEM.set( - new GT_MetaTileEntity_EM_essentiaQuantizer(15323, "multimachine.em.essentiatoem", "Essentia Quantizer") - .getStackForm(1L)); - Machine_Multi_EMToEssentia.set( - new GT_MetaTileEntity_EM_essentiaDequantizer( - 15324, - "multimachine.em.emtoessentia", - "Essentia Dequantizer").getStackForm(1L)); - - Machine_Multi_Scanner.set( - new GT_MetaTileEntity_EM_scanner(15330, "multimachine.em.scanner", "Elemental Scanner") - .getStackForm(1L)); Machine_Multi_Research.set( new GT_MetaTileEntity_EM_research(15331, "multimachine.em.research", "Research station") .getStackForm(1L)); - Machine_Multi_Collider.set( - new GT_MetaTileEntity_EM_collider(15340, "multimachine.em.collider", "Matter Collider") - .getStackForm(1L)); - Machine_Multi_Infuser.set( new GT_MetaTileEntity_EM_infuser(15350, "multimachine.em.infuser", "Energy Infuser").getStackForm(1)); - Machine_Multi_EMmachine.set( - new GT_MetaTileEntity_EM_machine(15360, "multimachine.em.processing", "Quantum Processing Machine") - .getStackForm(1L)); - - Machine_Multi_EMCrafter.set( - new GT_MetaTileEntity_EM_crafting(15370, "multimachine.em.crafter", "Matter Assembler") - .getStackForm(1L)); - - Machine_Multi_Stabilizer.set( - new GT_MetaTileEntity_EM_stabilizer(15380, "multimachine.em.stabilizer", "Elemental Stabilizer") - .getStackForm(1L)); - - Machine_Multi_Wormhole - .set(new GT_MetaTileEntity_EM_wormhole(15390, "multimachine.em.wormhole", "Wormhole").getStackForm(1L)); - - Machine_Multi_Decay.set( - new GT_MetaTileEntity_EM_decay(15400, "multimachine.em.decay", "Decay Generator").getStackForm(1L)); - Machine_Multi_Annihilation.set( - new GT_MetaTileEntity_EM_annihilation(15405, "multimachine.em.annihilation", "Annihilation Generator") - .getStackForm(1L)); Machine_Multi_EyeOfHarmony.set( new GT_MetaTileEntity_EM_EyeOfHarmony(15410, "multimachine.em.eye_of_harmony", "Eye of Harmony") .getStackForm(1L)); @@ -2367,13 +1766,10 @@ public void run() { // Pipes // =================================================================================================== - EMpipe.set(new GT_MetaTileEntity_Pipe_EM(15460, "pipe.elementalmatter", "Quantum \"Tunnel\"").getStackForm(1L)); LASERpipe.set( new GT_MetaTileEntity_Pipe_Energy(15465, "pipe.energystream", "Laser Vacuum Pipe").getStackForm(1L)); DATApipe.set(new GT_MetaTileEntity_Pipe_Data(15470, "pipe.datastream", "Optical Fiber Cable").getStackForm(1L)); - EMpipeBlock.set( - new GT_MetaTileEntity_PipeBlock_EM(15471, "pipe.elementalmatter.block", "Quantum \"Tunnel\" Casing") - .getStackForm(1L)); + LASERpipeBlock.set( new GT_MetaTileEntity_PipeBlock_Energy(15472, "pipe.energystream.block", "Laser Vacuum Pipe Casing") .getStackForm(1L)); @@ -2388,8 +1784,6 @@ public void run() { Machine_OwnerDetector.set( new GT_MetaTileEntity_OwnerDetector(15480, "machine.tt.ownerdetector", "Owner detector", 3) .getStackForm(1L)); - Machine_DataReader.set( - new GT_MetaTileEntity_DataReader(15481, "machine.tt.datareader", "Data Reader", 5).getStackForm(1L)); // =================================================================================================== // Buck Converters diff --git a/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java index f226ec034..5cf8f68c8 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java @@ -2,31 +2,13 @@ import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.TecTech.tectechTexturePage1; -import static gregtech.api.enums.Mods.OpenModularTurrets; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.openmodularturrets.blocks.turretbases.TurretBaseEM; -import com.github.technus.tectech.compatibility.openmodularturrets.blocks.turretheads.TurretHeadEM; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.block.ReactorSimBlock; import com.github.technus.tectech.thing.block.TileEyeOfHarmony; -import com.github.technus.tectech.thing.casing.GT_Block_CasingsBA0; -import com.github.technus.tectech.thing.casing.GT_Block_CasingsTT; -import com.github.technus.tectech.thing.casing.SpacetimeCompressionFieldCasing; -import com.github.technus.tectech.thing.casing.StabilisationFieldCasing; -import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.thing.casing.TimeAccelerationFieldCasing; -import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; -import com.github.technus.tectech.thing.item.ElementalDefinitionContainer_EM; -import com.github.technus.tectech.thing.item.ElementalDefinitionScanStorage_EM; -import com.github.technus.tectech.thing.item.EnderFluidLinkCover; -import com.github.technus.tectech.thing.item.EuMeterGT; -import com.github.technus.tectech.thing.item.ParametrizerMemoryCard; -import com.github.technus.tectech.thing.item.PowerPassUpgradeCover; -import com.github.technus.tectech.thing.item.TeslaCoilCapacitor; -import com.github.technus.tectech.thing.item.TeslaCoilComponent; -import com.github.technus.tectech.thing.item.TeslaCoilCover; -import com.github.technus.tectech.thing.item.TeslaStaff; +import com.github.technus.tectech.thing.casing.*; +import com.github.technus.tectech.thing.item.*; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.Textures; @@ -68,18 +50,10 @@ public void run() { QuantumGlassBlock.run(); TecTech.LOGGER.info("Quantum Glass registered"); - if (OpenModularTurrets.isModLoaded()) { - TurretHeadEM.run(); - TecTech.LOGGER.info("TurretHeadEM registered"); - TurretBaseEM.run(); - TecTech.LOGGER.info("TurretBaseEM registered"); - } - ReactorSimBlock.run(); TecTech.LOGGER.info("Reactor Simulator registered"); ParametrizerMemoryCard.run(); - ElementalDefinitionScanStorage_EM.run(); EuMeterGT.run(); TeslaStaff.run(); TeslaCoilCover.run(); @@ -91,8 +65,6 @@ public void run() { TeslaCoilComponent.run(); TecTech.LOGGER.info("Crafting Components registered"); - ElementalDefinitionContainer_EM.run(); - DebugElementalInstanceContainer_EM.run(); TecTech.LOGGER.info("Debug Items registered"); } } 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 deleted file mode 100644 index f5caf493e..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java +++ /dev/null @@ -1,538 +0,0 @@ -package com.github.technus.tectech.mechanics.anomaly; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; -import static com.github.technus.tectech.util.TT_Utility.crossProduct3D; -import static com.github.technus.tectech.util.TT_Utility.normalize3D; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import net.minecraft.block.Block; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -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; -import net.minecraftforge.event.world.ChunkEvent; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.loader.MainLoader; -import com.github.technus.tectech.loader.NetworkDispatcher; -import com.github.technus.tectech.mechanics.data.ChunkDataHandler; -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.EMAtomDefinition; -import com.github.technus.tectech.util.TT_Utility; - -import cpw.mods.fml.common.gameevent.TickEvent; -import gregtech.api.enums.SoundResource; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Utility; - -public class AnomalyHandler implements IChunkMetaDataHandler { - - private static final double SWAP_THRESHOLD = EMAtomDefinition.getSomethingHeavy().getMass() * 1000D - * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; // 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", - SPACE_MASS = "space_mass"; - private static final int MEAN_DELAY = 50; - private static final double CANCER_EFFECTIVENESS = 1 / EM_COUNT_PER_MATERIAL_AMOUNT; - private static final double MASS_EFFECTIVENESS = 1 / EM_COUNT_PER_MATERIAL_AMOUNT; - private static final double CHARGE_EFFECTIVENESS = 10 / EM_COUNT_PER_MATERIAL_AMOUNT; - private static final double CHARGE_EXPLOSIVENESS = 5 / EM_COUNT_PER_MATERIAL_AMOUNT; - - private boolean fixMe = false; - private final List playersWithCharge = new ArrayList<>(); - private final ArrayList worldDataArrayList = new ArrayList<>(512); - - @Override - public String getTagName() { - return "anomaly"; - } - - @Override - public void mergeData(NBTTagCompound target, NBTTagCompound loadedData) { - double intensity = target.getDouble(INTENSITY) + loadedData.getDouble(INTENSITY); - target.setDouble(INTENSITY, intensity); - } - - @Override - public NBTTagCompound createData() { - return new NBTTagCompound(); - } - - @Override - public void tickWorld(HashMap data, TickEvent.WorldTickEvent aEvent) { - if (TecTech.RANDOM.nextInt(MEAN_DELAY) == 0) { - int dim = aEvent.world.provider.dimensionId; - 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); - } - } - }); - if (worldDataArrayList.size() >= 2) { - Chunk a = worldDataArrayList.remove(TecTech.RANDOM.nextInt(worldDataArrayList.size())); - 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) { - if (getCharge((EntityPlayer) o) != 0) { - playersWithCharge.add((EntityPlayer) o); - } - } - } - if (playersWithCharge.size() > 0) { - outer: for (EntityPlayer other : playersWithCharge) { - double fieldOther = getCharge(other); - for (EntityPlayer player : playersWithCharge) { - if (other == player) { - continue outer; - } - double field = getCharge(player); - double absDifference = Math.abs(field - fieldOther); - if (absDifference != 0) { - if (player.getDistanceSqToEntity(other) < 1) { - double avg = (fieldOther + field) / 2; - 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, - SoundResource.IC2_MACHINES_MACHINE_OVERLOAD, - 1.0F, - -1, - (int) other.posX, - (int) other.posY, - (int) other.posZ); - GT_Utility.sendSoundToPlayers( - player.worldObj, - SoundResource.IC2_MACHINES_MACHINE_OVERLOAD, - 1.0F, - -1, - (int) player.posX, - (int) player.posY, - (int) player.posZ); - setCharge(player, avg); - setCharge(other, avg); - } - } - } - } - playersWithCharge.clear(); - } - } - - private void swapSomething(Chunk a, Chunk b, double mass) { - float explosionPower = (float) Math.log(mass / EM_COUNT_PER_MATERIAL_AMOUNT); - 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); - Block aBlock = a.getBlock(x, y, z); - Block bBlock = a.getBlock(x, y, z); - int aMeta = a.getBlockMetadata(x, y, z); - int bMeta = a.getBlockMetadata(x, y, z); - if (a.getTileEntityUnsafe(x, y, z) == null && b.getTileEntityUnsafe(x, y, z) == null) { - a.worldObj.setBlock((a.xPosition << 4) + x, y, (a.zPosition << 4) + z, bBlock, bMeta, 3); - b.worldObj.setBlock((b.xPosition << 4) + x, y, (b.zPosition << 4) + z, aBlock, aMeta, 3); - } else if (a.getTileEntityUnsafe(x, y, z) == null) { - b.worldObj.setBlock((b.xPosition << 4) + x, y, (b.zPosition << 4) + z, aBlock, aMeta, 3); - a.worldObj.setBlockToAir((a.xPosition << 4) + x, y, (a.zPosition << 4) + z); - } else if (b.getTileEntityUnsafe(x, y, z) == null) { - a.worldObj.setBlock((a.xPosition << 4) + x, y, (a.zPosition << 4) + z, bBlock, bMeta, 3); - b.worldObj.setBlockToAir((b.xPosition << 4) + x, y, (b.zPosition << 4) + z); - } else { - 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.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, - SoundResource.IC2_MACHINES_MACHINE_OVERLOAD, - 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, - explosionPower * TecTech.RANDOM.nextFloat(), - true); - } - GT_Utility.sendSoundToPlayers( - b.worldObj, - SoundResource.IC2_MACHINES_MACHINE_OVERLOAD, - 1.0F, - -1, - (b.xPosition << 4) + x, - y, - (b.zPosition << 4) + z); - } - } - int x = (b.xPosition - a.xPosition) << 4; - int z = (b.xPosition - a.xPosition) << 4; - List aE = a.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, TT_Utility.fromChunk(a)); - List bE = b.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, TT_Utility.fromChunk(b)); - for (EntityLivingBase entityLivingBase : aE) { - if (TecTech.RANDOM.nextBoolean()) { - 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)); - player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 600)); - player.addPotionEffect(new PotionEffect(Potion.confusion.id, 400)); - player.addPotionEffect(new PotionEffect(Potion.poison.id, 200)); - player.addPotionEffect(new PotionEffect(Potion.blindness.id, 100)); - player.addPotionEffect(new PotionEffect(Potion.wither.id, 60)); - 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))); - } - } - } - for (EntityLivingBase o : bE) { - if (TecTech.RANDOM.nextBoolean()) { - 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)); - 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 - public void tickPlayer(HashMap data, TickEvent.PlayerTickEvent aEvent) { - if (aEvent.side.isClient()) { - EntityPlayer player = TecTech.proxy.getPlayer(); - ChunkCoordIntPair pair = new ChunkCoordIntPair(player.chunkCoordX, player.chunkCoordZ); - NBTTagCompound compound = data.get(player.worldObj.provider.dimensionId).get(pair); - if (compound != null) { - for (int i = 0, badness = (int) Math.min(COUNT_DIV, compound.getDouble(INTENSITY) / PER_PARTICLE); i - < badness; i++) { - TecTech.proxy.em_particle( - player.worldObj, - player.posX + TecTech.RANDOM.nextGaussian() * 64D, - player.posY + TecTech.RANDOM.nextGaussian() * 64D, - player.posZ + TecTech.RANDOM.nextGaussian() * 64D); - } - } - - 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(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) { - 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, 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, cancer - 7.6293945E-5f)); - saveRequired = true; - } - } - } - - if (saveRequired) { - TecTech.playerPersistence.saveData(player); - NetworkDispatcher.INSTANCE - .sendTo(new PlayerDataMessage.PlayerDataData(player), (EntityPlayerMP) player); - } - } - } - - @Override - public void tickRender(HashMap data, TickEvent.RenderTickEvent aEvent) { - EntityPlayer player = TecTech.proxy.getPlayer(); - if (player != null) { - if (!player.capabilities.isCreativeMode) { - 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); - } - } - - 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; - double chargeOther = getCharge(otherPlayer); - if (chargeOther != 0 && player != o) { - double reaction = chargeOther * charge; - if (reaction != 0) { - double distanceSq = otherPlayer.getDistanceSqToEntity(player); - if (distanceSq >= 1) { - double effect = CHARGE_EFFECTIVENESS * reaction - / (distanceSq * distanceSq * distanceSq); - double dX = (player.posX - otherPlayer.posX) * effect; - double dY = (player.posY - otherPlayer.posY) * effect; - double dZ = (player.posZ - otherPlayer.posZ) * effect; - player.addVelocity(dX, dY, dZ); - otherPlayer.addVelocity(-dX, -dY, -dZ); - } - } - } - } - } - } - - double mass = getMass(player); - if (mass != 0) { - for (Object o : player.worldObj.playerEntities) { - if (o instanceof EntityPlayer && !((EntityPlayer) o).capabilities.isCreativeMode) { - EntityPlayer otherPlayer = (EntityPlayer) o; - double massOther = getMass(otherPlayer); - if (massOther != 0 && player != o) { - double reaction = massOther * mass; - if (reaction != 0) { - double distanceSq = otherPlayer.getDistanceSqToEntity(player); - if (distanceSq >= 1) { - double effect = MASS_EFFECTIVENESS * reaction - / (distanceSq * distanceSq * distanceSq); - double effect1 = effect / mass; - double effect2 = effect / massOther; - double[] dPos = new double[] { player.posX - otherPlayer.posX, - player.posY - otherPlayer.posY, player.posZ - otherPlayer.posZ }; - double[] vel = new double[] { player.motionX, player.motionY, player.motionZ }; - double[] out = new double[3]; - crossProduct3D(dPos, vel, out); - crossProduct3D(out, dPos, vel); - normalize3D(vel, out); - player.addVelocity(effect1 * out[0], effect1 * out[1], effect1 * out[2]); - otherPlayer - .addVelocity(effect2 * -out[0], effect2 * -out[1], effect2 * -out[2]); - } - } - } - } - } - } - } - if (fixMe) { - player.setInvisible(false); - fixMe = false; - } - } - } - - @Override - public void pullData(ChunkEvent.Load aEvent) { - NetworkDispatcher.INSTANCE.sendToServer(new ChunkDataMessage.ChunkDataQuery(aEvent, this)); - } - - @Override - public void pushData(World world, ChunkCoordIntPair chunk) { - NetworkDispatcher.INSTANCE.sendToDimension( - new ChunkDataMessage.ChunkDataData(world.provider.dimensionId, chunk, this), - world.provider.dimensionId); - } - - @Override - public int pushPayloadSpreadPeriod() { - return 100; - } - - 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(x >> 4, z >> 4), amount); - } - } - - public void addAnomaly(int world, ChunkCoordIntPair chunk, double amount) { - NBTTagCompound old = TecTech.chunkDataHandler.getChunkData(this, world, chunk); - if (old == null) { - NBTTagCompound data = new NBTTagCompound(); - data.setDouble(INTENSITY, amount); - TecTech.chunkDataHandler.putChunkData(this, world, chunk, data); - } else { - old.setDouble(INTENSITY, old.getDouble(INTENSITY) + amount); - } - 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 getMass(EntityPlayer player) { - return getDouble(player, SPACE_MASS); - } - - public void setMass(EntityPlayer player, double amount) { - setDouble(player, SPACE_MASS, amount); - } - - public void addMass(EntityPlayer player, double amount) { - addDouble(player, SPACE_MASS, 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 deleted file mode 100644 index 5206655c4..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.github.technus.tectech.mechanics.anomaly; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.ChatComponentText; - -import com.github.technus.tectech.TecTech; - -public class CancerCommand implements ICommand { - - ArrayList aliases = new ArrayList<>(); - - public CancerCommand() { - aliases.add("cancer_EM"); - aliases.add("cancer"); - aliases.add("sanser_EM"); - aliases.add("sanser"); - aliases.add("sancer_EM"); - aliases.add("sancer"); - } - - @Override - public void processCommand(ICommandSender sender, String[] args) { - if (sender instanceof EntityPlayerMP && !sender.getEntityWorld().isRemote) { - EntityPlayerMP player = (EntityPlayerMP) sender; - if (args == null || args.length == 0) { - sender.addChatMessage( - new ChatComponentText("Cancer amount: " + TecTech.anomalyHandler.getCancer(player))); - return; - } - double amount; - try { - amount = Double.parseDouble(args[0]); - } catch (NumberFormatException e) { - sender.addChatMessage(new ChatComponentText("Cannot parse amount!")); - return; - } - if (player.capabilities.isCreativeMode) { - sender.addChatMessage(new ChatComponentText("Doesn't really work in creative mode!")); - } else { - TecTech.anomalyHandler.setCancer(player, amount); - sender.addChatMessage(new ChatComponentText("Cancer set to: " + amount)); - } - } - } - - @Override - public boolean isUsernameIndex(String[] args, int index) { - return false; - } - - @Override - public List getCommandAliases() { - return aliases; - } - - @Override - public String getCommandName() { - return aliases.get(0); - } - - @Override - public List addTabCompletionOptions(ICommandSender sender, String[] args) { - return null; - } - - @Override - public String getCommandUsage(ICommandSender sender) { - return "cancer_EM [Amount]"; - } - - @Override - public int compareTo(Object o) { - if (o instanceof ICommand) { - return getCommandName().compareTo(((ICommand) o).getCommandName()); - } - return 0; - } - - @Override - public boolean canCommandSenderUseCommand(ICommandSender sender) { - return true; - } -} 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 deleted file mode 100644 index 64e0700df..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/anomaly/ChargeCommand.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.github.technus.tectech.mechanics.anomaly; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.ChatComponentText; - -import com.github.technus.tectech.TecTech; - -public class ChargeCommand implements ICommand { - - ArrayList aliases = new ArrayList<>(); - - public ChargeCommand() { - aliases.add("charge_EM"); - aliases.add("charge"); - } - - @Override - public void processCommand(ICommandSender sender, String[] args) { - if (sender instanceof EntityPlayerMP && !sender.getEntityWorld().isRemote) { - EntityPlayerMP player = (EntityPlayerMP) sender; - if (args == null || args.length == 0) { - sender.addChatMessage( - new ChatComponentText("Charge amount: " + TecTech.anomalyHandler.getCharge(player))); - return; - } - double amount; - try { - amount = Double.parseDouble(args[0]); - } catch (NumberFormatException e) { - sender.addChatMessage(new ChatComponentText("Cannot parse amount!")); - return; - } - if (player.capabilities.isCreativeMode) { - sender.addChatMessage(new ChatComponentText("Doesn't really work in creative mode!")); - } else { - TecTech.anomalyHandler.setCharge(player, amount); - sender.addChatMessage(new ChatComponentText("Charge set to: " + amount)); - } - } - } - - @Override - public boolean isUsernameIndex(String[] args, int index) { - return false; - } - - @Override - public List getCommandAliases() { - return aliases; - } - - @Override - public String getCommandName() { - return aliases.get(0); - } - - @Override - public List addTabCompletionOptions(ICommandSender sender, String[] args) { - return null; - } - - @Override - public String getCommandUsage(ICommandSender sender) { - return "charge_EM [Amount]"; - } - - @Override - public int compareTo(Object o) { - if (o instanceof ICommand) { - return getCommandName().compareTo(((ICommand) o).getCommandName()); - } - return 0; - } - - @Override - public boolean canCommandSenderUseCommand(ICommandSender sender) { - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/anomaly/MassCommand.java b/src/main/java/com/github/technus/tectech/mechanics/anomaly/MassCommand.java deleted file mode 100644 index 87246785b..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/anomaly/MassCommand.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.github.technus.tectech.mechanics.anomaly; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.ChatComponentText; - -import com.github.technus.tectech.TecTech; - -public class MassCommand implements ICommand { - - ArrayList aliases = new ArrayList<>(); - - public MassCommand() { - aliases.add("mass_EM"); - aliases.add("mass"); - } - - @Override - public void processCommand(ICommandSender sender, String[] args) { - if (sender instanceof EntityPlayerMP && !sender.getEntityWorld().isRemote) { - EntityPlayerMP player = (EntityPlayerMP) sender; - if (args == null || args.length == 0) { - sender.addChatMessage(new ChatComponentText("Msdd amount: " + TecTech.anomalyHandler.getMass(player))); - return; - } - double amount; - try { - amount = Double.parseDouble(args[0]); - } catch (NumberFormatException e) { - sender.addChatMessage(new ChatComponentText("Cannot parse amount!")); - return; - } - if (player.capabilities.isCreativeMode) { - sender.addChatMessage(new ChatComponentText("Doesn't really work in creative mode!")); - } else { - TecTech.anomalyHandler.setMass(player, amount); - sender.addChatMessage(new ChatComponentText("Mass set to: " + amount)); - } - } - } - - @Override - public boolean isUsernameIndex(String[] args, int index) { - return false; - } - - @Override - public List getCommandAliases() { - return aliases; - } - - @Override - public String getCommandName() { - return aliases.get(0); - } - - @Override - public List addTabCompletionOptions(ICommandSender sender, String[] args) { - return null; - } - - @Override - public String getCommandUsage(ICommandSender sender) { - return "mass_EM [Amount]"; - } - - @Override - public int compareTo(Object o) { - if (o instanceof ICommand) { - return getCommandName().compareTo(((ICommand) o).getCommandName()); - } - return 0; - } - - @Override - public boolean canCommandSenderUseCommand(ICommandSender sender) { - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/README b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/README deleted file mode 100644 index c774b126c..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/README +++ /dev/null @@ -1,47 +0,0 @@ -TO CHANGE DEFINITION YOU MUST INSTANTIATE IT ONCE MORE (from scratch, failing to do that will end up in the heavy bugs)! - - Example complex definition: - - Bottom - - PrimitiveDef - | - DefStack - ||||| - DefStackMap - | - ..... ETC up to the point when you can no longer make NBT to save it (128 levels - already used ones) - - Def - definition of the parent stack - | - DefStack - stacks that build the parent definition - |||||multiple to 1 - DefStackMap - internal storage for components of parent def - | - Def - definition of the parent stack - | - DefStack - stacks that build the parent definition - |||||multiple to 1 - DefStackMap - internal storage for components of parent def - | - Definition - top hierarchy definition - | 1 to 1 - DefinitionStack - for recipe comparisons - OR - InstanceStack - real things - - TOP - -Trees: - - DefinitionStack - def stack - |||||multiple to 1 - DefinitionStackTree - def container - for recipe comparisons - - - InstanceStack - inst stack - |||||multiple to 1 - InstanceStackTree - inst container - real things go here - - Preset for world: - 2;7,16x22,16x35:11,16x35:3,16x35;0; \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java deleted file mode 100644 index ad0b2d5d8..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -/** - * Created by danie_000 on 19.11.2016. - */ -public final class EMException extends RuntimeException { - - private static final long serialVersionUID = 8030521803764577214L; - - public EMException(String message) { - super(message); - } - - public EMException(String message, Throwable cause) { - super(message, cause); - } - - public EMException(Throwable cause) { - super(cause); - } - - public EMException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { - super(message, cause, enableSuppression, writableStackTrace); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/IEMContainer.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/IEMContainer.java deleted file mode 100644 index 76eb46a41..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/IEMContainer.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; - -/** - * Created by danie_000 on 25.01.2017. - */ -public interface IEMContainer { - - EMInstanceStackMap getContentHandler(); - - void purgeOverflow(); -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java deleted file mode 100644 index fce77ee60..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.commands; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ChatComponentText; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; - -/** - * Created by danie_000 on 30.12.2017. - */ -public class EMGive implements ICommand { - - ArrayList aliases = new ArrayList<>(); - - public EMGive() { - aliases.add("em_give"); - aliases.add("give_em"); - aliases.add("gib_em"); - } - - @Override - public void processCommand(ICommandSender sender, String[] args) { - if (sender instanceof EntityPlayerMP && !sender.getEntityWorld().isRemote) { - if (args.length < 3) { - sender.addChatMessage(new ChatComponentText(getCommandUsage(sender))); - } else { - TecTech.LOGGER.info( - "Spawninig EM for " + ((EntityPlayerMP) sender).getDisplayName() - + " - " - + Arrays.toString(args)); - - ArrayList list = new ArrayList<>(Arrays.asList(args)); - String energy = list.remove(0); - - EMDefinitionStack def = getDefinitionStack(TecTech.definitionsRegistry, list); - if (def != null) { - EMInstanceStack instanceStack = new EMInstanceStack(def, 1, 0, Long.parseLong(energy)); - - sender.addChatMessage( - new ChatComponentText( - instanceStack.getDefinition().getSymbol() + " - " - + instanceStack.getDefinition().getLocalizedName())); - - EMInstanceStackMap instanceMap = new EMInstanceStackMap(instanceStack); - - ItemStack itemStack = new ItemStack(DebugElementalInstanceContainer_EM.INSTANCE); - DebugElementalInstanceContainer_EM.INSTANCE.setContent(itemStack, instanceMap); - - ((EntityPlayerMP) sender).inventory.addItemStackToInventory(itemStack); - } - } - } - } - - private EMDefinitionStack getDefinitionStack(EMDefinitionsRegistry registry, ArrayList args) { - double amount; - if (args.size() == 0) { - return null; - } - String defTag = args.remove(0); - if ("<".equals(defTag)) { - return null; - } - try { - amount = Double.parseDouble(defTag); - if (args.size() == 0) { - return null; - } - defTag = args.remove(0); - if ("<".equals(defTag)) { - return null; - } - } catch (Exception e) { - amount = 1; - } - IEMDefinition definition = registry.getDirectBinds().get(defTag); - if (definition != null) { - return definition.getStackForm(amount); - } - EMIndirectType emIndirectType = registry.getIndirectBinds().get(defTag); - if (emIndirectType != null) { - EMDefinitionStackMap stacks = new EMDefinitionStackMap(); - while (args.size() > 0) { - EMDefinitionStack definitionStack = getDefinitionStack(registry, args); - if (definitionStack == null) { - break; - } else { - stacks.putUnifyExact(definitionStack); - } - } - return emIndirectType.create(registry, stacks.toNBT(registry)).getStackForm(amount); - } - return null; - } - - @Override - public boolean isUsernameIndex(String[] args, int index) { - return false; - } - - @Override - public List getCommandAliases() { - return aliases; - } - - @Override - public String getCommandName() { - return aliases.get(0); - } - - @Override - public List addTabCompletionOptions(ICommandSender sender, String[] args) { - if (args.length > 2 && args.length % 2 == 1) { - return new ArrayList<>(TecTech.definitionsRegistry.getBinds().keySet()); - } - return null; - } - - @Override - public String getCommandUsage(ICommandSender sender) { - return "em_give Energy Count ClassOrId ( (Count ClassOrId ... <) ...<)"; - } - - @Override - public int compareTo(Object o) { - if (o instanceof ICommand) { - return getCommandName().compareTo(((ICommand) o).getCommandName()); - } - return 0; - } - - @Override - public boolean canCommandSenderUseCommand(ICommandSender sender) { - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMList.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMList.java deleted file mode 100644 index 3ac4b0bde..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMList.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.commands; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.util.ChatComponentText; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; -import com.github.technus.tectech.util.TT_Utility; - -/** - * Created by danie_000 on 30.12.2017. - */ -public class EMList implements ICommand { - - ArrayList aliases = new ArrayList<>(); - - public EMList() { - aliases.add("em_list"); - aliases.add("list_em"); - } - - @Override - public void processCommand(ICommandSender sender, String[] args) { - if (!sender.getEntityWorld().isRemote) { - if (args.length == 0) { - listClasses(sender); - } else { - String concated = TT_Utility.getConcated(args, " "); - listDefinitions(sender, concated, concated.replaceAll(" ", "_"), concated.replaceAll("_", " ")); - } - } - } - - private void listDefinitions(ICommandSender sender, String raw, String unlocalized, String localized) { - sender.addChatMessage(new ChatComponentText(" Available Direct: tag - name symbol")); - for (EMType directType : TecTech.definitionsRegistry.getDirectTypes().values()) { - if ("*".equals(raw) || localized.equalsIgnoreCase(directType.getLocalizedName()) - || unlocalized.equalsIgnoreCase(directType.getUnlocalizedName())) { - directType.getDefinitions().forEach( - (bind, definition) -> sender.addChatMessage( - new ChatComponentText( - bind + " - " + definition.getLocalizedName() + " " + definition.getSymbol()))); - } - } - } - - private void listClasses(ICommandSender sender) { - sender.addChatMessage(new ChatComponentText(" Available Direct: name (use as parameter to learn more")); - TecTech.definitionsRegistry.getDirectTypes().forEach( - (aClass, emDirectType) -> sender - .addChatMessage(new ChatComponentText(emDirectType.getLocalizedName()))); - sender.addChatMessage(new ChatComponentText(" Available Indirect: tag - name")); - TecTech.definitionsRegistry.getIndirectBinds().forEach( - (bind, emIndirectType) -> sender - .addChatMessage(new ChatComponentText(bind + " - " + emIndirectType.getLocalizedName()))); - } - - @Override - public boolean isUsernameIndex(String[] args, int index) { - return false; - } - - @Override - public List getCommandAliases() { - return aliases; - } - - @Override - public String getCommandName() { - return aliases.get(0); - } - - @Override - public List addTabCompletionOptions(ICommandSender sender, String[] args) { - if (args.length == 1) { - return TecTech.definitionsRegistry.getDirectTypes().values().stream().map(EMType::getLocalizedName) - .map(s -> s.replaceAll(" ", "_")).collect(Collectors.toList()); - } - return null; - } - - @Override - public String getCommandUsage(ICommandSender sender) { - return "em_list (optional Direct Name or *)"; - } - - @Override - public int compareTo(Object o) { - if (o instanceof ICommand) { - return getCommandName().compareTo(((ICommand) o).getCommandName()); - } - return 0; - } - - @Override - public boolean canCommandSenderUseCommand(ICommandSender sender) { - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java deleted file mode 100644 index a6d85847a..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.decay; - -import static com.github.technus.tectech.util.DoubleCount.mul; - -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; - -/** - * Created by danie_000 on 22.10.2016. - */ -public final class EMDecay { - - public static final EMDecay[] NO_DECAY = null; - // DECAY IMPOSSIBLE!!! - // Do not use regular NULL java will not make it work with varargs!!! - // Or cast null into ARRAY type but this static is more convenient!!! - public static final EMDecay[] NO_PRODUCT = new EMDecay[0]; - // this in turn can be used to tell that the thing should just vanish - private final EMConstantStackMap outputStacks; - private final double probability; - - public EMDecay(IEMDefinition... outSafe) { - this(1D, outSafe); - } - - public EMDecay(double probability, IEMDefinition... outSafe) { - EMDefinitionStack[] outArr = new EMDefinitionStack[outSafe.length]; - for (int i = 0; i < outArr.length; i++) { - outArr[i] = new EMDefinitionStack(outSafe[i], 1D); - } - outputStacks = new EMConstantStackMap(outArr); - this.probability = probability; - } - - public EMDecay(EMDefinitionStack... outSafe) { - this(1D, outSafe); - } - - public EMDecay(double probability, EMDefinitionStack... out) { - outputStacks = new EMConstantStackMap(out); - this.probability = probability; - } - - public EMDecay(EMConstantStackMap tree) { - this(1D, tree); - } - - public EMDecay(double probability, EMConstantStackMap tree) { - outputStacks = tree; - this.probability = probability; - } - - public EMInstanceStackMap getResults(double lifeMult, double age, long newEnergyLevel, double amountDecaying) { - EMInstanceStackMap decayResult = new EMInstanceStackMap(); - if (getOutputStacks() == null) { - return decayResult; // This is to prevent null pointer exceptions. - } - // Deny decay code is in instance! - boolean empty = true; - for (EMDefinitionStack stack : getOutputStacks().valuesToArray()) { - if (stack.getAmount() > 0) { - empty = false; - break; - } - } - if (empty) { - return decayResult; - } - - for (EMDefinitionStack stack : getOutputStacks().valuesToArray()) { - decayResult.putUnify( - new EMInstanceStack( - stack.getDefinition(), - mul(amountDecaying, stack.getAmount()), - lifeMult, - age /* new products */, - (long) (newEnergyLevel / Math.max(1D, Math.abs(stack.getAmount()))))); // get instances from - // stack - } - return decayResult; - } - - public EMConstantStackMap getOutputStacks() { - return outputStacks; - } - - public double getProbability() { - return probability; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecayResult.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecayResult.java deleted file mode 100644 index f29f16129..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecayResult.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.decay; - -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; - -public class EMDecayResult { - - private final EMInstanceStackMap output; - private double massAffected; - private double massDiff; - - public EMDecayResult(EMInstanceStackMap output, double massAffected, double massDiff) { - this.output = output; - this.massAffected = massAffected; - this.massDiff = massDiff; - } - - public EMInstanceStackMap getOutput() { - return output; - } - - /** - * How much was lost in the process (decayed or removed) - * - * @return - */ - public double getMassAffected() { - return massAffected; - } - - /** - * Difference of mass of actually decayed elements - * - * @return - */ - public double getMassDiff() { - return massDiff; - } - - public void setMassAffected(double massAffected) { - this.massAffected = massAffected; - } - - public void setMassDiff(double massDiff) { - this.massDiff = massDiff; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java deleted file mode 100644 index a0b933cfb..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.definitions; - -import net.minecraft.nbt.NBTTagCompound; - -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; - -/** - * Created by danie_000 on 23.01.2017. - */ -public abstract class EMComplexTemplate implements IEMDefinition { - - /** - * Just empty array? - */ - public static final IEMDefinition[] nothing = new EMPrimitiveTemplate[0]; - - @Override - public final EMComplexTemplate clone() { - return this; // IMMUTABLE - } - - @Override - public int compareTo(IEMDefinition o) { - int classCompare = compareClassID(o); - if (classCompare != 0) { - return classCompare; - } - // that allows neat check if the same thing and - // top hierarchy amount can be used to store amount info - return getSubParticles().compareWithAmountsInternal(o.getSubParticles()); - } - - @Override - public final boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof IEMDefinition) { - return compareTo((IEMDefinition) obj) == 0; - } - if (obj instanceof IEMStack) { - return compareTo(((IEMStack) obj).getDefinition()) == 0; - } - return false; - } - - @Override - public int hashCode() { // Internal amounts should be also hashed - int hash = -(getSubParticles().size() << 16); - for (EMDefinitionStack stack : getSubParticles().valuesToArray()) { - int amount = (int) stack.getAmount(); - hash += ((amount & 0x1) == 0 ? -amount : amount) * (stack.getDefinition().hashCode() << 4); - } - return hash; - } - - @Override - public String toString() { - return getLocalizedName() + " " + getSymbol(); - } - - public NBTTagCompound toNBT(EMDefinitionsRegistry registry) { - return registry.indirectToNBT(getTagValue(), getSubParticles()); - } - - protected abstract String getTagValue(); -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMPrimitiveTemplate.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMPrimitiveTemplate.java deleted file mode 100644 index 56742af21..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMPrimitiveTemplate.java +++ /dev/null @@ -1,200 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.definitions; - -import static net.minecraft.util.StatCollector.translateToLocal; - -import net.minecraft.nbt.NBTTagCompound; - -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; - -/** - * Created by danie_000 on 22.10.2016. EXTEND THIS TO ADD NEW PRIMITIVES, WATCH OUT FOR ID'S!!! - */ -public abstract class EMPrimitiveTemplate extends EMComplexTemplate { - - private final String name; - private final String symbol; - // float-mass in eV/c^2 - private final double mass; - // int -electric charge in 1/3rds of electron charge for optimization - private final int charge; - // byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) - private final int color; - // -1/-2/-3 anti matter generations, +1/+2/+3 matter generations, 0 self anti - private final int generation; - - private IEMDefinition anti; // IMMUTABLE - private EMDecay[] elementalDecays; - private byte naturalDecayInstant; - private byte energeticDecayInstant; - private double rawLifeTime; - - private final int ID; - private final String bind; - - // no _ at end - normal particle - // _ at end - anti particle - // __ at end - self is antiparticle - - protected EMPrimitiveTemplate(String name, String symbol, int generation, double mass, int charge, int color, - int ID, String bind) { - this.name = name; - this.symbol = symbol; - this.generation = generation; - this.mass = mass; - this.charge = charge; - this.color = color; - this.ID = ID; - this.bind = bind; - } - - // - protected void init(EMDefinitionsRegistry registry, IEMDefinition antiParticle, double rawLifeTime, - int naturalInstant, int energeticInstant, EMDecay... elementalDecaysArray) { - anti = antiParticle; - this.rawLifeTime = rawLifeTime; - naturalDecayInstant = (byte) naturalInstant; - energeticDecayInstant = (byte) energeticInstant; - elementalDecays = elementalDecaysArray; - registry.registerForDisplay(this); - registry.registerDirectDefinition(bind, this); - } - - @Override - public String getSymbol() { - return symbol; - } - - @Override - public String getShortSymbol() { - return getSymbol(); - } - - @Override - public String getShortLocalizedName() { - return translateToLocal(getUnlocalizedName()); - } - - @Override - public IEMDefinition getAnti() { - return anti; // no need for copy - } - - @Override - public int getCharge() { - return charge; - } - - @Override - public int getMaxColors() { - return color; - } - - @Override - public double getMass() { - return mass; - } - - @Override - public EMDecay[] getNaturalDecayInstant() { - if (naturalDecayInstant < 0) { - return elementalDecays; - } else if (naturalDecayInstant >= elementalDecays.length) { - return EMDecay.NO_PRODUCT; - } - return new EMDecay[] { elementalDecays[naturalDecayInstant] }; - } - - @Override - public EMDecay[] getEnergyInducedDecay(long energyLevel) { - if (energeticDecayInstant < 0) { - return elementalDecays; - } else if (energeticDecayInstant >= elementalDecays.length) { - return EMDecay.NO_PRODUCT; - } - return new EMDecay[] { elementalDecays[energeticDecayInstant] }; - } - - @Override - public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { - return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); - } - - @Override - public boolean usesSpecialEnergeticDecayHandling() { - return false; - } - - @Override - public boolean usesMultipleDecayCalls(long energyLevel) { - return false; - } - - @Override - public boolean decayMakesEnergy(long energyLevel) { - return false; - } - - @Override - public boolean fusionMakesEnergy(long energyLevel) { - return false; - } - - @Override - public EMDecay[] getDecayArray() { - return elementalDecays; - } - - @Override - public double getRawTimeSpan(long currentEnergy) { - return rawLifeTime; - } - - @Override - public final EMConstantStackMap getSubParticles() { - return null; - } - - @Override - public int getGeneration() { - return generation; - } - - @Override - public final NBTTagCompound toNBT(EMDefinitionsRegistry registry) { - return registry.directToNBT(bind); - } - - @Override - protected final String getTagValue() { - return bind; - } - - @Override - public final int getMatterMassType() { - return getClassTypeStatic(); - } - - public static int getClassTypeStatic() { - return Short.MIN_VALUE; - } - - @Override - public final int compareTo(IEMDefinition o) { - if (getMatterMassType() == o.getMatterMassType()) { - int oID = ((EMPrimitiveTemplate) o).ID; - return Integer.compare(ID, oID); - } - return compareClassID(o); - } - - @Override - public final int hashCode() { - return ID; - } - - public String getUnlocalizedName() { - return name; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java deleted file mode 100644 index d4426f20f..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.definitions; - -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.SCAN_GET_CHARGE; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.SCAN_GET_CLASS_TYPE; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.SCAN_GET_COLORABLE; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.SCAN_GET_MASS; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.SCAN_GET_NOMENCLATURE; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.SCAN_GET_TIMESPAN_INFO; -import static com.github.technus.tectech.util.TT_Utility.areBitsSet; -import static net.minecraft.util.StatCollector.translateToLocal; - -import java.util.ArrayList; - -import net.minecraft.nbt.NBTTagCompound; - -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.util.TT_Utility; - -/** - * Created by danie_000 on 11.11.2016. - */ -public interface IEMDefinition extends Comparable, Cloneable { // IMMUTABLE - - double STABLE_RAW_LIFE_TIME = 1.5e36D; - double NO_DECAY_RAW_LIFE_TIME = -1D; - long DEFAULT_ENERGY_LEVEL = 0; - double DEFAULT_ENERGY_REQUIREMENT = 25000D; // legit cuz normal atoms should only emit a gamma if they don't have - // defined energy levels - // add text based creators for recipe formula input? - - // Nomenclature - String getLocalizedTypeName(); - - String getShortLocalizedName(); - - default String getLocalizedName() { - return getLocalizedTypeName() + ": " + getShortLocalizedName(); - } - - String getShortSymbol(); - - String getSymbol(); - - default void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel, - EMDefinitionsRegistry registry) { - if (areBitsSet( - SCAN_GET_NOMENCLATURE | SCAN_GET_CLASS_TYPE | SCAN_GET_CHARGE | SCAN_GET_MASS | SCAN_GET_TIMESPAN_INFO, - capabilities)) { - lines.add(getShortSymbol()); - } - } - - default void addScanResults(ArrayList lines, int capabilities, long energyLevel, - EMDefinitionsRegistry registry) { - if (TT_Utility.areBitsSet( - SCAN_GET_CLASS_TYPE | SCAN_GET_CHARGE | SCAN_GET_MASS | SCAN_GET_TIMESPAN_INFO, - capabilities)) { - lines.add( - translateToLocal("tt.keyword.scan.class") + " = " - + registry.getTypes().get(getClass()).getLocalizedName()); - if (areBitsSet(SCAN_GET_NOMENCLATURE, capabilities)) { - lines.add(translateToLocal("tt.keyword.scan.name") + " = " + getLocalizedName()); - lines.add(translateToLocal("tt.keyword.scan.symbol") + " = " + getSymbol()); - } - } - if (areBitsSet(SCAN_GET_CHARGE, capabilities)) { - lines.add( - translateToLocal("tt.keyword.scan.charge") + " = " - + getCharge() / 3D - + " " - + translateToLocal("tt.keyword.unit.charge")); - } - if (areBitsSet(SCAN_GET_COLORABLE, capabilities)) { - lines.add( - hasColor() ? translateToLocal("tt.keyword.scan.colored") - : translateToLocal("tt.keyword.scan.colorless")); - } - if (areBitsSet(SCAN_GET_MASS, capabilities)) { - lines.add( - translateToLocal("tt.keyword.scan.mass") + " = " - + getMass() - + " " - + translateToLocal("tt.keyword.unit.mass")); - } - if (areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add( - (isTimeSpanHalfLife() ? translateToLocal("tt.keyword.scan.half_life") - : translateToLocal("tt.keyword.scan.life_time")) + " = " - + getRawTimeSpan(energyLevel) - + " " - + translateToLocal("tt.keyword.unit.time")); - lines.add(" " + translateToLocal("tt.keyphrase.scan.at_current_energy_level")); - } - } - - int getMatterMassType(); // bigger number means bigger things usually, but it is just used to differentiate - // between classes of iED - - int getGeneration(); - - // Not dynamically changing stuff - IEMDefinition getAnti(); // gives new anti particle def - - EMDecay[] getDecayArray(); // possible decays - - EMDecay[] getNaturalDecayInstant(); // natural decay if lifespan <1tick - - EMDecay[] getEnergyInducedDecay(long energyLevel); // energetic decay - - boolean usesSpecialEnergeticDecayHandling(); - - boolean usesMultipleDecayCalls(long energyLevel); - - boolean decayMakesEnergy(long energyLevel); - - boolean fusionMakesEnergy(long energyLevel); - - double getEnergyDiffBetweenStates(long currentEnergy, long newEnergyLevel); // positive or negative - - double getMass(); // mass... MeV/c^2 - - int getCharge(); // charge 1/3 electron charge - - // dynamically changing stuff - int getMaxColors(); - - default boolean hasColor() { - return getMaxColors() > 0; - } - - double getRawTimeSpan(long currentEnergy); // defined in static fields or generated - - boolean isTimeSpanHalfLife(); - - EMConstantStackMap getSubParticles(); // contents... null if none - - NBTTagCompound toNBT(EMDefinitionsRegistry registry); - - default EMDefinitionStack getStackForm(double amount) { - return new EMDefinitionStack(this, amount); - } - - default IEMDefinition clone() { - return this; - } - - default int compareClassID(IEMDefinition obj) { - return getMatterMassType() - obj.getMatterMassType(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMDefinitionsRegistry.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMDefinitionsRegistry.java deleted file mode 100644 index 931f7426e..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMDefinitionsRegistry.java +++ /dev/null @@ -1,196 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.NavigableSet; -import java.util.TreeSet; - -import net.minecraft.nbt.NBTTagCompound; - -import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.IEMMapRead; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; - -public class EMDefinitionsRegistry { - - private static final String TAG_NAME = "EM"; - - private final NavigableSet stacksRegistered = new TreeSet<>(); - - private final Map hashMap = new HashMap<>(); - private final Map hashMapR = Collections.unmodifiableMap(hashMap); - - private final Map, EMType> types = new HashMap<>(); - private final Map, EMType> typesR = Collections.unmodifiableMap(types); - private final Map, EMType> directTypes = new HashMap<>(); - private final Map, EMType> directTypesR = Collections.unmodifiableMap(directTypes); - private final Map, EMIndirectType> indirectTypes = new HashMap<>(); - private final Map, EMIndirectType> indirectTypesR = Collections - .unmodifiableMap(indirectTypes); - - private final Map binds = new HashMap<>(); - private final Map bindsR = Collections.unmodifiableMap(binds); - private final Map directBinds = new HashMap<>(); - private final Map directBindsR = Collections.unmodifiableMap(directBinds); - private final Map indirectBinds = new HashMap<>(); - private final Map indirectBindsR = Collections.unmodifiableMap(indirectBinds); - - public NBTTagCompound directToNBT(String bind) { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setString(TAG_NAME, bind); - return nbt; - } - - public NBTTagCompound indirectToNBT(String bind, IEMMapRead content) { - NBTTagCompound nbt = content.toNBT(this); - nbt.setString(TAG_NAME, bind); - return nbt; - } - - public IEMDefinition fromNBT(NBTTagCompound nbt) { - IEMDefinition definition; - try { - String bind = nbt.getString(TAG_NAME); - definition = directBinds.get(bind); - if (definition == null) { - definition = indirectBinds.get(bind).create(this, nbt); - } - } catch (Exception e) { - EMException emException = new EMException("Failed to create from: " + nbt.toString(), e); - if (DEBUG_MODE) { - emException.printStackTrace(); - return nbtE__; - } else { - throw emException; - } - } - if (!DEBUG_MODE) { - if (definition == nbtE__) { - throw new EMException("Deserialized to NBT ERROR!"); - } else if (definition == null) { - throw new EMException("Deserialized to NULL POINTER!"); - } else if (definition == null__) { - throw new EMException("Deserialized to NULL!"); - } - } - if (definition == null) { - return null__; - } - return definition; - } - - public boolean isOccupied(String bind) { - return binds.containsKey(bind); - } - - protected void addType(EMType emType) { - if (types.put(emType.getClazz(), emType) != null) { - EMException e = new EMException("Class collision! " + emType.getClazz().getName()); - if (DEBUG_MODE) { - e.printStackTrace(); - } else { - throw e; - } - } - } - - protected void bindType(String bind, EMType emType) { - if (binds.put(bind, emType) != null) { - EMException e = new EMException("NBT Bind collision! " + bind); - if (DEBUG_MODE) { - e.printStackTrace(); - } else { - throw e; - } - } - } - - public void registerDefinitionClass(String bind, EMIndirectType emIndirectType) { - addType(emIndirectType); - indirectTypes.put(emIndirectType.getClazz(), emIndirectType); - bindType(bind, emIndirectType); - indirectBinds.put(bind, emIndirectType); - } - - public void registerDefinitionClass(EMType emDirectType) { - addType(emDirectType); - } - - public void registerDirectDefinition(String bind, IEMDefinition definition) { - if (hashMap.put(definition.hashCode(), definition) != null) { - EMException e = new EMException("Hash collision! " + definition.hashCode()); - if (DEBUG_MODE) { - e.printStackTrace(); - } else { - throw e; - } - } - EMType emType = directTypes.get(definition.getClass()); - if (emType == null) { - emType = types.get(definition.getClass()); - if (emType != null) { - directTypes.put(definition.getClass(), emType); - } else { - EMException e = new EMException("Direct Type bind missing! " + definition.getClass().getName()); - if (DEBUG_MODE) { - e.printStackTrace(); - } else { - throw e; - } - } - } - if (emType != null) { - directTypes.put(definition.getClass(), emType); - bindType(bind, emType); - emType.addDefinition(bind, definition); - directBinds.put(bind, definition); - } - } - - public void registerForDisplay(IEMDefinition definition) { - stacksRegistered.add(definition); - IEMDefinition anti = definition.getAnti(); - if (anti != null) { - stacksRegistered.add(anti); - } - } - - @Deprecated - public Map getHashMapping() { - return hashMapR; - } - - public NavigableSet getStacksRegisteredForDisplay() { - return stacksRegistered; - } - - public Map getBinds() { - return bindsR; - } - - public Map getDirectBinds() { - return directBindsR; - } - - public Map getIndirectBinds() { - return indirectBindsR; - } - - public Map, EMType> getTypes() { - return typesR; - } - - public Map, EMType> getDirectTypes() { - return directTypesR; - } - - public Map, EMIndirectType> getIndirectTypes() { - return indirectTypesR; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMIndirectType.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMIndirectType.java deleted file mode 100644 index 97d5be06e..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMIndirectType.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; - -import java.util.function.BiFunction; - -import net.minecraft.nbt.NBTTagCompound; - -import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; - -public class EMIndirectType extends EMType { - - private final BiFunction creator; - - public EMIndirectType(BiFunction creator, - Class clazz, String unlocalizedName) { - super(clazz, unlocalizedName); - this.creator = creator; - } - - protected BiFunction getCreator() { - return creator; - } - - public IEMDefinition create(EMDefinitionsRegistry registry, NBTTagCompound nbt) { - try { - return creator.apply(registry, nbt); - } catch (Exception e) { - EMException emException = new EMException("Failed to create from: " + nbt.toString(), e); - if (DEBUG_MODE) { - emException.printStackTrace(); - return nbtE__; - } else { - throw emException; - } - } - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMType.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMType.java deleted file mode 100644 index 999ad2d06..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMType.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static net.minecraft.util.StatCollector.translateToLocal; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; - -public class EMType { - - private final Map definitions = new HashMap<>(); - private final Map definitionsR = Collections.unmodifiableMap(definitions); - private final Class clazz; - private final String unlocalizedName; - - public EMType(Class clazz, String unlocalizedName) { - this.clazz = clazz; - this.unlocalizedName = unlocalizedName; - } - - public Class getClazz() { - return clazz; - } - - public String getUnlocalizedName() { - return unlocalizedName; - } - - public String getLocalizedName() { - return translateToLocal(getUnlocalizedName()); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - return clazz == ((EMType) o).clazz; - } - - @Override - public int hashCode() { - return clazz.hashCode(); - } - - public void addDefinition(String bind, IEMDefinition definition) { - if (definitions.put(bind, definition) != null) { - EMException e = new EMException("NBT Bind collision on Direct bind!"); - if (DEBUG_MODE) { - e.printStackTrace(); - } else { - throw e; - } - } - } - - public Map getDefinitions() { - return definitionsR; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java deleted file mode 100644 index 9dce19c31..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.maps; - -import static com.github.technus.tectech.util.TT_Utility.unpackNBT; - -import java.util.Collections; -import java.util.NavigableMap; -import java.util.TreeMap; - -import net.minecraft.nbt.NBTTagCompound; - -import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; - -/** - * Created by Tec on 12.05.2017. - */ -public final class EMConstantStackMap /* IMMUTABLE */ - extends EMStackMap { // Target class for construction of definitions/recipes - // Constructors + Clone, all make a whole new OBJ. - - public static final EMConstantStackMap EMPTY = new EMConstantStackMap(); - - private EMConstantStackMap() { - super(Collections.emptyNavigableMap()); - } - - public EMConstantStackMap(EMDefinitionStack... in) { - this(new EMDefinitionStackMap(in).getBackingMap()); - } - - public EMConstantStackMap(NavigableMap in) { - super(Collections.unmodifiableNavigableMap(in)); - } - - @Override - public Class getType() { - return EMDefinitionStack.class; - } - - // IMMUTABLE DON'T NEED IT - @Override - public EMConstantStackMap clone() { - return this; - } - - public EMDefinitionStackMap toMutable() { - return new EMDefinitionStackMap(new TreeMap<>(getBackingMap())); - } - - public static EMConstantStackMap fromNBT(EMDefinitionsRegistry registry, NBTTagCompound nbt) throws EMException { - return new EMConstantStackMap( - unpackNBT(EMDefinitionStack.class, inner -> EMDefinitionStack.fromNBT(registry, inner), nbt)); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java deleted file mode 100644 index 7158a169b..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.maps; - -import static com.github.technus.tectech.util.TT_Utility.unpackNBT; - -import java.util.NavigableMap; -import java.util.TreeMap; - -import net.minecraft.nbt.NBTTagCompound; - -import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; - -/** - * Created by danie_000 on 22.01.2017. - */ -public final class EMDefinitionStackMap extends EMStackMap - implements IEMMapWriteExact { // Transient class for construction of definitions/recipes - // Constructors + Clone, all make a whole new OBJ. - - public EMDefinitionStackMap() {} - - public EMDefinitionStackMap(EMDefinitionStack... in) { - putUnifyAllExact(in); - } - - public EMDefinitionStackMap(NavigableMap in) { - super(in); - } - - @Override - public Class getType() { - return EMDefinitionStack.class; - } - - @Override - public EMDefinitionStackMap clone() { - return new EMDefinitionStackMap(new TreeMap<>(getBackingMap())); - } - - public EMConstantStackMap toImmutable() { - return new EMConstantStackMap(new TreeMap<>(getBackingMap())); - } - - public EMConstantStackMap toImmutable_optimized_unsafe_LeavesExposedElementalTree() { - return new EMConstantStackMap(getBackingMap()); - } - - public static EMDefinitionStackMap fromNBT(EMDefinitionsRegistry registry, NBTTagCompound nbt) throws EMException { - return new EMDefinitionStackMap( - unpackNBT(EMDefinitionStack.class, inner -> EMDefinitionStack.fromNBT(registry, inner), nbt)); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java deleted file mode 100644 index 44c985040..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.maps; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.AVOGADRO_CONSTANT; -import static com.github.technus.tectech.util.DoubleCount.add; -import static com.github.technus.tectech.util.TT_Utility.unpackNBT; -import static net.minecraft.util.StatCollector.translateToLocal; - -import java.util.ArrayList; -import java.util.Map; -import java.util.NavigableMap; -import java.util.TreeMap; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; - -import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; -import com.github.technus.tectech.util.TT_Utility; - -import gregtech.api.util.GT_Utility; - -/** - * Created by danie_000 on 22.01.2017. - */ -public final class EMInstanceStackMap extends EMStackMap implements IEMMapWrite { - - // Constructors - public EMInstanceStackMap() {} - - public EMInstanceStackMap(EMInstanceStack... inSafe) { - this(true, inSafe); - } - - public EMInstanceStackMap(boolean clone, EMInstanceStack... in) { - if (clone) { - EMInstanceStack[] stacks = new EMInstanceStack[in.length]; - for (int i = 0; i < stacks.length; i++) { - stacks[i] = in[i].clone(); - } - putUnifyAll(stacks); - } else { - putUnifyAll(in); - } - } - - private EMInstanceStackMap(NavigableMap inSafe) { - this(true, inSafe); - } - - private EMInstanceStackMap(boolean clone, NavigableMap in) { - super(clone ? new TreeMap<>() : in); - if (clone) { - for (EMInstanceStack stack : in.values()) { - putUnify(stack.clone()); - } - } - } - - @Override - public Class getType() { - return EMInstanceStack.class; - } - - @Override - public EMInstanceStackMap clone() { - return new EMInstanceStackMap(getBackingMap()); - } - - // Remove overflow - public double removeOverflow(int stacksCount, double stackCapacity) { - double massRemoved = 0; - - if (size() > stacksCount) { - IEMDefinition[] keys = keySetToArray(); - for (int i = stacksCount; i < keys.length; i++) { - massRemoved += get(keys[i]).getDefinitionStack().getMass(); - removeKey(keys[i]); - } - } - - for (EMInstanceStack instance : valuesToArray()) { - if (instance.getAmount() > stackCapacity) { - massRemoved += instance.getDefinition().getMass() * (instance.getAmount() - stackCapacity); - instance.setAmount(stackCapacity); - } - } - return massRemoved; - } - - // Getters - public String[] getElementalInfo() { - String[] info = new String[size()]; - int i = 0; - for (Map.Entry entry : entrySet()) { - EMInstanceStack instance = entry.getValue(); - info[i++] = EnumChatFormatting.BLUE + instance.getDefinition().getLocalizedName() - + " " - + EnumChatFormatting.AQUA - + instance.getDefinition().getSymbol() - + EnumChatFormatting.RESET - + " " - + translateToLocal("tt.keyword.short.amount") - + ": " - + EnumChatFormatting.GREEN - + TT_Utility.formatNumberExp(instance.getAmount() / AVOGADRO_CONSTANT) - + " " - + translateToLocal("tt.keyword.unit.mol") - + EnumChatFormatting.RESET - + " " - + translateToLocal("tt.keyword.short.energy") - + ": " - + EnumChatFormatting.GREEN - + GT_Utility - .formatNumbers(instance.getDefinition().getEnergyDiffBetweenStates(0, instance.getEnergy())) - + " " - + translateToLocal("tt.keyword.unit.energy") - + EnumChatFormatting.RESET - + " " - + translateToLocal("tt.keyword.short.charge") - + ": " - + EnumChatFormatting.GREEN - + TT_Utility.formatNumberExp(instance.getCharge()) - + " " - + translateToLocal("tt.keyword.unit.charge") - + EnumChatFormatting.RESET - + " " - + translateToLocal("tt.keyword.short.time") - + ": " - + EnumChatFormatting.GREEN - + (instance.getLifeTime() < 0 ? translateToLocal("tt.keyword.stable") - : TT_Utility.formatNumberShortExp(instance.getLifeTime()) + " " - + translateToLocal("tt.keyword.unit.time")) - + EnumChatFormatting.RESET; - } - return info; - } - - public ArrayList getScanInfo(int[] capabilities) { - ArrayList list = new ArrayList<>(16); - for (Map.Entry e : entrySet()) { - e.getValue().addScanResults(list, capabilities); - } - return list; - } - - public double tickContent(double lifeTimeMult, int postEnergize, double seconds) { - // cleanUp(); - double diff = 0; - for (EMInstanceStack instance : takeAllToArray()) { - instance.setAge(instance.getAge() + seconds); - EMDecayResult newInstances = instance.decay(lifeTimeMult, instance.getAge(), postEnergize); - if (newInstances == null) { - putUnify(instance); - } else { - diff = add(diff, newInstances.getMassDiff()); - putUnifyAll(newInstances.getOutput()); - } - } - return diff; - } - - // NBT - public static EMInstanceStackMap fromNBT(EMDefinitionsRegistry registry, NBTTagCompound nbt) throws EMException { - return new EMInstanceStackMap( - false, - unpackNBT(EMInstanceStack.class, inner -> EMInstanceStack.fromNBT(registry, inner), nbt)); - } - - @Override - public String toString() { - StringBuilder build = new StringBuilder("Instance Stack Map\n"); - for (Map.Entry stack : entrySet()) { - build.append(stack.getValue().toString()).append('\n'); - } - return build.toString(); - } - - public EMInstanceStack[] takeAllToArray() { - EMInstanceStack[] newStack = valuesToArray(); // just in case to uncouple The map - clear(); - return newStack; - } - - public EMInstanceStackMap takeAll() { - EMInstanceStackMap newStack = new EMInstanceStackMap(false, new TreeMap<>(getBackingMap())); // just in case to - // uncouple The map - clear(); - return newStack; - } - - @Deprecated - public EMDefinitionStackMap toDefinitionMapForComparison() { - EMDefinitionStack[] list = new EMDefinitionStack[size()]; - int i = 0; - for (Map.Entry entry : entrySet()) { - EMInstanceStack value = entry.getValue(); - list[i++] = new EMDefinitionStack(value.getDefinition(), value.getAmount()); - } - return new EMDefinitionStackMap(list); - } - - @Override - public EMInstanceStack putUnify(EMInstanceStack stack) { - EMInstanceStack target = get(stack.getDefinition()); - if (target == null) { - putReplace(stack); - return stack; - } - double newAmount = add(target.getAmount(), stack.getAmount()); - if (IEMStack.isValidAmount(newAmount)) { - stack = target.unifyIntoThis(stack); - putReplace(stack); - return stack; - } else { - removeKey(stack.getDefinition()); - return null; - } - } - - @Override - public EMInstanceStack putUnifyExact(EMInstanceStack stack) { - EMInstanceStack target = get(stack.getDefinition()); - if (target == null) { - putReplace(stack); - return stack; - } - double newAmount = target.getAmount() + stack.getAmount(); - if (IEMStack.isValidAmount(newAmount)) { - stack = target.unifyIntoThis(stack); - putReplace(stack); - return stack; - } else { - removeKey(stack.getDefinition()); - return null; - } - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java deleted file mode 100644 index 4fdffc790..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.maps; - -import java.util.Map; -import java.util.NavigableMap; -import java.util.TreeMap; - -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; - -/** - * Created by Tec on 12.05.2017. - */ -abstract class EMStackMap implements IEMMapRead { - - private final NavigableMap backingMap; - - protected EMStackMap() { - this(new TreeMap<>()); - } - - protected EMStackMap(NavigableMap map) { - this.backingMap = map; - } - - @Override - public NavigableMap getBackingMap() { - return backingMap; - } - - @Override - public abstract EMStackMap clone(); - - @SuppressWarnings("unchecked") - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof IEMMapRead) { - return compareTo((IEMMapRead) obj) == 0; - } - return false; - } - - @Override - public int hashCode() { // Hash only definitions to compare contents not amounts or data - int hash = -(size() << 4); - for (Map.Entry entry : entrySet()) { - hash += entry.getValue().getDefinition().hashCode(); - } - return hash; - } - - @Override - public int compareTo(IEMMapRead o) { - return IEMMapRead.super.compareTo(o); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java deleted file mode 100644 index 2cdc864f1..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java +++ /dev/null @@ -1,304 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.maps; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.AVOGADRO_CONSTANT; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_EPSILON; -import static com.github.technus.tectech.util.DoubleCount.ulpSigned; -import static com.github.technus.tectech.util.TT_Utility.packNBT; -import static net.minecraft.util.StatCollector.translateToLocal; - -import java.lang.reflect.Array; -import java.util.Collection; -import java.util.Iterator; -import java.util.Map; -import java.util.NavigableMap; -import java.util.Set; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; -import com.github.technus.tectech.util.TT_Utility; - -public interface IEMMapRead extends Comparable>, Cloneable { - - NavigableMap getBackingMap(); - - IEMMapRead clone(); - - default Set> entrySet() { - return getBackingMap().entrySet(); - } - - default Set keySet() { - return getBackingMap().keySet(); - } - - default IEMDefinition[] keySetToArray() { - return keySetToArray(new IEMDefinition[size()]); - } - - default IEMDefinition[] keySetToArray(IEMDefinition[] array) { - return keySet().toArray(array); - } - - default Collection values() { - return getBackingMap().values(); - } - - @SuppressWarnings("unchecked") - default T[] valuesToArray() { - return valuesToArray((T[]) Array.newInstance(getType(), size())); - } - - default T[] valuesToArray(T[] array) { - return values().toArray(array); - } - - Class getType(); - - // Getters - default T getFirst() { - return getBackingMap().firstEntry().getValue(); - } - - default T getLast() { - return getBackingMap().lastEntry().getValue(); - } - - default T get(IEMStack stack) { - return get(stack.getDefinition()); - } - - default T get(IEMDefinition def) { - return getBackingMap().get(def); - } - - default T getNaturallySorted(int pos) { - if (pos < 0 || pos >= size()) { - throw new IndexOutOfBoundsException("Index was: " + pos + " size was: " + size()); - } - for (Map.Entry entry : entrySet()) { - if (pos == 0) { - return entry.getValue(); - } - pos--; - } - return null; - } - - default T getRandom() { - return getNaturallySorted(TecTech.RANDOM.nextInt(size())); - } - - default String[] getShortSymbolsInfo() { - String[] info = new String[size()]; - int i = 0; - for (Map.Entry instance : entrySet()) { - info[i++] = instance.getValue().getDefinition().getShortSymbol(); - } - return info; - } - - default String[] getElementalInfo() { - String[] info = new String[size()]; - int i = 0; - for (Map.Entry entry : entrySet()) { - T instance = entry.getValue(); - info[i++] = EnumChatFormatting.BLUE + instance.getDefinition().getLocalizedName() - + " " - + EnumChatFormatting.AQUA - + instance.getDefinition().getSymbol() - + EnumChatFormatting.RESET - + " " - + translateToLocal("tt.keyword.short.amount") - + ": " - + EnumChatFormatting.GREEN - + TT_Utility.formatNumberExp(instance.getAmount() / AVOGADRO_CONSTANT) - + " " - + translateToLocal("tt.keyword.unit.mol") - + EnumChatFormatting.RESET - + " " - + translateToLocal("tt.keyword.short.charge") - + ": " - + EnumChatFormatting.GREEN - + TT_Utility.formatNumberExp(instance.getCharge()) - + " " - + translateToLocal("tt.keyword.unit.charge") - + EnumChatFormatting.RESET; - } - return info; - } - - // NBT - default NBTTagCompound toNBT(EMDefinitionsRegistry registry) { - return packNBT(t -> t.toNBT(registry), valuesToArray()); - } - - @Override - default int compareTo(IEMMapRead o) { // this actually compares rest - int sizeDiff = size() - o.size(); - if (sizeDiff != 0) { - return sizeDiff; - } - - Iterator> iterator = entrySet().iterator(); - Iterator> iteratorO = o.entrySet().iterator(); - - while (iterator.hasNext()) { - int result = iterator.next().getValue().compareTo(iteratorO.next().getValue()); - if (result != 0) { - return result; - } - } - return 0; - } - - /** - * use only for nested operations! - * - * @param o - * @return - */ - default int compareWithAmountsInternal(IEMMapRead o) { - if (o == null) { - return 1; - } - - int lenDiff = size() - o.size(); - if (lenDiff != 0) { - return lenDiff; - } - - Iterator> iterator = entrySet().iterator(); - Iterator> iteratorO = o.entrySet().iterator(); - - while (iterator.hasNext()) { - T first = iterator.next().getValue(); - IEMStack second = iteratorO.next().getValue(); - int result = first.compareTo(second); - if (result != 0) { - return result; - } - result = Double.compare(first.getAmount(), second.getAmount()); - if (result != 0) { - return result; - } - } - return 0; - } - - default double getMass() { - double mass = 0; - for (Map.Entry entry : entrySet()) { - mass += entry.getValue().getMass(); - } - return mass; - } - - default long getCharge() { - long charge = 0; - for (Map.Entry entry : entrySet()) { - charge += entry.getValue().getCharge(); - } - return charge; - } - - // Tests - default boolean containsKey(IEMDefinition def) { - return getBackingMap().containsKey(def); - } - - default boolean containsKey(IEMStack def) { - return containsKey(def.getDefinition()); - } - - default boolean containsAllKeys(IEMDefinition... definitions) { - for (IEMDefinition def : definitions) { - if (!containsKey(def)) { - return false; - } - } - return true; - } - - default boolean containsAllKeys(IEMStack... hasElementalDefinition) { - for (IEMStack has : hasElementalDefinition) { - if (!containsKey(has)) { - return false; - } - } - return true; - } - - default boolean containsAmountExact(IEMDefinition def, double amount) { - T target = get(def); - return target != null && target.getAmount() >= amount; - } - - default boolean containsAmountExact(IEMStack stack) { - return containsAmountExact(stack.getDefinition(), stack.getAmount()); - } - - default boolean containsAllAmountsExact(IEMStack... stacks) { - for (IEMStack stack : stacks) { - if (!containsAmountExact(stack)) { - return false; - } - } - return true; - } - - default boolean containsAllAmountsExact(IEMMapRead container) { - for (Map.Entry entry : container.entrySet()) { - if (!containsAmountExact(entry.getValue())) { - return false; - } - } - return true; - } - - default boolean containsAmount(IEMDefinition def, double amountToConsume) { - double amountRequired = amountToConsume - EM_COUNT_EPSILON; - if (amountRequired == amountToConsume) { - amountRequired -= ulpSigned(amountRequired); - } - return containsAmountExact(def, amountRequired); - } - - default boolean containsAmount(IEMStack stack) { - return containsAmount(stack.getDefinition(), stack.getAmount()); - } - - default boolean containsAllAmounts(IEMStack... stacks) { - for (IEMStack stack : stacks) { - if (!containsAmount(stack)) { - return false; - } - } - return true; - } - - default boolean containsAllAmounts(IEMMapRead container) { - for (Map.Entry entry : container.entrySet()) { - if (!containsAmount(entry.getValue())) { - return false; - } - } - return true; - } - - default int size() { - return getBackingMap().size(); - } - - default boolean hasStacks() { - return !isEmpty(); - } - - default boolean isEmpty() { - return getBackingMap().isEmpty(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java deleted file mode 100644 index e83d59186..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.maps; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_EPSILON; -import static com.github.technus.tectech.util.DoubleCount.add; -import static com.github.technus.tectech.util.DoubleCount.sub; -import static com.github.technus.tectech.util.DoubleCount.ulpSigned; - -import java.util.Map; - -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; - -public interface IEMMapWrite extends IEMMapWriteExact { - - IEMMapWrite clone(); - - /** - * Consumes amount from map - * - * @param def def to consume - * @param amountToConsume should be comparable to {@link EMTransformationRegistry#EM_COUNT_PER_MATERIAL_AMOUNT} - * @return consumed successfully - */ - default boolean removeAmount(IEMDefinition def, double amountToConsume) { - double amountRequired = amountToConsume - EM_COUNT_EPSILON; - if (amountRequired == amountToConsume) { - amountRequired -= ulpSigned(amountRequired); - } - return removeAmount(def, amountToConsume, amountRequired); - } - - @SuppressWarnings("unchecked") - default boolean removeAmount(IEMDefinition def, double amountToConsume, double amountRequired) { - T current = get(def); - if (current != null) { - if (current.getAmount() >= amountRequired) { - double newAmount = sub(current.getAmount(), amountToConsume); - if (IEMStack.isValidAmount(newAmount)) { - current = (T) current.mutateAmount(newAmount); - putReplace(current); - } else { - removeKey(current.getDefinition()); - } - return true; - } - } - return false; - } - - default boolean removeAmount(IEMStack stack) { - return removeAmount(stack.getDefinition(), stack.getAmount()); - } - - default boolean removeAllAmounts(IEMStack... stacks) { - boolean test = true; - for (IEMStack stack : stacks) { - test &= containsAmount(stack); - } - if (!test) { - return test; - } - for (IEMStack stack : stacks) { - removeAmount(stack); - } - return true; - } - - default boolean removeAllAmounts(IEMMapRead map) { - boolean test = true; - for (Map.Entry entry : map.entrySet()) { - test &= containsAmount(entry.getValue()); - } - if (!test) { - return test; - } - for (Map.Entry entry : map.entrySet()) { - removeAmount(entry.getValue()); - } - return true; - } - - // Put unify - /** - * - * @param stack thing to put - * @return new mapping or null if merging actually removed stuff - */ - @SuppressWarnings("unchecked") - default T putUnify(T stack) { - T target = get(stack.getDefinition()); - if (target == null) { - putReplace(stack); - return stack; - } - double newAmount = add(target.getAmount(), stack.getAmount()); - if (IEMStack.isValidAmount(newAmount)) { - stack = (T) target.mutateAmount(newAmount); - putReplace(stack); - return stack; - } else { - removeKey(stack.getDefinition()); - return null; - } - } - - default void putUnifyAll(@SuppressWarnings("unchecked") T... defs) { - for (T def : defs) { - putUnify(def); - } - } - - default void putUnifyAll(IEMMapRead inTreeUnsafe) { - for (Map.Entry in : inTreeUnsafe.entrySet()) { - putUnify(in.getValue()); - } - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java deleted file mode 100644 index 89c02774a..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java +++ /dev/null @@ -1,167 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.maps; - -import java.util.Map; - -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; - -public interface IEMMapWriteExact extends IEMMapRead { - - default void cleanUp() { - entrySet().removeIf(entry -> entry.getValue().isInvalidAmount()); - } - - default void clear() { - getBackingMap().clear(); - } - - IEMMapWriteExact clone(); - - // Remove - default T removeKey(IEMDefinition def) { - return getBackingMap().remove(def); - } - - default boolean removeKeys(IEMDefinition... definitions) { - boolean hadAll = true; - for (IEMDefinition def : definitions) { - hadAll &= removeKey(def) != null; - } - return hadAll; - } - - default boolean removeKeys(IEMStack... hasElementalDefinition) { - boolean hadAll = true; - for (IEMStack has : hasElementalDefinition) { - hadAll &= removeKey(has.getDefinition()) != null; - } - return hadAll; - } - - default boolean removeAllKeys(IEMDefinition... definitions) { - boolean hadAll = containsAllKeys(definitions); - if (hadAll) { - for (IEMDefinition def : definitions) { - removeKey(def); - } - } - return hadAll; - } - - default boolean removeAllKeys(IEMStack... hasElementalDefinition) { - boolean hadAll = containsAllKeys(hasElementalDefinition); - if (hadAll) { - for (IEMStack stack : hasElementalDefinition) { - removeKey(stack.getDefinition()); - } - } - return hadAll; - } - - default void putReplace(T defStackUnsafe) { - getBackingMap().put(defStackUnsafe.getDefinition(), defStackUnsafe); - } - - default void putReplaceAll(@SuppressWarnings("unchecked") T... defStacksUnsafe) { - for (T defStack : defStacksUnsafe) { - putReplace(defStack); - } - } - - default void putReplaceAll(IEMMapRead inContainerUnsafe) { - getBackingMap().putAll(inContainerUnsafe.getBackingMap()); - } - - /** - * Should only be used when modifying definitions to alter the integer count correctly - * - * @param def - * @return - */ - default boolean removeAmountExact(IEMStack def) { - return removeAmountExact(def.getDefinition(), def.getAmount()); - } - - /** - * Should only be used when modifying definitions to alter the integer count correctly - * - * @param def - * @param amountToConsume - * @return - */ - @SuppressWarnings("unchecked") - default boolean removeAmountExact(IEMDefinition def, double amountToConsume) { - T current = get(def); - if (current != null) { - double newAmount = current.getAmount() - amountToConsume; - if (newAmount >= 0) { - if (current.isValidAmount()) { - current = (T) current.mutateAmount(newAmount); - putReplace(current); - } else { - removeKey(current.getDefinition()); - } - return true; - } - } - return false; - } - - default boolean removeAllAmountsExact(IEMStack... stacks) { - boolean test = true; - for (IEMStack stack : stacks) { - test &= containsAmountExact(stack); - } - if (!test) { - return test; - } - for (IEMStack stack : stacks) { - removeAmountExact(stack); - } - return true; - } - - default boolean removeAllAmountsExact(IEMMapRead map) { - boolean test = true; - for (Map.Entry entry : map.entrySet()) { - test &= containsAmountExact(entry.getValue()); - } - if (!test) { - return test; - } - for (Map.Entry entry : map.entrySet()) { - removeAmountExact(entry.getValue()); - } - return true; - } - - @SuppressWarnings("unchecked") - default T putUnifyExact(T stack) { - T target = get(stack.getDefinition()); - if (target == null) { - putReplace(stack); - return stack; - } - double newAmount = target.getAmount() + stack.getAmount(); - if (IEMStack.isValidAmount(newAmount)) { - stack = (T) target.mutateAmount(newAmount); - putReplace(stack); - return stack; - } else { - removeKey(stack.getDefinition()); - return null; - } - } - - default void putUnifyAllExact(@SuppressWarnings("unchecked") T... defs) { - for (T def : defs) { - putUnifyExact(def); - } - } - - default void putUnifyAllExact(IEMMapRead inTreeUnsafe) { - for (Map.Entry in : inTreeUnsafe.entrySet()) { - putUnifyExact(in.getValue()); - } - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipe.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipe.java deleted file mode 100644 index bfe913a4a..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipe.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.recipes; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.IEMMapRead; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; - -/** - * Created by Tec on 02.03.2017. - */ -public class EMRecipe implements Comparable> { - - private final int ID; - private final EMConstantStackMap inEM; - private final IEMMapRead outEM; - private final ItemStack[] outItems; - private final FluidStack[] outFluids; - private T extension; - - public EMRecipe(EMConstantStackMap inEM, // not null plz - int id, IEMMapRead outEM, ItemStack[] outItems, FluidStack[] outFluids) { - this.inEM = inEM; - this.outEM = outEM; - this.outItems = outItems; - this.outFluids = outFluids; - ID = id; // allows multiple recipes with the same input EM,so u can actually extend... - } - - public EMRecipe extend(T data) { - setExtension(data); - return this; - } - - @Override - public int compareTo(EMRecipe o) { - int compare = getInEM().compareTo(o.getInEM()); - if (compare != 0) { - return compare; - } - return Integer.compare(getID(), o.getID()); - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public boolean equals(Object obj) { - if (obj instanceof EMRecipe) { - return compareTo((EMRecipe) obj) == 0; - } - return false; - } - - @Override - public int hashCode() { - return getInEM().hashCode(); - } - - public int getID() { - return ID; - } - - public EMConstantStackMap getInEM() { - return inEM; - } - - public IEMMapRead getOutEM() { - return outEM; - } - - public ItemStack[] getOutItems() { - return outItems; - } - - public FluidStack[] getOutFluids() { - return outFluids; - } - - public T getExtension() { - return extension; - } - - public void setExtension(T extension) { - this.extension = extension; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java deleted file mode 100644 index c121417d5..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; - -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__; - -import net.minecraft.nbt.NBTTagCompound; - -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; - -/** - * Created by danie_000 on 20.11.2016. - */ -public final class EMDefinitionStack implements IEMStack { - - private final IEMDefinition definition; - private final double amount; - - public EMDefinitionStack(IEMDefinition def, double amount) { - definition = def == null ? null__ : def; - this.amount = amount; - } - - @Override - public EMDefinitionStack clone() { - return this; // IMMUTABLE - } - - @Override - public EMDefinitionStack mutateAmount(double newAmount) { - if (getAmount() == newAmount) { - return this; - } - return new EMDefinitionStack(getDefinition(), newAmount); // IMMUTABLE - } - - @Override - public IEMDefinition getDefinition() { - return definition; // IMMUTABLE - } - - @Override - public double getAmount() { - return amount; - } - - public NBTTagCompound toNBT(EMDefinitionsRegistry registry) { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setTag("d", getDefinition().toNBT(registry)); - nbt.setDouble("Q", getAmount()); - return nbt; - } - - public static EMDefinitionStack fromNBT(EMDefinitionsRegistry registry, NBTTagCompound nbt) { - return new EMDefinitionStack(registry.fromNBT(nbt.getCompoundTag("d")), nbt.getLong("q") + nbt.getDouble("Q")); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof IEMDefinition) { - return getDefinition().compareTo((IEMDefinition) obj) == 0; - } - if (obj instanceof IEMStack) { - return getDefinition().compareTo(((IEMStack) obj).getDefinition()) == 0; - } - return false; - } - - // Amount shouldn't be hashed if this is just indicating amount and not structure - @Override - public int hashCode() { - return getDefinition().hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMInstanceStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMInstanceStack.java deleted file mode 100644 index 2d0d216f5..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMInstanceStack.java +++ /dev/null @@ -1,590 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.AVOGADRO_CONSTANT; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.SCAN_GET_AGE; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.SCAN_GET_AMOUNT; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.SCAN_GET_COLOR_VALUE; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.SCAN_GET_DEPTH_LEVEL; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.SCAN_GET_ENERGY; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.SCAN_GET_ENERGY_LEVEL; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.SCAN_GET_TIMESPAN_MULT; -import static com.github.technus.tectech.util.DoubleCount.add; -import static com.github.technus.tectech.util.DoubleCount.distribute; -import static com.github.technus.tectech.util.DoubleCount.div; -import static com.github.technus.tectech.util.DoubleCount.ulpSigned; -import static java.lang.Math.max; -import static java.lang.Math.min; -import static net.minecraft.util.StatCollector.translateToLocal; - -import java.util.ArrayList; - -import net.minecraft.client.Minecraft; -import net.minecraft.crash.CrashReport; -import net.minecraft.nbt.NBTTagCompound; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.util.TT_Utility; - -/** - * Created by danie_000 on 22.10.2016. - */ -public final class EMInstanceStack implements IEMStack { - - public static int MIN_MULTIPLE_DECAY_CALLS = 4, MAX_MULTIPLE_DECAY_CALLS = 16; - public static double DECAY_CALL_PER = EM_COUNT_PER_MATERIAL_AMOUNT; // todo - - private final IEMDefinition definition; - private double amount; - - private double age; - // energy - if positive then particle should try to decay - private long energy; - // byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) - private int color; - private double lifeTime; - private double lifeTimeMult; - - public EMInstanceStack(IEMStack stackSafe) { - this(stackSafe.getDefinition(), stackSafe.getAmount(), 1D, 0D, 0); - } - - public EMInstanceStack(IEMStack stackSafe, double lifeTimeMult, double age, long energy) { - this(stackSafe.getDefinition(), stackSafe.getAmount(), lifeTimeMult, age, energy); - } - - public EMInstanceStack(IEMDefinition defSafe, double amount) { - this(defSafe, amount, 1D, 0D, 0); - } - - public EMInstanceStack(IEMDefinition defSafe, double amount, double lifeTimeMult, double age, long energy) { - definition = defSafe == null ? null__ : defSafe; - if (getDefinition().hasColor()) { - this.color = (byte) TecTech.RANDOM.nextInt(getDefinition().getMaxColors()); - } else { // transforms colorable??? into proper color - this.color = getDefinition().getMaxColors(); - } - this.lifeTimeMult = lifeTimeMult; - lifeTime = getDefinition().getRawTimeSpan(energy) * this.lifeTimeMult; - setEnergy(energy); - this.setAge(age); - this.setAmount(amount); - } - - // Clone proxy - private EMInstanceStack(EMInstanceStack stack) { - definition = stack.getDefinition(); - color = stack.color; - setAge(stack.getAge()); - setAmount(stack.getAmount()); - lifeTime = stack.lifeTime; - lifeTimeMult = stack.lifeTimeMult; - energy = stack.energy; - } - - @Override - public EMInstanceStack clone() { - return new EMInstanceStack(this); - } - - @Override - public EMInstanceStack mutateAmount(double newAmount) { - this.setAmount(newAmount); - return this; - } - - @Override - public double getAmount() { - return amount; - } - - public long getEnergy() { - return energy; - } - - public void setEnergy(long newEnergyLevel) { - energy = newEnergyLevel; - setLifeTimeMultiplier(getLifeTimeMultiplier()); - } - - public double getEnergySettingCost(long currentEnergyLevel, long newEnergyLevel) { - return getDefinition().getEnergyDiffBetweenStates(currentEnergyLevel, newEnergyLevel) * getAmount(); - } - - public double getEnergySettingCost(long newEnergyLevel) { - return getEnergySettingCost(energy, newEnergyLevel) * getAmount(); - } - - public EMDefinitionStack getDefinitionStack() { - return new EMDefinitionStack(getDefinition(), getAmount()); - } - - @Override - public IEMDefinition getDefinition() { - return definition; - } - - public int getColor() { - return color; - } - - public void setColor(int color) { // does not allow changing magic element - if (this.color < 0 || this.color > 2 || color < 0 || color >= 3) { - return; - } - this.color = color; - } - - public void nextColor() { // does not allow changing magic element - if (definition.hasColor()) { - color = (byte) TecTech.RANDOM.nextInt(definition.getMaxColors()); - } - } - - public double getLifeTime() { - return lifeTime; - } - - public void setLifeTimeMultiplier(double mult) { - if (mult <= 0) // since infinity*0=nan - { - throw new IllegalArgumentException("multiplier must be >0"); - } - lifeTimeMult = mult; - if (getDefinition().getRawTimeSpan(energy) <= 0) { - return; - } - lifeTime = getDefinition().getRawTimeSpan(energy) * lifeTimeMult; - } - - public double getLifeTimeMultiplier() { - return lifeTimeMult; - } - - public EMDecayResult tickStackByOneSecond(double lifeTimeMult, int postEnergize) { - return tickStack(lifeTimeMult, postEnergize, 1D); - } - - public EMDecayResult tickStack(double lifeTimeMult, int postEnergize, double seconds) { - setAge(getAge() + seconds); - EMDecayResult newInstances = decay(lifeTimeMult, getAge(), postEnergize); - if (newInstances == null) { - nextColor(); - } else { - for (EMInstanceStack newInstance : newInstances.getOutput().valuesToArray()) { - newInstance.nextColor(); - } - } - return newInstances; - } - - public EMDecayResult decay() { - return decay(1D, getAge(), 0); // try to decay without changes - } - - public EMDecayResult decay(double apparentAge, long postEnergize) { - return decay(1D, apparentAge, postEnergize); - } - - public EMDecayResult decay(double lifeTimeMult, double apparentAge, long postEnergize) { - long newEnergyLevel = postEnergize + energy; - if (newEnergyLevel > 0) { - newEnergyLevel -= 1; - } else if (newEnergyLevel < 0) { - newEnergyLevel += 1; - } - EMDecayResult output; - if (getDefinition().usesMultipleDecayCalls(energy)) { - double amountTemp = getAmount(); - int decayCnt = (int) min( - MAX_MULTIPLE_DECAY_CALLS, - max(getAmount() / DECAY_CALL_PER, MIN_MULTIPLE_DECAY_CALLS)); - setAmount(div(getAmount(), decayCnt)); - decayCnt--; - - output = decayMechanics(lifeTimeMult, apparentAge, newEnergyLevel); - if (output == null) { - setAmount(amountTemp); - return null; - } - - for (int i = 0; i < decayCnt; i++) { - EMDecayResult map = decayMechanics(lifeTimeMult, apparentAge, newEnergyLevel); - if (map != null) { - output.getOutput().putUnifyAll(map.getOutput()); - output.setMassDiff(add(output.getMassDiff(), map.getMassDiff())); - output.setMassAffected(output.getMassDiff() + map.getMassDiff()); - } - } - setAmount(amountTemp); - } else { - output = decayMechanics(lifeTimeMult, apparentAge, newEnergyLevel); - } - if (output != null) { - output.getOutput().cleanUp(); - } - return output; - } - - private EMDecayResult decayMechanics(double lifeTimeMult, double apparentAge, long newEnergyLevel) { - if (energy > 0 && !getDefinition().usesSpecialEnergeticDecayHandling()) { - setLifeTimeMultiplier(getLifeTimeMultiplier()); - return decayCompute(getDefinition().getEnergyInducedDecay(energy), lifeTimeMult, -1D, newEnergyLevel); - } else if (getDefinition().getRawTimeSpan(energy) < 0) { - return null; // return null, decay cannot be achieved - } else if (getDefinition().isTimeSpanHalfLife()) { - return exponentialDecayCompute( - energy > 0 ? getDefinition().getEnergyInducedDecay(energy) : getDefinition().getDecayArray(), - lifeTimeMult, - -1D, - newEnergyLevel); - } else { - if (1 > lifeTime) { - return decayCompute( - energy > 0 ? getDefinition().getEnergyInducedDecay(energy) - : getDefinition().getNaturalDecayInstant(), - lifeTimeMult, - 0D, - newEnergyLevel); - } else if (apparentAge > lifeTime) { - return decayCompute( - energy > 0 ? getDefinition().getEnergyInducedDecay(energy) : getDefinition().getDecayArray(), - lifeTimeMult, - 0D, - newEnergyLevel); - } - } - return null; // return null since decay cannot be achieved - } - - // Use to get direct decay output providing correct decay array - private EMDecayResult exponentialDecayCompute(EMDecay[] decays, double lifeTimeMult, double newProductsAge, - long newEnergyLevel) { - double newAmount = div(getAmount(), Math.pow(2D, 1D /* 1 second */ / lifeTime)); - - if (newAmount == getAmount()) { - newAmount -= ulpSigned(newAmount); - } else if (newAmount < 1) { - return decayCompute(decays, lifeTimeMult, newProductsAge, newEnergyLevel); - } - - // split to non decaying and decaying part - double amount = this.getAmount(); - this.setAmount(this.getAmount() - newAmount); - EMDecayResult products = decayCompute(decays, lifeTimeMult, newProductsAge, newEnergyLevel); - this.setAmount(newAmount); - if (products != null) { - products.getOutput().putUnify(clone()); - } - this.setAmount(amount); - return products; - } - - // Use to get direct decay output providing correct decay array - private EMDecayResult decayCompute(EMDecay[] decays, double lifeTimeMult, double newProductsAge, - long newEnergyLevel) { - if (decays == null) { - return null; // Can not decay so it won't - } - boolean makesEnergy = getDefinition().decayMakesEnergy(energy); - double mass = getMass(); - if (decays.length == 0) { - return makesEnergy ? null : new EMDecayResult(new EMInstanceStackMap(), mass, 0); - // provide non null 0 length array for annihilation - } else if (decays.length == 1) { // only one type of decay :D, doesn't need dead end - if (decays[0] == deadEnd) { - return makesEnergy ? null - : new EMDecayResult( - decays[0].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, getAmount()), - mass, - 0); - } - EMInstanceStackMap output = decays[0].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, getAmount()); - if (newProductsAge < 0) { - if (output.size() == 1) { - if (output.size() == 1 && output.getFirst().getDefinition().equals(getDefinition())) { - output.getFirst().setEnergy(energy); - output.getFirst().setAge(getAge()); - } - } else { - for (EMInstanceStack stack : output.valuesToArray()) { - if (stack.getDefinition().equals(getDefinition())) { - stack.setAge(getAge()); - } - } - } - } else { - if (output.size() == 1 && output.getFirst().getDefinition().equals(getDefinition())) { - output.getFirst().setEnergy(energy); - } - } - if (energy <= 0 && output.getMass() > mass) { - return null; // no energy usage to decay - } - return new EMDecayResult(new EMInstanceStackMap(), mass, makesEnergy ? output.getMass() - mass : 0); - } else { - EMDecayResult totalOutput = new EMDecayResult(new EMInstanceStackMap(), getMass(), 0); - EMInstanceStackMap output = totalOutput.getOutput(), results; - int differentDecays = decays.length; - double[] probabilities = new double[differentDecays]; - for (int i = 0; i < probabilities.length; i++) { - probabilities[i] = decays[i].getProbability(); - } - double[] qttyOfDecay; - try { - qttyOfDecay = distribute(getAmount(), probabilities); - } catch (ArithmeticException e) { - Minecraft.getMinecraft().crashed(new CrashReport("Decay failed for: " + this, e)); - return null; - } - - if (getDefinition().decayMakesEnergy(energy)) { - for (int i = differentDecays - 1; i >= 0; i--) { - if (decays[i] == deadEnd) { - EMInstanceStack clone = clone(); - clone.setAmount(qttyOfDecay[i]); - output.putUnify(clone); - } else { - results = decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i]); - output.putUnifyAll(results); - totalOutput.setMassDiff(add(totalOutput.getMassDiff(), results.getMass() - mass)); - } - } - } else { - for (int i = differentDecays - 1; i >= 0; i--) { - results = decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i]); - output.putUnifyAll(results); - } - } - - if (newProductsAge < 0) { - if (output.size() == 1 && output.getFirst().getDefinition().equals(getDefinition())) { - output.getFirst().setEnergy(energy); - output.getFirst().setAge(getAge()); - } else { - for (EMInstanceStack stack : output.valuesToArray()) { - if (stack.getDefinition().equals(getDefinition())) { - stack.setAge(getAge()); - } - } - } - } else { - if (output.size() == 1 && output.getFirst().getDefinition().equals(getDefinition())) { - output.getFirst().setEnergy(energy); - output.getFirst().setAge(getAge()); - } - } - if (energy <= 0 && output.getMass() > getMass()) { - return null; // no energy usage to decay - } - return totalOutput; - } - } - - public EMInstanceStack unifyIntoThis(EMInstanceStack... instances) { - if (instances == null) { - return this; - } - // returns with the definition from the first object passed - double energyTotal = getEnergySettingCost(0, energy); - long maxEnergy = energy; - long minEnergy = energy; - - for (EMInstanceStack instance : instances) { - // if (instance != null && compareTo(instance) == 0) { - setAmount(add(getAmount(), instance.getAmount())); - energyTotal += instance.getEnergySettingCost(0, instance.energy); - maxEnergy = max(instance.energy, maxEnergy); - minEnergy = min(instance.energy, maxEnergy); - lifeTimeMult = min(lifeTimeMult, instance.lifeTimeMult); - setAge(max(getAge(), instance.getAge())); - // } - } - - if (energyTotal >= 0) { - for (; maxEnergy > 0; maxEnergy--) { - if (getEnergySettingCost(0, maxEnergy) < energyTotal) { - break; - } - } - setEnergy(maxEnergy); - } else { - for (; minEnergy < 0; minEnergy++) { - if (getEnergySettingCost(minEnergy, 0) < energyTotal) { - break; - } - } - setEnergy(minEnergy); - } - return this; - } - - public EMInstanceStack unifyIntoThisExact(EMInstanceStack... instances) { - if (instances == null) { - return this; - } - // returns with the definition from the first object passed - double energyTotal = getEnergySettingCost(0, energy); - long maxEnergy = energy; - long minEnergy = energy; - - for (EMInstanceStack instance : instances) { - // if (instance != null && compareTo(instance) == 0) { - setAmount(getAmount() + instance.getAmount()); - energyTotal += instance.getEnergySettingCost(0, instance.energy); - maxEnergy = max(instance.energy, maxEnergy); - minEnergy = min(instance.energy, maxEnergy); - lifeTimeMult = min(lifeTimeMult, instance.lifeTimeMult); - setAge(max(getAge(), instance.getAge())); - // } - } - - if (energyTotal >= 0) { - for (; maxEnergy > 0; maxEnergy--) { - if (getEnergySettingCost(0, maxEnergy) < energyTotal) { - break; - } - } - setEnergy(maxEnergy); - } else { - for (; minEnergy < 0; minEnergy++) { - if (getEnergySettingCost(minEnergy, 0) < energyTotal) { - break; - } - } - setEnergy(minEnergy); - } - return this; - } - - public void addScanResults(ArrayList lines, int[] detailsOnDepthLevels) { - int capabilities = detailsOnDepthLevels[0]; - if (TT_Utility.areBitsSet(SCAN_GET_DEPTH_LEVEL, capabilities)) { - lines.add(translateToLocal("tt.keyword.scan.depth") + " = " + 0); - } - getDefinition().addScanResults(lines, capabilities, energy, TecTech.definitionsRegistry); - - if (TT_Utility.areBitsSet(SCAN_GET_TIMESPAN_MULT, capabilities)) { - lines.add(translateToLocal("tt.keyword.scan.life_mult") + " = " + lifeTimeMult); - } - if (TT_Utility.areBitsSet(SCAN_GET_AGE, capabilities)) { - lines.add( - translateToLocal("tt.keyword.scan.age") + " = " - + getAge() - + " " - + translateToLocal("tt.keyword.unit.time")); - } - if (TT_Utility.areBitsSet(SCAN_GET_COLOR_VALUE, capabilities)) { - lines.add(translateToLocal("tt.keyword.scan.color") + " = " + color); - } - if (TT_Utility.areBitsSet(SCAN_GET_ENERGY, capabilities)) { - lines.add( - translateToLocal("tt.keyword.scan.energy") + " = " - + getDefinition().getEnergyDiffBetweenStates(0, energy) - + " " - + translateToLocal("tt.keyword.unit.energy")); - } - if (TT_Utility.areBitsSet(SCAN_GET_ENERGY_LEVEL, capabilities)) { - lines.add(translateToLocal("tt.keyword.scan.energyLevel") + " = " + energy); - } - if (TT_Utility.areBitsSet(SCAN_GET_AMOUNT, capabilities)) { - lines.add( - translateToLocal("tt.keyword.scan.amount") + " = " - + getAmount() / AVOGADRO_CONSTANT - + " " - + translateToLocal("tt.keyword.unit.mol")); - } - - scanContents(lines, getDefinition().getSubParticles(), 1, detailsOnDepthLevels); - } - - private void scanContents(ArrayList lines, EMConstantStackMap definitions, int depth, - int[] detailsOnDepthLevels) { - if (definitions != null && depth < detailsOnDepthLevels.length) { - int deeper = depth + 1; - for (EMDefinitionStack definitionStack : definitions.valuesToArray()) { - lines.add(""); // def separator - if (TT_Utility.areBitsSet(SCAN_GET_DEPTH_LEVEL, detailsOnDepthLevels[depth])) { - lines.add(translateToLocal("tt.keyword.scan.depth") + " = " + depth); - } - getDefinition().addScanResults(lines, detailsOnDepthLevels[depth], energy, TecTech.definitionsRegistry); - if (TT_Utility.areBitsSet(SCAN_GET_AMOUNT, detailsOnDepthLevels[depth])) { - lines.add(translateToLocal("tt.keyword.scan.count") + " = " + definitionStack.getAmount()); - } - scanContents(lines, definitionStack.getDefinition().getSubParticles(), deeper, detailsOnDepthLevels); - } - } - } - - public NBTTagCompound toNBT(EMDefinitionsRegistry registry) { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setTag("d", getDefinition().toNBT(registry)); - nbt.setDouble("Q", getAmount()); - nbt.setDouble("M", getLifeTimeMultiplier()); - nbt.setDouble("A", getAge()); - nbt.setLong("e", getEnergy()); - nbt.setInteger("c", getColor()); - return nbt; - } - - public static EMInstanceStack fromNBT(EMDefinitionsRegistry registry, NBTTagCompound nbt) { - EMInstanceStack instance = new EMInstanceStack( - registry.fromNBT(nbt.getCompoundTag("d")), - nbt.getDouble("Q"), - nbt.getDouble("M"), - nbt.getDouble("A"), - nbt.getLong("e")); - instance.setColor(nbt.getInteger("c")); - return instance; - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof IEMDefinition) { - return getDefinition().compareTo((IEMDefinition) obj) == 0; - } - if (obj instanceof IEMStack) { - return getDefinition().compareTo(((IEMStack) obj).getDefinition()) == 0; - } - return false; - } - - // Amount shouldn't be hashed if this is just indicating amount and not structure, DOES NOT CARE ABOUT - // creativeTabTecTech INFO - @Override - public int hashCode() { - return getDefinition().hashCode(); - } - - @Override - public String toString() { - return getDefinition().toString() + ' ' - + getAmount() / AVOGADRO_CONSTANT - + " " - + translateToLocal("tt.keyword.unit.mol") - + " " - + getMass() - + " " - + translateToLocal("tt.keyword.unit.mass"); - } - - public void setAmount(double amount) { - this.amount = amount; - } - - public double getAge() { - return age; - } - - public void setAge(double age) { - this.age = age; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java deleted file mode 100644 index b1115df11..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_MINIMUM; - -import net.minecraft.nbt.NBTTagCompound; - -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; - -/** - * Created by danie_000 on 30.01.2017. - */ -public interface IEMStack extends Comparable, Cloneable { - - static boolean isValidAmount(double amount) { - return amount >= EM_COUNT_MINIMUM; - } - - static boolean isInvalidAmount(double amount) { - return amount < EM_COUNT_MINIMUM; - } - - default boolean isValidAmount() { - return isValidAmount(getAmount()); - } - - default boolean isInvalidAmount() { - return isInvalidAmount(getAmount()); - } - - IEMDefinition getDefinition(); - - double getAmount(); - - default double getCharge() { - return getDefinition().getCharge() * getAmount(); - } - - default double getMass() { - return getDefinition().getMass() * getAmount(); - } - - IEMStack clone(); - - /** - * Will return stack with mutated amount, it might be a new object! - * - * @param newAmount new amount - * @return new stack (or previous one if was mutable) - */ - IEMStack mutateAmount(double newAmount); - - NBTTagCompound toNBT(EMDefinitionsRegistry registry); - - @Override - default int compareTo(IEMStack o) { - return getDefinition().compareTo(o.getDefinition()); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMDequantizationInfo.java deleted file mode 100644 index 0e4e7bf87..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMDequantizationInfo.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; - -public class EMDequantizationInfo { - - private final IEMStack definition; - private Object stack; - - public EMDequantizationInfo(IEMStack definition) { - this.definition = definition; - } - - public IEMStack getInput() { - return definition; - } - - public FluidStack getFluid() { - return ((FluidStack) stack).copy(); - } - - public void setFluid(FluidStack fluid) { - this.stack = fluid; - } - - public ItemStack getItem() { - return ((ItemStack) stack).copy(); - } - - public void setItem(ItemStack item) { - this.stack = item; - } - - public OreDictionaryStack getOre() { - return (OreDictionaryStack) stack; - } - - public void setOre(OreDictionaryStack ore) { - this.stack = ore; - } - - public Object getStack() { - return stack; - } - - @Override - public boolean equals(Object o) { - return o instanceof EMDequantizationInfo && definition.equals(((EMDequantizationInfo) o).definition); - } - - @Override - public int hashCode() { - return definition.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java deleted file mode 100644 index c3ad01292..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; - -/** - * Created by Tec on 23.05.2017. - */ -public class EMFluidQuantizationInfo { - - private final FluidStack in; - private final IEMStack out; - - public EMFluidQuantizationInfo(FluidStack fluidStackIn, IEMStack emOut) { - in = fluidStackIn; - out = emOut; - } - - public EMFluidQuantizationInfo(Fluid fluid, int fluidAmount, IEMStack emOut) { - in = new FluidStack(fluid, fluidAmount); - out = emOut; - } - - public FluidStack input() { - return in.copy(); - } - - public IEMStack output() { - return out.clone(); - } - - @Override - public int hashCode() { - return in.getFluidID(); - } - - @Override - public boolean equals(Object obj) { - return obj instanceof EMFluidQuantizationInfo && hashCode() == obj.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java deleted file mode 100644 index 5acb0deb1..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; - -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_OreDictUnificator; - -/** - * Created by Tec on 23.05.2017. - */ -public class EMItemQuantizationInfo { - - private final ItemStack in; - private final boolean skipNBT; - private final IEMStack out; - - public EMItemQuantizationInfo(ItemStack itemStackIn, boolean skipNBT, IEMStack emOut) { - in = itemStackIn; - out = emOut; - this.skipNBT = skipNBT; - } - - public EMItemQuantizationInfo(OrePrefixes prefix, Materials material, int amount, boolean skipNBT, IEMStack emOut) { - in = GT_OreDictUnificator.get(prefix, material, amount); - out = emOut; - this.skipNBT = skipNBT; - } - - public ItemStack input() { - return in.copy(); - } - - public IEMStack output() { - return out.clone(); - } - - @Override - public int hashCode() { - return (GameRegistry.findUniqueIdentifierFor(in.getItem()) + ":" - + in.getUnlocalizedName() - + ':' - + in.getItemDamage()).hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof EMItemQuantizationInfo) { - // alias - ItemStack stack = ((EMItemQuantizationInfo) obj).in; - if (!in.getUnlocalizedName().equals(((EMItemQuantizationInfo) obj).in.getUnlocalizedName())) { - return false; - } - - if (!GameRegistry.findUniqueIdentifierFor(in.getItem()) - .equals(GameRegistry.findUniqueIdentifierFor(((EMItemQuantizationInfo) obj).in.getItem()))) { - return false; - } - - if (in.getItemDamage() != OreDictionary.WILDCARD_VALUE - && stack.getItemDamage() != OreDictionary.WILDCARD_VALUE) { - if (in.getItemDamage() != stack.getItemDamage()) { - return false; - } - } - return skipNBT || ItemStack.areItemStackTagsEqual(in, stack); - } - return false; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java deleted file mode 100644 index 9c857447d..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import net.minecraftforge.oredict.OreDictionary; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; - -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; - -/** - * Created by Tec on 23.05.2017. - */ -public class EMOredictQuantizationInfo { - - private final int id; - private final int amount; - private final IEMStack out; - - public EMOredictQuantizationInfo(int id, int amount, IEMStack out) { - this.id = id; - this.amount = amount; - this.out = out; - } - - public EMOredictQuantizationInfo(String name, int qty, IEMStack emOut) { - this(OreDictionary.getOreID(name), qty, emOut); - } - - public EMOredictQuantizationInfo(OrePrefixes prefix, Materials material, int qty, IEMStack emOut) { - this(prefix, material.mName, qty, emOut); - } - - public EMOredictQuantizationInfo(OrePrefixes prefix, String materialName, int qty, IEMStack emOut) { - this(OreDictionary.getOreID(prefix.name() + materialName), qty, emOut); - } - - public IEMStack getOut() { - return out; - } - - @Override - public int hashCode() { - return getId(); - } - - @Override - public boolean equals(Object obj) { - return obj instanceof EMOredictQuantizationInfo && hashCode() == obj.hashCode(); - } - - public int getId() { - return id; - } - - public int getAmount() { - return amount; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationRegistry.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationRegistry.java deleted file mode 100644 index f8312cf7c..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationRegistry.java +++ /dev/null @@ -1,136 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import static java.lang.Math.pow; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.Function; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.oredict.OreDictionary; - -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; - -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_OreDictUnificator; - -/** - * Created by Tec on 26.05.2017. - */ -public class EMTransformationRegistry { - - /** - * Atom count per Mol - */ - public static final double AVOGADRO_CONSTANT = 6.02214076e23D; - /** - * Scale to 1m^3 of C-12 - */ - public static final double EM_COUNT_PER_CUBE = AVOGADRO_CONSTANT * 1650_000D / 0.012; - - public static final double EM_COUNT_PER_MATERIAL_AMOUNT = EM_COUNT_PER_CUBE / 144 / 9; - public static final double EM_COUNT_PER_ITEM = EM_COUNT_PER_CUBE * 9; - public static final double EM_COUNT_PER_1k = EM_COUNT_PER_MATERIAL_AMOUNT * 1000; - - public static final double EM_COUNT_MINIMUM = 1 / EM_COUNT_PER_CUBE; - /** - * Quantity considered to be indifferent when computing stuff - */ - public static final double EM_COUNT_EPSILON = EM_COUNT_PER_CUBE / pow(2, 40); - - public static final double EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED = EM_COUNT_PER_MATERIAL_AMOUNT - - EM_COUNT_EPSILON; - public static final double EM_COUNT_PER_CUBE_DIMINISHED = EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED * 144 * 9; - public static final double EM_COUNT_PER_ITEM_DIMINISHED = EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED * 144; - public static final double EM_COUNT_PER_1k_DIMINISHED = EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED * 1000; - - private final Map fluidQuantization; - private final Map itemQuantization; - private final Map oredictQuantization; - - private final Map infoMap; - private final Function creator; - - public EMTransformationRegistry() { - this(EMDequantizationInfo::new); - } - - public EMTransformationRegistry(Function creator) { - this(creator, new HashMap<>(16), new HashMap<>(16), new HashMap<>(64), new HashMap<>(256)); - } - - public EMTransformationRegistry(Function creator, - Map fluidQuantization, - Map itemQuantization, - Map oredictQuantization, - Map infoMap) { - this.creator = creator; - this.fluidQuantization = fluidQuantization; - this.itemQuantization = itemQuantization; - this.oredictQuantization = oredictQuantization; - this.infoMap = infoMap; - } - - protected EMDequantizationInfo compute(IEMStack em) { - return infoMap.computeIfAbsent(em.getDefinition(), stack -> creator.apply(em)); - } - - public void addFluid(IEMStack em, FluidStack fluidStack) { - getFluidQuantization().put(fluidStack.getFluidID(), new EMFluidQuantizationInfo(fluidStack, em)); - compute(em).setFluid(fluidStack); - } - - public void addFluid(IEMStack em, Fluid fluid, int fluidAmount) { - addFluid(em, new FluidStack(fluid, fluidAmount)); - } - - protected void addItemQuantization(EMItemQuantizationInfo aIQI) { - getItemQuantization().put(aIQI, aIQI); - } - - public void addItem(IEMStack em, ItemStack itemStack, boolean skipNBT) { - addItemQuantization(new EMItemQuantizationInfo(itemStack, skipNBT, em)); - compute(em).setItem(itemStack); - } - - public void addItem(IEMStack em, OrePrefixes prefix, Materials material, int amount, boolean skipNBT) { - addItem(em, GT_OreDictUnificator.get(prefix, material, amount), skipNBT); - } - - public void addOredict(IEMStack em, int id, int qty) { - getOredictQuantization().put(id, new EMOredictQuantizationInfo(id, qty, em)); - compute(em).setOre(new OreDictionaryStack(qty, id)); - } - - public void addOredict(IEMStack em, String name, int qty) { - addOredict(em, OreDictionary.getOreID(name), qty); - } - - public void addOredict(IEMStack em, OrePrefixes prefix, Materials material, int qty) { - addOredict(em, prefix, material.mName, qty); - } - - public void addOredict(IEMStack em, OrePrefixes prefix, String materialName, int qty) { - addOredict(em, OreDictionary.getOreID(prefix.name() + materialName), qty); - } - - public Map getFluidQuantization() { - return fluidQuantization; - } - - public Map getItemQuantization() { - return itemQuantization; - } - - public Map getOredictQuantization() { - return oredictQuantization; - } - - public Map getInfoMap() { - return infoMap; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/OreDictionaryStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/OreDictionaryStack.java deleted file mode 100644 index 83117e50d..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/OreDictionaryStack.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -public class OreDictionaryStack { - - private final int amount; - private final int id; - - public OreDictionaryStack(int amount, int id) { - this.amount = amount; - this.id = id; - } - - public int getAmount() { - return amount; - } - - public int getOreId() { - return id; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java deleted file mode 100644 index 24c397dc2..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java +++ /dev/null @@ -1,2300 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.boson_Y__; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; -import static com.github.technus.tectech.util.XSTR.XSTR_INSTANCE; -import static gregtech.api.enums.Materials.Aluminium; -import static gregtech.api.enums.Materials.Americium; -import static gregtech.api.enums.Materials.Antimony; -import static gregtech.api.enums.Materials.Argon; -import static gregtech.api.enums.Materials.Arsenic; -import static gregtech.api.enums.Materials.Barium; -import static gregtech.api.enums.Materials.Beryllium; -import static gregtech.api.enums.Materials.Bismuth; -import static gregtech.api.enums.Materials.Boron; -import static gregtech.api.enums.Materials.Cadmium; -import static gregtech.api.enums.Materials.Caesium; -import static gregtech.api.enums.Materials.Calcium; -import static gregtech.api.enums.Materials.Carbon; -import static gregtech.api.enums.Materials.Cerium; -import static gregtech.api.enums.Materials.Chrome; -import static gregtech.api.enums.Materials.Cobalt; -import static gregtech.api.enums.Materials.Copper; -import static gregtech.api.enums.Materials.Deuterium; -import static gregtech.api.enums.Materials.Dysprosium; -import static gregtech.api.enums.Materials.Erbium; -import static gregtech.api.enums.Materials.Europium; -import static gregtech.api.enums.Materials.Fluorine; -import static gregtech.api.enums.Materials.Gadolinium; -import static gregtech.api.enums.Materials.Gallium; -import static gregtech.api.enums.Materials.Gold; -import static gregtech.api.enums.Materials.Helium; -import static gregtech.api.enums.Materials.Helium_3; -import static gregtech.api.enums.Materials.Holmium; -import static gregtech.api.enums.Materials.Hydrogen; -import static gregtech.api.enums.Materials.Indium; -import static gregtech.api.enums.Materials.Iridium; -import static gregtech.api.enums.Materials.Iron; -import static gregtech.api.enums.Materials.Lanthanum; -import static gregtech.api.enums.Materials.Lead; -import static gregtech.api.enums.Materials.Lithium; -import static gregtech.api.enums.Materials.Lutetium; -import static gregtech.api.enums.Materials.Magnesium; -import static gregtech.api.enums.Materials.Manganese; -import static gregtech.api.enums.Materials.Mercury; -import static gregtech.api.enums.Materials.Molybdenum; -import static gregtech.api.enums.Materials.Neodymium; -import static gregtech.api.enums.Materials.Nickel; -import static gregtech.api.enums.Materials.Niobium; -import static gregtech.api.enums.Materials.Nitrogen; -import static gregtech.api.enums.Materials.Osmium; -import static gregtech.api.enums.Materials.Oxygen; -import static gregtech.api.enums.Materials.Palladium; -import static gregtech.api.enums.Materials.Phosphorus; -import static gregtech.api.enums.Materials.Platinum; -import static gregtech.api.enums.Materials.Plutonium; -import static gregtech.api.enums.Materials.Plutonium241; -import static gregtech.api.enums.Materials.Potassium; -import static gregtech.api.enums.Materials.Praseodymium; -import static gregtech.api.enums.Materials.Promethium; -import static gregtech.api.enums.Materials.Radon; -import static gregtech.api.enums.Materials.Rubidium; -import static gregtech.api.enums.Materials.Samarium; -import static gregtech.api.enums.Materials.Scandium; -import static gregtech.api.enums.Materials.Silicon; -import static gregtech.api.enums.Materials.Silver; -import static gregtech.api.enums.Materials.Sodium; -import static gregtech.api.enums.Materials.Strontium; -import static gregtech.api.enums.Materials.Sulfur; -import static gregtech.api.enums.Materials.Tantalum; -import static gregtech.api.enums.Materials.Tellurium; -import static gregtech.api.enums.Materials.Terbium; -import static gregtech.api.enums.Materials.Thorium; -import static gregtech.api.enums.Materials.Thulium; -import static gregtech.api.enums.Materials.Tin; -import static gregtech.api.enums.Materials.Titanium; -import static gregtech.api.enums.Materials.Tritium; -import static gregtech.api.enums.Materials.Tungsten; -import static gregtech.api.enums.Materials.Uranium; -import static gregtech.api.enums.Materials.Uranium235; -import static gregtech.api.enums.Materials.Vanadium; -import static gregtech.api.enums.Materials.Ytterbium; -import static gregtech.api.enums.Materials.Yttrium; -import static gregtech.api.enums.Materials.Zinc; -import static gregtech.api.enums.OrePrefixes.dust; -import static java.lang.Math.abs; -import static net.minecraft.util.StatCollector.translateToLocal; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; -import java.util.Random; -import java.util.TreeMap; -import java.util.TreeSet; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMComplexTemplate; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition; -import com.github.technus.tectech.util.TT_Utility; -import com.github.technus.tectech.util.XSTR; - -/** - * Created by danie_000 on 18.11.2016. - */ -public class EMAtomDefinition extends EMComplexTemplate { - - private static final String[] SYMBOL = new String[] { "Nt", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", - "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", - "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", - "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", - "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", - "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", - "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", - "Og" }; - private static final String[] NAME = new String[] { "Neutronium", "Hydrogen", "Helium", "Lithium", "Beryllium", - "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", - "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", - "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", - "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", - "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", - "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", - "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", - "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", - "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", - "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", - "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", - "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", - "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson" }; - private static final String[] SYMBOL_IUPAC = new String[] { "n", "u", "b", "t", "q", "p", "h", "s", "o", "e", "N", - "U", "B", "T", "Q", "P", "H", "S", "O", "E" }; - - public static final long ATOM_COMPLEXITY_LIMIT = 65536L; - private static final byte BYTE_OFFSET = 32; - - private final int hash; - public static double refMass, refUnstableMass; - - private static final String nbtType = "a"; - private static final Random xstr = new XSTR(); // NEEDS SEPARATE! - private static Map> stableIsotopes = new HashMap<>(); - private static final Map stableAtoms = new HashMap<>(); - private static Map> mostStableUnstableIsotopes = new HashMap<>(); - private static final Map unstableAtoms = new HashMap<>(); - private static EMDefinitionStack alpha, deuterium, tritium, helium_3, beryllium_8, carbon_14, neon_24, silicon_34, - uranium_238, uranium_235, plutonium_239, plutonium_241; - private static final HashMap lifetimeOverrides = new HashMap<>(); - - private final EMNuclideIAEA iaea; - - private static EMAtomDefinition somethingHeavy; - - public static EMAtomDefinition getSomethingHeavy() { - return somethingHeavy; - } - - private static final ArrayList overrides = new ArrayList<>(); - - public static void addOverride(EMAtomDefinition atom, double rawLifeTime) { - lifetimeOverrides.put(atom, rawLifeTime); - } - - // float-mass in eV/c^2 - private final double mass; - // public final int charge; - private final int charge; - // int -electric charge in 1/3rds of electron charge for optimization - private final int chargeLeptons; - private final double rawLifeTime; - // generation max present inside - minus if contains any anti quark - private final byte type; - - private final byte decayMode; // t neutron to proton+,0,f proton to neutron - // public final boolean stable; - - private final int neutralCount; - private final int element; - - private final boolean iaeaDefinitionExistsAndHasEnergyLevels; - - private final EMConstantStackMap elementalStacks; - - // stable is rawLifeTime>=10^9 - - public EMAtomDefinition(EMDefinitionStack... things) throws EMException { - this(true, new EMConstantStackMap(things)); - } - - public EMAtomDefinition(EMConstantStackMap things) throws EMException { - this(true, things); - } - - private EMAtomDefinition(boolean check, EMConstantStackMap things) throws EMException { - if (check && !canTheyBeTogether(things)) { - throw new EMException("Atom Definition error"); - } - elementalStacks = things; - - double mass = 0; - int cLeptons = 0; - int cNucleus = 0; - int neutralCount = 0, element = 0; - int type = 0; - boolean containsAnti = false; - for (EMDefinitionStack stack : elementalStacks.valuesToArray()) { - IEMDefinition def = stack.getDefinition(); - int amount = (int) stack.getAmount(); - if ((int) stack.getAmount() != stack.getAmount()) { - throw new ArithmeticException("Amount cannot be safely converted to int!"); - } - mass += stack.getMass(); - if (def.getGeneration() < 0) { - containsAnti = true; - } - type = Math.max(type, abs(def.getGeneration())); - - if (def instanceof EMLeptonDefinition) { - cLeptons += stack.getCharge(); - } else { - cNucleus += stack.getCharge(); - if (def.getCharge() == 3) { - element += amount; - } else if (def.getCharge() == -3) { - element -= amount; - } else if (def.getCharge() == 0) { - neutralCount += amount; - } - } - } - this.type = containsAnti ? (byte) -type : (byte) type; - // this.mass = mass; - chargeLeptons = cLeptons; - charge = cNucleus + cLeptons; - this.neutralCount = neutralCount; - this.element = element; - - element = abs(element); - - // stability curve - int StableIsotope = stableIzoCurve(element); - int izoDiff = neutralCount - StableIsotope; - int izoDiffAbs = abs(izoDiff); - - xstr.setSeed((element + 1L) * (neutralCount + 100L)); - iaea = EMNuclideIAEA.get(element, neutralCount); - if (getIaea() != null) { - if (Double.isNaN(getIaea().getMass())) { - this.mass = mass; - } else { - this.mass = getIaea().getMass(); - } - - if (Double.isNaN(getIaea().getHalfTime())) { - Double overriddenLifeTime = lifetimeOverrides.get(this); - double rawLifeTimeTemp; - if (overriddenLifeTime != null) { - rawLifeTimeTemp = overriddenLifeTime; - } else { - rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); - } - rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME); - } else { - rawLifeTime = containsAnti ? getIaea().getHalfTime() * 1.5514433E-21d * (1d + xstr.nextDouble() * 9d) - : getIaea().getHalfTime(); - } - iaeaDefinitionExistsAndHasEnergyLevels = getIaea().getEnergeticStatesArray().length > 1; - } else { - this.mass = mass; - - Double overriddenLifeTime = lifetimeOverrides.get(this); - double rawLifeTimeTemp; - if (overriddenLifeTime != null) { - rawLifeTimeTemp = overriddenLifeTime; - } else { - rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); - } - rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME); - - iaeaDefinitionExistsAndHasEnergyLevels = false; - } - - if (getIaea() == null || getIaea().getEnergeticStatesArray()[0].energy != 0) { - if (izoDiff == 0) { - decayMode = 0; - } else { - decayMode = izoDiff > 0 ? (byte) Math.min(2, 1 + izoDiffAbs / 4) - : (byte) -Math.min(2, 1 + izoDiffAbs / 4); - } - } else { - decayMode = izoDiff > 0 ? (byte) (Math.min(2, 1 + izoDiffAbs / 4) + BYTE_OFFSET) - : (byte) (-Math.min(2, 1 + izoDiffAbs / 4) + BYTE_OFFSET); - } - // this.stable = this.rawLifeTime >= STABLE_RAW_LIFE_TIME; - hash = super.hashCode(); - } - - private static int stableIzoCurve(int element) { - return (int) Math.round( - -1.19561E-06D * Math.pow(element, 4D) + 1.60885E-04D * Math.pow(element, 3D) - + 3.76604E-04D * Math.pow(element, 2D) - + 1.08418E+00D * (double) element); - } - - private static double calculateLifeTime(int izoDiff, int izoDiffAbs, int element, int isotope, - boolean containsAnti) { - double rawLifeTime; - - if (element <= 83 && isotope < 127 - && (izoDiffAbs == 0 || element == 1 && isotope == 0 - || element == 2 && isotope == 1 - || izoDiffAbs == 1 && element > 2 && element % 2 == 1 - || izoDiffAbs == 3 && element > 30 && element % 2 == 0 - || izoDiffAbs == 5 && element > 30 && element % 2 == 0 - || izoDiffAbs == 2 && element > 20 && element % 2 == 1)) { - rawLifeTime = (1D + xstr.nextDouble() * 9D) * (containsAnti ? 2.381e4D : 1.5347e25D); - } else { - // Y = (X-A)/(B-A) * (D-C) + C - double unstabilityEXP; - if (element == 0) { - return 1e-35D; - } else if (element == 1) { - unstabilityEXP = 1.743D - abs(izoDiff - 1) * 9.743D; - } else if (element == 2) { - switch (isotope) { - case 4: - unstabilityEXP = 1.61D; - break; - case 5: - unstabilityEXP = -7.523D; - break; - case 6: - unstabilityEXP = -1.51D; - break; - default: - unstabilityEXP = -(izoDiffAbs * 6.165D); - break; - } - } else if (element <= 83 || isotope <= 127 && element <= 120) { - double elementPow4 = Math.pow(element, 4); - - unstabilityEXP = Math.min(element / 2.4D, 6 + ((element + 1) % 2) * 3e6D / elementPow4) - + -izoDiff * elementPow4 / 1e8D - - abs(izoDiff - 1 + element / 60D) * (3D - element / 12.5D + element * element / 1500D); - } else if (element < 180) { - unstabilityEXP = Math.min((element - 85) * 2, 16 + ((isotope + 1) % 2) * 2.5D - (element - 85) / 3D) - - abs(izoDiff) * (3D - element / 13D + element * element / 1600D); - } else { - return -1; - } - if ((isotope == 127 || isotope == 128) && element < 120 && element > 83) { - unstabilityEXP -= 1.8D; - } - if (element > 83 && element < 93 && isotope % 2 == 0 && izoDiff == 3) { - unstabilityEXP += 6; - } - if (element > 93 && element < 103 && isotope % 2 == 0 && izoDiff == 4) { - unstabilityEXP += 6; - } - rawLifeTime = (containsAnti ? 1e-8D : 1) * Math.pow(10D, unstabilityEXP) * (1D + xstr.nextDouble() * 9D); - } - - if (rawLifeTime < 8e-15D) { - return 1e-35D; - } - if (rawLifeTime > 8e28D) { - return 8e30D; - } - return rawLifeTime; - } - - private static boolean canTheyBeTogether(EMConstantStackMap stacks) { - boolean nuclei = false; - long qty = 0; - for (EMDefinitionStack stack : stacks.valuesToArray()) { - if (stack.getDefinition() instanceof EMHadronDefinition) { - if (((EMHadronDefinition) stack.getDefinition()).getAmount() != 3) { - return false; - } - nuclei = true; - } else if (!(stack.getDefinition() instanceof EMLeptonDefinition)) { - return false; - } - if ((int) stack.getAmount() != stack.getAmount()) { - throw new ArithmeticException("Amount cannot be safely converted to int!"); - } - qty += stack.getAmount(); - } - return nuclei && qty < ATOM_COMPLEXITY_LIMIT; - } - - @Override - public int getCharge() { - return charge; - } - - public int getChargeLeptons() { - return chargeLeptons; - } - - public int getChargeHadrons() { - return getCharge() - getChargeLeptons(); - } - - public int getIonizationElementWise() { - return getElement() * 3 + getChargeLeptons(); - } - - @Override - public double getMass() { - return mass; - } - - @Override - public int getGeneration() { - return type; - } - - @Override - public double getRawTimeSpan(long currentEnergy) { - if (currentEnergy <= 0) { - return rawLifeTime; - } - if (iaeaDefinitionExistsAndHasEnergyLevels) { - if (currentEnergy >= getIaea().getEnergeticStatesArray().length) { - return getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length - 1].Thalf - / (currentEnergy - getIaea().getEnergeticStatesArray().length + 1); - } - return getIaea().getEnergeticStatesArray()[(int) currentEnergy].Thalf; - } - return rawLifeTime / (currentEnergy + 1); - } - - @Override - public boolean isTimeSpanHalfLife() { - return true; - } - - @Override - public int getMaxColors() { - return -10; - } - - @Override - public String getLocalizedTypeName() { - return translateToLocal("tt.keyword.Element"); - } - - @Override - public String getShortLocalizedName() { - int element = abs(getElement()); - boolean anti = getElement() < 0; - boolean weird = abs(getGeneration()) != 1; - if (element >= NAME.length) { - StringBuilder s = new StringBuilder(); - if (anti) { - s.append(translateToLocal("tt.IUPAC.Anti")); - do { - s.append(translateToLocal("tt.IUPAC." + SYMBOL_IUPAC[element % 10])); - element = element / 10; - } while (element > 0); - } else { - while (element >= 10) { - s.append(translateToLocal("tt.IUPAC." + SYMBOL_IUPAC[element % 10])); - element = element / 10; - } - s.append(translateToLocal("tt.IUPAC." + SYMBOL_IUPAC[element + 10])); - } - if (weird) { - s.append(translateToLocal("tt.keyword.Weird")); - } - return s.toString(); - } - return translateToLocal("tt.element." + (anti ? "Anti" : "") + NAME[element]) - + (weird ? translateToLocal("tt.keyword.Weird") : ""); - } - - @Override - public String getSymbol() { - String ionName = ""; - int ionization = getCharge() / 3; - if (ionization > 0) { - ionName = ionization == 1 ? TT_Utility.toSuperscript("+") : TT_Utility.toSuperscript(ionization + "+"); - } else if (ionization < 0) { - ionName = ionization == -1 ? TT_Utility.toSuperscript("-") : TT_Utility.toSuperscript(-ionization + "-"); - } - return TT_Utility.toSuperscript(Long.toString(getNeutralCount() + (long) getElement())) + getShortSymbol() - + ionName; - } - - @Override - public String getShortSymbol() { - int element = abs(getElement()); - boolean anti = getElement() < 0; - boolean weird = abs(getGeneration()) != 1; - if (element >= SYMBOL.length) { - StringBuilder s = new StringBuilder(anti ? "~" : ""); - while (element >= 10) { - s.append(SYMBOL_IUPAC[element % 10]); - element = element / 10; - } - s.append(SYMBOL_IUPAC[element + 10]); - if (weird) { - s.append(translateToLocal("tt.keyword.Weird")); - } - return s.toString(); - } - return (anti ? "~" : "") + SYMBOL[element] + (weird ? translateToLocal("tt.keyword.Weird") : ""); - } - - @Override - public EMConstantStackMap getSubParticles() { - return elementalStacks.clone(); - } - - @Override - public EMDecay[] getDecayArray() { - ArrayList decaysList = new ArrayList<>(4); - return getDecayArray(decaysList, getDecayMode(), true); - } - - private EMDecay[] getDecayArray(ArrayList decaysList, int decayMode, boolean tryAnti) { // todo? - if (getGeneration() == 1) { - switch (decayMode) { - case -2: - if (TecTech.RANDOM.nextBoolean() && ElectronCapture(decaysList)) { - return decaysList.toArray(EMDecay.NO_PRODUCT); - } else if (PbetaDecay(decaysList)) { - return decaysList.toArray(EMDecay.NO_PRODUCT); - } - break; - case -1: - if (Emmision(decaysList, EMHadronDefinition.hadron_p1)) { - return decaysList.toArray(EMDecay.NO_PRODUCT); - } - break; - case 0: - if (alphaDecay(decaysList)) { - return decaysList.toArray(EMDecay.NO_PRODUCT); - } - break; - case 1: - if (Emmision(decaysList, EMHadronDefinition.hadron_n1)) { - return decaysList.toArray(EMDecay.NO_PRODUCT); - } - break; - case 2: - if (MbetaDecay(decaysList)) { - return decaysList.toArray(EMDecay.NO_PRODUCT); - } - break; - default: - if (decayMode > 8) { - if (iaeaDecay(decaysList, 0)) { - return decaysList.toArray(EMDecay.NO_PRODUCT); - } - return getDecayArray(decaysList, decayMode - BYTE_OFFSET, false); - } - } - return EMDecay.NO_DECAY; - } else if (getGeneration() == -1) { - EMAtomDefinition anti = getAnti(); - if (anti != null) { - return anti.getDecayArray(decaysList, decayMode, false); - } - } - return getNaturalDecayInstant(); - } - - private boolean iaeaDecay(ArrayList decaysList, long energy) { - EMNuclideIAEA.energeticState state; - if (energy > getIaea().getEnergeticStatesArray().length) { - state = getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length - 1]; - } else if (energy <= 0) { - state = getIaea().getEnergeticStatesArray()[0]; - } else { - state = getIaea().getEnergeticStatesArray()[(int) energy]; - } - for (int i = 0; i < state.decaymodes.length; i++) { - if (!getDecayFromIaea(decaysList, state.decaymodes[i], energy)) { - decaysList.clear(); - return false; - } - } - return !decaysList.isEmpty(); - } - - private boolean getDecayFromIaea(ArrayList decaysList, EMNuclideIAEA.iaeaDecay decay, long energy) { - EMDefinitionStackMap withThis = elementalStacks.toMutable(), newStuff = new EMDefinitionStackMap(); - switch (decay.decayName) { - case "D": { - if (withThis.removeAllAmountsExact(deuterium.getDefinition().getSubParticles())) { - withThis.putReplace(deuterium); - decaysList.add( - new EMDecay( - decay.chance, - withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } - } - break; - case "3H": { - if (withThis.removeAllAmountsExact(tritium.getDefinition().getSubParticles())) { - withThis.putReplace(tritium); - decaysList.add( - new EMDecay( - decay.chance, - withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } - } - break; - case "3HE": { - if (withThis.removeAllAmountsExact(helium_3.getDefinition().getSubParticles())) { - withThis.putReplace(helium_3); - decaysList.add( - new EMDecay( - decay.chance, - withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } - } - break; - case "8BE": { - if (withThis.removeAllAmountsExact(beryllium_8.getDefinition().getSubParticles())) { - withThis.putReplace(beryllium_8); - decaysList.add( - new EMDecay( - decay.chance, - withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } - } - break; - case "14C": { - if (withThis.removeAllAmountsExact(carbon_14.getDefinition().getSubParticles())) { - newStuff.putReplace(carbon_14); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "24NE": { - if (withThis.removeAllAmountsExact(neon_24.getDefinition().getSubParticles())) { - newStuff.putReplace(neon_24); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "34SI": { - if (withThis.removeAllAmountsExact(silicon_34.getDefinition().getSubParticles())) { - newStuff.putReplace(silicon_34); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "A": - case "A?": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2, EMHadronDefinition.hadron_p2)) { - newStuff.putReplace(alpha); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "B+": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1)) { - withThis.putUnifyExact(EMHadronDefinition.hadron_n1); - newStuff.putReplace(EMLeptonDefinition.lepton_e_1); - newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "2B+": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)) { - withThis.putUnifyExact(EMHadronDefinition.hadron_n2); - newStuff.putReplace(EMLeptonDefinition.lepton_e_2); - newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "B-": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)) { - withThis.putUnifyExact(EMHadronDefinition.hadron_p1); - newStuff.putReplace(EMLeptonDefinition.lepton_e1); - newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "2B-": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)) { - withThis.putUnifyExact(EMHadronDefinition.hadron_p2); - newStuff.putReplace(EMLeptonDefinition.lepton_e2); - newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_2); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "EC": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1, EMLeptonDefinition.lepton_e1)) { - withThis.putUnifyExact(EMHadronDefinition.hadron_n1); - newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "2EC": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e2)) { - withThis.putUnifyExact(EMHadronDefinition.hadron_n2); - newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "B++EC": - case "EC+B+": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)) { - withThis.putUnifyExact(EMHadronDefinition.hadron_n2); - newStuff.putReplace(EMLeptonDefinition.lepton_e_1); - newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "B+A": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p3, EMHadronDefinition.hadron_n1)) { - newStuff.putReplace(EMLeptonDefinition.lepton_e_1); - newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(alpha); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "B+P": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)) { - withThis.putUnifyExact(EMHadronDefinition.hadron_n1); - newStuff.putReplace(EMLeptonDefinition.lepton_e_1); - newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(EMHadronDefinition.hadron_p1); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "B+2P": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p3)) { - withThis.putUnifyExact(EMHadronDefinition.hadron_n1); - newStuff.putReplace(EMLeptonDefinition.lepton_e_1); - newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(EMHadronDefinition.hadron_p2); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "B-A": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n3, EMHadronDefinition.hadron_p1)) { - newStuff.putReplace(EMLeptonDefinition.lepton_e1); - newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); - newStuff.putReplace(alpha); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "B-N": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)) { - withThis.putUnifyExact(EMHadronDefinition.hadron_p1); - newStuff.putReplace(EMLeptonDefinition.lepton_e1); - newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); - newStuff.putReplace(EMHadronDefinition.hadron_n1); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "B-2N": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n3)) { - withThis.putUnifyExact(EMHadronDefinition.hadron_p1); - newStuff.putReplace(EMLeptonDefinition.lepton_e1); - newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); - newStuff.putReplace(EMHadronDefinition.hadron_n2); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "B-P": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)) { - newStuff.putReplace(EMLeptonDefinition.lepton_e1); - newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); - newStuff.putReplace(EMHadronDefinition.hadron_p1); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "ECA": { - if (withThis.removeAllAmountsExact( - EMHadronDefinition.hadron_n1, - EMLeptonDefinition.lepton_e1, - EMHadronDefinition.hadron_p3)) { - newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(alpha); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "ECP": { - if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p2)) { - withThis.putUnifyExact(EMHadronDefinition.hadron_n1); - newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(EMHadronDefinition.hadron_p1); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "EC2P": { - if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p3)) { - withThis.putUnifyExact(EMHadronDefinition.hadron_n1); - newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(EMHadronDefinition.hadron_p2); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "ECP+EC2P": { // todo look at branching ratios - if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e2, EMHadronDefinition.hadron_p5)) { - withThis.putUnifyExact(EMHadronDefinition.hadron_n1); - newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); - newStuff.putReplace(EMHadronDefinition.hadron_p3); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "N": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)) { - newStuff.putReplace(EMHadronDefinition.hadron_n1); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "2N": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)) { - newStuff.putReplace(EMHadronDefinition.hadron_n2); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "P": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1)) { - newStuff.putReplace(EMHadronDefinition.hadron_p1); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "2P": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)) { - newStuff.putReplace(EMHadronDefinition.hadron_p2); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "SF": { - if (Fission(decaysList, withThis, newStuff, decay.chance, false)) { - return true; - } - } - break; - case "B-F": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)) { - withThis.putUnifyExact(EMHadronDefinition.hadron_p1); - newStuff.putReplace(EMLeptonDefinition.lepton_e1); - newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); - try { - if (Fission(decaysList, withThis, newStuff, decay.chance, false)) { - return true; - } - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "ECF": - case "ECSF": - case "EC(+SF)": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1, EMLeptonDefinition.lepton_e1)) { - withThis.putUnifyExact(EMHadronDefinition.hadron_n1); - newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); - try { - if (Fission(decaysList, withThis, newStuff, decay.chance, false)) { - return true; - } - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "SF(+EC+B+)": - case "SF+EC+B+": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)) { - withThis.putUnifyExact(EMHadronDefinition.hadron_n2); - newStuff.putReplace(EMLeptonDefinition.lepton_e_1); - newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); - try { - if (Fission(decaysList, withThis, newStuff, decay.chance, false)) { - return true; - } - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "SF+EC+B-": { - if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1)) { - newStuff.putReplace(EMLeptonDefinition.lepton_e1); - newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); - try { - if (Fission(decaysList, withThis, newStuff, decay.chance, false)) { - return true; - } - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "IT": - case "IT?": - case "G": { - if (energy > 0) { - decaysList.add(new EMDecay(decay.chance, this, boson_Y__)); - } else { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Tried to emit Gamma from ground state"); - } - decaysList.add(new EMDecay(decay.chance, this)); - } - return true; - } // break; - case "IT+EC+B+": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)) { - withThis.putUnifyExact(EMHadronDefinition.hadron_n2); - newStuff.putReplace(EMLeptonDefinition.lepton_e_1); - newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); - newStuff.putReplace(EMGaugeBosonDefinition.boson_Y__1); - try { - newStuff.putReplace( - new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()) - .getStackForm(1)); - decaysList.add( - new EMDecay( - decay.chance, - newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } - break; - case "DEAD_END": - decaysList.add(deadEnd); - return true; - default: - throw new Error( - "Unsupported decay mode: " + decay.decayName + ' ' + getNeutralCount() + ' ' + getElement()); - } - if (DEBUG_MODE) { - TecTech.LOGGER.info("Failed to decay " + getElement() + ' ' + getNeutralCount() + ' ' + decay.decayName); - } - return false; - } - - private boolean Emmision(ArrayList decaysList, EMDefinitionStack emit) { - EMDefinitionStackMap tree = elementalStacks.toMutable(); - if (tree.removeAmountExact(emit)) { - try { - decaysList.add( - new EMDecay( - 1, - new EMDefinitionStack( - new EMAtomDefinition( - tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), - 1), - emit)); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - return false; - } - - private boolean alphaDecay(ArrayList decaysList) { - EMDefinitionStackMap tree = elementalStacks.toMutable(); - if (tree.removeAllAmountsExact(alpha.getDefinition().getSubParticles())) { - try { - decaysList.add( - new EMDecay( - 1, - new EMDefinitionStack( - new EMAtomDefinition( - tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), - 1), - alpha)); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - return false; - } - - private boolean MbetaDecay(ArrayList decaysList) { - EMDefinitionStackMap tree = elementalStacks.toMutable(); - if (tree.removeAmountExact(EMHadronDefinition.hadron_n1)) { - try { - tree.putUnifyExact(EMHadronDefinition.hadron_p1); - decaysList.add( - new EMDecay( - 1, - new EMDefinitionStack( - new EMAtomDefinition( - tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), - 1), - EMLeptonDefinition.lepton_e1, - EMNeutrinoDefinition.lepton_Ve_1)); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - return false; - } - - private boolean PbetaDecay(ArrayList decaysList) { - EMDefinitionStackMap tree = elementalStacks.toMutable(); - if (tree.removeAmountExact(EMHadronDefinition.hadron_p1)) { - try { - tree.putUnifyExact(EMHadronDefinition.hadron_n1); - decaysList.add( - new EMDecay( - 1, - new EMDefinitionStack( - new EMAtomDefinition( - tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), - 1), - EMLeptonDefinition.lepton_e_1, - EMNeutrinoDefinition.lepton_Ve1)); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - return false; - } - - private boolean ElectronCapture(ArrayList decaysList) { - EMDefinitionStackMap tree = elementalStacks.toMutable(); - if (tree.removeAllAmountsExact(EMHadronDefinition.hadron_p1, EMLeptonDefinition.lepton_e1)) { - try { - tree.putUnifyExact(EMHadronDefinition.hadron_n1); - decaysList.add( - new EMDecay( - 1, - new EMDefinitionStack( - new EMAtomDefinition( - tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), - 1), - EMNeutrinoDefinition.lepton_Ve1)); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - return false; - } - - private boolean Fission(ArrayList decaysList, EMDefinitionStackMap fissile, EMDefinitionStackMap particles, - double probability, boolean spontaneousCheck) { - EMDefinitionStackMap heavy = new EMDefinitionStackMap(); - double[] liquidDrop = liquidDropFunction(abs(getElement()) <= 97); - - for (EMDefinitionStack stack : fissile.valuesToArray()) { - if (spontaneousCheck && stack.getDefinition() instanceof EMHadronDefinition - && (stack.getAmount() <= 80 - || stack.getAmount() < 90 && XSTR_INSTANCE.nextInt(10) < stack.getAmount() - 80)) { - return false; - } - if (stack.getDefinition().getCharge() == 0) { - // if(stack.definition instanceof dHadronDefinition){ - double neutrals = stack.getAmount() * liquidDrop[2]; - int neutrals_cnt = (int) Math.floor(neutrals); - neutrals_cnt += neutrals - neutrals_cnt > XSTR_INSTANCE.nextDouble() ? 1 : 0; - particles.putUnifyExact(new EMDefinitionStack(stack.getDefinition(), neutrals_cnt)); - - int heavy_cnt = (int) Math.ceil(stack.getAmount() * liquidDrop[1]); - while (heavy_cnt + neutrals_cnt > stack.getAmount()) { - heavy_cnt--; - } - fissile.removeAmountExact(new EMDefinitionStack(stack.getDefinition(), heavy_cnt + neutrals_cnt)); - heavy.putReplace(new EMDefinitionStack(stack.getDefinition(), heavy_cnt)); - // }else{ - // particles.add(stack); - // light.remove(stack.definition); - // } - } else { - int heavy_cnt = (int) Math.ceil(stack.getAmount() * liquidDrop[0]); - if (heavy_cnt % 2 == 1 && XSTR_INSTANCE.nextDouble() > 0.05D) { - heavy_cnt--; - } - EMDefinitionStack new_stack = new EMDefinitionStack(stack.getDefinition(), heavy_cnt); - fissile.removeAmountExact(new_stack); - heavy.putReplace(new_stack); - } - } - - try { - particles.putReplace( - new EMDefinitionStack( - new EMAtomDefinition(fissile.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), - 1)); - particles.putReplace( - new EMDefinitionStack( - new EMAtomDefinition(heavy.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), - 1)); - decaysList - .add(new EMDecay(probability, particles.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - return false; - } - - private static double[] liquidDropFunction(boolean asymmetric) { - double[] out = new double[3]; - - out[0] = XSTR_INSTANCE.nextGaussian(); - - if (out[0] < 1 && out[0] >= -1) { - if (XSTR_INSTANCE.nextBoolean()) { - out[0] = XSTR_INSTANCE.nextDouble() * 2d - 1d; - } - } - - if (asymmetric && out[0] > XSTR_INSTANCE.nextDouble() && XSTR_INSTANCE.nextInt(4) == 0) { - out[0] = -out[0]; - } - - // scale to splitting ratio - out[0] = out[0] * 0.05d + .6d; - - if (out[0] < 0 || out[0] > 1) { - return liquidDropFunction(asymmetric); - } - if (out[0] < .5d) { - out[0] = 1d - out[0]; - } - - // extra neutrals - out[2] = 0.012d + XSTR_INSTANCE.nextDouble() * 0.01d; - - if (asymmetric) { - out[1] = out[0]; - } else { - out[1] = out[0] - out[2] * .5d; - } - - return out; - } - - @Override - public EMDecay[] getEnergyInducedDecay(long energyLevel) { - if (iaeaDefinitionExistsAndHasEnergyLevels) { - ArrayList decays = new ArrayList<>(4); - if (iaeaDecay(decays, energyLevel)) { - return decays.toArray(EMDecay.NO_PRODUCT); - } - } - if (energyLevel < abs(getCharge()) / 3 + getNeutralCount()) { - return new EMDecay[] { new EMDecay(1, this, boson_Y__) }; - } - return getNaturalDecayInstant(); - } - - @Override - public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { - if (iaeaDefinitionExistsAndHasEnergyLevels) { - double result = 0; - boolean backwards = newEnergyLevel < currentEnergyLevel; - if (backwards) { - long temp = currentEnergyLevel; - currentEnergyLevel = newEnergyLevel; - newEnergyLevel = temp; - } - - if (currentEnergyLevel <= 0) { - if (newEnergyLevel <= 0) { - return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); - } else { - result += IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * -currentEnergyLevel; - } - } else { - result -= getIaea().getEnergeticStatesArray()[(int) Math - .min(getIaea().getEnergeticStatesArray().length - 1, currentEnergyLevel)].energy; - } - if (newEnergyLevel >= getIaea().getEnergeticStatesArray().length) { - if (currentEnergyLevel >= getIaea().getEnergeticStatesArray().length) { - return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); - } else { - result += IEMDefinition.DEFAULT_ENERGY_REQUIREMENT - * (newEnergyLevel - getIaea().getEnergeticStatesArray().length + 1); - } - result += getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length - 1].energy; - } else { - result += getIaea().getEnergeticStatesArray()[(int) newEnergyLevel].energy; - } - - return backwards ? -result : result; - } - return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); - } - - @Override - public boolean usesSpecialEnergeticDecayHandling() { - return iaeaDefinitionExistsAndHasEnergyLevels; - } - - @Override - public boolean usesMultipleDecayCalls(long energyLevel) { - if (!iaeaDefinitionExistsAndHasEnergyLevels) return false; - EMNuclideIAEA.energeticState state; - if (energyLevel > getIaea().getEnergeticStatesArray().length) { - state = getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length - 1]; - } else if (energyLevel <= 0) { - state = getIaea().getEnergeticStatesArray()[0]; - } else { - state = getIaea().getEnergeticStatesArray()[(int) energyLevel]; - } - for (EMNuclideIAEA.iaeaDecay decay : state.decaymodes) { - if (decay.decayName.contains("F")) return true; // if is fissile - } - return false; - } - - @Override - public boolean decayMakesEnergy(long energyLevel) { - return iaeaDefinitionExistsAndHasEnergyLevels; - } - - @Override - public boolean fusionMakesEnergy(long energyLevel) { - return getIaea() != null || iaeaDefinitionExistsAndHasEnergyLevels; - } - - @Override - public EMDecay[] getNaturalDecayInstant() { - // disembody - ArrayList decaysInto = new ArrayList<>(); - for (EMDefinitionStack elementalStack : elementalStacks.valuesToArray()) { - if (elementalStack.getDefinition().getGeneration() == 1 - || elementalStack.getDefinition().getGeneration() == -1) { - // covers both quarks and antiquarks - decaysInto.add(elementalStack); - } else { - // covers both quarks and antiquarks - decaysInto.add(new EMDefinitionStack(boson_Y__, 2)); - } - } - return new EMDecay[] { new EMDecay(0.75D, decaysInto.toArray(new EMDefinitionStack[0])), deadEnd }; - } - - @Override - public EMAtomDefinition getAnti() { - EMDefinitionStackMap anti = new EMDefinitionStackMap(); - for (EMDefinitionStack stack : elementalStacks.valuesToArray()) { - anti.putReplace(new EMDefinitionStack(stack.getDefinition().getAnti(), stack.getAmount())); - } - try { - return new EMAtomDefinition(anti.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - } catch (EMException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return null; - } - } - - public EMNuclideIAEA getIaea() { - return iaea; - } - - public byte getDecayMode() { - return decayMode; - } - - public int getNeutralCount() { - return neutralCount; - } - - public int getElement() { - return element; - } - - @Override - protected String getTagValue() { - return nbtType; - } - - public static void run(EMDefinitionsRegistry registry) { - registry.registerDefinitionClass( - nbtType, - new EMIndirectType( - (definitionsRegistry, - nbt) -> new EMAtomDefinition(EMConstantStackMap.fromNBT(definitionsRegistry, nbt)), - EMAtomDefinition.class, - "tt.keyword.Element")); - EMNuclideIAEA.run(); - - for (Runnable r : overrides) { - r.run(); - } - - for (Map.Entry entry : lifetimeOverrides.entrySet()) { - try { - lifetimeOverrides.put(new EMAtomDefinition(entry.getKey().elementalStacks), entry.getValue()); - } catch (EMException e) { - e.printStackTrace(); // Impossible - } - } - - // populate stable isotopes - for (int element = 1; element < 83; element++) { // Up to Bismuth exclusive - for (int isotope = 0; isotope < 130; isotope++) { - xstr.setSeed((long) (element + 1) * (isotope + 100)); - // stability curve - int StableIsotope = stableIzoCurve(element); - int izoDiff = isotope - StableIsotope; - int izoDiffAbs = abs(izoDiff); - double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); - EMNuclideIAEA nuclide = EMNuclideIAEA.get(element, isotope); - if (rawLifeTime >= STABLE_RAW_LIFE_TIME - || nuclide != null && nuclide.getHalfTime() >= STABLE_RAW_LIFE_TIME) { - TreeSet isotopes = stableIsotopes.computeIfAbsent(element, k -> new TreeSet<>()); - isotopes.add(isotope); - } - } - } - - // populate unstable isotopes - for (int element = 1; element < 150; element++) { - for (int isotope = 100; isotope < 180; isotope++) { - xstr.setSeed((long) (element + 1) * (isotope + 100)); - // stability curve - int Isotope = stableIzoCurve(element); - int izoDiff = isotope - Isotope; - int izoDiffAbs = abs(izoDiff); - double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); - TreeMap isotopes = mostStableUnstableIsotopes - .computeIfAbsent(element, k -> new TreeMap<>()); - isotopes.put(rawLifeTime, isotope); // todo dont add stable ones - } - } - - try { - for (Map.Entry> integerTreeSetEntry : stableIsotopes.entrySet()) { - stableAtoms.put( - integerTreeSetEntry.getKey(), - new EMAtomDefinition( - new EMDefinitionStack(EMHadronDefinition.hadron_p, integerTreeSetEntry.getKey()), - new EMDefinitionStack( - EMHadronDefinition.hadron_n, - integerTreeSetEntry.getValue().first()), - new EMDefinitionStack(EMLeptonDefinition.lepton_e, integerTreeSetEntry.getKey()))); - if (DEBUG_MODE) { - TecTech.LOGGER.info( - "Added Stable Atom:" + integerTreeSetEntry.getKey() - + ' ' - + integerTreeSetEntry.getValue().first() - + ' ' - + stableAtoms.get(integerTreeSetEntry.getKey()).getMass()); - } - } - for (Map.Entry> integerTreeMapEntry : mostStableUnstableIsotopes - .entrySet()) { - unstableAtoms.put( - integerTreeMapEntry.getKey(), - new EMAtomDefinition( - new EMDefinitionStack(EMHadronDefinition.hadron_p, integerTreeMapEntry.getKey()), - new EMDefinitionStack( - EMHadronDefinition.hadron_n, - integerTreeMapEntry.getValue().lastEntry().getValue()), - new EMDefinitionStack(EMLeptonDefinition.lepton_e, integerTreeMapEntry.getKey()))); - if (DEBUG_MODE) { - TecTech.LOGGER.info( - "Added Unstable Atom:" + integerTreeMapEntry.getKey() - + ' ' - + integerTreeMapEntry.getValue().lastEntry().getValue() - + ' ' - + unstableAtoms.get(integerTreeMapEntry.getKey()).getMass()); - } - } - - deuterium = new EMAtomDefinition( - EMHadronDefinition.hadron_p1, - EMHadronDefinition.hadron_n1, - EMLeptonDefinition.lepton_e1).getStackForm(1); - registry.registerForDisplay(deuterium.getDefinition()); - - tritium = new EMAtomDefinition( - EMHadronDefinition.hadron_p1, - EMHadronDefinition.hadron_n2, - EMLeptonDefinition.lepton_e1).getStackForm(1); - registry.registerForDisplay(tritium.getDefinition()); - - helium_3 = new EMAtomDefinition( - EMHadronDefinition.hadron_p2, - EMHadronDefinition.hadron_n1, - EMLeptonDefinition.lepton_e2).getStackForm(1); - registry.registerForDisplay(helium_3.getDefinition()); - - alpha = new EMAtomDefinition(EMHadronDefinition.hadron_p2, EMHadronDefinition.hadron_n2).getStackForm(1); - registry.registerForDisplay(alpha.getDefinition()); - - beryllium_8 = new EMAtomDefinition( - new EMDefinitionStack(EMHadronDefinition.hadron_p, 4), - new EMDefinitionStack(EMHadronDefinition.hadron_n, 4), - new EMDefinitionStack(EMLeptonDefinition.lepton_e, 4)).getStackForm(1); - registry.registerForDisplay(beryllium_8.getDefinition()); - - carbon_14 = new EMAtomDefinition( - new EMDefinitionStack(EMHadronDefinition.hadron_p, 6), - new EMDefinitionStack(EMHadronDefinition.hadron_n, 8), - new EMDefinitionStack(EMLeptonDefinition.lepton_e, 6)).getStackForm(1); - registry.registerForDisplay(carbon_14.getDefinition()); - - neon_24 = new EMAtomDefinition( - new EMDefinitionStack(EMHadronDefinition.hadron_p, 10), - new EMDefinitionStack(EMHadronDefinition.hadron_n, 14), - new EMDefinitionStack(EMLeptonDefinition.lepton_e, 10)).getStackForm(1); - registry.registerForDisplay(neon_24.getDefinition()); - - silicon_34 = new EMAtomDefinition( - new EMDefinitionStack(EMHadronDefinition.hadron_p, 14), - new EMDefinitionStack(EMHadronDefinition.hadron_n, 20), - new EMDefinitionStack(EMLeptonDefinition.lepton_e, 14)).getStackForm(1); - registry.registerForDisplay(silicon_34.getDefinition()); - - uranium_238 = new EMAtomDefinition( - new EMDefinitionStack(EMLeptonDefinition.lepton_e, 92), - new EMDefinitionStack(EMHadronDefinition.hadron_p, 92), - new EMDefinitionStack(EMHadronDefinition.hadron_n, 146)).getStackForm(1); - registry.registerForDisplay(uranium_238.getDefinition()); - - uranium_235 = new EMAtomDefinition( - new EMDefinitionStack(EMLeptonDefinition.lepton_e, 92), - new EMDefinitionStack(EMHadronDefinition.hadron_p, 92), - new EMDefinitionStack(EMHadronDefinition.hadron_n, 143)).getStackForm(1); - registry.registerForDisplay(uranium_235.getDefinition()); - - TecTech.LOGGER.info( - "Diff Mass U : " + (uranium_238.getDefinition().getMass() - uranium_235.getDefinition().getMass())); - - plutonium_239 = new EMAtomDefinition( - new EMDefinitionStack(EMLeptonDefinition.lepton_e, 94), - new EMDefinitionStack(EMHadronDefinition.hadron_p, 94), - new EMDefinitionStack(EMHadronDefinition.hadron_n, 145)).getStackForm(1); - registry.registerForDisplay(plutonium_239.getDefinition()); - - plutonium_241 = new EMAtomDefinition( - new EMDefinitionStack(EMLeptonDefinition.lepton_e, 94), - new EMDefinitionStack(EMHadronDefinition.hadron_p, 94), - new EMDefinitionStack(EMHadronDefinition.hadron_n, 147)).getStackForm(1); - registry.registerForDisplay(plutonium_241.getDefinition()); - - TecTech.LOGGER.info( - "Diff Mass Pu: " - + (plutonium_241.getDefinition().getMass() - plutonium_239.getDefinition().getMass())); - - somethingHeavy = (EMAtomDefinition) plutonium_241.getDefinition(); - - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - - if (DEBUG_MODE) { - TecTech.LOGGER.info("Registered Elemental Matter Class: Atom " + nbtType + ' ' + getClassTypeStatic()); - } - - for (int i = 1; i <= 118; i++) { - EMAtomDefinition firstStableIsotope = getFirstStableIsotope(i); - if (firstStableIsotope == null) { - firstStableIsotope = getBestUnstableIsotope(i); - if (firstStableIsotope == null) { - continue; - } - } - registry.registerForDisplay(firstStableIsotope); - } - } - - public static void setTransformations(EMTransformationRegistry transformationInfo) { - /*----STABLE ATOMS----**/ - refMass = getFirstStableIsotope(1).getMass() * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; - - transformationInfo.addFluid( - new EMDefinitionStack(getFirstStableIsotope(1), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - Hydrogen.mGas, - 144); - transformationInfo.addFluid( - new EMDefinitionStack(getFirstStableIsotope(2), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - Helium.mGas, - 144); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(3), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Lithium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(4), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Beryllium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(5), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Boron, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(6), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Carbon, - 1); - transformationInfo.addFluid( - new EMDefinitionStack(getFirstStableIsotope(7), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - Nitrogen.mGas, - 144); - transformationInfo.addFluid( - new EMDefinitionStack(getFirstStableIsotope(8), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - Oxygen.mGas, - 144); - transformationInfo.addFluid( - new EMDefinitionStack(getFirstStableIsotope(9), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - Fluorine.mGas, - 144); - - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(11), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Sodium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(12), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Magnesium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(13), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Aluminium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(14), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Silicon, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(15), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Phosphorus, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(16), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Sulfur, - 1); - transformationInfo.addFluid( - new EMDefinitionStack(getFirstStableIsotope(17), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - Argon.mGas, - 144); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(19), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Potassium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(20), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Calcium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(21), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Scandium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(22), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Titanium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(23), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Vanadium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(24), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Chrome, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(25), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Manganese, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(26), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Iron, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(27), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Cobalt, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(28), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Nickel, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(29), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Copper, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(30), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Zinc, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(31), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Gallium, - 1); - - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(33), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Arsenic, - 1); - - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(37), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Rubidium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(38), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Strontium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(39), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Yttrium, - 1); - - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(41), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Niobium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(42), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Molybdenum, - 1); - - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(46), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Palladium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(47), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Silver, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(48), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Cadmium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(49), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Indium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(50), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Tin, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(51), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Antimony, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(52), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Tellurium, - 1); - - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(55), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Caesium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(56), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Barium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(57), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Lanthanum, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(58), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Cerium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(59), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Praseodymium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(60), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Neodymium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(62), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Samarium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(63), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Europium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(64), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Gadolinium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(65), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Terbium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(66), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Dysprosium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(67), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Holmium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(68), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Erbium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(69), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Thulium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(70), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Ytterbium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(71), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Lutetium, - 1); - - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(73), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Tantalum, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(74), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Tungsten, - 1); - - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(76), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Osmium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(77), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Iridium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(78), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Platinum, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(79), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Gold, - 1); - transformationInfo.addFluid( - new EMDefinitionStack(getFirstStableIsotope(80), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - Mercury.mFluid, - 144); - - transformationInfo.addOredict( - new EMDefinitionStack(getFirstStableIsotope(82), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Lead, - 1); - - /*----UNSTABLE ATOMS----**/ - refUnstableMass = getFirstStableIsotope(82).getMass() * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; - - transformationInfo.addOredict( - new EMDefinitionStack(getBestUnstableIsotope(61), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Promethium, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(getBestUnstableIsotope(83), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Bismuth, - 1); - - transformationInfo.addFluid( - new EMDefinitionStack(getBestUnstableIsotope(86), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - Radon.mGas, - 144); - - transformationInfo.addOredict( - new EMDefinitionStack(getBestUnstableIsotope(90), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Thorium, - 1); - - transformationInfo.addOredict( - new EMDefinitionStack(getBestUnstableIsotope(95), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Americium, - 1); - - transformationInfo.addFluid( - new EMDefinitionStack(deuterium.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - Deuterium.mGas, - 144); - transformationInfo.addFluid( - new EMDefinitionStack(tritium.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - Tritium.mGas, - 144); - transformationInfo.addFluid( - new EMDefinitionStack(helium_3.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - Helium_3.mGas, - 144); - - transformationInfo.addOredict( - new EMDefinitionStack(uranium_238.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Uranium /* 238 */, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(uranium_235.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Uranium235, - 1); - - transformationInfo.addOredict( - new EMDefinitionStack(plutonium_239.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Plutonium /* 239 */, - 1); - transformationInfo.addOredict( - new EMDefinitionStack(plutonium_241.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), - dust, - Plutonium241, - 1); - } - - public static EMAtomDefinition getFirstStableIsotope(int element) { - return stableAtoms.get(element); - } - - public static EMAtomDefinition getBestUnstableIsotope(int element) { - return unstableAtoms.get(element); - } - - @Override - public int getMatterMassType() { - return getClassTypeStatic(); - } - - public static int getClassTypeStatic() { - return 64; - } - - @Override - public int hashCode() { - return hash; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java deleted file mode 100644 index 701143c09..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java +++ /dev/null @@ -1,480 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.boson_Y__; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; -import static net.minecraft.util.StatCollector.translateToLocal; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import net.minecraftforge.oredict.OreDictionary; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMComplexTemplate; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictQuantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.OreDictionaryStack; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition; - -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; - -/** - * Created by danie_000 on 17.11.2016. - */ -public class EMHadronDefinition extends EMComplexTemplate { // TODO Optimize map i/o - - private final int hash; - - private static final String nbtType = "h"; - // Helpers - public static final Map SYMBOL_MAP = new HashMap<>(); - public static final Map UNLOCALIZED_NAME_MAP = new HashMap<>(); - public static EMHadronDefinition hadron_p, hadron_n, hadron_p_, hadron_n_; - public static EMDefinitionStack hadron_p1, hadron_n1, hadron_p2, hadron_n2, hadron_p3, hadron_n3, hadron_p5; - private static double protonMass = 0D; - private static double neutronMass = 0D; - private static final double actualProtonMass = 938272081.3D; - private static final double actualNeutronMass = 939565413.3D; - - // float-mass in eV/c^2 - private final double mass; - // int -electric charge in 1/3rds of electron charge for optimization - private final int charge; - private final double rawLifeTime; - private final int amount; - // generation max present inside - minus if contains any antiquark - private final byte type; - - private final EMConstantStackMap quarkStacks; - - public EMHadronDefinition(EMDefinitionStack... quarks) throws EMException { - this(true, new EMConstantStackMap(quarks)); - } - - private EMHadronDefinition(boolean check, EMDefinitionStack... quarks) throws EMException { - this(check, new EMConstantStackMap(quarks)); - } - - public EMHadronDefinition(EMConstantStackMap quarks) throws EMException { - this(true, quarks); - } - - private EMHadronDefinition(boolean check, EMConstantStackMap quarks) throws EMException { - if (check && !canTheyBeTogether(quarks)) { - throw new EMException("Hadron Definition error"); - } - quarkStacks = quarks; - - int amount = 0; - int charge = 0; - int type = 0; - boolean containsAnti = false; - double mass = 0; - for (EMDefinitionStack quarkStack : quarkStacks.valuesToArray()) { - amount += quarkStack.getAmount(); - if ((int) quarkStack.getAmount() != quarkStack.getAmount()) { - throw new ArithmeticException("Amount cannot be safely converted to int!"); - } - mass += quarkStack.getMass(); - charge += quarkStack.getCharge(); - type = Math.max(Math.abs(quarkStack.getDefinition().getGeneration()), type); - if (quarkStack.getDefinition().getGeneration() < 0) { - containsAnti = true; - } - } - this.amount = amount; - this.charge = charge; - this.type = containsAnti ? (byte) -type : (byte) type; - long mult = (long) this.getAmount() * this.getAmount() * (this.getAmount() - 1); - mass = mass * 5.543D * mult; // yes it becomes heavier - - if (mass == protonMass && this.getAmount() == 3) { - rawLifeTime = IEMDefinition.STABLE_RAW_LIFE_TIME; - mass = actualProtonMass; - } else if (mass == neutronMass && this.getAmount() == 3) { - rawLifeTime = 882D; - mass = actualNeutronMass; - } else { - if (this.getAmount() == 3) { - rawLifeTime = 1.34D / mass * Math.pow(9.81, charge); - } else if (this.getAmount() == 2) { - rawLifeTime = 1.21D / mass / Math.pow(19.80, charge); - } else { - rawLifeTime = 1.21D / mass / Math.pow(9.80, charge); - } - } - this.mass = mass; - hash = super.hashCode(); - } - - // public but u can just try{}catch(){} the constructor it still calls this method - private static boolean canTheyBeTogether(EMConstantStackMap stacks) { - long amount = 0; - for (EMDefinitionStack quarks : stacks.valuesToArray()) { - if (!(quarks.getDefinition() instanceof EMQuarkDefinition)) { - return false; - } - if ((int) quarks.getAmount() != quarks.getAmount()) { - throw new ArithmeticException("Amount cannot be safely converted to int!"); - } - amount += quarks.getAmount(); - } - return amount >= 2 && amount <= 12; - } - - @Override - public String getShortLocalizedName() { - StringBuilder name = new StringBuilder(); - String sym = translateToLocal(UNLOCALIZED_NAME_MAP.get(this)); - if (sym != null) { - name.append(' ').append(sym); - } else { - for (EMDefinitionStack quark : quarkStacks.valuesToArray()) { - name.append(' ').append(quark.getDefinition().getSymbol()).append((int) quark.getAmount()); - } - } - return name.toString(); - } - - @Override - public String getLocalizedTypeName() { - switch (getAmount()) { - case 2: - return translateToLocal("tt.keyword.Meson"); - case 3: - return translateToLocal("tt.keyword.Baryon"); - case 4: - return translateToLocal("tt.keyword.Tetraquark"); - case 5: - return translateToLocal("tt.keyword.Pentaquark"); - case 6: - return translateToLocal("tt.keyword.Hexaquark"); - default: - return translateToLocal("tt.keyword.Hadron"); - } - } - - @Override - public String getSymbol() { - String sym = SYMBOL_MAP.get(this); - if (sym != null) { - return sym; - } else { - StringBuilder symbol = new StringBuilder(8); - for (EMDefinitionStack quark : quarkStacks.valuesToArray()) { - for (int i = 0; i < quark.getAmount(); i++) { - symbol.append(quark.getDefinition().getSymbol()); - } - } - return symbol.toString(); - } - } - - @Override - public String getShortSymbol() { - String sym = SYMBOL_MAP.get(this); - if (sym != null) { - return sym; - } else { - StringBuilder symbol = new StringBuilder(8); - for (EMDefinitionStack quark : quarkStacks.valuesToArray()) { - for (int i = 0; i < quark.getAmount(); i++) { - symbol.append(quark.getDefinition().getShortSymbol()); - } - } - return symbol.toString(); - } - } - - @Override - public int getMaxColors() { - return -7; - } - - @Override - public EMConstantStackMap getSubParticles() { - return quarkStacks; - } - - @Override - public EMDecay[] getNaturalDecayInstant() { - EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); - if (getAmount() == 2 && quarkStacks.length == 2 - && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() - && quarkStacks[0].getDefinition().getGeneration() == -quarkStacks[1].getDefinition().getGeneration()) { - return EMDecay.NO_PRODUCT; - } - ArrayList decaysInto = new ArrayList<>(); - for (EMDefinitionStack quarks : quarkStacks) { - if (quarks.getDefinition().getGeneration() == 1 || quarks.getDefinition().getGeneration() == -1) { - // covers both quarks and antiquarks - decaysInto.add(quarks); - } else { - // covers both quarks and antiquarks - decaysInto.add(new EMDefinitionStack(boson_Y__, 2)); - } - } - return new EMDecay[] { new EMDecay(0.75D, decaysInto.toArray(new EMDefinitionStack[0])), deadEnd }; - } - - @Override - public EMDecay[] getEnergyInducedDecay(long energyLevel) { - EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); - if (getAmount() == 2 && quarkStacks.length == 2 - && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() - && quarkStacks[0].getDefinition().getGeneration() == -quarkStacks[1].getDefinition().getGeneration()) { - return EMDecay.NO_PRODUCT; - } - return new EMDecay[] { new EMDecay(0.75D, quarkStacks), deadEnd }; // decay into quarks - } - - @Override - public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { - return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); - } - - @Override - public boolean usesSpecialEnergeticDecayHandling() { - return false; - } - - @Override - public boolean usesMultipleDecayCalls(long energyLevel) { - return false; - } - - @Override - public boolean decayMakesEnergy(long energyLevel) { - return false; - } - - @Override - public boolean fusionMakesEnergy(long energyLevel) { - return false; - } - - @Override - public EMDecay[] getDecayArray() { - EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); - if (getAmount() == 2 && quarkStacks.length == 2 - && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() - && quarkStacks[0].getDefinition().getGeneration() == -quarkStacks[1].getDefinition().getGeneration()) { - return EMDecay.NO_PRODUCT; - } else if (getAmount() != 3) { - return new EMDecay[] { new EMDecay(0.95D, quarkStacks), deadEnd }; // decay into quarks - } else { - ArrayList newBaryon = new ArrayList<>(); - IEMDefinition[] Particles = new IEMDefinition[2]; - for (EMDefinitionStack quarks : quarkStacks) { - for (int i = 0; i < quarks.getAmount(); i++) { - newBaryon.add((EMQuarkDefinition) quarks.getDefinition()); - } - } - // remove last - EMQuarkDefinition lastQuark = newBaryon.remove(2); - - EMDefinitionStack[] decay; - if (Math.abs(lastQuark.getGeneration()) > 1) { - decay = lastQuark.getDecayArray()[1].getOutputStacks().valuesToArray(); - } else { - decay = lastQuark.getDecayArray()[2].getOutputStacks().valuesToArray(); - } - newBaryon.add((EMQuarkDefinition) decay[0].getDefinition()); - Particles[0] = decay[1].getDefinition(); - Particles[1] = decay[2].getDefinition(); - - EMDefinitionStack[] contentOfBaryon = newBaryon.stream() - .map(eQuarkDefinition -> new EMDefinitionStack(eQuarkDefinition, 1)) - .toArray(EMDefinitionStack[]::new); - - try { - return new EMDecay[] { - new EMDecay( - 0.001D, - new EMHadronDefinition(false, contentOfBaryon), - Particles[0], - Particles[1], - boson_Y__), - new EMDecay(0.99D, new EMHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1]), - deadEnd }; - } catch (EMException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return new EMDecay[] { deadEnd }; - } - } - } - - @Override - public double getMass() { - return mass; - } - - @Override - public int getCharge() { - return charge; - } - - @Override - public double getRawTimeSpan(long currentEnergy) { - return getRawLifeTime(); - } - - @Override - public boolean isTimeSpanHalfLife() { - return true; - } - - @Override - public int getGeneration() { - return type; - } - - @Override - public IEMDefinition getAnti() { - EMDefinitionStackMap anti = new EMDefinitionStackMap(); - for (EMDefinitionStack stack : quarkStacks.valuesToArray()) { - anti.putReplace(new EMDefinitionStack(stack.getDefinition().getAnti(), stack.getAmount())); - } - try { - return new EMHadronDefinition(anti.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - } catch (EMException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return null; - } - } - - @Override - protected String getTagValue() { - return nbtType; - } - - public static void run(EMDefinitionsRegistry registry) { - registry.registerDefinitionClass( - nbtType, - new EMIndirectType( - (definitionsRegistry, - nbt) -> new EMHadronDefinition(EMConstantStackMap.fromNBT(definitionsRegistry, nbt)), - EMHadronDefinition.class, - "tt.keyword.Hadron")); - try { - hadron_p = new EMHadronDefinition( - new EMConstantStackMap( - EMQuarkDefinition.quark_u.getStackForm(2), - EMQuarkDefinition.quark_d.getStackForm(1))); - protonMass = hadron_p.getMass(); - // redefine the proton with proper lifetime (the lifetime is based on mass comparison) - hadron_p = new EMHadronDefinition( - new EMConstantStackMap( - EMQuarkDefinition.quark_u.getStackForm(2), - EMQuarkDefinition.quark_d.getStackForm(1))); - SYMBOL_MAP.put(hadron_p, "p"); - UNLOCALIZED_NAME_MAP.put(hadron_p, "tt.keyword.Proton"); - registry.registerForDisplay(hadron_p); - registry.registerDirectDefinition("p", hadron_p); - - hadron_p_ = (EMHadronDefinition) hadron_p.getAnti(); - SYMBOL_MAP.put(hadron_p_, "~p"); - UNLOCALIZED_NAME_MAP.put(hadron_p_, "tt.keyword.AntiProton"); - registry.registerForDisplay(hadron_p_); - registry.registerDirectDefinition("~p", hadron_p_); - - hadron_n = new EMHadronDefinition( - new EMConstantStackMap( - EMQuarkDefinition.quark_u.getStackForm(1), - EMQuarkDefinition.quark_d.getStackForm(2))); - neutronMass = hadron_n.getMass(); - // redefine the neutron with proper lifetime (the lifetime is based on mass comparison) - hadron_n = new EMHadronDefinition( - new EMConstantStackMap( - EMQuarkDefinition.quark_u.getStackForm(1), - EMQuarkDefinition.quark_d.getStackForm(2))); - SYMBOL_MAP.put(hadron_n, "n"); - UNLOCALIZED_NAME_MAP.put(hadron_n, "tt.keyword.Neutron"); - registry.registerForDisplay(hadron_n); - registry.registerDirectDefinition("n", hadron_n); - - hadron_n_ = (EMHadronDefinition) hadron_n.getAnti(); - SYMBOL_MAP.put(hadron_n_, "~n"); - UNLOCALIZED_NAME_MAP.put(hadron_n_, "tt.keyword.AntiNeutron"); - registry.registerForDisplay(hadron_n_); - registry.registerDirectDefinition("~n", hadron_n_); - - TecTech.LOGGER.info("Old Neutron Mass: " + neutronMass); - TecTech.LOGGER.info("Old Proton Mass: " + protonMass); - TecTech.LOGGER.info("New Neutron Mass: " + EMHadronDefinition.hadron_n.getMass()); - TecTech.LOGGER.info("New Proton Mass: " + EMHadronDefinition.hadron_p.getMass()); - } catch (EMException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - protonMass = -1; - neutronMass = -1; - } - hadron_p1 = new EMDefinitionStack(hadron_p, 1D); - hadron_n1 = new EMDefinitionStack(hadron_n, 1D); - hadron_p2 = new EMDefinitionStack(hadron_p, 2D); - hadron_n2 = new EMDefinitionStack(hadron_n, 2D); - hadron_p3 = new EMDefinitionStack(hadron_p, 3D); - hadron_n3 = new EMDefinitionStack(hadron_n, 3D); - hadron_p5 = new EMDefinitionStack(hadron_p, 5D); - - if (DEBUG_MODE) { - TecTech.LOGGER.info("Registered Elemental Matter Class: Hadron " + nbtType + ' ' + getClassTypeStatic()); - } - } - - public static void setTransformations(EMTransformationRegistry transformationInfo) { // Todo use Neutronium atom? - // Added to atom map, but should be in its own - EMDefinitionStack neutrons = new EMDefinitionStack(hadron_n, 1000 * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED); - EMDequantizationInfo emDequantizationInfo = new EMDequantizationInfo(neutrons); - emDequantizationInfo.setOre( - new OreDictionaryStack( - 1, - OreDictionary.getOreID(OrePrefixes.dust.name() + Materials.Neutronium.mName))); // todo shitty - // looking, but - // works... - transformationInfo.getInfoMap().put(neutrons.getDefinition(), emDequantizationInfo); - transformationInfo.getOredictQuantization().put( - OreDictionary.getOreID(OrePrefixes.ingotHot.name() + Materials.Neutronium.mName), - new EMOredictQuantizationInfo(OrePrefixes.ingotHot, Materials.Neutronium, 1, neutrons)); - } - - @Override - public int getMatterMassType() { - return getClassTypeStatic(); - } - - public static int getClassTypeStatic() { - return -64; - } - - @Override - public int hashCode() { - return hash; - } - - public double getRawLifeTime() { - return rawLifeTime; - } - - public int getAmount() { - return amount; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMNuclideIAEA.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMNuclideIAEA.java deleted file mode 100644 index f86dc9c96..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMNuclideIAEA.java +++ /dev/null @@ -1,343 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition.STABLE_RAW_LIFE_TIME; -import static com.github.technus.tectech.util.TT_Utility.splitButDifferent; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.TreeMap; - -public final class EMNuclideIAEA { - - public static final double AMU_TO_EV_DIV_C_C = 9.31494061E08D, MICRO_AMU_TO_EV_DIV_C_C = 9.31494061E02D; - - // Nuclide T1/2 T1/2 [s] Decay Modes ? Q Q?- Q? QEC Q?- n Sn Sp Binding/A Atomic Mass Mass - // Excess Discovery - // Abund. [mole fract.] BR [%] [?N] [barn] [keV] [keV] [keV] [keV] [keV] [keV] [keV] [? AMU] [keV] - - // Z,N,symb,radius, unc, energy, unc, jp, half-life operator, half_life, unc,unit, half_life [s], unc, decay, decay - // %, unc, decay, decay %, unc, decay, decay %, unc,isospin,magn. dipole, unc, elect. quad , unc,Qb-,unc,Qb- - // n,unc,Qa, unc, Qec, unc,Sn,unc, Sp,unc,Binding/A,unc,atomic mass, unc, mass excess,unc, - // Z,N,symbol,energy , unc, jp,half-life operator, half_life, unc,unit, half_life [s], unc, decay, decay %, unc, - // decay, decay %, unc, decay, decay %, unc,isospin,magn. dipole, unc, elect. quadrupole , unc, - private static final HashMap NUCLIDES = new HashMap<>(); - - public static void run() { - String line = ""; - - try { - BufferedReader reader = new BufferedReader( - new InputStreamReader(EMNuclideIAEA.class.getResourceAsStream("nuclides.csv"))); - ArrayList blockOfData = new ArrayList<>(4); - while ((line = reader.readLine()) != null) { - String[] split = splitButDifferent(line, ","); - if (split.length != 19) { - throw new Error( - "Invalid count (" + split.length + ") of separators in IAEA nuclides database " + line); - } - if (!split[1].isEmpty() && !blockOfData.isEmpty()) { - new EMNuclideIAEA(blockOfData.toArray(new String[blockOfData.size()][])); - blockOfData.clear(); - } - blockOfData.add(split); - } - if (!blockOfData.isEmpty()) { - new EMNuclideIAEA(blockOfData.toArray(new String[blockOfData.size()][])); - blockOfData.clear(); - } - reader.close(); - } catch (Exception e) { - System.out.println(line); - e.printStackTrace(); - } - - try { - BufferedReader reader = new BufferedReader( - new InputStreamReader(EMNuclideIAEA.class.getResourceAsStream("nuclidesTable.csv"))); - while ((line = reader.readLine()) != null) { - String[] split = splitButDifferent(line, ","); - if (split.length != 47) { - throw new Error( - "Invalid count (" + split.length - + ") of separators in IAEA nuclidesTable database " - + line); - } - get(Integer.parseInt(split[0]), Integer.parseInt(split[1])).getMoreData(split); - } - reader.close(); - } catch (Exception e) { - System.out.println(line); - e.printStackTrace(); - } - - try { - BufferedReader reader = new BufferedReader( - new InputStreamReader(EMNuclideIAEA.class.getResourceAsStream("energyLevels.csv"))); - while ((line = reader.readLine()) != null) { - String[] split = splitButDifferent(line, ","); - if (split.length != 27) { - throw new Error( - "Invalid count (" + split.length + ") of separators in IAEA energyLevels database " + line); - } - new energeticState(split); - } - reader.close(); - } catch (Exception e) { - System.out.println(line); - e.printStackTrace(); - } - - for (EMNuclideIAEA nuclide : NUCLIDES.values()) { - nuclide.makeArrayOfEnergyStates(); - } - } - - public static EMNuclideIAEA get(int protons, int neutrons) { - return NUCLIDES.get((protons << 16) + neutrons); - } - - private final short N; - private final short Z; - private final double halfTime; // sec - private final double mass; // eV/c^2 - private final short discovery; // year - private TreeMap energeticStates; - private energeticState[] energeticStatesArray; - - private EMNuclideIAEA(String[][] rows) { - N = Short.parseShort(rows[1][2]); - Z = Short.parseShort(rows[1][0]); - NUCLIDES.put(((int) getZ() << 16) + getN(), this); - - String[] parts = splitButDifferent(rows[0][16], "|"); - double Mass = doubleOrNaN(parts[0], "mass"); - if (!Double.isNaN(Mass)) { - // System.out.println("Mass =\t" + Mass+"\t"+(N+Z)+"\t"+N+"\t"+Z+"\t"+(Mass/(N+Z))); - mass = Mass * MICRO_AMU_TO_EV_DIV_C_C; - } else { - mass = Double.NaN; - } - - discovery = (short) doubleOrNaN(rows[0][18], "discovery"); - - if (rows[0][3].contains("STABLE")) { - halfTime = STABLE_RAW_LIFE_TIME; - } else { - parts = splitButDifferent(rows[0][4], "|"); - halfTime = doubleOrNaN(parts[0], "half life"); - } - } - - private void getMoreData(String[] cells) { - new energeticState( - this, - getHalfTime(), - getDecaysFixed( - cells[14], - doubleOrNaN(cells[15], "chance1"), - cells[17], - doubleOrNaN(cells[18], "chance1"), - cells[20], - doubleOrNaN(cells[21], "chance1"))); - } - - private static final energeticState[] empty = new energeticState[0]; - - private void makeArrayOfEnergyStates() { - if (energeticStates == null || energeticStates.isEmpty()) { - setEnergeticStatesArray(empty); - } else { - setEnergeticStatesArray(energeticStates.values().toArray(new energeticState[0])); - double life = getHalfTime(); - for (energeticState energeticState : getEnergeticStatesArray()) { - if (Double.isNaN(energeticState.Thalf)) { - energeticState.Thalf = life; - } else { - life = energeticState.Thalf; - } - } - } - } - - private double doubleOrNaN(String s, String name) { - s = s.replaceAll("#", ""); - if (!s.isEmpty()) { - try { - double value = Double.parseDouble(s); - if (Double.isNaN(value)) { - return Double.NaN; - } - return value != 0 ? value : Double.NaN; - } catch (Exception e) { - System.out.println("Invalid Value " + name + ' ' + getN() + ' ' + getZ() + ' ' + s); - e.printStackTrace(); - } - } - return Double.NaN; - } - - public short getN() { - return N; - } - - public short getZ() { - return Z; - } - - public double getHalfTime() { - return halfTime; - } - - public double getMass() { - return mass; - } - - public short getDiscovery() { - return discovery; - } - - public energeticState[] getEnergeticStatesArray() { - return energeticStatesArray; - } - - public void setEnergeticStatesArray(energeticState[] energeticStatesArray) { - this.energeticStatesArray = energeticStatesArray; - } - - public static final class energeticState { - - public final double energy; - public double Thalf; - public final iaeaDecay[] decaymodes; - - private energeticState(EMNuclideIAEA nuclide, double Thalf, iaeaDecay[] decaymodes) { - energy = 0; - this.Thalf = Thalf; - this.decaymodes = decaymodes; - if (nuclide.energeticStates == null) { - nuclide.energeticStates = new TreeMap<>(); - } - nuclide.energeticStates.put(energy, this); - } - - private energeticState(String[] cells) { - EMNuclideIAEA nuclide = get( - (int) doubleOrNaN(cells[0], "protons"), - (int) doubleOrNaN(cells[1], "neutrons")); - if (nuclide == null) { - throw new Error( - "Missing nuclide " + (int) doubleOrNaN(cells[0], "protons") - + ' ' - + (int) doubleOrNaN(cells[1], "neutrons")); - } - energy = doubleOrNaN(cells[3], "energy level", nuclide) * 1000D; // to eV - if (energy < 0) { - throw new Error("Invalid energy " + nuclide.getN() + ' ' + nuclide.getZ() + ' ' + cells[3]); - } - Thalf = doubleOrNaN(cells[10], "half life", nuclide); - if (nuclide.energeticStates == null) { - new Exception("Should be initialized before doing this... " + nuclide.getN() + ' ' + nuclide.getZ()) - .printStackTrace(); - nuclide.energeticStates = new TreeMap<>(); - } - nuclide.energeticStates.put(energy, this); - decaymodes = getDecaysFixed( - cells[12], - doubleOrNaN(cells[13], "chance 1", nuclide), - cells[15], - doubleOrNaN(cells[16], "chance 2", nuclide), - cells[18], - doubleOrNaN(cells[19], "chance 3", nuclide)); - } - - private double doubleOrNaN(String s, String name) { - return doubleOrNaN(s, name, null); - } - - private double doubleOrNaN(String s, String name, EMNuclideIAEA nuclide) { - s = s.replaceAll("#", ""); - if (!s.isEmpty()) { - try { - return Double.parseDouble(s); - } catch (Exception e) { - if (nuclide == null) { - System.out.println("Invalid Value " + name + ' ' + s); - } else { - System.out.println( - "Invalid Value " + name + ' ' + nuclide.getN() + ' ' + nuclide.getZ() + ' ' + s); - } - e.printStackTrace(); - } - } - return Double.NaN; - } - } - - private static iaeaDecay[] getDecaysFixed(String decay1, double chance1, String decay2, double chance2, - String decay3, double chance3) { - boolean do1, do2, do3; - do1 = !decay1.isEmpty() && !Double.isNaN(chance1); - do2 = !decay2.isEmpty() && !Double.isNaN(chance2); - do3 = !decay3.isEmpty() && !Double.isNaN(chance3); - TreeMap decays = new TreeMap<>(); - if (do1 && do2 && chance1 == 100 && chance2 == 100 && chance3 != 100) { - decays.put(1D, new iaeaDecay(1D, decay1)); - if (do3) { - chance3 /= 100d; - decays.put(chance3, new iaeaDecay(chance3, decay2)); - chance2 = 1d - chance3; - } - chance2 /= 2d; - decays.put(chance2, new iaeaDecay(chance2, decay2)); - } else if (do1 && chance1 == 100) { - decays.put(1D, new iaeaDecay(1D, decay1)); - if (do2) { - chance2 /= 100d; - decays.put(chance2, new iaeaDecay(chance2, decay2)); - } - if (do3) { - chance3 /= 100d; - if (do2) { - chance3 *= chance2; - } - decays.put(chance3, new iaeaDecay(chance3, decay3)); - } - } else { - double normalization = (do1 ? chance1 : 0) + (do2 ? chance2 : 0) + (do3 ? chance3 : 0); - if (do1) { - chance1 /= normalization; - decays.put(chance1, new iaeaDecay(chance1, decay1)); - } - if (do2) { - chance2 /= normalization; - decays.put(chance2, new iaeaDecay(chance2, decay2)); - } - if (do3) { - chance3 /= normalization; - decays.put(chance3, new iaeaDecay(chance3, decay3)); - } - if (do1 || do2 || do3) { - decays.put(1D, iaeaDecay.DEAD_END); - } - } - // if(DEBUG_MODE){ - // System.out.println("INVALID - // SUM?\t"+normalization+"\t"+decay1+"\t"+chance1+"\t"+decay2+"\t"+chance2+"\t"+decay3+"\t"+chance3); - // } - return decays.values().toArray(new iaeaDecay[0]); - } - - public static final class iaeaDecay { - - public final double chance; - public final String decayName; - public static final iaeaDecay DEAD_END = new iaeaDecay(1D, "DEAD_END"); - - private iaeaDecay(double chance, String decayName) { - this.chance = chance; - this.decayName = decayName; - } - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java deleted file mode 100644 index e2020e06a..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; - -import static net.minecraft.util.StatCollector.translateToLocal; - -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; - -public abstract class EMBosonDefinition extends EMPrimitiveTemplate { - - protected EMBosonDefinition(String name, String symbol, int generation, double mass, int charge, int color, int ID, - String bind) { - super(name, symbol, generation, mass, charge, color, ID, bind); - } - - @Override - public String getLocalizedTypeName() { - return translateToLocal("tt.keyword.Boson"); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java deleted file mode 100644 index d5fbbfad8..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; - -import static net.minecraft.util.StatCollector.translateToLocal; - -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; - -public abstract class EMFermionDefinition extends EMPrimitiveTemplate { - - protected EMFermionDefinition(String name, String symbol, int generation, double mass, int charge, int color, - int ID, String bind) { - super(name, symbol, generation, mass, charge, color, ID, bind); - } - - @Override - public String getLocalizedTypeName() { - return translateToLocal("tt.keyword.Fermion"); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java deleted file mode 100644 index 67b041a1b..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.lepton_e; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.lepton_e_; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.lepton_m; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.lepton_m_; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.lepton_t; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.lepton_t_; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.lepton_Ve; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.lepton_Ve_; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.lepton_Vm; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.lepton_Vm_; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.lepton_Vt; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.lepton_Vt_; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.quark_b; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.quark_b_; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.quark_c; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.quark_c_; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.quark_d; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.quark_d_; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.quark_s; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.quark_s_; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.quark_u; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.quark_u_; -import static net.minecraft.util.StatCollector.translateToLocal; - -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.util.TT_Utility; - -/** - * Created by danie_000 on 22.10.2016. - */ -public class EMGaugeBosonDefinition extends EMBosonDefinition { - - public static final EMGaugeBosonDefinition boson_g__ = new EMGaugeBosonDefinition( - "tt.keyword.Gluon", - "g", - 0, - 0, - 8, - 27, - "g"), boson_Y__ = new EMGaugeBosonDefinition("tt.keyword.Photon", "\u03b3", 1e-18D, 0, -1, 28, "Y"), - boson_Z = new EMGaugeBosonDefinition("tt.keyword.Weak0", "Z0", 91.1876e9, 0, -1, 29, "Z0"), - boson_W_ = new EMGaugeBosonDefinition("tt.keyword.WeakPlus", "W+", 80.379e9, 3, -1, 30, "W+"), - boson_W = new EMGaugeBosonDefinition("tt.keyword.WeakMinus", "W-", 80.379e9, -3, -1, 31, "W-"); - // deadEnd - public static final EMDecay deadEnd = new EMDecay(boson_Y__, boson_Y__); - public static final EMDefinitionStack boson_Y__1 = new EMDefinitionStack(boson_Y__, 1); - public static final EMDecay deadEndHalf = new EMDecay(boson_Y__1); - - protected EMGaugeBosonDefinition(String name, String symbol, double mass, int charge, int color, int ID, - String bind) { - super(name, TT_Utility.toSuperscript(symbol), 0, mass, charge, color, ID, bind); - } - - public static void run(EMDefinitionsRegistry registry) { - registry.registerDefinitionClass(new EMType(EMGaugeBosonDefinition.class, "tt.keyword.GaugeBoson")); - boson_g__.init(registry, boson_g__, 3e-50, 0, 0, deadEndHalf); - boson_Y__.init(registry, boson_Y__, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); - boson_Z.init( - registry, - boson_Z, - 3e-25, - 11, - 11, - new EMDecay(0.03363, lepton_e, lepton_e_), - new EMDecay(0.03366, lepton_m, lepton_m_), - new EMDecay(0.03367, lepton_t, lepton_t_), - new EMDecay(0.068333, lepton_Ve, lepton_Ve_), - new EMDecay(0.068333, lepton_Vm, lepton_Vm_), - new EMDecay(0.068333, lepton_Vt, lepton_Vt_), - new EMDecay(0.118, quark_u, quark_u_), - new EMDecay(0.118, quark_c, quark_c_), - new EMDecay(0.152, quark_d, quark_d_), - new EMDecay(0.152, quark_s, quark_s_), - new EMDecay(0.152, quark_b, quark_b_), - deadEnd); - boson_W.init( - registry, - boson_W_, - 3e-25, - 9, - 9, - new EMDecay(0.108, lepton_e, lepton_Ve_), - new EMDecay(0.108, lepton_m, lepton_Vm_), - new EMDecay(0.108, lepton_t, lepton_Vt_), - new EMDecay(0.112666, quark_u_, quark_d), - new EMDecay(0.112666, quark_u_, quark_s), - new EMDecay(0.112666, quark_u_, quark_b), - new EMDecay(0.112666, quark_c_, quark_d), - new EMDecay(0.112666, quark_c_, quark_s), - new EMDecay(0.112666, quark_c_, quark_b), - deadEnd); - boson_W_.init( - registry, - boson_W, - 3e-25, - 9, - 9, - new EMDecay(0.108, lepton_e_, lepton_Ve), - new EMDecay(0.108, lepton_m_, lepton_Vm), - new EMDecay(0.108, lepton_t_, lepton_Vt), - new EMDecay(0.112666, quark_u, quark_d_), - new EMDecay(0.112666, quark_u, quark_s_), - new EMDecay(0.112666, quark_u, quark_b_), - new EMDecay(0.112666, quark_c, quark_d_), - new EMDecay(0.112666, quark_c, quark_s_), - new EMDecay(0.112666, quark_c, quark_b_), - deadEnd); - } - - @Override - public String getLocalizedTypeName() { - return translateToLocal("tt.keyword.GaugeBoson"); - } - - @Override - public boolean isTimeSpanHalfLife() { - return false; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java deleted file mode 100644 index 46663605b..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; - -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.boson_Y__; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.lepton_Ve; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.lepton_Ve_; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.lepton_Vm; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.lepton_Vm_; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.lepton_Vt; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.lepton_Vt_; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMScalarBosonDefinition.boson_H__; -import static net.minecraft.util.StatCollector.translateToLocal; - -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.util.TT_Utility; - -/** - * Created by danie_000 on 22.10.2016. - */ -public class EMLeptonDefinition extends EMFermionDefinition { - - public static final EMLeptonDefinition lepton_e = new EMLeptonDefinition( - "tt.keyword.Electron", - "\u03b2-", - 1, - 0.511e6D, - -3, - 15, - "e-"), lepton_m = new EMLeptonDefinition("tt.keyword.Muon", "\u03bc-", 2, 105.658e6D, -3, 17, "m-"), - lepton_t = new EMLeptonDefinition("tt.keyword.Tauon", "\u03c4-", 3, 1776.83e6D, -3, 19, "t-"), - lepton_e_ = new EMLeptonDefinition("tt.keyword.Positron", "\u03b2+", -1, 0.511e6D, 3, 16, "e+"), - lepton_m_ = new EMLeptonDefinition("tt.keyword.Antimuon", "\u03bc+", -2, 105.658e6D, 3, 18, "m+"), - lepton_t_ = new EMLeptonDefinition("tt.keyword.Antitauon", "\u03c4+", -3, 1776.83e6D, 3, 20, "t+"); - - public static final EMDefinitionStack lepton_e1 = new EMDefinitionStack(lepton_e, 1); - public static final EMDefinitionStack lepton_e2 = new EMDefinitionStack(lepton_e, 2); - public static final EMDefinitionStack lepton_e_1 = new EMDefinitionStack(lepton_e_, 1); - public static final EMDefinitionStack lepton_e_2 = new EMDefinitionStack(lepton_e_, 2); - - protected EMLeptonDefinition(String name, String symbol, int type, double mass, int charge, int ID, String bind) { - super(name, TT_Utility.toSuperscript(symbol), type, mass, charge, -1, ID, bind); - } - - public static void run(EMDefinitionsRegistry registry) { - registry.registerDefinitionClass(new EMType(EMLeptonDefinition.class, "tt.keyword.Lepton")); - lepton_e.init(registry, lepton_e_, STABLE_RAW_LIFE_TIME, 0, 1, deadEnd, new EMDecay(lepton_e, boson_Y__)); - lepton_m.init( - registry, - lepton_m_, - 2.197019e-6D, - 0, - 1, - new EMDecay(0.9D, lepton_e, lepton_Ve_, lepton_Vm), - deadEnd); // makes photons and don't care - lepton_t.init( - registry, - lepton_t_, - 2.903e-13D, - 1, - 3, - new EMDecay(0.05F, lepton_m, lepton_Vm_, lepton_Vt, boson_H__), - new EMDecay(0.1D, lepton_e, lepton_Ve_, lepton_Vm), - new EMDecay(0.8D, lepton_m, lepton_Vm_, lepton_Vt, boson_Y__), - deadEnd); // makes photons and don't care - - lepton_e_.init(registry, lepton_e, STABLE_RAW_LIFE_TIME, 0, 1, deadEnd, new EMDecay(lepton_e, boson_Y__)); - lepton_m_.init( - registry, - lepton_m, - 2.197019e-6F, - 0, - 1, - new EMDecay(0.9F, lepton_e_, lepton_Ve, lepton_Vm_), - deadEnd); // makes photons and don't care - lepton_t_.init( - registry, - lepton_t, - 2.903e-13F, - 1, - 3, - new EMDecay(0.05F, lepton_m_, lepton_Vm, lepton_Vt_, boson_H__), - new EMDecay(0.1F, lepton_e_, lepton_Ve, lepton_Vm_), - new EMDecay(0.8F, lepton_m_, lepton_Vm, lepton_Vt_, boson_Y__), - deadEnd); // makes photons and don't care - } - - @Override - public String getLocalizedName() { - return translateToLocal("tt.keyword.Lepton") + ": " + getShortLocalizedName(); - } - - @Override - public boolean isTimeSpanHalfLife() { - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java deleted file mode 100644 index 9b42f1b5e..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; - -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEndHalf; -import static net.minecraft.util.StatCollector.translateToLocal; - -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; - -/** - * Created by danie_000 on 22.10.2016. - */ -public class EMNeutrinoDefinition extends EMLeptonDefinition { - - public static final EMNeutrinoDefinition lepton_Ve = new EMNeutrinoDefinition( - "tt.keyword.ElectronNeutrino", - "\u03bd\u03b2", - 1, - 2e0D, - 21, - "Ve"), - lepton_Vm = new EMNeutrinoDefinition("tt.keyword.MuonNeutrino", "\u03bd\u03bc", 2, 0.15e6D, 23, "Vm"), - lepton_Vt = new EMNeutrinoDefinition("tt.keyword.TauonNeutrino", "\u03bd\u03c4", 3, 15e6D, 25, "Vt"), - lepton_Ve_ = new EMNeutrinoDefinition("tt.keyword.PositronNeutrino", "~\u03bd\u03b2", -1, 2e0D, 22, "~Ve"), - lepton_Vm_ = new EMNeutrinoDefinition( - "tt.keyword.AntimuonNeutrino", - "~\u03bd\u03bc", - -2, - 0.15e6D, - 24, - "~Vm"), - lepton_Vt_ = new EMNeutrinoDefinition( - "tt.keyword.AntitauonNeutrino", - "~\u03bd\u03c4", - -3, - 15e6D, - 26, - "~Vt"); - - public static final EMDefinitionStack lepton_Ve1 = new EMDefinitionStack(lepton_Ve, 1); - public static final EMDefinitionStack lepton_Ve2 = new EMDefinitionStack(lepton_Ve, 2); - public static final EMDefinitionStack lepton_Ve_1 = new EMDefinitionStack(lepton_Ve_, 1); - public static final EMDefinitionStack lepton_Ve_2 = new EMDefinitionStack(lepton_Ve_, 2); - - protected EMNeutrinoDefinition(String name, String symbol, int type, double mass, int ID, String bind) { - super(name, symbol, type, mass, 0, ID, bind); - } - - public static void run(EMDefinitionsRegistry registry) { - registry.registerDefinitionClass(new EMType(EMNeutrinoDefinition.class, "tt.keyword.Neutrino")); - lepton_Ve.init(registry, lepton_Ve_, 1D, -1, -1, EMDecay.NO_PRODUCT); - lepton_Vm.init(registry, lepton_Vm_, 1D, 1, 0, new EMDecay(0.825D, nothing), deadEndHalf); - lepton_Vt.init(registry, lepton_Vt_, 1, 1, 0, new EMDecay(0.75F, nothing), deadEnd); - - lepton_Ve_.init(registry, lepton_Ve, 1, -1, -1, EMDecay.NO_PRODUCT); - lepton_Vm_.init(registry, lepton_Vm, 1, 1, 0, new EMDecay(0.825F, nothing), deadEndHalf); - lepton_Vt_.init(registry, lepton_Vt, 1, 1, 0, new EMDecay(0.75F, nothing), deadEnd); - } - - @Override - public String getLocalizedTypeName() { - return translateToLocal("tt.keyword.Neutrino"); - } - - @Override - public boolean isTimeSpanHalfLife() { - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java deleted file mode 100644 index 115e79825..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; -import static net.minecraft.util.StatCollector.translateToLocal; - -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; - -/** - * Created by danie_000 on 22.10.2016. - */ -public class EMPrimitiveDefinition extends EMPrimitiveTemplate { - - public static final EMPrimitiveDefinition nbtE__ = new EMPrimitiveDefinition( - "tt.keyword.PrimitiveNBTERROR", - "!", - 0, - 0D, - -1, - Integer.MIN_VALUE, - "!"), - null__ = new EMPrimitiveDefinition( - "tt.keyword.PrimitiveNULLPOINTER", - ".", - 0, - 0D, - -3, - Integer.MIN_VALUE + 1, - "."), - space = new EMPrimitiveDefinition("tt.keyword.PrimitiveSpace", "_", 0, 0D, -4, Integer.MIN_VALUE + 2, "_"), - space_ = new EMPrimitiveDefinition( - "tt.keyword.PrimitivePresence", - "~_", - 0, - 0D, - -4, - Integer.MIN_VALUE + 3, - "~_"), - mass = new EMPrimitiveDefinition("tt.keyword.PrimitiveMass", "*", 0, 1, -4, Integer.MIN_VALUE + 4, "*"), - mass_ = new EMPrimitiveDefinition( - "tt.keyword.PrimitiveDarkMass", - "~*", - 0, - 1, - -4, - Integer.MIN_VALUE + 5, - "~*"), - energy = new EMPrimitiveDefinition( - "tt.keyword.PrimitiveEnergy", - "E", - 4, - 0D, - -4, - Integer.MIN_VALUE + 6, - "E"), - energy_ = new EMPrimitiveDefinition( - "tt.keyword.PrimitiveDarkEnergy", - "~E", - -4, - 0, - -4, - Integer.MIN_VALUE + 7, - "~E"), - magic = new EMPrimitiveDefinition( - "tt.keyword.PrimitiveMagic", - "Ma", - 5, - 1e5D, - 0, - Integer.MIN_VALUE + 8, - "Ma"), - magic_ = new EMPrimitiveDefinition( - "tt.keyword.PrimitiveAntimagic", - "~Ma", - -5, - 1e5D, - 0, - Integer.MIN_VALUE + 9, - "~Ma"); - - protected EMPrimitiveDefinition(String name, String symbol, int type, double mass, int color, int ID, String bind) { - super(name, symbol, type, mass, 0, color, ID, bind); - } - - public static void run(EMDefinitionsRegistry registry) { - registry.registerDefinitionClass(new EMType(EMPrimitiveDefinition.class, "tt.keyword.Primitive")); - nbtE__.init(registry, null, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); - null__.init(registry, null, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); - - space.init(registry, space_, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); - space_.init(registry, space, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); - - mass.init(registry, mass_, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); - mass_.init(registry, mass, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); - - energy.init(registry, energy_, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); - energy_.init(registry, energy, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); - - magic.init(registry, magic_, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); - magic_.init(registry, magic, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); - } - - @Override - public String getLocalizedTypeName() { - return translateToLocal("tt.keyword.Primitive"); - } - - @Override - public boolean isTimeSpanHalfLife() { - return false; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java deleted file mode 100644 index 26b63841e..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java +++ /dev/null @@ -1,186 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; - -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.lepton_e; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.lepton_e_; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.lepton_m; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.lepton_m_; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.lepton_t; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.lepton_t_; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.lepton_Ve; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.lepton_Ve_; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.lepton_Vm; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.lepton_Vm_; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.lepton_Vt; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.lepton_Vt_; -import static net.minecraft.util.StatCollector.translateToLocal; - -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; - -/** - * Created by danie_000 on 22.10.2016. - */ -public class EMQuarkDefinition extends EMFermionDefinition { - - public static final EMQuarkDefinition quark_u = new EMQuarkDefinition( - "tt.keyword.QuarkUp", - "u", - 1, - 2.3e6D, - 2, - 3, - "u"), quark_c = new EMQuarkDefinition("tt.keyword.QuarkCharm", "c", 2, 1.29e9D, 2, 9, "c"), - quark_t = new EMQuarkDefinition("tt.keyword.QuarkTop", "t", 3, 172.44e9D, 2, 13, "t"), - quark_d = new EMQuarkDefinition("tt.keyword.QuarkDown", "d", 1, 4.8e6D, -1, 5, "d"), - quark_s = new EMQuarkDefinition("tt.keyword.QuarkStrange", "s", 2, 95e6D, -1, 7, "s"), - quark_b = new EMQuarkDefinition("tt.keyword.QuarkBottom", "b", 3, 4.65e9D, -1, 11, "b"), - quark_u_ = new EMQuarkDefinition("tt.keyword.QuarkAntiUp", "~u", -1, 2.3e6D, -2, 4, "~u"), - quark_c_ = new EMQuarkDefinition("tt.keyword.QuarkAntiCharm", "~c", -2, 1.29e9D, -2, 10, "~c"), - quark_t_ = new EMQuarkDefinition("tt.keyword.QuarkAntiTop", "~t", -3, 172.44e9D, -2, 14, "~t"), - quark_d_ = new EMQuarkDefinition("tt.keyword.QuarkAntiDown", "~d", -1, 4.8e6D, 1, 6, "~d"), - quark_s_ = new EMQuarkDefinition("tt.keyword.QuarkAntiStrange", "~s", -2, 95e6D, 1, 8, "~s"), - quark_b_ = new EMQuarkDefinition("tt.keyword.QuarkAntiBottom", "~b", -3, 4.65e9D, 1, 12, "~b"); - - protected EMQuarkDefinition(String name, String symbol, int type, double mass, int charge, int ID, String bind) { - super(name, symbol, type, mass, charge, 0, ID, bind); - } - - public static void run(EMDefinitionsRegistry registry) { - registry.registerDefinitionClass(new EMType(EMQuarkDefinition.class, "tt.keyword.Quark")); - quark_u.init( - registry, - quark_u_, - STABLE_RAW_LIFE_TIME, - 3, - -1, - new EMDecay(1.23201e-5D, quark_b /* ,lepton_t_,lepton_Vt */), - new EMDecay(0.050778116D, quark_s /* ,lepton_m_,lepton_Vm */), - new EMDecay(0.9D, quark_d, lepton_e_, lepton_Ve), - deadEnd); // makes photons and don't care - quark_c.init( - registry, - quark_c_, - 0.5e-13D, - 1, - -1, - new EMDecay(0.00169744D, quark_b /* ,lepton_t_,lepton_Vt */), - new EMDecay(0.05071504D, quark_d, lepton_m_, lepton_Vm), - new EMDecay(0.9D, quark_s, lepton_e_, lepton_Ve), - deadEnd); // makes photons and don't care - quark_t.init( - registry, - quark_t_, - 2.5e-26D, - 0, - -1, - new EMDecay(7.51689e-5D, quark_d, lepton_t_, lepton_Vt), - new EMDecay(0.00163216D, quark_s, lepton_m_, lepton_Vm), - new EMDecay(0.9D, quark_b, lepton_e_, lepton_Ve), - deadEnd); // makes photons and don't care - - quark_d.init( - registry, - quark_d_, - STABLE_RAW_LIFE_TIME, - 3, - -1, - new EMDecay(7.51689e-5D, quark_t /* ,lepton_t,lepton_Vt_ */), - new EMDecay(0.05071504D, quark_c /* ,lepton_m,lepton_Vm_ */), - new EMDecay(0.9D, quark_u, lepton_e, lepton_Ve_), - deadEnd); // makes photons and don't care - quark_s.init( - registry, - quark_s_, - 0.6e-9D, - 1, - -1, - new EMDecay(0.00163216D, quark_t /* ,lepton_t,lepton_Vt_ */), - new EMDecay(0.050778116D, quark_u, lepton_m, lepton_Vm_), - new EMDecay(0.9D, quark_c, lepton_e, lepton_Ve_), - deadEnd); // makes photons and don't care - quark_b.init( - registry, - quark_b_, - 0.7e-13D, - 0, - -1, - new EMDecay(1.23201e-5D, quark_u, lepton_t, lepton_Vt_), - new EMDecay(0.00169744D, quark_c, lepton_m, lepton_Vm_), - new EMDecay(0.9D, quark_t, lepton_e, lepton_Ve_), - deadEnd); // makes photons and don't care - - quark_u_.init( - registry, - quark_u, - STABLE_RAW_LIFE_TIME, - 3, - -1, - new EMDecay(1.23201e-5D, quark_b_ /* ,lepton_t,lepton_Vt_ */), - new EMDecay(0.050778116D, quark_s_ /* ,lepton_m,lepton_Vm_ */), - new EMDecay(0.9D, quark_d_, lepton_e, lepton_Ve_), - deadEnd); // makes photons and don't care - quark_c_.init( - registry, - quark_c, - 0.5e-13D, - 1, - -1, - new EMDecay(0.00169744F, quark_b_ /* ,lepton_t,lepton_Vt_ */), - new EMDecay(0.05071504F, quark_d_, lepton_m, lepton_Vm_), - new EMDecay(0.9F, quark_s_, lepton_e, lepton_Ve_), - deadEnd); // makes photons and don't care - quark_t_.init( - registry, - quark_t, - 2.5e-26F, - 0, - -1, - new EMDecay(7.51689e-5F, quark_d_, lepton_t, lepton_Vt_), - new EMDecay(0.00163216F, quark_s_, lepton_m, lepton_Vm_), - new EMDecay(0.9F, quark_b_, lepton_e, lepton_Ve_), - deadEnd); // makes photons and don't care - - quark_d_.init( - registry, - quark_d, - STABLE_RAW_LIFE_TIME, - 3, - -1, - new EMDecay(7.51689e-5F, quark_t_ /* ,lepton_t_,lepton_Vt */), - new EMDecay(0.05071504F, quark_c_ /* ,lepton_m_,lepton_Vm */), - new EMDecay(0.9F, quark_u_, lepton_e_, lepton_Ve), - deadEnd); // makes photons and don't care - quark_s_.init( - registry, - quark_s, - 0.6e-9F, - 1, - -1, - new EMDecay(0.00163216F, quark_t_ /* ,lepton_t_,lepton_Vt */), - new EMDecay(0.050778116F, quark_u_, lepton_m_, lepton_Vm), - new EMDecay(0.9F, quark_c_, lepton_e_, lepton_Ve), - deadEnd); // makes photons and don't care - quark_b_.init( - registry, - quark_b, - 0.7e-13F, - 0, - -1, - new EMDecay(1.23201e-5F, quark_u_, lepton_t_, lepton_Vt), - new EMDecay(0.00169744F, quark_c_, lepton_m_, lepton_Vm), - new EMDecay(0.9F, quark_t_, lepton_e_, lepton_Ve), - deadEnd); // makes photons and don't care - } - - @Override - public String getLocalizedTypeName() { - return translateToLocal("tt.keyword.Quark"); - } - - @Override - public boolean isTimeSpanHalfLife() { - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java deleted file mode 100644 index 6c4a88bb5..000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; - -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.boson_W; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.boson_W_; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.boson_Y__; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.boson_Z; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.boson_g__; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.lepton_m; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.lepton_m_; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.lepton_t; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.lepton_t_; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.quark_b; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.quark_b_; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.quark_c; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.quark_c_; -import static net.minecraft.util.StatCollector.translateToLocal; - -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; -import com.github.technus.tectech.util.TT_Utility; - -/** - * Created by danie_000 on 22.10.2016. - */ -public class EMScalarBosonDefinition extends EMBosonDefinition { - - public static final EMScalarBosonDefinition boson_H__ = new EMScalarBosonDefinition( - "tt.keyword.Higgs", - "H0", - 125.09e9D, - -2, - 32, - "H0"); - - private EMScalarBosonDefinition(String name, String symbol, double mass, int color, int ID, String bind) { - super(name, TT_Utility.toSuperscript(symbol), 0, mass, 0, color, ID, bind); - } - - public static void run(EMDefinitionsRegistry registry) { - registry.registerDefinitionClass(new EMType(EMScalarBosonDefinition.class, "tt.keyword.ScalarBoson")); - boson_H__.init( - registry, - boson_H__, - 1.56e-22D, - 8, - 8, - new EMDecay(0.0002171, lepton_m, lepton_m_), - new EMDecay(0.001541, boson_Z, boson_Y__), - new EMDecay(0.02641, boson_Z, boson_Z), - new EMDecay(0.02884, quark_c, quark_c_), - new EMDecay(0.06256, lepton_t, lepton_t_), - new EMDecay(0.0818, boson_g__, boson_g__), - new EMDecay(0.2152, boson_W_, boson_W), - new EMDecay(0.5809, quark_b, quark_b_), - deadEnd); - } - - @Override - public String getLocalizedTypeName() { - return translateToLocal("tt.keyword.ScalarBoson"); - } - - @Override - public boolean isTimeSpanHalfLife() { - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java index 317a820ff..9555fb712 100644 --- a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java +++ b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java @@ -2,7 +2,6 @@ import static com.github.technus.tectech.TecTech.RANDOM; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.eyeOfHarmonyRenderBlock; -import static gregtech.api.enums.Mods.OpenModularTurrets; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityClientPlayerMP; @@ -17,15 +16,11 @@ import net.minecraftforge.common.util.ForgeDirection; import com.github.technus.tectech.Reference; -import com.github.technus.tectech.compatibility.openmodularturrets.TT_turret_loader; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.block.QuantumGlassRender; import com.github.technus.tectech.thing.block.RenderEyeOfHarmony; import com.github.technus.tectech.thing.block.TileEyeOfHarmony; -import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; -import com.github.technus.tectech.thing.item.ElementalDefinitionContainer_EM; import com.github.technus.tectech.thing.item.RenderEyeOfHarmonyItem; -import com.github.technus.tectech.thing.item.renderElemental.RenderElementalName; import com.gtnewhorizon.structurelib.entity.fx.WeightlessParticleFX; import cpw.mods.fml.client.FMLClientHandler; @@ -40,17 +35,9 @@ public void registerRenderInfo() { QuantumGlassBlock.renderID = RenderingRegistry.getNextAvailableRenderId(); RenderingRegistry.registerBlockHandler(QuantumGlassBlock.renderID, new QuantumGlassRender()); - MinecraftForgeClient - .registerItemRenderer(ElementalDefinitionContainer_EM.INSTANCE, RenderElementalName.INSTANCE); - MinecraftForgeClient - .registerItemRenderer(DebugElementalInstanceContainer_EM.INSTANCE, RenderElementalName.INSTANCE); MinecraftForgeClient .registerItemRenderer(Item.getItemFromBlock(eyeOfHarmonyRenderBlock), new RenderEyeOfHarmonyItem()); - if (OpenModularTurrets.isModLoaded()) { - new TT_turret_loader().run(); - } - ClientRegistry.bindTileEntitySpecialRenderer(TileEyeOfHarmony.class, new RenderEyeOfHarmony()); } diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java index b249b5968..f33164c3b 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java @@ -4,27 +4,16 @@ import static com.google.common.math.LongMath.pow; import static gregtech.api.util.GT_Utility.formatNumbers; import static java.lang.Math.min; -import static net.minecraft.util.EnumChatFormatting.BOLD; -import static net.minecraft.util.EnumChatFormatting.DARK_RED; -import static net.minecraft.util.EnumChatFormatting.RESET; +import static net.minecraft.util.EnumChatFormatting.*; import static net.minecraft.util.StatCollector.translateToLocal; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; +import java.util.*; import java.util.function.Supplier; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.fluids.FluidStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.IEMMapRead; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; import com.gtnewhorizons.modularui.api.forge.IItemHandlerModifiable; import com.gtnewhorizons.modularui.api.math.Alignment; import com.gtnewhorizons.modularui.api.math.Pos2d; @@ -45,15 +34,9 @@ public class TT_recipe extends GT_Recipe { public static final String E_RECIPE_ID = "eRecipeID"; - public final EMConstantStackMap[] input; - public final IEMMapRead[] output; - public final EMConstantStackMap[] eCatalyst; - public final IAdditionalCheck additionalCheck; public TT_recipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, int[] aChances, - FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue, - EMConstantStackMap[] in, IEMMapRead[] out, EMConstantStackMap[] catalyst, - IAdditionalCheck check) { + FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { super( aOptimize, aInputs, @@ -65,137 +48,9 @@ public TT_recipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, O aDuration, aEUt, aSpecialValue); - input = in; - output = out; - eCatalyst = catalyst; - additionalCheck = check; } - public boolean EMisRecipeInputEqual(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, - FluidStack[] fluidStacks) { - return EMisRecipeInputEqual(consume, doNotCheckStackSizes, itemStacks, fluidStacks, null, null); - } - - public boolean EMisRecipeInputEqual(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, - FluidStack[] fluidStacks, EMInstanceStackMap[] in) { - return EMisRecipeInputEqual(consume, doNotCheckStackSizes, itemStacks, fluidStacks, in, null); - } - - public boolean EMisRecipeInputEqual(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, - FluidStack[] fluidStacks, EMInstanceStackMap[] in, EMInstanceStackMap[] catalyst) { - if (additionalCheck != null - && !additionalCheck.check(this, consume, doNotCheckStackSizes, itemStacks, fluidStacks, in, catalyst)) { - return false; - } - if (eCatalyst != null) { - if (catalyst != null && catalyst.length >= eCatalyst.length) { - for (int i = 0; i < eCatalyst.length; i++) { - if (eCatalyst[i] != null && eCatalyst[i].hasStacks()) { - if (catalyst[i] != null && catalyst[i].hasStacks()) { - if (!catalyst[i].containsAllAmounts(eCatalyst[i])) { - return false; - } - } else { - return false; - } - } - } - } else { - return false; - } - } - if (input != null) { - if (in != null && in.length >= input.length) { - for (int i = 0; i < input.length; i++) { - if (input[i] != null && input[i].hasStacks()) { - if (in[i] != null && in[i].hasStacks()) { - if (consume) { - if (!in[i].removeAllAmounts(input[i])) { - return false; - } - } else { - if (!in[i].containsAllAmounts(input[i])) { - return false; - } - } - } else { - return false; - } - } - } - } else { - return false; - } - } - return super.isRecipeInputEqual(consume, doNotCheckStackSizes, fluidStacks, itemStacks); - } - - @Deprecated - public boolean EMisRecipeInputEqualConsumeFromOne(boolean consume, boolean doNotCheckStackSizes, - ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap in) { - return EMisRecipeInputEqualConsumeFromOne(consume, doNotCheckStackSizes, itemStacks, fluidStacks, in, null); - } - - @Deprecated - public boolean EMisRecipeInputEqualConsumeFromOne(boolean consume, boolean doNotCheckStackSizes, - ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap in, EMInstanceStackMap[] catalyst) { - if (additionalCheck != null - && !additionalCheck.check(this, consume, doNotCheckStackSizes, itemStacks, fluidStacks, in, catalyst)) { - return false; - } - if (eCatalyst != null) { - if (catalyst != null && catalyst.length >= eCatalyst.length) { - for (int i = 0; i < eCatalyst.length; i++) { - if (eCatalyst[i] != null && eCatalyst[i].hasStacks()) { - if (catalyst[i] != null && catalyst[i].hasStacks()) { - if (!catalyst[i].containsAllAmounts(eCatalyst[i])) { - return false; - } - } else { - return false; - } - } - } - } else { - return false; - } - } - if (input != null) { - if (in != null) { - for (EMConstantStackMap anInput : input) { - if (anInput != null && anInput.hasStacks()) { - if (in.hasStacks()) { - if (consume) { - if (!in.removeAllAmounts(anInput)) { - return false; - } - } else { - if (!in.containsAllAmounts(anInput)) { - return false; - } - } - } else { - return false; - } - } - } - } else { - return false; - } - } - return super.isRecipeInputEqual(consume, doNotCheckStackSizes, fluidStacks, itemStacks); - } - - public interface IAdditionalCheck { - - boolean check(TT_recipe thisRecipe, boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, - FluidStack[] fluidStacks, EMInstanceStackMap[] in, EMInstanceStackMap[] e); - - boolean check(TT_recipe thisRecipe, boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, - FluidStack[] fluidStacks, EMInstanceStackMap in, EMInstanceStackMap[] e); - } - - public static class TT_Recipe_Map { + public static class TT_Recipe_Map { public static TT_Recipe_Map sCrafterRecipes = new TT_Recipe_Map<>(); public static TT_Recipe_Map sMachineRecipes = new TT_Recipe_Map<>(); @@ -306,14 +161,12 @@ public GT_Recipe_MapTT(Collection aRecipeList, String aUnlocalizedNam } } - public static class TT_assLineRecipe extends TT_recipe { + public static class TT_assLineRecipe extends GT_Recipe { public final ItemStack mResearchItem; public TT_assLineRecipe(boolean aOptimize, ItemStack researchItem, ItemStack[] aInputs, ItemStack[] aOutputs, - Object aSpecialItems, FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, - EMConstantStackMap[] in, EMConstantStackMap[] out, EMConstantStackMap[] catalyst, - IAdditionalCheck check) { + Object aSpecialItems, FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue) { super( aOptimize, aInputs, @@ -324,115 +177,10 @@ public TT_assLineRecipe(boolean aOptimize, ItemStack researchItem, ItemStack[] a null, aDuration, aEUt, - aSpecialValue, - in, - out, - catalyst, - check); + aSpecialValue); mResearchItem = researchItem; } - public TT_assLineRecipe(boolean aOptimize, ItemStack researchItem, ItemStack[] aInputs, ItemStack[] aOutputs, - Object aSpecialItems, FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, - EMConstantStackMap[] in) { - this( - aOptimize, - researchItem, - aInputs, - aOutputs, - aSpecialItems, - aFluidInputs, - aDuration, - aEUt, - aSpecialValue, - in, - null, - null, - null); - } - } - - public static class TT_EMRecipe extends TT_recipe { - - public final IEMDefinition mResearchEM; - public final GT_Recipe scannerRecipe; - - public TT_EMRecipe(boolean aOptimize, GT_Recipe scannerRecipe, IEMDefinition researchEM, ItemStack[] aInputs, - ItemStack[] aOutputs, Object aSpecialItems, FluidStack[] aFluidInputs, int aDuration, int aEUt, - int aSpecialValue, EMConstantStackMap[] in, EMConstantStackMap[] out, EMConstantStackMap[] catalyst, - IAdditionalCheck check) { - super( - aOptimize, - aInputs, - aOutputs, - aSpecialItems, - null, - aFluidInputs, - null, - aDuration, - aEUt, - aSpecialValue, - in, - out, - catalyst, - check); - mResearchEM = researchEM; - this.scannerRecipe = scannerRecipe; - } - - public TT_EMRecipe(boolean aOptimize, GT_Recipe scannerRecipe, IEMDefinition researchEM, ItemStack[] aInputs, - ItemStack[] aOutputs, Object aSpecialItems, FluidStack[] aFluidInputs, int aDuration, int aEUt, - int aSpecialValue, EMConstantStackMap[] in) { - this( - aOptimize, - scannerRecipe, - researchEM, - aInputs, - aOutputs, - aSpecialItems, - aFluidInputs, - aDuration, - aEUt, - aSpecialValue, - in, - null, - null, - null); - } - } - - public static class TT_Recipe_Map_EM { - - public static TT_Recipe_Map_EM sCrafterRecipesEM = new TT_Recipe_Map_EM<>( - "EM Crafter Recipes", - "gt.recipe.em_crafter", - null); - public static TT_Recipe_Map_EM sMachineRecipesEM = new TT_Recipe_Map_EM<>( - "EM Machinert Recipe", - "gt.recipe.em_machinery", - null); - - private final HashMap mRecipeMap; - public final String mNEIName, mUnlocalizedName, mNEIGUIPath; - - public TT_Recipe_Map_EM(String mNEIName, String mUnlocalizedName, String mNEIGUIPath) { - mRecipeMap = new HashMap<>(16); - this.mNEIName = mNEIName; - this.mUnlocalizedName = mUnlocalizedName; - this.mNEIGUIPath = mNEIGUIPath; - } - - public T findRecipe(IEMDefinition stack) { - return mRecipeMap.get(stack); - } - - public void add(T recipe) { - mRecipeMap.put(recipe.mResearchEM, recipe); - } - - public Collection recipeList() { - return mRecipeMap.values(); - } } public static class Eye_Of_Harmony_Recipe_Map extends GT_Recipe_Map { diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java index ee1019900..bf27d57af 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java @@ -10,13 +10,7 @@ import net.minecraftforge.fluids.FluidStack; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; import com.github.technus.tectech.thing.CustomItemList; -import com.github.technus.tectech.thing.item.ElementalDefinitionContainer_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting; -import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.ItemList; @@ -234,219 +228,4 @@ public static boolean addResearchableAssemblylineRecipe(ItemStack aResearchItem, return true; } - public static boolean addResearchableEMmachineRecipe(ItemStack aResearchItem, int totalComputationRequired, - int computationRequiredPerSec, int researchEUt, int researchAmperage, ItemStack[] aInputs, - FluidStack[] aFluidInputs, EMConstantStackMap[] eInputs, ItemStack aOutput, int machineDuration, - int machineEUt, int machineAmperage) { - if (aInputs == null) { - aInputs = nullItem; - } - if (aFluidInputs == null) { - aFluidInputs = nullFluid; - } - if (aResearchItem == null || totalComputationRequired <= 0 || aOutput == null) { - return false; - } - for (ItemStack tItem : aInputs) { - if (tItem == null) { - TecTech.LOGGER.error( - "addResearchableEMmachineRecipe " + aResearchItem.getDisplayName() - + " --> " - + aOutput.getUnlocalizedName() - + " there is some null item in that recipe"); - } - } - if (researchAmperage <= 0) { - researchAmperage = 1; - } else if (researchAmperage > Short.MAX_VALUE) { - researchAmperage = Short.MAX_VALUE; - } - if (computationRequiredPerSec <= 0) { - computationRequiredPerSec = 1; - } else if (computationRequiredPerSec > Short.MAX_VALUE) { - computationRequiredPerSec = Short.MAX_VALUE; - } - TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.addFakeRecipe( - false, - new ItemStack[] { aResearchItem }, - new ItemStack[] { aOutput }, - new ItemStack[] { ItemList.Tool_DataOrb - .getWithName(1L, "Writes Research result for " + GT_MetaTileEntity_EM_machine.machine) }, - null, - null, - totalComputationRequired, - researchEUt, - researchAmperage | computationRequiredPerSec << 16); - TT_recipe.TT_Recipe_Map.sMachineRecipes.add( - new TT_recipe.TT_assLineRecipe( - false, - aResearchItem, - aInputs, - new ItemStack[] { aOutput }, - new ItemStack[] { ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result") }, - aFluidInputs, - machineDuration, - machineEUt, - machineAmperage, - eInputs)); - return true; - } - - public static boolean addResearchableEMcrafterRecipe(ItemStack aResearchItem, int totalComputationRequired, - int computationRequiredPerSec, int researchEUt, int researchAmperage, EMConstantStackMap[] eInputs, - EMConstantStackMap[] catalyst, TT_recipe.IAdditionalCheck check, ItemStack aOutput, int crafterDuration, - int crafterEUt, int crafterAmperage) { - if (aResearchItem == null || totalComputationRequired <= 0 || aOutput == null) { - return false; - } - if (researchAmperage <= 0) { - researchAmperage = 1; - } else if (researchAmperage > Short.MAX_VALUE) { - researchAmperage = Short.MAX_VALUE; - } - if (computationRequiredPerSec <= 0) { - computationRequiredPerSec = 1; - } else if (computationRequiredPerSec > Short.MAX_VALUE) { - computationRequiredPerSec = Short.MAX_VALUE; - } - TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.addFakeRecipe( - false, - new ItemStack[] { aResearchItem }, - new ItemStack[] { aOutput }, - new ItemStack[] { ItemList.Tool_DataOrb - .getWithName(1L, "Writes Research result for " + GT_MetaTileEntity_EM_crafting.crafter) }, - null, - null, - totalComputationRequired, - researchEUt, - researchAmperage | computationRequiredPerSec << 16); - TT_recipe.TT_Recipe_Map.sCrafterRecipes.add( - new TT_recipe.TT_assLineRecipe( - false, - aResearchItem, - null, - new ItemStack[] { aOutput }, - new ItemStack[] { ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result") }, - null, - crafterDuration, - crafterEUt, - crafterAmperage, - eInputs, - null, - catalyst, - check)); - return true; - } - - public static boolean addScannableEMmachineRecipe(IEMDefinition aResearchEM, int totalComputationRequired, - int computationRequiredPerSec, int researchEUt, int researchAmperage, ItemStack[] aInputs, - FluidStack[] aFluidInputs, EMConstantStackMap[] eInputs, ItemStack aOutput, int machineDuration, - int machineEUt, int machineAmperage) { - if (aInputs == null) { - aInputs = nullItem; - } - if (aFluidInputs == null) { - aFluidInputs = nullFluid; - } - if (aResearchEM == null || totalComputationRequired <= 0 || aOutput == null) { - return false; - } - for (ItemStack tItem : aInputs) { - if (tItem == null) { - TecTech.LOGGER.error( - "addScannableEMmachineRecipe " + aResearchEM - + " --> " - + aOutput.getUnlocalizedName() - + " there is some null item in that recipe"); - } - } - if (researchAmperage <= 0) { - researchAmperage = 1; - } else if (researchAmperage > Short.MAX_VALUE) { - researchAmperage = Short.MAX_VALUE; - } - if (computationRequiredPerSec <= 0) { - computationRequiredPerSec = 1; - } else if (computationRequiredPerSec > Short.MAX_VALUE) { - computationRequiredPerSec = Short.MAX_VALUE; - } - ItemStack placeholder = new ItemStack(ElementalDefinitionContainer_EM.INSTANCE); - ElementalDefinitionContainer_EM - .setContent(placeholder, new EMConstantStackMap(new EMDefinitionStack(aResearchEM, 1))); - GT_Recipe thisRecipe = TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes.addFakeRecipe( - false, - new ItemStack[] { placeholder }, - new ItemStack[] { aOutput }, - new ItemStack[] { ItemList.Tool_DataOrb - .getWithName(1L, "Writes Research result for " + GT_MetaTileEntity_EM_machine.machine) }, - null, - null, - totalComputationRequired, - researchEUt, - researchAmperage | computationRequiredPerSec << 16); - TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.add( - new TT_recipe.TT_EMRecipe( - false, - thisRecipe, - aResearchEM, - aInputs, - new ItemStack[] { aOutput }, - new ItemStack[] { ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result") }, - aFluidInputs, - machineDuration, - machineEUt, - machineAmperage, - eInputs)); - return true; - } - - public static boolean addScannableEMcrafterRecipe(IEMDefinition aResearchEM, int totalComputationRequired, - int computationRequiredPerSec, int researchEUt, int researchAmperage, EMConstantStackMap[] eInputs, - EMConstantStackMap[] catalyst, TT_recipe.IAdditionalCheck check, ItemStack aOutput, int crafterDuration, - int crafterEUt, int crafterAmperage) { - if (aResearchEM == null || totalComputationRequired <= 0 || aOutput == null) { - return false; - } - if (researchAmperage <= 0) { - researchAmperage = 1; - } else if (researchAmperage > Short.MAX_VALUE) { - researchAmperage = Short.MAX_VALUE; - } - if (computationRequiredPerSec <= 0) { - computationRequiredPerSec = 1; - } else if (computationRequiredPerSec > Short.MAX_VALUE) { - computationRequiredPerSec = Short.MAX_VALUE; - } - ItemStack placeholder = new ItemStack(ElementalDefinitionContainer_EM.INSTANCE); - ElementalDefinitionContainer_EM - .setContent(placeholder, new EMConstantStackMap(new EMDefinitionStack(aResearchEM, 1))); - GT_Recipe thisRecipe = TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes.addFakeRecipe( - false, - new ItemStack[] { placeholder }, - new ItemStack[] { aOutput }, - new ItemStack[] { ItemList.Tool_DataOrb - .getWithName(1L, "Writes Research result for " + GT_MetaTileEntity_EM_crafting.crafter) }, - null, - null, - totalComputationRequired, - researchEUt, - researchAmperage | computationRequiredPerSec << 16); - TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.add( - new TT_recipe.TT_EMRecipe( - false, - thisRecipe, - aResearchEM, - null, - new ItemStack[] { aOutput }, - new ItemStack[] { ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result") }, - null, - crafterDuration, - crafterEUt, - crafterAmperage, - eInputs, - null, - catalyst, - check)); - return true; - } } diff --git a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java index 39d715048..1fe736575 100644 --- a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java +++ b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java @@ -52,7 +52,6 @@ public enum CustomItemList implements IItemContainer { hatch_CreativeMaintenance, hatch_CreativeData, Machine_OwnerDetector, - Machine_DataReader, Machine_BuckConverter_IV, Machine_BuckConverter_LuV, Machine_BuckConverter_ZPM, @@ -66,7 +65,6 @@ public enum CustomItemList implements IItemContainer { Machine_DebugGenny, UnusedStuff, Machine_DebugPollutor, - EMpipe, DATApipe, LASERpipe, rack_Hatch, @@ -303,24 +301,6 @@ public enum CustomItemList implements IItemContainer { eM_energyWirelessTunnel6_UXV, eM_energyWirelessTunnel7_UXV, - eM_in_UV, - eM_in_UHV, - eM_in_UEV, - eM_in_UIV, - eM_in_UMV, - eM_in_UXV, - eM_out_UV, - eM_out_UHV, - eM_out_UEV, - eM_out_UIV, - eM_out_UMV, - eM_out_UXV, - eM_muffler_UV, - eM_muffler_UHV, - eM_muffler_UEV, - eM_muffler_UIV, - eM_muffler_UMV, - eM_muffler_UXV, Parametrizer_Hatch, ParametrizerX_Hatch, ParametrizerTXT_Hatch, @@ -368,19 +348,8 @@ public enum CustomItemList implements IItemContainer { Machine_Multi_Switch, Machine_Multi_Research, Machine_Multi_DataBank, - Machine_Multi_MatterToEM, - Machine_Multi_EMToMatter, - Machine_Multi_EMjunction, - Machine_Multi_Scanner, - Machine_Multi_EssentiaToEM, - Machine_Multi_EMToEssentia, Machine_Multi_Infuser, - Machine_Multi_Collider, Machine_Multi_Decay, - Machine_Multi_EMmachine, - Machine_Multi_Stabilizer, - Machine_Multi_EMCrafter, - Machine_Multi_Wormhole, Machine_Multi_Annihilation, Machine_Multi_EyeOfHarmony, hint_0, @@ -400,17 +369,6 @@ public enum CustomItemList implements IItemContainer { hint_noAir, hint_error, - eM_avr_HV, - eM_avr_EV, - eM_avr_IV, - eM_avr_LuV, - eM_avr_ZPM, - eM_avr_UV, - eM_avr_UHV, - eM_avr_UEV, - eM_avr_UIV, - eM_avr_UMV, - scanContainer, parametrizerMemory, teslaCapacitor, @@ -441,7 +399,6 @@ public enum CustomItemList implements IItemContainer { Machine_TeslaCoil_4by4_EV, Machine_TeslaCoil_4by4_IV, DATApipeBlock, - EMpipeBlock, LASERpipeBlock, SpacetimeCompressionFieldGeneratorTier0, diff --git a/src/main/java/com/github/technus/tectech/thing/block/EyeOfHarmonyBlock.java b/src/main/java/com/github/technus/tectech/thing/block/EyeOfHarmonyBlock.java index 38670df38..a126fa2eb 100644 --- a/src/main/java/com/github/technus/tectech/thing/block/EyeOfHarmonyBlock.java +++ b/src/main/java/com/github/technus/tectech/thing/block/EyeOfHarmonyBlock.java @@ -21,7 +21,7 @@ public EyeOfHarmonyBlock() { super(Material.iron); this.setResistance(20f); this.setHardness(-1.0f); - this.setCreativeTab(TecTech.creativeTabEM); + this.setCreativeTab(TecTech.creativeTabTecTech); this.setBlockName("Eye of Harmony Renderer"); this.setLightLevel(100.0f); registerOther(this); diff --git a/src/main/java/com/github/technus/tectech/thing/item/AvrProgrammer.java b/src/main/java/com/github/technus/tectech/thing/item/AvrProgrammer.java deleted file mode 100644 index 8df0b63de..000000000 --- a/src/main/java/com/github/technus/tectech/thing/item/AvrProgrammer.java +++ /dev/null @@ -1,223 +0,0 @@ -package com.github.technus.tectech.thing.item; - -import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.TecTech.creativeTabTecTech; -import static net.minecraft.util.StatCollector.translateToLocal; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.List; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.util.FakePlayer; - -import com.github.technus.avrClone.AvrCore; -import com.github.technus.avrClone.instructions.InstructionRegistry; -import com.github.technus.avrClone.memory.program.ProgramMemory; -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.loader.gui.ModGuiHandler; -import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_MicroController; - -import cpw.mods.fml.common.Optional; -import dan200.computercraft.api.filesystem.IMount; -import dan200.computercraft.api.filesystem.IWritableMount; -import dan200.computercraft.api.media.IMedia; -import gregtech.api.enums.Mods; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - -@Optional.InterfaceList({ @Optional.Interface(iface = "dan200.computercraft.api.media.IMedia", modid = "ComputerCraft"), - @Optional.Interface(iface = "li.cil.oc.api.fs.FileSystem", modid = Mods.Names.OPEN_COMPUTERS) }) -public class AvrProgrammer extends Item implements IMedia { - - public static AvrProgrammer INSTANCE = new AvrProgrammer(); - - private AvrProgrammer() { - setMaxStackSize(1); - setHasSubtypes(true); - setUnlocalizedName("em.programmer"); - setTextureName(MODID + ":itemProgrammer"); - setCreativeTab(creativeTabTecTech); - } - - @Override - public boolean onItemUseFirst(ItemStack stack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int side, - float hitX, float hitY, float hitZ) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity == null || aPlayer instanceof FakePlayer) { - return aPlayer instanceof EntityPlayerMP; - } - if (aPlayer instanceof EntityPlayerMP) { - if (tTileEntity instanceof IGregTechTileEntity) { - IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); - if (metaTE instanceof GT_MetaTileEntity_MicroController) { - if (aPlayer.isSneaking()) { - if (stack.stackTagCompound.hasKey("pgm")) { - NBTTagCompound pgm = stack.stackTagCompound.getCompoundTag("pgm"); - if (pgm.hasKey("instructions")) { - AvrCore core = ((GT_MetaTileEntity_MicroController) metaTE).core; - InstructionRegistry registry = InstructionRegistry.REGISTRIES - .get(pgm.getString("instructionRegistry")); - if (registry != null) { - core.setProgramMemory( - new ProgramMemory( - registry, - pgm.getBoolean("immersive"), - pgm.getIntArray("instructions"), - pgm.getIntArray("param0"), - pgm.getIntArray("param1"))); - } - } - } - } else { - NBTTagCompound tag = new NBTTagCompound(); - metaTE.saveNBTData(tag); - stack.stackTagCompound.setTag("avr", tag.getCompoundTag("avr")); - } - return true; - } - } - } - return false; - } - - public void writeToProgrammer(ItemStack stack, InstructionRegistry registry, boolean immersive, - List strings) throws Exception { - writeToProgrammer(stack, new ProgramMemory(registry, immersive, strings)); - } - - public void writeToProgrammer(ItemStack stack, InstructionRegistry registry, boolean immersive, String... strings) - throws Exception { - writeToProgrammer(stack, new ProgramMemory(registry, immersive, strings)); - } - - public void writeToProgrammer(ItemStack stack, ProgramMemory programMemory) { - NBTTagCompound pgm = new NBTTagCompound(); - pgm.setIntArray("instructions", programMemory.instructions); - pgm.setIntArray("param0", programMemory.param0); - pgm.setIntArray("param1", programMemory.param1); - pgm.setBoolean("immersive", programMemory.immersiveOperands); - pgm.setString("instructionRegistry", programMemory.registry.toString()); - stack.stackTagCompound.setTag("pgm", pgm); - } - - @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { - if (world.isRemote) { - player.openGui(TecTech.instance, ModGuiHandler.PROGRAMMER_DISPLAY_SCREEN_ID, world, 0, 0, 0); - } - return itemStack; - } - - @Override - public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { - if (aStack.stackTagCompound.hasKey("avr")) { - NBTTagCompound avr = aStack.stackTagCompound.getCompoundTag("avr"); - aList.add(translateToLocal("item.em.programmer.desc.0") + ": " + avr.getInteger("programCounter")); // Current - // PC - aList.add(translateToLocal("item.em.programmer.desc.1") + ": " + avr.getBoolean("awoken")); // Awoken - aList.add(translateToLocal("item.em.programmer.desc.2") + ": " + avr.getBoolean("active")); // Active - aList.add(translateToLocal("item.em.programmer.desc.3") + ": " + avr.getBoolean("debugRun")); // Debug - aList.add(translateToLocal("item.em.programmer.desc.4") + ": " + avr.getBoolean("delay")); // Delay - } - } - - @Override - @Optional.Method(modid = "ComputerCraft") - public String getLabel(ItemStack itemStack) { - return itemStack.getDisplayName(); - } - - @Override - @Optional.Method(modid = "ComputerCraft") - public boolean setLabel(ItemStack itemStack, String s) { - itemStack.setStackDisplayName(s); - return true; - } - - @Override - @Optional.Method(modid = "ComputerCraft") - public String getAudioTitle(ItemStack itemStack) { - return null; - } - - @Override - @Optional.Method(modid = "ComputerCraft") - public String getAudioRecordName(ItemStack itemStack) { - return null; - } - - @Override - @Optional.Method(modid = "ComputerCraft") - public IMount createDataMount(ItemStack itemStack, World world) { - return new IWritableMount() { - - @Override - public void makeDirectory(String s) throws IOException { - throw new IOException("Cannot make dir!"); - } - - @Override - public void delete(String s) throws IOException { - if ("avr".equals(s)) { - itemStack.stackTagCompound.removeTag("avr"); - } else { - throw new IOException("Cannot remove file!"); - } - } - - @Override - public OutputStream openForWrite(String s) throws IOException { - return null; - } - - @Override - public OutputStream openForAppend(String s) throws IOException { - return null; - } - - @Override - public long getRemainingSpace() throws IOException { - return 1024000 - getSize("avr"); - } - - @Override - public boolean exists(String s) throws IOException { - return "avr".equals(s) && itemStack.getTagCompound().hasKey(s); - } - - @Override - public boolean isDirectory(String s) throws IOException { - return false; - } - - @Override - public void list(String s, List list) throws IOException {} - - @Override - public long getSize(String s) throws IOException { - return "avr".equals(s) ? 1 : 0; - } - - @Override - public InputStream openForRead(String s) throws IOException { - return null; - } - }; - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - ItemStack stack = new ItemStack(item, 1, 0); - stack.setTagCompound(new NBTTagCompound()); - list.add(stack); - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java deleted file mode 100644 index 61117d9fe..000000000 --- a/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java +++ /dev/null @@ -1,171 +0,0 @@ -package com.github.technus.tectech.thing.item; - -import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.TecTech.creativeTabEM; -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_1k; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_ITEM; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; -import static cpw.mods.fml.relauncher.Side.CLIENT; -import static net.minecraft.util.StatCollector.translateToLocal; - -import java.util.Collections; -import java.util.List; - -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.font.TecTechFontRender; -import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.IEMContainer; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; -import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.TT_Utility; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - -/** - * Created by Tec on 15.03.2017. - */ -public final class DebugElementalInstanceContainer_EM extends Item implements IElementalItem { - - public static DebugElementalInstanceContainer_EM INSTANCE; - - private DebugElementalInstanceContainer_EM() { - setMaxStackSize(1); - setUnlocalizedName("em.debugContainer"); - setTextureName(MODID + ":itemDebugContainer"); - setCreativeTab(creativeTabEM); - } - - @Override - public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, - int ordinalSide, float hitX, float hitY, float hitZ) { - NBTTagCompound tNBT = aStack.getTagCompound(); - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (aPlayer instanceof EntityPlayerMP) { - aStack.stackSize = 1; - if (tTileEntity instanceof IGregTechTileEntity) { - IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); - if (metaTE instanceof IEMContainer) { - EMInstanceStackMap content = ((IEMContainer) metaTE).getContentHandler(); - if (tNBT.hasKey("content")) { - try { - content.putUnifyAll( - EMInstanceStackMap - .fromNBT(TecTech.definitionsRegistry, tNBT.getCompoundTag("content"))); - } catch (EMException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return true; - } - ((IEMContainer) metaTE).purgeOverflow(); - tNBT.removeTag("content"); - tNBT.removeTag("symbols"); - } else if (content.hasStacks()) { - ((IEMContainer) metaTE).purgeOverflow(); - tNBT.setTag("content", content.toNBT(TecTech.definitionsRegistry)); - tNBT.setTag("symbols", TT_Utility.packStrings(content.getShortSymbolsInfo())); - content.clear(); - } - return true; - } - } - } - return aPlayer instanceof EntityPlayerMP; - } - - public ItemStack setContent(ItemStack aStack, EMInstanceStackMap content) { - NBTTagCompound tNBT = aStack.getTagCompound(); - if (tNBT == null) { - tNBT = new NBTTagCompound(); - aStack.setTagCompound(tNBT); - } - tNBT.setTag("content", content.toNBT(TecTech.definitionsRegistry)); - tNBT.setTag("symbols", TT_Utility.packStrings(content.getShortSymbolsInfo())); - return aStack; - } - - @Override - public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { - aList.add(CommonValues.TEC_MARK_EM); - try { - NBTTagCompound tNBT = aStack.getTagCompound(); - if (tNBT != null && tNBT.hasKey("content")) { - aList.add(translateToLocal("item.em.debugContainer.desc.0") + ": "); // Contains - EMInstanceStackMap content = EMInstanceStackMap - .fromNBT(TecTech.definitionsRegistry, tNBT.getCompoundTag("content")); - Collections.addAll(aList, content.getElementalInfo()); - } else { - aList.add(translateToLocal("item.em.debugContainer.desc.1")); // Container for elemental matter - } - aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.debugContainer.desc.2")); // Right click on - // elemental hatches - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - aList.add(translateToLocal("item.em.debugContainer.desc.3")); // ---Unexpected Termination--- - } - } - - public static void run() { - INSTANCE = new DebugElementalInstanceContainer_EM(); - GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName()); - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - ItemStack that = new ItemStack(this, 1); - that.setTagCompound(new NBTTagCompound()); - list.add(that); - for (IEMDefinition definition : TecTech.definitionsRegistry.getStacksRegisteredForDisplay()) { - list.add( - setContent( - new ItemStack(this).setStackDisplayName( - definition.getLocalizedName() + " " - + 1 - + " " - + translateToLocal("tt.keyword.unit.mbMols")), - new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_MATERIAL_AMOUNT)))); - list.add( - setContent( - new ItemStack(this).setStackDisplayName( - definition.getLocalizedName() + " " - + 1 - + " " - + translateToLocal("tt.keyword.unit.itemMols")), - new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_ITEM)))); - list.add( - setContent( - new ItemStack(this).setStackDisplayName( - definition.getLocalizedName() + " " - + 1000 - + " " - + translateToLocal("tt.keyword.unit.mbMols")), - new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_1k)))); - } - } - - @Override - @SideOnly(CLIENT) - public FontRenderer getFontRenderer(ItemStack stack) { - return TecTechFontRender.INSTANCE; - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java deleted file mode 100644 index 02977907e..000000000 --- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.github.technus.tectech.thing.item; - -import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.TecTech.creativeTabEM; -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static cpw.mods.fml.relauncher.Side.CLIENT; -import static net.minecraft.util.StatCollector.translateToLocal; - -import java.util.Collections; -import java.util.List; - -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.font.TecTechFontRender; -import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; -import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; -import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.TT_Utility; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.SideOnly; - -/** - * Created by Tec on 15.03.2017. - */ -public final class ElementalDefinitionContainer_EM extends Item implements IElementalItem { - - public static ElementalDefinitionContainer_EM INSTANCE; - - private ElementalDefinitionContainer_EM() { - setMaxStackSize(1); - setUnlocalizedName("em.definitionContainer"); - setTextureName(MODID + ":itemDefinitionContainer"); - setCreativeTab(creativeTabEM); - } - - public static void setContent(ItemStack aStack, EMConstantStackMap definitions) { - NBTTagCompound tNBT = aStack.getTagCompound(); - if (tNBT == null) { - tNBT = new NBTTagCompound(); - aStack.setTagCompound(tNBT); - } - tNBT.setTag("content", definitions.toNBT(TecTech.definitionsRegistry)); - tNBT.setTag("symbols", TT_Utility.packStrings(definitions.getShortSymbolsInfo())); - } - - public static EMConstantStackMap getContent(ItemStack containerItem) { - if (containerItem.getItem() instanceof ElementalDefinitionContainer_EM) { - NBTTagCompound tNBT = containerItem.stackTagCompound; - - if (tNBT == null || !tNBT.hasKey("content")) { - return null; - } - try { - return EMConstantStackMap.fromNBT(TecTech.definitionsRegistry, tNBT.getCompoundTag("content")); - } catch (EMException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - return null; - } - - public static EMConstantStackMap clearContent(ItemStack containerItem) { - if (containerItem.getItem() instanceof ElementalDefinitionContainer_EM) { - NBTTagCompound tNBT = containerItem.stackTagCompound; - if (tNBT == null) { - return null; - } - - EMConstantStackMap oldMap = null; - if (tNBT.hasKey("content")) { - try { - oldMap = EMConstantStackMap.fromNBT(TecTech.definitionsRegistry, tNBT.getCompoundTag("content")); - } catch (EMException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - tNBT.removeTag("content"); - tNBT.removeTag("symbols"); - return oldMap; - } - return null; - } - - @Override - public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { - aList.add(CommonValues.TEC_MARK_EM); - try { - NBTTagCompound tNBT = aStack.getTagCompound(); - if (tNBT != null && tNBT.hasKey("content")) { - aList.add(translateToLocal("item.em.definitionContainer.desc.0") + ": "); // Should Contain - EMDefinitionStackMap content = EMDefinitionStackMap - .fromNBT(TecTech.definitionsRegistry, tNBT.getCompoundTag("content")); - Collections.addAll(aList, content.getElementalInfo()); - } else { - aList.add(translateToLocal("item.em.definitionContainer.desc.1")); // Recipe Hint - } - } catch (Exception e) { - aList.add(translateToLocal("item.em.definitionContainer.desc.2")); // ---Unexpected Termination--- - } - } - - public static void run() { - INSTANCE = new ElementalDefinitionContainer_EM(); - GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName()); - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - ItemStack that = new ItemStack(this, 1); - that.setTagCompound(new NBTTagCompound()); - list.add(that); - } - - @Override - @SideOnly(CLIENT) - public FontRenderer getFontRenderer(ItemStack stack) { - return TecTechFontRender.INSTANCE; - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java deleted file mode 100644 index a915a563b..000000000 --- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java +++ /dev/null @@ -1,137 +0,0 @@ -package com.github.technus.tectech.thing.item; - -import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.TecTech.creativeTabTecTech; -import static cpw.mods.fml.relauncher.Side.CLIENT; -import static net.minecraft.util.StatCollector.translateToLocal; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.font.TecTechFontRender; -import com.github.technus.tectech.loader.gui.ModGuiHandler; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.thing.CustomItemList; -import com.github.technus.tectech.util.CommonValues; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -/** - * Created by Tec on 15.03.2017. - */ -public final class ElementalDefinitionScanStorage_EM extends Item { - - public static ElementalDefinitionScanStorage_EM INSTANCE; - public static IIcon offline, online; - - private ElementalDefinitionScanStorage_EM() { - setMaxStackSize(1); - setUnlocalizedName("em.definitionScanStorage"); - setTextureName(MODID + ":itemDefinitionScanStorage"); - setCreativeTab(creativeTabTecTech); - } - - // return previous thing - public static void setContent(ItemStack aStack, EMInstanceStackMap instances, int[] detailsOnDepthLevels) { - NBTTagCompound tNBT = aStack.getTagCompound(); - if (tNBT == null) { - tNBT = new NBTTagCompound(); - aStack.setTagCompound(tNBT); - } - tNBT.setTag("content", instances.toNBT(TecTech.definitionsRegistry)); - tNBT.setIntArray("scanConfiguration", detailsOnDepthLevels); - } - - public static void clearContent(ItemStack containerItem) { - if (containerItem.getItem() instanceof ElementalDefinitionScanStorage_EM) { - if (containerItem.stackTagCompound == null) { - return; - } - containerItem.stackTagCompound = null; - } - } - - public static ArrayList getLines(ItemStack containerItem) { - if (containerItem.stackTagCompound != null && containerItem.stackTagCompound.hasKey("content")) { - EMInstanceStackMap content = EMInstanceStackMap - .fromNBT(TecTech.definitionsRegistry, containerItem.stackTagCompound.getCompoundTag("content")); - return content.getScanInfo(containerItem.stackTagCompound.getIntArray("scanConfiguration")); - } - return null; - } - - @Override - public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { - aList.add(CommonValues.TEC_MARK_EM); - if (aStack.stackTagCompound != null && aStack.stackTagCompound.hasKey("content")) { - aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.definitionScanStorage.desc.0")); // Contains - // scan - // result - aList.add(translateToLocal("item.em.definitionScanStorage.desc.1")); // Use to read - } else { - aList.add(translateToLocal("item.em.definitionScanStorage.desc.2")); // Storage for matter scan data - } - } - - public static void run() { - INSTANCE = new ElementalDefinitionScanStorage_EM(); - GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName()); - CustomItemList.scanContainer.set(INSTANCE); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) { - offline = iconRegister.registerIcon(MODID + ":itemDefinitionScanStorageOff"); - online = itemIcon = iconRegister.registerIcon(getIconString()); - } - - @Override - public IIcon getIconIndex(ItemStack itemStack) { - NBTTagCompound tagCompound = itemStack.stackTagCompound; - return tagCompound != null && tagCompound.hasKey("content") ? online : offline; - } - - @Override - public IIcon getIcon(ItemStack itemStack, int pass) { - NBTTagCompound tagCompound = itemStack.stackTagCompound; - return tagCompound != null && tagCompound.hasKey("content") ? online : offline; - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - ItemStack that = new ItemStack(this, 1); - list.add(that); - } - - @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { - if (world.isRemote) { - NBTTagCompound tagCompound = itemStack.stackTagCompound; - if (tagCompound != null && tagCompound.hasKey("content")) { - player.openGui(TecTech.instance, ModGuiHandler.SCAN_DISPLAY_SCREEN_ID, world, 0, 0, 0); - } - } - return itemStack; - } - - @Override - @SideOnly(CLIENT) - public FontRenderer getFontRenderer(ItemStack stack) { - return TecTechFontRender.INSTANCE; - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/item/gui/ScanDisplayScreen.java b/src/main/java/com/github/technus/tectech/thing/item/gui/ScanDisplayScreen.java index e574e1ca8..3a788ecee 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/gui/ScanDisplayScreen.java +++ b/src/main/java/com/github/technus/tectech/thing/item/gui/ScanDisplayScreen.java @@ -8,19 +8,15 @@ import static org.lwjgl.opengl.GL11.glDisable; import static org.lwjgl.opengl.GL11.glEnable; -import java.util.Objects; - import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.audio.SoundHandler; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.font.TecTechFontRender; -import com.github.technus.tectech.thing.item.ElementalDefinitionScanStorage_EM; /** * Created by danie_000 on 17.12.2017. @@ -30,7 +26,7 @@ public class ScanDisplayScreen extends GuiScreen { private static final int sizeX = 240, sizeY = 220, renderedLines = 10; private int baseX, baseY; private Button up, down, pgUp, pgDown; - private final String[] lines; + private final String[] lines = { "" }; private int firstLine; private static final ResourceLocation[] BACKGROUNDS = new ResourceLocation[] { @@ -44,10 +40,7 @@ public class ScanDisplayScreen extends GuiScreen { new ResourceLocation(MODID + ":textures/gui/scanDisplayScreen8.png") }; private static final ResourceLocation ITEM = new ResourceLocation(MODID + ":textures/gui/scanDisplayItem.png"); - public ScanDisplayScreen(EntityPlayer player) { - lines = Objects.requireNonNull(ElementalDefinitionScanStorage_EM.getLines(player.getHeldItem())) - .toArray(new String[0]); - } + public ScanDisplayScreen() {} @Override public void drawScreen(int x, int y, float partialTicks) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java deleted file mode 100644 index d883dc1ab..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ /dev/null @@ -1,363 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.hatch; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; -import static com.github.technus.tectech.util.CommonValues.DECAY_AT; -import static com.github.technus.tectech.util.CommonValues.MOVE_AT; -import static com.github.technus.tectech.util.CommonValues.OVERFLOW_AT; -import static com.github.technus.tectech.util.CommonValues.TEC_MARK_EM; -import static com.github.technus.tectech.util.CommonValues.V; -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; -import static net.minecraft.util.StatCollector.translateToLocalFormatted; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; - -import org.apache.commons.lang3.reflect.FieldUtils; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.IEMContainer; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.mechanics.pipe.IConnectsToElementalPipe; -import com.github.technus.tectech.util.TT_Utility; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.Dyes; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Utility; - -/** - * Created by danie_000 on 11.12.2016. - */ -public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_MetaTileEntity_Hatch - implements IEMContainer, IConnectsToElementalPipe { - - private static Textures.BlockIcons.CustomIcon EM_T_SIDES; - private static Textures.BlockIcons.CustomIcon EM_T_ACTIVE; - private static Textures.BlockIcons.CustomIcon EM_T_CONN; - - private String clientLocale = "en_US"; - - protected EMInstanceStackMap content = new EMInstanceStackMap(); - // float lifeTimeMult=1f; - public int postEnergize = 0; - public double overflowMatter = 0f; - public short id = -1; - private byte deathDelay = 2; - - protected GT_MetaTileEntity_Hatch_ElementalContainer(int aID, String aName, String aNameRegional, int aTier, - String descr) { - super( - aID, - aName, - aNameRegional, - aTier, - 0, - new String[] { TEC_MARK_EM, descr, - translateToLocal("tt.base.emhatch.desc.0") + " " - + EnumChatFormatting.AQUA - + GT_Utility.formatNumbers(aTier * aTier >> 4), - translateToLocal("tt.base.emhatch.desc.1") + " " - + EnumChatFormatting.AQUA - + TT_Utility.formatNumberShortExp(aTier * aTier >> 4), - translateToLocal("tt.base.emhatch.desc.2"), translateToLocal("tt.base.emhatch.desc.3"), - translateToLocal("tt.base.emhatch.desc.4"), translateToLocal("tt.base.emhatch.desc.5"), - translateToLocal("tt.base.emhatch.desc.6"), - EnumChatFormatting.AQUA + translateToLocal("tt.base.emhatch.desc.7") }); - TT_Utility.setTier(aTier, this); - } - - protected GT_MetaTileEntity_Hatch_ElementalContainer(String aName, int aTier, String[] aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, 0, aDescription, aTextures); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aBlockIconRegister) { - super.registerIcons(aBlockIconRegister); - EM_T_ACTIVE = new Textures.BlockIcons.CustomIcon("iconsets/OVERLAY_EM_T_ACTIVE"); - EM_T_SIDES = new Textures.BlockIcons.CustomIcon("iconsets/OVERLAY_EM_T_SIDES"); - EM_T_CONN = new Textures.BlockIcons.CustomIcon("iconsets/EM_PIPE_CONN"); - } - - @Override - public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, - new GT_RenderedTexture( - EM_T_ACTIVE, - Dyes.getModulation(getBaseMetaTileEntity().getColorization(), MACHINE_METAL.getRGBA())), - new GT_RenderedTexture(EM_T_CONN) }; - } - - @Override - public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, - new GT_RenderedTexture( - EM_T_SIDES, - Dyes.getModulation(getBaseMetaTileEntity().getColorization(), MACHINE_METAL.getRGBA())), - new GT_RenderedTexture(EM_T_CONN) }; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setInteger("postEnergize", postEnergize); - // aNBT.setFloat("lifeTimeMult",lifeTimeMult); - aNBT.setDouble("OverflowMatter", overflowMatter); - content.cleanUp(); - aNBT.setTag("eM_Stacks", content.toNBT(TecTech.definitionsRegistry)); - aNBT.setShort("eID", id); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - postEnergize = aNBT.getInteger("postEnergize"); - // lifeTimeMult=aNBT.getFloat("lifeTimeMult"); - overflowMatter = aNBT.getFloat("overflowMatter") + aNBT.getDouble("OverflowMatter"); - id = aNBT.getShort("eID"); - try { - content = EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry, aNBT.getCompoundTag("eM_Stacks")); - } catch (EMException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - if (content == null) { - content = new EMInstanceStackMap(); - } - } - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide()) { - byte Tick = (byte) (aTick % 20); - if (DECAY_AT == Tick) { - purgeOverflow(); - content.tickContent(1, postEnergize, 1); // Hatches don't life time mult things - purgeOverflow(); - } else if (OVERFLOW_AT == Tick) { - if (overflowMatter <= 0) { - deathDelay = 3; - } else { - if (deathDelay == 1) { - IGregTechTileEntity tGTTileEntity = aBaseMetaTileEntity - .getIGregTechTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()); - if (tGTTileEntity == null || !(tGTTileEntity - .getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_OverflowElemental)) { - tGTTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityAtSide(ForgeDirection.DOWN); - } - if (tGTTileEntity == null || !(tGTTileEntity - .getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_OverflowElemental)) { - tGTTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityAtSide(ForgeDirection.UP); - } - if (tGTTileEntity != null && tGTTileEntity - .getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_OverflowElemental) { - GT_MetaTileEntity_Hatch_OverflowElemental aMetaTileEntity = (GT_MetaTileEntity_Hatch_OverflowElemental) tGTTileEntity - .getMetaTileEntity(); - if (aMetaTileEntity.addOverflowMatter(overflowMatter)) { - if (TecTech.configTecTech.BOOM_ENABLE) { - tGTTileEntity.doExplosion(V[14]); - } else { - TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity, overflowMatter * 32D); - TecTech.proxy.broadcast( - "Container1 " + translateToLocal("tt.keyword.BOOM") - + " " - + aBaseMetaTileEntity.getXCoord() - + ' ' - + aBaseMetaTileEntity.getYCoord() - + ' ' - + aBaseMetaTileEntity.getZCoord()); - } - } - deathDelay = 3; // needed in some cases like repetitive failures. Should be 4 since there is - // -- - // at end but meh... - overflowMatter = 0F; - } - } else if (deathDelay < 1) { - if (TecTech.configTecTech.BOOM_ENABLE) { - aBaseMetaTileEntity.doExplosion(V[14]); - } else { - TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity, overflowMatter * 32D); - deathDelay = 3; - overflowMatter = 0; - TecTech.proxy.broadcast( - "Container0 " + translateToLocal("tt.keyword.BOOM") - + " " - + aBaseMetaTileEntity.getXCoord() - + ' ' - + aBaseMetaTileEntity.getYCoord() - + ' ' - + aBaseMetaTileEntity.getZCoord()); - } - } - deathDelay--; - } - } else if (MOVE_AT == Tick) { - if (content.hasStacks()) { - content.cleanUp(); - moveAround(aBaseMetaTileEntity); - } - getBaseMetaTileEntity().setActive(content.hasStacks()); - } - } - } - - public void moveAround(IGregTechTileEntity aBaseMetaTileEntity) {} - - @Override - public EMInstanceStackMap getContentHandler() { - return content; - } - - @Override - public boolean isFacingValid(ForgeDirection facing) { - return true; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isLiquidInput(ForgeDirection side) { - return false; - } - - @Override - public boolean isFluidInputAllowed(FluidStack aFluid) { - return false; - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return false; - } - - @Override - public boolean isValidSlot(int aIndex) { - return false; - } - - public int getMaxStacksCount() { - return mTier * mTier >> 4; - } - - public double getMaxStackSize() { - return mTier * (mTier - 7) * 64D * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; - } - - @Override - public void purgeOverflow() { - overflowMatter += content.removeOverflow(getMaxStacksCount(), getMaxStackSize()); - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - super.onRightclick(aBaseMetaTileEntity, aPlayer); - - if (!aBaseMetaTileEntity.isClientSide() && aPlayer instanceof EntityPlayerMP) { - try { - EntityPlayerMP player = (EntityPlayerMP) aPlayer; - clientLocale = (String) FieldUtils.readField(player, "translator", true); - } catch (Exception e) { - clientLocale = "en_US"; - } - } else { - return true; - } - return true; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public String[] getInfoData() { - if (TecTech.configTecTech.EASY_SCAN || DEBUG_MODE) { - if (id > 0) { - if (content == null || content.size() == 0) { - return new String[] { translateToLocalFormatted("tt.keyword.ID", clientLocale) + ": " - + EnumChatFormatting.AQUA - + id, translateToLocalFormatted("tt.keyphrase.No_Stacks", clientLocale) }; - } else { - String[] lines = content.getElementalInfo(); - String[] output = new String[lines.length + 1]; - output[0] = translateToLocalFormatted("tt.keyword.ID", clientLocale) + ": " - + EnumChatFormatting.AQUA - + id; - System.arraycopy(lines, 0, output, 1, lines.length); - return output; - } - } - if (content == null || content.size() == 0) { - return new String[] { translateToLocalFormatted("tt.keyphrase.No_Stacks", clientLocale) }; - } - return content.getElementalInfo(); - } else { - if (id > 0) { - if (content == null || content.size() == 0) { - return new String[] { translateToLocalFormatted("tt.keyword.ID", clientLocale) + ": " - + EnumChatFormatting.AQUA - + id, translateToLocalFormatted("tt.keyphrase.No_Stacks", clientLocale) }; - } - return new String[] { - translateToLocalFormatted("tt.keyword.ID", clientLocale) + ": " + EnumChatFormatting.AQUA + id, - translateToLocalFormatted("tt.keyphrase.Contains_EM", clientLocale) }; - } - if (content == null || content.size() == 0) { - return new String[] { translateToLocalFormatted("tt.keyphrase.No_Stacks", clientLocale) }; - } - return new String[] { translateToLocalFormatted("tt.keyphrase.Contains_EM", clientLocale) }; - } - } - - public void updateSlots() { - purgeOverflow(); - } - - @Override - public void onRemoval() { - if (isValidMetaTileEntity(this) && getBaseMetaTileEntity().isActive()) { - TecTech.anomalyHandler.addAnomaly(getBaseMetaTileEntity(), (overflowMatter + content.getMass()) * 16D); - IGregTechTileEntity base = getBaseMetaTileEntity(); - if (TecTech.configTecTech.BOOM_ENABLE) { - base.doExplosion(V[15]); - } else { - TecTech.proxy.broadcast( - translateToLocal("tt.keyword.BOOM") + " " - + base.getXCoord() - + ' ' - + base.getYCoord() - + ' ' - + base.getZCoord()); - } - } - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputElemental.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputElemental.java deleted file mode 100644 index 54939327c..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputElemental.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.hatch; - -import static net.minecraft.util.StatCollector.translateToLocal; - -import net.minecraftforge.common.util.ForgeDirection; - -import com.github.technus.tectech.util.TT_Utility; - -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; - -/** - * Created by danie_000 on 27.10.2016. - */ -public class GT_MetaTileEntity_Hatch_InputElemental extends GT_MetaTileEntity_Hatch_ElementalContainer { - - public GT_MetaTileEntity_Hatch_InputElemental(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, translateToLocal("gt.blockmachines.emin.desc")); - TT_Utility.setTier(aTier, this); - } - - public GT_MetaTileEntity_Hatch_InputElemental(String aName, int aTier, String[] aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_InputElemental(mName, mTier, mDescriptionArray, mTextures); - } - - @Override - public boolean isInputFacing(ForgeDirection side) { - return side == getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public boolean isOutputFacing(ForgeDirection side) { - return false; - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - public boolean canConnect(ForgeDirection side) { - return isInputFacing(side); - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputElemental.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputElemental.java deleted file mode 100644 index ca662897f..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputElemental.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.hatch; - -import static net.minecraft.util.StatCollector.translateToLocal; - -import net.minecraftforge.common.util.ForgeDirection; - -import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_EM; -import com.github.technus.tectech.util.TT_Utility; - -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; - -/** - * Created by danie_000 on 27.10.2016. - */ -public class GT_MetaTileEntity_Hatch_OutputElemental extends GT_MetaTileEntity_Hatch_ElementalContainer { - - public GT_MetaTileEntity_Hatch_OutputElemental(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, translateToLocal("gt.blockmachines.emout.desc")); // Elemental Output - // for Multiblocks - TT_Utility.setTier(aTier, this); - } - - public GT_MetaTileEntity_Hatch_OutputElemental(String aName, int aTier, String[] aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_OutputElemental(mName, mTier, mDescriptionArray, mTextures); - } - - @Override - public boolean isOutputFacing(ForgeDirection side) { - return side == getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public boolean isInputFacing(ForgeDirection side) { - return false; - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - public void moveAround(IGregTechTileEntity aBaseMetaTileEntity) { - byte color = getBaseMetaTileEntity().getColorization(); - if (color < 0) { - return; - } - final ForgeDirection front = aBaseMetaTileEntity.getFrontFacing(); - final ForgeDirection opposite = front.getOpposite(); - for (byte dist = 1; dist < 16; dist++) { - IGregTechTileEntity tGTTileEntity = aBaseMetaTileEntity - .getIGregTechTileEntityAtSideAndDistance(front, dist); - if (tGTTileEntity != null && tGTTileEntity.getColorization() == color) { - IMetaTileEntity aMetaTileEntity = tGTTileEntity.getMetaTileEntity(); - if (aMetaTileEntity != null) { - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputElemental - && opposite == tGTTileEntity.getFrontFacing()) { - ((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity).getContentHandler() - .putUnifyAll(content); - ((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity).updateSlots(); - content.clear(); - return; - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Pipe_EM) { - if (((GT_MetaTileEntity_Pipe_EM) aMetaTileEntity).connectionCount != 2) { - return; - } else { - ((GT_MetaTileEntity_Pipe_EM) aMetaTileEntity).markUsed(); - } - } else { - return; - } - } else { - return; - } - } else { - return; - } - } - } - - @Override - public boolean canConnect(ForgeDirection side) { - return isOutputFacing(side); - } -} 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 deleted file mode 100644 index 56615882d..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java +++ /dev/null @@ -1,307 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.hatch; - -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 gregtech.api.enums.Dyes.MACHINE_METAL; -import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity; -import static net.minecraft.util.StatCollector.translateToLocal; -import static net.minecraft.util.StatCollector.translateToLocalFormatted; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.EnumSkyBlock; -import net.minecraftforge.common.util.ForgeDirection; - -import org.apache.commons.lang3.reflect.FieldUtils; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.TT_Utility; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.Dyes; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.objects.GT_RenderedTexture; - -/** - * Created by danie_000 on 12.12.2016. - */ -public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity_Hatch { - - private static Textures.BlockIcons.CustomIcon EM_T_SIDES; - private static Textures.BlockIcons.CustomIcon EM_T_ACTIVE; - public static Textures.BlockIcons.CustomIcon MufflerEM; - public static Textures.BlockIcons.CustomIcon MufflerEMidle; - private double overflowMatter; - public final double overflowMax; - private final double overflowDisperse; - - private String clientLocale = "en_US"; - - public GT_MetaTileEntity_Hatch_OverflowElemental(int aID, String aName, String aNameRegional, int aTier, - double max) { - super( - aID, - aName, - aNameRegional, - aTier, - 0, - new String[] { CommonValues.TEC_MARK_EM, translateToLocal("gt.blockmachines.hatch.emmuffler.desc.0"), - translateToLocal("gt.blockmachines.hatch.emmuffler.desc.1") + ": " - + EnumChatFormatting.AQUA - + TT_Utility.formatNumberShortExp(max) - + " " - + translateToLocal("tt.keyword.unit.mass"), - translateToLocal("gt.blockmachines.hatch.emmuffler.desc.2") + ": " - + EnumChatFormatting.AQUA - + TT_Utility.formatNumberShortExp(max / (float) (30 - aTier)) - + " " - + translateToLocal("tt.keyword.unit.massFlux"), - translateToLocal("gt.blockmachines.hatch.emmuffler.desc.3") }); - overflowMatter = max / 2; - overflowMax = max; - overflowDisperse = overflowMax / (float) (30 - aTier); - TT_Utility.setTier(aTier, this); - } - - public GT_MetaTileEntity_Hatch_OverflowElemental(String aName, int aTier, double max, String[] aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, 0, aDescription, aTextures); - overflowMatter = max / 2; - overflowMax = max; - overflowDisperse = overflowMax / (float) (30 - aTier); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aBlockIconRegister) { - super.registerIcons(aBlockIconRegister); - EM_T_ACTIVE = new Textures.BlockIcons.CustomIcon("iconsets/OVERLAY_EM_T_ACTIVE"); - EM_T_SIDES = new Textures.BlockIcons.CustomIcon("iconsets/OVERLAY_EM_T_SIDES"); - MufflerEM = new Textures.BlockIcons.CustomIcon("iconsets/MUFFLER_EM"); - MufflerEMidle = new Textures.BlockIcons.CustomIcon("iconsets/MUFFLER_EM_IDLE"); - } - - @Override - public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, - new GT_RenderedTexture( - EM_T_ACTIVE, - Dyes.getModulation(getBaseMetaTileEntity().getColorization(), MACHINE_METAL.getRGBA())), - new GT_RenderedTexture(MufflerEM) }; - } - - @Override - public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, - new GT_RenderedTexture( - EM_T_SIDES, - Dyes.getModulation(getBaseMetaTileEntity().getColorization(), MACHINE_METAL.getRGBA())), - new GT_RenderedTexture(MufflerEMidle) }; - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - public boolean isFacingValid(ForgeDirection facing) { - return true; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isValidSlot(int aIndex) { - return false; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_OverflowElemental(mName, mTier, overflowMax, mDescriptionArray, mTextures); - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setDouble("OverflowMatter", overflowMatter); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - overflowMatter = aNBT.getFloat("overflowMatter") + aNBT.getDouble("OverflowMatter"); - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return false; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide() && aTick % 20 == DISPERSE_AT) { - if (aBaseMetaTileEntity.isActive()) { - if (overflowMatter > overflowDisperse) { - TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity, overflowDisperse / (Math.pow(2, mTier))); - overflowMatter -= overflowDisperse; - } else { - TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity, overflowMatter / (Math.pow(2, mTier))); - overflowMatter = 0; - aBaseMetaTileEntity.setActive(false); - aBaseMetaTileEntity.setLightValue((byte) 0); - aBaseMetaTileEntity.getWorld().updateLightByType( - EnumSkyBlock.Block, - aBaseMetaTileEntity.getXCoord(), - aBaseMetaTileEntity.getYCoord(), - aBaseMetaTileEntity.getZCoord()); - } - vapePollution(aBaseMetaTileEntity); - } else { - if (overflowMatter > 0) { - aBaseMetaTileEntity.setActive(true); - aBaseMetaTileEntity.setLightValue((byte) 15); - aBaseMetaTileEntity.getWorld().updateLightByType( - EnumSkyBlock.Block, - aBaseMetaTileEntity.getXCoord(), - aBaseMetaTileEntity.getYCoord(), - aBaseMetaTileEntity.getZCoord()); - } - } - } else if (aBaseMetaTileEntity.isClientSide() && aBaseMetaTileEntity.isActive()) { - TecTech.proxy.em_particle(aBaseMetaTileEntity, aBaseMetaTileEntity.getFrontFacing()); - } - super.onPostTick(aBaseMetaTileEntity, aTick); - // DOES NOT CHECK FOR TOO MUCH, it is done only while putting stuff in (OPTIMIZATION!!!) - } - - private void vapePollution(IGregTechTileEntity mte) { - float xPos = mte.getXCoord() + 0.5f; - float yPos = mte.getYCoord() + 0.5f; - float zPos = mte.getZCoord() + 0.5f; - - int xDirShift = mte.getFrontFacing().offsetX; - int yDirShift = mte.getFrontFacing().offsetY; - int zDirShift = mte.getFrontFacing().offsetZ; - - AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox( - xPos - .5 + xDirShift, - yPos - .5 + yDirShift, - zPos - .5 + zDirShift, - xPos + .5 + xDirShift, - yPos + 1.5 + yDirShift, - zPos + .5 + zDirShift); - for (Object entity : mte.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, aabb)) { - float damagingFactor = (float) Math.log(overflowDisperse); - ((EntityLivingBase) entity) - .addPotionEffect(new PotionEffect(Potion.confusion.id, 1, (int) (damagingFactor * 20))); - ((EntityLivingBase) entity) - .addPotionEffect(new PotionEffect(Potion.wither.id, 2, (int) (damagingFactor * 15))); - ((EntityLivingBase) entity).attackEntityFrom(elementalPollution, damagingFactor); - if (entity instanceof EntityPlayer) { - TecTech.anomalyHandler.addMass((EntityPlayer) entity, overflowDisperse); - } - } - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - super.onRightclick(aBaseMetaTileEntity, aPlayer); - - if (!aBaseMetaTileEntity.isClientSide() && aPlayer instanceof EntityPlayerMP) { - try { - EntityPlayerMP player = (EntityPlayerMP) aPlayer; - clientLocale = (String) FieldUtils.readField(player, "translator", true); - } catch (Exception e) { - clientLocale = "en_US"; - } - } else { - return true; - } - return true; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public String[] getInfoData() { - return new String[] { translateToLocalFormatted("tt.keyphrase.Contained_mass", clientLocale) + ":", - EnumChatFormatting.RED + TT_Utility.formatNumberExp(overflowMatter) - + EnumChatFormatting.RESET - + " " - + translateToLocal("tt.keyword.unit.mass") - + " / ", - EnumChatFormatting.GREEN + TT_Utility.formatNumberShortExp(overflowMax) - + EnumChatFormatting.RESET - + " " - + translateToLocal("tt.keyword.unit.mass"), - translateToLocalFormatted("tt.keyphrase.Mass_Disposal_speed", clientLocale) + ": " - + EnumChatFormatting.BLUE - + TT_Utility.formatNumberShortExp(overflowDisperse) - + EnumChatFormatting.RESET - + " " - + translateToLocal("tt.keyword.unit.massFlux") }; - } - - @Override - public void onRemoval() { - if (isValidMetaTileEntity(this) && getBaseMetaTileEntity().isActive()) { - TecTech.anomalyHandler.addAnomaly(getBaseMetaTileEntity(), overflowMatter); - if (TecTech.configTecTech.BOOM_ENABLE) { - getBaseMetaTileEntity().doExplosion(V[15]); - } else { - TecTech.proxy.broadcast( - translateToLocalFormatted("tt.keyphrase.Muffler_BOOM", clientLocale) + " " - + getBaseMetaTileEntity().getXCoord() - + ' ' - + getBaseMetaTileEntity().getYCoord() - + ' ' - + getBaseMetaTileEntity().getZCoord()); - } - } - } - - // Return - Should Explode - public boolean addOverflowMatter(double matter) { - overflowMatter += matter; - return overflowMatter > overflowMax; - } - - public double getOverflowMatter() { - return overflowMatter; - } - - // Return - Should Explode - public boolean setOverflowMatter(double overflowMatter) { - this.overflowMatter = overflowMatter; - return overflowMatter > overflowMax; - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java deleted file mode 100644 index 296002afb..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi; - -import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; -import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; -import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; -import static net.minecraft.util.StatCollector.translateToLocal; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; - -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.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; -import com.github.technus.tectech.util.CommonValues; -import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - - // region variables - private static Textures.BlockIcons.CustomIcon ScreenOFF; - private static Textures.BlockIcons.CustomIcon ScreenON; - private static final String[] description = new String[] { - EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", - translateToLocal("gt.blockmachines.multimachine.em.annihilation.hint.0"), // 1 - Classic Hatches or High - // Power Casing - translateToLocal("gt.blockmachines.multimachine.em.annihilation.hint.1"), // 2 - Elemental Hatches or - // Molecular Casing - }; - // endregion - - // region structure - private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition - .builder() - .addShape( - "main", - transpose( - new String[][] { - { " ", " AB BA ", " AB BA ", " BBB ", " A A A ", - "AA F AA", " A A A ", " BBB ", " AB BA ", " AB BA ", - " " }, - { " ", " AB BA ", " EECEEECEE ", " EGGEEEGGE ", "ACGGGEGGGCA", - "AEGGGDGGGEA", "ACGGGEGGGCA", " EGGEEEGGE ", " EECEEECEE ", " AB BA ", - " " }, - { " ", " B B ", " EGGEGEGGE ", " G G ", " G G ", - " G G ", " G G ", " G G ", " EGGEGEGGE ", " B B ", - " " }, - { " AAA ", "AA BAB AA", "ACGGEGEGGCA", " G G ", " G G ", - " G G ", " G G ", " G G ", "ACGGEGEGGCA", "AA BAB AA", - " AAA " }, - { " AHHHA ", "BBBBBBBBBBB", "BEEEDEDEEEB", "BE EB", " G G ", - " G G ", " G G ", "BE EB", "BEEEDEDEEEB", "BBBBBBBBBBB", - " AHHHA " }, - { " AH~HA ", " ABBBA ", " EGGEEEGGE ", "BE EB", "AE EA", - "FD DF", "AE EA", "BE EB", " EGGEEEGGE ", " ABBBA ", - " AHHHA " }, - { " AHHHA ", "BBBBBBBBBBB", "BEEEDEDEEEB", "BE EB", " G G ", - " G G ", " G G ", "BE EB", "BEEEDEDEEEB", "BBBBBBBBBBB", - " AHHHA " }, - { " AAA ", "AA BAB AA", "ACGGEGEGGCA", " G G ", " G G ", - " G G ", " G G ", " G G ", "ACGGEGEGGCA", "AA BAB AA", - " AAA " }, - { " ", " B B ", " EGGEGEGGE ", " G G ", " G G ", - " G G ", " G G ", " G G ", " EGGEGEGGE ", " B B ", - " " }, - { " ", " AB BA ", " EECEEECEE ", " EGGEEEGGE ", "ACGGGEGGGCA", - "AEGGGDGGGEA", "ACGGGEGGGCA", " EGGEEEGGE ", " EECEEECEE ", " AB BA ", - " " }, - { " ", " AB BA ", " AB BA ", " BBB ", " A A A ", - "AA F AA", " A A A ", " BBB ", " AB BA ", " AB BA ", - " " } })) - .addElement('A', ofBlock(sBlockCasingsTT, 4)).addElement('B', ofBlock(sBlockCasingsTT, 5)) - .addElement('C', ofBlock(sBlockCasingsTT, 6)).addElement('D', ofBlock(sBlockCasingsTT, 10)) - .addElement('E', ofBlock(sBlockCasingsTT, 12)).addElement('G', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement( - 'H', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_annihilation::addClassicToMachineList, - textureOffset, - 1, - sBlockCasingsTT, - 0)) - .addElement( - 'F', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_annihilation::addElementalToMachineList, - textureOffset + 4, - 2, - sBlockCasingsTT, - 4)) - .build(); - // endregion - - public GT_MetaTileEntity_EM_annihilation(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_annihilation(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_annihilation(mName); - } - - @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM("main", 5, 5, 0); - } - - @Override - public GT_Multiblock_Tooltip_Builder createTooltip() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(translateToLocal("gt.blockmachines.multimachine.em.annihilation.name")) // Machine Type: - // Annihilation - // Generator - .addInfo(translateToLocal("gt.blockmachines.multimachine.em.annihilation.desc.0")) // Controller block - // of the - // Annihilation Generator - .addInfo(translateToLocal("tt.keyword.Structure.StructureTooComplex")) // The structure is too complex! - .addSeparator().beginStructureBlock(11, 11, 11, false) - .addOtherStructurePart( - translateToLocal("tt.keyword.Structure.Elemental"), - translateToLocal("tt.keyword.Structure.AnyMolecularCasing"), - 1) // Elemental Hatch: Any Molecular Casing - .addEnergyHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasing"), 1) // Energy Hatch: Any - // High Power Casing - .addMaintenanceHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasing"), 1) // Maintenance - // Hatch: Any High - // Power Casing - .toolTipFinisher(CommonValues.TEC_MARK_EM); - return tt; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aBlockIconRegister) { - ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_ANNIHILATION"); - ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_ANNIHILATION_ACTIVE"); - super.registerIcons(aBlockIconRegister); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, - int colorIndex, boolean aActive, boolean aRedstone) { - if (side == facing) { - return new ITexture[] { Textures.BlockIcons.casingTexturePages[texturePage][12], - new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF) }; - } - return new ITexture[] { Textures.BlockIcons.casingTexturePages[texturePage][12] }; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - structureBuild_EM("main", 5, 5, 0, stackSize, hintsOnly); - } - - @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; - } - - @Override - public String[] getStructureDescription(ItemStack stackSize) { - return description; - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java deleted file mode 100644 index 22704a349..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java +++ /dev/null @@ -1,1306 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi; - -import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; -import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; -import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; -import static net.minecraft.util.StatCollector.translateToLocal; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; - -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.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; -import com.github.technus.tectech.util.CommonValues; -import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - - // region variables - private static Textures.BlockIcons.CustomIcon ScreenOFF; - private static Textures.BlockIcons.CustomIcon ScreenON; - - public boolean glassDome = false; - // endregion - - // Time dillatation - to slow down the explosion thing but REALLY REDUCE POWER OUTPUT - // Startcodes to startup - // per dim disable thingies - - // region structure actual - private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition - .builder() - .addShape( - "main_t1", - transpose( - new String[][] { - { " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " C C ", " C C ", - " C C ", " CCCCCCCCC ", - " C C ", " CCCCCCCCC ", - " C C ", " C C ", - " C C ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " " }, - { " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " C C ", - " C C ", " C C ", - " C C ", " DDDDD ", - " DDCDCDD ", " CCCCDCCDCCDCCCC ", - " DDDDDDD ", " CCCCDCCDCCDCCCC ", - " DDCDCDD ", " DDDDD ", - " C C ", " C C ", - " C C ", " C C ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " " }, - { " ", " ", - " ", " ", - " ", " ", - " ", " C C ", - " C C ", " C C ", - " D ", " D ", - " DDDDDDD ", " DD DD ", - " D EEE D ", " CCC D EAAAE D CCC ", - " DDD EAAAE DDD ", " CCC D EAAAE D CCC ", - " D EEE D ", " DD DD ", - " DDDDDDD ", " D ", - " D ", " C C ", - " C C ", " C C ", - " ", " ", - " ", " ", - " ", " ", - " " }, - { " ", " ", - " ", " ", - " ", " ", - " C C ", " C C ", - " D ", " D ", - " ", " ", - " ", " ", - " ", " CC CC ", - " DD DD ", " CC CC ", - " ", " ", - " ", " ", - " ", " D ", - " D ", " C C ", - " C C ", " ", - " ", " ", - " ", " ", - " " }, - { " ", " ", - " ", " ", - " ", " C C ", - " CCCCC ", " D ", - " B ", " B ", - " ", " ", - " ", " ", - " C C ", " CC CC ", - " CDBB BBDC ", " CC CC ", - " C C ", " ", - " ", " ", - " ", " B ", - " B ", " D ", - " CCCCC ", " C C ", - " ", " ", - " ", " ", - " " }, - { " ", " ", - " ", " ", - " C C ", " C C ", - " D ", " EEEBEEE ", - " ", " ", - " ", " ", - " ", " E E ", - " E E ", " CC E E CC ", - " DB BD ", " CC E E CC ", - " E E ", " E E ", - " ", " ", - " ", " ", - " ", " EEEBEEE ", - " D ", " C C ", - " C C ", " ", - " ", " ", - " " }, - { " ", " ", - " ", " C C ", - " CCCCC ", " D ", - " B ", " ", - " ", " ", - " ", " ", - " ", " ", - " C C ", " CC CC ", - " CDB BDC ", " CC CC ", - " C C ", " ", - " ", " ", - " ", " ", - " ", " ", - " B ", " D ", - " CCCCC ", " C C ", - " ", " ", - " " }, - { " ", " ", - " C C ", " C C ", - " D ", " EEEBEEE ", - " ", " ", - " ", " ", - " ", " ", - " ", " E E ", - " E E ", " CC E E CC ", - " DB BD ", " CC E E CC ", - " E E ", " E E ", - " ", " ", - " ", " ", - " ", " ", - " ", " EEEBEEE ", - " D ", " C C ", - " C C ", " ", - " " }, - { " ", " ", - " C C ", " D ", - " B ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " C C ", - " DB BD ", " C C ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " B ", " D ", - " C C ", " ", - " " }, - { " ", " C C ", - " C C ", " D ", - " B ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " CC CC ", - " DB BD ", " CC CC ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " B ", " D ", - " C C ", " C C ", - " " }, - { " ", " C C ", - " D ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " C C ", - " D D ", " C C ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " D ", " C C ", - " " }, - { " ", " C C ", - " D ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " C C ", - " D D ", " C C ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " D ", " C C ", - " " }, - { " CCCCCCC ", " C C ", - " DDDDDDD ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " D D ", - " D D ", "CCD DCC", - " D D ", "CCD DCC", - " D D ", " D D ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " DDDDDDD ", " C C ", - " C C " }, - { " CCHHHHHCC ", " DDDDD ", - " DD DD ", " ", - " ", " E E ", - " ", " E E ", - " ", " ", - " ", " ", - " D D ", " D D ", - " D D ", "CD DC", - " D D ", "CD DC", - " D D ", " D D ", - " D D ", " ", - " ", " ", - " ", " E E ", - " ", " E E ", - " ", " ", - " DD DD ", " DDDDD ", - " C C " }, - { " CHHHHHHHC ", " DDCDCDD ", - " D EEE D ", " ", - " C C ", " E E ", - " C C ", " E E ", - " ", " ", - " ", " ", - " D D ", " D D ", - " D D ", "CCE ECC", - " DE ED ", "CCE ECC", - " D D ", " D D ", - " D D ", " ", - " ", " ", - " ", " E E ", - " C C ", " E E ", - " C C ", " ", - " D EEE D ", " DDCDCDD ", - " C C " }, - { " CHHFFFHHC ", " CCCCDCCDCCDCCCC ", - " CCC D EAAAE D CCC ", " CC CC ", - " CC CC ", " CC E E CC ", - " CC CC ", " CC E E CC ", - " C C ", " CC CC ", - " C C ", " C C ", - "CCD DCC", "CD DC", - "CCE ECC", "CCA ACC", - "CDA ADC", "CCA ACC", - "CCE ECC", "CD DC", - "CCD DCC", " C C ", - " C C ", " CC CC ", - " C C ", " CC E E CC ", - " CC CC ", " CC E E CC ", - " CC CC ", " CC CC ", - " CCC D EAAAE D CCC ", " CCCCDCCDCCDCCCC ", - " CCCCCCCCC " }, - { " CHHF~FHHC ", " DDDDDDD ", - " DDD EAAAE DDD ", " DD DD ", - " CDBB BBDC ", " DB BD ", - " CDB BDC ", " DB BD ", - " DB BD ", " DB BD ", - " D D ", " D D ", - " D D ", " D D ", - " DE ED ", "CDA ADC", - " DA AD ", "CDA ADC", - " DE ED ", " D D ", - " D D ", " D D ", - " D D ", " DB BD ", - " DB BD ", " DB BD ", - " CDB BDC ", " DB BD ", - " CDBB BBDC ", " DD DD ", - " DDD EAAAE DDD ", " DDDDDDD ", - " C C " }, - { " CHHFFFHHC ", " CCCCDCCDCCDCCCC ", - " CCC D EAAAE D CCC ", " CC CC ", - " CC CC ", " CC E E CC ", - " CC CC ", " CC E E CC ", - " C C ", " CC CC ", - " C C ", " C C ", - "CCD DCC", "CD DC", - "CCE ECC", "CCA ACC", - "CDA ADC", "CCA ACC", - "CCE ECC", "CD DC", - "CCD DCC", " C C ", - " C C ", " CC CC ", - " C C ", " CC E E CC ", - " CC CC ", " CC E E CC ", - " CC CC ", " CC CC ", - " CCC D EAAAE D CCC ", " CCCCDCCDCCDCCCC ", - " CCCCCCCCC " }, - { " CHHHHHHHC ", " DDCDCDD ", - " D EEE D ", " ", - " C C ", " E E ", - " C C ", " E E ", - " ", " ", - " ", " ", - " D D ", " D D ", - " D D ", "CCE ECC", - " DE ED ", "CCE ECC", - " D D ", " D D ", - " D D ", " ", - " ", " ", - " ", " E E ", - " C C ", " E E ", - " C C ", " ", - " D EEE D ", " DDCDCDD ", - " C C " }, - { " CCHHHHHCC ", " DDDDD ", - " DD DD ", " ", - " ", " E E ", - " ", " E E ", - " ", " ", - " ", " ", - " D D ", " D D ", - " D D ", "CD DC", - " D D ", "CD DC", - " D D ", " D D ", - " D D ", " ", - " ", " ", - " ", " E E ", - " ", " E E ", - " ", " ", - " DD DD ", " DDDDD ", - " C C " }, - { " CCCCCCC ", " C C ", - " DDDDDDD ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " D D ", - " D D ", "CCD DCC", - " D D ", "CCD DCC", - " D D ", " D D ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " DDDDDDD ", " C C ", - " C C " }, - { " ", " C C ", - " D ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " C C ", - " D D ", " C C ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " D ", " C C ", - " " }, - { " ", " C C ", - " D ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " C C ", - " D D ", " C C ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " D ", " C C ", - " " }, - { " ", " C C ", - " C C ", " D ", - " B ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " CC CC ", - " DB BD ", " CC CC ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " B ", " D ", - " C C ", " C C ", - " " }, - { " ", " ", - " C C ", " D ", - " B ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " C C ", - " DB BD ", " C C ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " B ", " D ", - " C C ", " ", - " " }, - { " ", " ", - " C C ", " C C ", - " D ", " EEEBEEE ", - " ", " ", - " ", " ", - " ", " ", - " ", " E E ", - " E E ", " CC E E CC ", - " DB BD ", " CC E E CC ", - " E E ", " E E ", - " ", " ", - " ", " ", - " ", " ", - " ", " EEEBEEE ", - " D ", " C C ", - " C C ", " ", - " " }, - { " ", " ", - " ", " C C ", - " CCCCC ", " D ", - " B ", " ", - " ", " ", - " ", " ", - " ", " ", - " C C ", " CC CC ", - " CDB BDC ", " CC CC ", - " C C ", " ", - " ", " ", - " ", " ", - " ", " ", - " B ", " D ", - " CCCCC ", " C C ", - " ", " ", - " " }, - { " ", " ", - " ", " ", - " C C ", " C C ", - " D ", " EEEBEEE ", - " ", " ", - " ", " ", - " ", " E E ", - " E E ", " CC E E CC ", - " DB BD ", " CC E E CC ", - " E E ", " E E ", - " ", " ", - " ", " ", - " ", " EEEBEEE ", - " D ", " C C ", - " C C ", " ", - " ", " ", - " " }, - { " ", " ", - " ", " ", - " ", " C C ", - " CCCCC ", " D ", - " B ", " B ", - " ", " ", - " ", " ", - " C C ", " CC CC ", - " CDBB BBDC ", " CC CC ", - " C C ", " ", - " ", " ", - " ", " B ", - " B ", " D ", - " CCCCC ", " C C ", - " ", " ", - " ", " ", - " " }, - { " ", " ", - " ", " ", - " ", " ", - " C C ", " C C ", - " D ", " D ", - " ", " ", - " ", " ", - " ", " CC CC ", - " DD DD ", " CC CC ", - " ", " ", - " ", " D ", - " D ", " D ", - " D ", " C C ", - " C C ", " ", - " ", " ", - " ", " ", - " " }, - { " ", " ", - " ", " ", - " ", " ", - " ", " C C ", - " C C ", " C C ", - " D ", " D ", - " DDDDDDD ", " DD DD ", - " D EEE D ", " CCC D EAAAE D CCC ", - " DDD EAAAE DDD ", " CCC D EAAAE D CCC ", - " D EEE D ", " DD DD ", - " DDDDDDD ", " D ", - " D ", " C C ", - " C C ", " C C ", - " ", " ", - " ", " ", - " ", " ", - " " }, - { " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " C C ", - " C C ", " C C ", - " C C ", " DDDDD ", - " DDCDCDD ", " CCCCDCCDCCDCCCC ", - " DDDDDDD ", " CCCCDCCDCCDCCCC ", - " DDCDCDD ", " DDDDD ", - " C C ", " C C ", - " C C ", " C C ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " " }, - { " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " C C ", " C C ", - " C C ", " CCCCCCCCC ", - " C C ", " CCCCCCCCC ", - " C C ", " C C ", - " C C ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " " } })) - .addShape( - "main_t2", - transpose( - new String[][] { - { " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " C C ", " C C ", - " C C ", " CCCCCCCCC ", - " C C ", " CCCCCCCCC ", - " C C ", " C C ", - " C C ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " " }, - { " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " C C ", - " GGC CGG ", " GGGC CGGG ", - " GGGGC CGGGG ", " GGGGDDDDDGGGG ", - " GGGDDCDCDDGGG ", " CCCCDCCDCCDCCCC ", - " DDDDDDD ", " CCCCDCCDCCDCCCC ", - " GGGDDCDCDDGGG ", " GGGGDDDDDGGGG ", - " GGGGC CGGGG ", " GGGC CGGG ", - " GGC CGG ", " C C ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " " }, - { " ", " ", - " ", " ", - " ", " ", - " ", " C C ", - " GGC CGG ", " GGGGC CGGGG ", - " GGG D GGG ", " GGG D GGG ", - " GG DDDDDDD GG ", " GG DD DD GG ", - " GG D EEE D GG ", " CCC D EAAAE D CCC ", - " DDD EAAAE DDD ", " CCC D EAAAE D CCC ", - " GG D EEE D GG ", " GG DD DD GG ", - " GG DDDDDDD GG ", " GGG D GGG ", - " GGG D GGG ", " GGGGC CGGGG ", - " GGC CGG ", " C C ", - " ", " ", - " ", " ", - " ", " ", - " " }, - { " ", " ", - " ", " ", - " ", " ", - " C C ", " GGGC CGGG ", - " GGG D GGG ", " GG D GG ", - " GG GG ", " G G ", - " GG GG ", " G G ", - " G G ", " CC CC ", - " DD DD ", " CC CC ", - " G G ", " G G ", - " GG GG ", " G G ", - " GG GG ", " GG D GG ", - " GGG D GGG ", " GGGC CGGG ", - " C C ", " ", - " ", " ", - " ", " ", - " " }, - { " ", " ", - " ", " ", - " ", " C C ", - " GGGCCCCCGGG ", " GGG D GGG ", - " GG B GG ", " GG B GG ", - " G G ", " GG GG ", - " G G ", " G G ", - " C C ", " CC CC ", - " CDBB BBDC ", " CC CC ", - " C C ", " G G ", - " G G ", " GG GG ", - " G G ", " GG B GG ", - " GG B GG ", " GGG D GGG ", - " GGGCCCCCGGG ", " C C ", - " ", " ", - " ", " ", - " " }, - { " ", " ", - " ", " ", - " C C ", " GGGGGC CGGGGG ", - " GGG D GGG ", " GG EEEBEEE GG ", - " GG GG ", " G G ", - " GG GG ", " G G ", - " G G ", " G E E G ", - " G E E G ", " CC E E CC ", - " DB BD ", " CC E E CC ", - " G E E G ", " G E E G ", - " G G ", " G G ", - " GG GG ", " G G ", - " GG GG ", " GG EEEBEEE GG ", - " GGG D GGG ", " GGGGGC CGGGGG ", - " C C ", " ", - " ", " ", - " " }, - { " ", " ", - " ", " C C ", - " GGGCCCCCGGG ", " GGG D GGG ", - " GG B GG ", " G G ", - " GG GG ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " C C ", " CC CC ", - " CDB BDC ", " CC CC ", - " C C ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " GG GG ", " G G ", - " GG B GG ", " GGG D GGG ", - " GGGCCCCCGGG ", " C C ", - " ", " ", - " " }, - { " ", " ", - " C C ", " GGGC CGGG ", - " GGG D GGG ", " GG EEEBEEE GG ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G E E G ", - " G E E G ", " CC E E CC ", - " DB BD ", " CC E E CC ", - " G E E G ", " G E E G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " GG EEEBEEE GG ", - " GGG D GGG ", " GGGC CGGG ", - " C C ", " ", - " " }, - { " ", " ", - " GGC CGG ", " GGG D GGG ", - " GG B GG ", " GG GG ", - " GG GG ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " C C ", - " DB BD ", " C C ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " GG GG ", " GG GG ", - " GG B GG ", " GGG D GGG ", - " GGC CGG ", " ", - " " }, - { " ", " C C ", - " GGGGC CGGGG ", " GG D GG ", - " GG B GG ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " CC CC ", - " DB BD ", " CC CC ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " GG B GG ", " GG D GG ", - " GGGGC CGGGG ", " C C ", - " " }, - { " ", " GGC CGG ", - " GGG D GGG ", " GG GG ", - " G G ", " GG GG ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " C C ", - " D D ", " C C ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " GG GG ", - " G G ", " GG GG ", - " GGG D GGG ", " GGC CGG ", - " " }, - { " ", " GGGC CGGG ", - " GGG D GGG ", " G G ", - " GG GG ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " C C ", - " D D ", " C C ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " GG GG ", " G G ", - " GGG D GGG ", " GGGC CGGG ", - " " }, - { " CCCCCCC ", " GGGGC CGGGG ", - " GG DDDDDDD GG ", " GG GG ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " GD DG ", - " GD DG ", "CCD DCC", - " D D ", "CCD DCC", - " GD DG ", " GD DG ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " GG GG ", - " GG DDDDDDD GG ", " GGGGC CGGGG ", - " C C " }, - { " CCHHHHHCC ", " GGGGDDDDDGGGG ", - " GG DD DD GG ", " G G ", - " G G ", " G E E G ", - " G G ", " G E E G ", - " G G ", " G G ", - " G G ", " G G ", - " GD DG ", " GD DG ", - " D D ", "CD DC", - " D D ", "CD DC", - " D D ", " GD DG ", - " GD DG ", " G G ", - " G G ", " G G ", - " G G ", " G E E G ", - " G G ", " G E E G ", - " G G ", " G G ", - " GG DD DD GG ", " GGGGDDDDDGGGG ", - " C C " }, - { " CHHHHHHHC ", " GGGDDCDCDDGGG ", - " GG D EEE D GG ", " G G ", - " C C ", " G E E G ", - " C C ", " G E E G ", - " G G ", " G G ", - " G G ", " G G ", - " GD DG ", " D D ", - " D D ", "CCE ECC", - " DE ED ", "CCE ECC", - " D D ", " D D ", - " GD DG ", " G G ", - " G G ", " G G ", - " G G ", " G E E G ", - " C C ", " G E E G ", - " C C ", " G G ", - " GG D EEE D GG ", " GGGDDCDCDDGGG ", - " C C " }, - { " CHHFFFHHC ", " CCCCDCCDCCDCCCC ", - " CCC D EAAAE D CCC ", " CC CC ", - " CC CC ", " CC E E CC ", - " CC CC ", " CC E E CC ", - " C C ", " CC CC ", - " C C ", " C C ", - "CCD DCC", "CD DC", - "CCE ECC", "CCA ACC", - "CDA ADC", "CCA ACC", - "CCE ECC", "CD DC", - "CCD DCC", " C C ", - " C C ", " CC CC ", - " C C ", " CC E E CC ", - " CC CC ", " CC E E CC ", - " CC CC ", " CC CC ", - " CCC D EAAAE D CCC ", " CCCCDCCDCCDCCCC ", - " CCCCCCCCC " }, - { " CHHF~FHHC ", " DDDDDDD ", - " DDD EAAAE DDD ", " DD DD ", - " CDBB BBDC ", " DB BD ", - " CDB BDC ", " DB BD ", - " DB BD ", " DB BD ", - " D D ", " D D ", - " D D ", " D D ", - " DE ED ", "CDA ADC", - " DA AD ", "CDA ADC", - " DE ED ", " D D ", - " D D ", " D D ", - " D D ", " DB BD ", - " DB BD ", " DB BD ", - " CDB BDC ", " DB BD ", - " CDBB BBDC ", " DD DD ", - " DDD EAAAE DDD ", " DDDDDDD ", - " C C " }, - { " CHHFFFHHC ", " CCCCDCCDCCDCCCC ", - " CCC D EAAAE D CCC ", " CC CC ", - " CC CC ", " CC E E CC ", - " CC CC ", " CC E E CC ", - " C C ", " CC CC ", - " C C ", " C C ", - "CCD DCC", "CD DC", - "CCE ECC", "CCA ACC", - "CDA ADC", "CCA ACC", - "CCE ECC", "CD DC", - "CCD DCC", " C C ", - " C C ", " CC CC ", - " C C ", " CC E E CC ", - " CC CC ", " CC E E CC ", - " CC CC ", " CC CC ", - " CCC D EAAAE D CCC ", " CCCCDCCDCCDCCCC ", - " CCCCCCCCC " }, - { " CHHHHHHHC ", " GGGDDCDCDDGGG ", - " GG D EEE D GG ", " G G ", - " C C ", " G E E G ", - " C C ", " G E E G ", - " G G ", " G G ", - " G G ", " G G ", - " GD DG ", " D D ", - " D D ", "CCE ECC", - " DE ED ", "CCE ECC", - " D D ", " D D ", - " GD DG ", " G G ", - " G G ", " G G ", - " G G ", " G E E G ", - " C C ", " G E E G ", - " C C ", " G G ", - " GG D EEE D GG ", " GGGDDCDCDDGGG ", - " C C " }, - { " CCHHHHHCC ", " GGGGDDDDDGGGG ", - " GG DD DD GG ", " G G ", - " G G ", " G E E G ", - " G G ", " G E E G ", - " G G ", " G G ", - " G G ", " G G ", - " GD DG ", " GD DG ", - " D D ", "CD DC", - " D D ", "CD DC", - " D D ", " GD DG ", - " GD DG ", " G G ", - " G G ", " G G ", - " G G ", " G E E G ", - " G G ", " G E E G ", - " G G ", " G G ", - " GG DD DD GG ", " GGGGDDDDDGGGG ", - " C C " }, - { " CCCCCCC ", " GGGGC CGGGG ", - " GG DDDDDDD GG ", " GG GG ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " GD DG ", - " GD DG ", "CCD DCC", - " D D ", "CCD DCC", - " GD DG ", " GD DG ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " GG GG ", - " GG DDDDDDD GG ", " GGGGC CGGGG ", - " C C " }, - { " ", " GGGC CGGG ", - " GGG D GGG ", " G G ", - " GG GG ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " C C ", - " D D ", " C C ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " GG GG ", " G G ", - " GGG D GGG ", " GGGC CGGG ", - " " }, - { " ", " GGC CGG ", - " GGG D GGG ", " GG GG ", - " G G ", " GG GG ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " C C ", - " D D ", " C C ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " GG GG ", - " G G ", " GG GG ", - " GGG D GGG ", " GGC CGG ", - " " }, - { " ", " C C ", - " GGGGC CGGGG ", " GG D GG ", - " GG B GG ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " CC CC ", - " DB BD ", " CC CC ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " GG B GG ", " GG D GG ", - " GGGGC CGGGG ", " C C ", - " " }, - { " ", " ", - " GGC CGG ", " GGG D GGG ", - " GG B GG ", " GG GG ", - " GG GG ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " C C ", - " DB BD ", " C C ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " GG GG ", " GG GG ", - " GG B GG ", " GGG D GGG ", - " GGC CGG ", " ", - " " }, - { " ", " ", - " C C ", " GGGC CGGG ", - " GGG D GGG ", " GG EEEBEEE GG ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G E E G ", - " G E E G ", " CC E E CC ", - " DB BD ", " CC E E CC ", - " G E E G ", " G E E G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " G G ", " GG EEEBEEE GG ", - " GGG D GGG ", " GGGC CGGG ", - " C C ", " ", - " " }, - { " ", " ", - " ", " C C ", - " GGGCCCCCGGG ", " GGG D GGG ", - " GG B GG ", " G G ", - " GG GG ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " C C ", " CC CC ", - " CDB BDC ", " CC CC ", - " C C ", " G G ", - " G G ", " G G ", - " G G ", " G G ", - " GG GG ", " G G ", - " GG B GG ", " GGG D GGG ", - " GGGCCCCCGGG ", " C C ", - " ", " ", - " " }, - { " ", " ", - " ", " ", - " C C ", " GGGGGC CGGGGG ", - " GGG D GGG ", " GG EEEBEEE GG ", - " GG GG ", " G G ", - " GG GG ", " G G ", - " G G ", " G E E G ", - " G E E G ", " CC E E CC ", - " DB BD ", " CC E E CC ", - " G E E G ", " G E E G ", - " G G ", " G G ", - " GG GG ", " G G ", - " GG GG ", " GG EEEBEEE GG ", - " GGG D GGG ", " GGGGGC CGGGGG ", - " C C ", " ", - " ", " ", - " " }, - { " ", " ", - " ", " ", - " ", " C C ", - " GGGCCCCCGGG ", " GGG D GGG ", - " GG B GG ", " GG B GG ", - " G G ", " GG GG ", - " G G ", " G G ", - " C C ", " CC CC ", - " CDBB BBDC ", " CC CC ", - " C C ", " G G ", - " G G ", " GG GG ", - " G G ", " GG B GG ", - " GG B GG ", " GGG D GGG ", - " GGGCCCCCGGG ", " C C ", - " ", " ", - " ", " ", - " " }, - { " ", " ", - " ", " ", - " ", " ", - " C C ", " GGGC CGGG ", - " GGG D GGG ", " GG D GG ", - " GG GG ", " G G ", - " GG GG ", " G G ", - " G G ", " CC CC ", - " DD DD ", " CC CC ", - " G G ", " G G ", - " GG GG ", " G D G ", - " GG D GG ", " GG D GG ", - " GGG D GGG ", " GGGC CGGG ", - " C C ", " ", - " ", " ", - " ", " ", - " " }, - { " ", " ", - " ", " ", - " ", " ", - " ", " C C ", - " GGC CGG ", " GGGGC CGGGG ", - " GGG D GGG ", " GGG D GGG ", - " GG DDDDDDD GG ", " GG DD DD GG ", - " GG D EEE D GG ", " CCC D EAAAE D CCC ", - " DDD EAAAE DDD ", " CCC D EAAAE D CCC ", - " GG D EEE D GG ", " GG DD DD GG ", - " GG DDDDDDD GG ", " GGG D GGG ", - " GGG D GGG ", " GGGGC CGGGG ", - " GGC CGG ", " C C ", - " ", " ", - " ", " ", - " ", " ", - " " }, - { " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " C C ", - " GGC CGG ", " GGGC CGGG ", - " GGGGC CGGGG ", " GGGGDDDDDGGGG ", - " GGGDDCDCDDGGG ", " CCCCDCCDCCDCCCC ", - " DDDDDDD ", " CCCCDCCDCCDCCCC ", - " GGGDDCDCDDGGG ", " GGGGDDDDDGGGG ", - " GGGGC CGGGG ", " GGGC CGGG ", - " GGC CGG ", " C C ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " " }, - { " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " C C ", " C C ", - " C C ", " CCCCCCCCC ", - " C C ", " CCCCCCCCC ", - " C C ", " C C ", - " C C ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " ", " ", - " " } })) - .addElement('A', ofBlock(sBlockCasingsTT, 10)).addElement('B', ofBlock(sBlockCasingsTT, 11)) - .addElement('C', ofBlock(sBlockCasingsTT, 12)).addElement('D', ofBlock(sBlockCasingsTT, 13)) - .addElement('E', ofBlock(sBlockCasingsTT, 14)).addElement('G', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement( - 'H', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_bhg::addClassicToMachineList, - textureOffset, - 1, - sBlockCasingsTT, - 0)) - .addElement( - 'F', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_bhg::addElementalToMachineList, - textureOffset + 4, - 2, - sBlockCasingsTT, - 4)) - .build(); - - @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; - } - - private static final String[] description = new String[] { - EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", - translateToLocal("gt.blockmachines.multimachine.em.blackholegenerator.hint.0"), // 1 - Classic Hatches or - // High Power - // Casing - translateToLocal("gt.blockmachines.multimachine.em.blackholegenerator.hint.1"), // 2 - Elemental Hatches or - // Molecular - // Casing - }; - // endregion - - public GT_MetaTileEntity_EM_bhg(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_bhg(String aName) { - super(aName); - } - - // todo compaction energy 8 * Long.MAx_VALUE? - - // todo neutronium decay gen? 0.0007186885 mass diff - actually compute hydrogen amount... - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_bhg(mName); - } - - @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - if (structureCheck_EM("t2", 16, 16, 0)) { - glassDome = true; - return true; - } - if (structureCheck_EM("t1", 16, 16, 0)) { - glassDome = false; - return true; - } - // todo check tiers of hatches!!!! - return false; - } - - @Override - public GT_Multiblock_Tooltip_Builder createTooltip() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(translateToLocal("gt.blockmachines.multimachine.em.blackholegenerator.name")) // Machine Type: - // Black Hole - // Generator - .addInfo(translateToLocal("gt.blockmachines.multimachine.em.blackholegenerator.desc.0")) // Controller - // block of - // the Black Hole - // Generator - .addInfo(translateToLocal("gt.blockmachines.multimachine.em.blackholegenerator.desc.1")) // Uses a black - // hole to - // generate power - .addInfo(translateToLocal("tt.keyword.Structure.StructureTooComplex")) // The structure is too complex! - .addSeparator().beginStructureBlock(33, 33, 33, false) - .addEnergyHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasing1D"), 1) // Energy Hatch: Any - // High Power Casing - // with 1 dot - .addMaintenanceHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasing1D"), 1) // Maintenance - // Hatch: Any - // High Power - // Casing with 1 - // dot - .toolTipFinisher(CommonValues.TEC_MARK_EM); - return tt; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aBlockIconRegister) { - ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_BHG"); - ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_BHG_ACTIVE"); - super.registerIcons(aBlockIconRegister); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, - int colorIndex, boolean aActive, boolean aRedstone) { - if (side == facing) { - return new ITexture[] { Textures.BlockIcons.casingTexturePages[texturePage][12], - new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF) }; - } - return new ITexture[] { Textures.BlockIcons.casingTexturePages[texturePage][12] }; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - try { - structureBuild_EM((stackSize.stackSize & 1) == 1 ? "main_t1" : "main_t2", 16, 16, 0, stackSize, hintsOnly); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public String[] getStructureDescription(ItemStack stackSize) { - return description; - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java deleted file mode 100644 index f20913aee..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java +++ /dev/null @@ -1,162 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi; - -import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; -import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; -import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; -import static net.minecraft.util.StatCollector.translateToLocal; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; - -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.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; -import com.github.technus.tectech.util.CommonValues; -import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - - // region variables - private static Textures.BlockIcons.CustomIcon ScreenOFF; - private static Textures.BlockIcons.CustomIcon ScreenON; - - public static final String crafter = "EM Crafting"; - // endregion - - // region structure - private static final String[] description = new String[] { - EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", - translateToLocal("gt.blockmachines.multimachine.em.crafter.hint.0"), // 1 - Classic Hatches or High Power - // Casing - translateToLocal("gt.blockmachines.multimachine.em.crafter.hint.1"), // 2 - Elemental Hatches or Molecular - // Casing - }; - - private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition - .builder() - .addShape( - "main", - transpose( - new String[][] { - { " AAA ", "AAAAA", "A A", "BBBBB", "BGCGB", "BGGGB", "BGCGB", "BBBBB", "A A", - "AAAAA", " AAA " }, - { "AHHHA", "AAAAA", " FFF ", "BBBBB", "GGGGG", "GGGGG", "GGGGG", "BBBBB", " FFF ", - "AAAAA", "AHHHA" }, - { "AH~HA", "AAAAA", " FEF ", "BBEBB", "CGEGC", "GGDGG", "CGEGC", "BBEBB", " FEF ", - "AAAAA", "AHHHA" }, - { "AHHHA", "AAAAA", " FFF ", "BBBBB", "GGGGG", "GGGGG", "GGGGG", "BBBBB", " FFF ", - "AAAAA", "AHHHA" }, - { " AAA ", "AAAAA", "A A", "BBBBB", "BGCGB", "BGGGB", "BGCGB", "BBBBB", "A A", - "AAAAA", " AAA " } })) - .addElement('A', ofBlock(sBlockCasingsTT, 4)).addElement('B', ofBlock(sBlockCasingsTT, 5)) - .addElement('C', ofBlock(sBlockCasingsTT, 6)).addElement('D', ofBlock(sBlockCasingsTT, 9)) - .addElement('E', ofBlock(sBlockCasingsTT, 10)).addElement('G', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement( - 'H', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_crafting::addClassicToMachineList, - textureOffset, - 1, - sBlockCasingsTT, - 0)) - .addElement( - 'F', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_crafting::addElementalToMachineList, - textureOffset + 4, - 2, - sBlockCasingsTT, - 4)) - .build(); - // endregion - - public GT_MetaTileEntity_EM_crafting(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_crafting(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_crafting(mName); - } - - @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM("main", 2, 2, 0); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aBlockIconRegister) { - ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_CRAFTING"); - ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_CRAFTING_ACTIVE"); - super.registerIcons(aBlockIconRegister); - } - - @Override - public GT_Multiblock_Tooltip_Builder createTooltip() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(translateToLocal("gt.blockmachines.multimachine.em.crafter.name")) // Machine Type: Matter - // Assembler - .addInfo(translateToLocal("gt.blockmachines.multimachine.em.crafter.desc.0")) // Controller block of the - // Matter Assembler - .addInfo(translateToLocal("tt.keyword.Structure.StructureTooComplex")) // The structure is too complex! - .addSeparator().beginStructureBlock(5, 5, 11, false) - .addOtherStructurePart( - translateToLocal("tt.keyword.Structure.Elemental"), - translateToLocal("tt.keyword.Structure.AnyMolecularCasing2D"), - 2) // Elemental Hatch: Any Molecular Casing with 2 dot - .addEnergyHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasing"), 1) // Energy Hatch: Any - // High Power Casing - .addMaintenanceHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasing"), 1) // Maintenance - // Hatch: Any High - // Power Casing - .toolTipFinisher(CommonValues.TEC_MARK_EM); - return tt; - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, - int colorIndex, boolean aActive, boolean aRedstone) { - if (side == facing) { - return new ITexture[] { Textures.BlockIcons.casingTexturePages[texturePage][12], - new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF) }; - } - return new ITexture[] { Textures.BlockIcons.casingTexturePages[texturePage][12] }; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - structureBuild_EM("main", 2, 2, 0, stackSize, hintsOnly); - } - - @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; - } - - @Override - public String[] getStructureDescription(ItemStack stackSize) { - return description; - } -} 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 deleted file mode 100644 index 8c2cc6f5d..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ /dev/null @@ -1,362 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; -import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; -import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; -import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_OK; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_TOO_LOW; -import static com.github.technus.tectech.util.CommonValues.VN; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; -import static net.minecraft.util.StatCollector.translateToLocal; -import static net.minecraft.util.StatCollector.translateToLocalFormatted; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; - -import org.apache.commons.lang3.reflect.FieldUtils; - -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; -import com.github.technus.tectech.util.CommonValues; -import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import ic2.core.init.MainConfig; -import ic2.core.util.ConfigUtil; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - - // region variables - private static Textures.BlockIcons.CustomIcon ScreenOFF; - private static Textures.BlockIcons.CustomIcon ScreenON; - - public static final double URANIUM_INGOT_MASS_DIFF = 1.6114516E10 * EM_COUNT_PER_MATERIAL_AMOUNT; - 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"; - // endregion - - // region structure - private static final String[] description = new String[] { - EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", - translateToLocal("gt.blockmachines.multimachine.em.decay.hint.0"), // 1 - Classic Hatches or High Power - // Casing - translateToLocal("gt.blockmachines.multimachine.em.decay.hint.1"), // 2 - Elemental Hatches or Molecular - // Casing - }; - - private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition - .builder() - .addShape( - "main", - transpose( - new String[][] { - { "A A", "AAAAA", "A A", "ABBBA", "ABCBA", "ABBBA", "A A", "AAAAA", "A A" }, - { " FFF ", "AAAAA", " EEE ", "BDDDB", "BDDDB", "BDDDB", " EEE ", "AAAAA", " FFF " }, - { " F~F ", "AAAAA", " EAE ", "BDDDB", "CDDDC", "BDDDB", " EAE ", "AAAAA", " FFF " }, - { " FFF ", "AAAAA", " EEE ", "BDDDB", "BDDDB", "BDDDB", " EEE ", "AAAAA", " FFF " }, - { "A A", "AAAAA", "A A", "ABBBA", "ABCBA", "ABBBA", "A A", "AAAAA", - "A A" } })) - .addElement('A', ofBlock(sBlockCasingsTT, 4)).addElement('B', ofBlock(sBlockCasingsTT, 5)) - .addElement('C', ofBlock(sBlockCasingsTT, 6)).addElement('D', ofBlock(sBlockCasingsTT, 8)) - .addElement( - 'F', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_decay::addClassicToMachineList, - textureOffset, - 1, - sBlockCasingsTT, - 0)) - .addElement( - 'E', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_decay::addElementalToMachineList, - textureOffset + 4, - 2, - sBlockCasingsTT, - 4)) - .build(); - // endregion - - // region parameters - protected Parameters.Group.ParameterIn ampereFlow; - private static final INameFunction FLOW_NAME = (base, - p) -> translateToLocal("gt.blockmachines.multimachine.em.decay.conf"); // Ampere divider - private static final IStatusFunction FLOW_STATUS = (base, p) -> { - if (base.eAmpereFlow <= 0) { - return STATUS_TOO_LOW; - } - return STATUS_OK; - }; - // endregion - - public GT_MetaTileEntity_EM_decay(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_decay(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_decay(mName); - } - - @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM("main", 2, 2, 0); - } - - @Override - public boolean checkRecipe_EM(ItemStack itemStack) { - EMInstanceStackMap map = getInputsClone_EM(); - if (map != null && map.hasStacks()) { - for (GT_MetaTileEntity_Hatch_InputElemental i : eInputHatches) { - i.getContentHandler().clear(); - } - return startRecipe(map); - } - return false; - } - - private boolean startRecipe(EMInstanceStackMap input) { - mMaxProgresstime = 20; - mEfficiencyIncrease = 10000; - outputEM = new EMInstanceStackMap[2]; - outputEM[0] = input; - outputEM[1] = new EMInstanceStackMap(); - - for (EMInstanceStack stack : outputEM[0].valuesToArray()) { - if (stack.getEnergy() == 0 && stack.getDefinition().decayMakesEnergy(1) - && getBaseMetaTileEntity().decreaseStoredEnergyUnits( - (long) (stack.getEnergySettingCost(1) * URANIUM_MASS_TO_EU_INSTANT), - false)) { - stack.setEnergy(1); - } else if (!stack.getDefinition().decayMakesEnergy(stack.getEnergy())) { - outputEM[0].removeKey(stack.getDefinition()); - outputEM[1].putReplace(stack); - } - } - - eAmpereFlow = (long) ampereFlow.get(); - if (eAmpereFlow <= 0) { - mEUt = 0; - return false; - } - double energyDose = -outputEM[0].tickContent(1, 0, 1) * URANIUM_MASS_TO_EU_PARTIAL; - mEUt = (int) (energyDose / eAmpereFlow); - return outputEM[0].hasStacks(); - } - - @Override - public void outputAfterRecipe_EM() { - for (int i = 0; i < 2 && i < eOutputHatches.size(); i++) { - eOutputHatches.get(i).getContentHandler().putUnifyAll(outputEM[i]); - outputEM[i] = null; - } - } - - @Override - public GT_Multiblock_Tooltip_Builder createTooltip() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(translateToLocal("gt.blockmachines.multimachine.em.decay.name")) // Machine Type: Decay - // Generator - .addInfo(translateToLocal("gt.blockmachines.multimachine.em.decay.desc.0")) // Controller block of the - // Decay Generator - .addInfo(translateToLocal("gt.blockmachines.multimachine.em.decay.desc.1")) // Decays elemental matter - // to generate power - .addInfo(translateToLocal("tt.keyword.Structure.StructureTooComplex")) // The structure is too complex! - .addSeparator().beginStructureBlock(5, 5, 9, false) - .addOtherStructurePart( - translateToLocal("tt.keyword.Structure.Elemental"), - translateToLocal("tt.keyword.Structure.AnyMolecularCasing2D"), - 2) // Elemental Hatch: Any Molecular Casing with 2 dot - .addOtherStructurePart( - translateToLocal("gt.blockmachines.hatch.param.tier.05.name"), - translateToLocal("tt.keyword.Structure.Optional") + " " - + translateToLocal("tt.keyword.Structure.AnyHighPowerCasing"), - 1) // Parametrizer: (optional) Any High Power Casing - .addEnergyHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasing"), 1) // Energy Hatch: Any - // High Power Casing - .addMaintenanceHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasing"), 1) // Maintenance - // Hatch: Any High - // Power Casing - .toolTipFinisher(CommonValues.TEC_MARK_EM); - return tt; - } - - @Override - public String[] getInfoData() { // TODO Do it - long storedEnergy = 0; - long maxEnergy = 0; - for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); - maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); - } - } - for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); - maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); - } - } - - return new String[] { translateToLocalFormatted("tt.keyword.Progress", clientLocale) + ":", - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mProgresstime / 20) - + EnumChatFormatting.RESET - + " s / " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(mMaxProgresstime / 20) - + EnumChatFormatting.RESET - + " s", - translateToLocalFormatted("tt.keyphrase.Energy_Hatches", clientLocale) + ":", - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) - + EnumChatFormatting.RESET - + " EU / " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(maxEnergy) - + EnumChatFormatting.RESET - + " EU", - (mEUt <= 0 ? translateToLocalFormatted("tt.keyphrase.Probably_uses", clientLocale) + ": " - : translateToLocalFormatted("tt.keyphrase.Probably_makes", clientLocale) + ": ") - + EnumChatFormatting.RED - + GT_Utility.formatNumbers(Math.abs(mEUt)) - + EnumChatFormatting.RESET - + " EU/t at " - + EnumChatFormatting.RED - + GT_Utility.formatNumbers(eAmpereFlow) - + EnumChatFormatting.RESET - + " A", - translateToLocalFormatted("tt.keyphrase.Tier_Rating", clientLocale) + ": " - + EnumChatFormatting.YELLOW - + VN[getMaxEnergyInputTier_EM()] - + EnumChatFormatting.RESET - + " / " - + EnumChatFormatting.GREEN - + VN[getMinEnergyInputTier_EM()] - + EnumChatFormatting.RESET - + " " - + translateToLocalFormatted("tt.keyphrase.Amp_Rating", clientLocale) - + ": " - + EnumChatFormatting.GREEN - + GT_Utility.formatNumbers(eMaxAmpereFlow) - + EnumChatFormatting.RESET - + " A", - translateToLocalFormatted("tt.keyword.Problems", clientLocale) + ": " - + EnumChatFormatting.RED - + (getIdealStatus() - getRepairStatus()) - + EnumChatFormatting.RESET - + " " - + translateToLocalFormatted("tt.keyword.Efficiency", clientLocale) - + ": " - + EnumChatFormatting.YELLOW - + mEfficiency / 100.0F - + EnumChatFormatting.RESET - + " %", - translateToLocalFormatted("tt.keyword.PowerPass", clientLocale) + ": " - + EnumChatFormatting.BLUE - + ePowerPass - + EnumChatFormatting.RESET - + " " - + translateToLocalFormatted("tt.keyword.SafeVoid", clientLocale) - + ": " - + EnumChatFormatting.BLUE - + eSafeVoid, - translateToLocalFormatted("tt.keyword.Computation", clientLocale) + ": " - + EnumChatFormatting.GREEN - + GT_Utility.formatNumbers(eAvailableData) - + EnumChatFormatting.RESET - + " / " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(eRequiredData) - + EnumChatFormatting.RESET, }; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aBlockIconRegister) { - ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_DECAY"); - ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_DECAY_ACTIVE"); - super.registerIcons(aBlockIconRegister); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, - int colorIndex, boolean aActive, boolean aRedstone) { - if (side == facing) { - return new ITexture[] { Textures.BlockIcons.casingTexturePages[texturePage][12], - new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF) }; - } - return new ITexture[] { Textures.BlockIcons.casingTexturePages[texturePage][12] }; - } - - @Override - protected void parametersInstantiation_EM() { - Parameters.Group hatch_0 = parametrization.getGroup(0, true); - ampereFlow = hatch_0.makeInParameter(0, 1, FLOW_NAME, FLOW_STATUS); - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - super.onRightclick(aBaseMetaTileEntity, aPlayer); - - if (!aBaseMetaTileEntity.isClientSide() && aPlayer instanceof EntityPlayerMP) { - try { - EntityPlayerMP player = (EntityPlayerMP) aPlayer; - clientLocale = (String) FieldUtils.readField(player, "translator", true); - } catch (Exception e) { - clientLocale = "en_US"; - } - } else { - return true; - } - return true; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - structureBuild_EM("main", 2, 2, 0, stackSize, hintsOnly); - } - - @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; - } - - @Override - public String[] getStructureDescription(ItemStack stackSize) { - return description; - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java deleted file mode 100644 index 77901be6f..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ /dev/null @@ -1,211 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition.STABLE_RAW_LIFE_TIME; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refMass; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refUnstableMass; -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 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; - -import java.util.ArrayList; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.oredict.OreDictionary; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.OreDictionaryStack; -import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; -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 cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_dequantizer 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 = IStructureDefinition - .builder() - .addShape( - "main", - transpose( - new String[][] { { "CCC", "ABA", "EEE", "BDB" }, { "C~C", "BBB", "EBE", "DFD" }, - { "CCC", "ABA", "EEE", "BDB" } })) - .addElement('A', ofBlock(sBlockCasingsTT, 0)).addElement('B', ofBlock(sBlockCasingsTT, 4)) - .addElement('D', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement( - 'C', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_dequantizer::addClassicToMachineList, - textureOffset, - 1, - sBlockCasingsTT, - 0)) - .addElement( - 'F', - ofHatchAdder( - GT_MetaTileEntity_EM_dequantizer::addElementalInputToMachineList, - textureOffset + 4, - 2)) - .addElement( - 'E', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_dequantizer::addElementalMufflerToMachineList, - textureOffset + 4, - 3, - sBlockCasingsTT, - 4)) - .build(); - - private static final String[] description = new String[] { - EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", - translateToLocal("gt.blockmachines.multimachine.em.emtomatter.hint.0"), // 1 - Classic Hatches or High Power - // Casing" - translateToLocal("gt.blockmachines.multimachine.em.emtomatter.hint.1"), // 2 - Elemental Input Hatch - translateToLocal("gt.blockmachines.multimachine.em.emtomatter.hint.2"), // 3 - Elemental Overflow Hatches or - // Molecular - // Casing - }; - // endregion - - public GT_MetaTileEntity_EM_dequantizer(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_dequantizer(String aName) { - super(aName); - } - - private void startRecipe(IEMStack from, long energy) { - mMaxProgresstime = 20; - mEfficiencyIncrease = 10000; - double mass = from.getMass(); - double euMult = Math.abs(mass / refMass); - eAmpereFlow = (int) Math.ceil(Math.sqrt(Math.sqrt(euMult))); - if (mass > refUnstableMass || from.getDefinition().getRawTimeSpan(energy) < STABLE_RAW_LIFE_TIME) { - mEUt = (int) -V[8]; - } else { - mEUt = (int) -V[6]; - } - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_dequantizer(mName); - } - - @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM("main", 1, 1, 0); - } - - @Override - public boolean checkRecipe_EM(ItemStack itemStack) { - for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { - EMInstanceStackMap map = in.getContentHandler(); - for (EMInstanceStack stack : map.valuesToArray()) { - EMDequantizationInfo emDequantizationInfo = TecTech.transformationInfo.getInfoMap() - .get(stack.getDefinition()); - if (emDequantizationInfo != null && emDequantizationInfo.getStack() != null - && map.removeAllAmounts(emDequantizationInfo.getInput())) { - Object out = emDequantizationInfo.getStack(); - if (out instanceof ItemStack) { - mOutputItems = new ItemStack[] { emDequantizationInfo.getItem() }; - } else if (out instanceof FluidStack) { - mOutputFluids = new FluidStack[] { emDequantizationInfo.getFluid() }; - } else if (out instanceof OreDictionaryStack) { - ArrayList items = OreDictionary - .getOres(OreDictionary.getOreName(emDequantizationInfo.getOre().getOreId())); - if (items != null && !items.isEmpty()) { - mOutputItems = new ItemStack[] { items.get(0) }; - } - } - startRecipe(emDequantizationInfo.getInput(), stack.getEnergy()); - return true; - } - } - } - return false; - } - - @Override - public GT_Multiblock_Tooltip_Builder createTooltip() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(translateToLocal("gt.blockmachines.multimachine.em.emtomatter.name")) // Machine Type: Matter - // Dequantizer - .addInfo(translateToLocal("gt.blockmachines.multimachine.em.emtomatter.desc.0")) // Controller block of - // the Matter - // Dequantizer - .addInfo(translateToLocal("gt.blockmachines.multimachine.em.emtomatter.desc.1")) // Transforms elemental - // matter - // back into items - .addInfo(translateToLocal("tt.keyword.Structure.StructureTooComplex")) // The structure is too complex! - .addSeparator().beginStructureBlock(3, 3, 4, false) - .addOtherStructurePart( - translateToLocal("tt.keyword.Structure.ElementalInput"), - translateToLocal("tt.keyword.Structure.BackCenter"), - 2) // Elemental Input Hatch: Back center - .addOtherStructurePart( - translateToLocal("tt.keyword.Structure.ElementalOverflow"), - translateToLocal("tt.keyword.Structure.AnyOuterMolecularCasing3rd"), - 3) // Elemental Overflow Hatch: Any outer Molecular Casing on the 3rd slice - .addOutputBus(translateToLocal("tt.keyword.Structure.AnyHighPowerCasingFront"), 1) // Output Bus: Any - // High Power Casing - // on the front side - .addEnergyHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasingFront"), 1) // Energy Hatch: - // Any High Power - // Casing on the - // front side - .addMaintenanceHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasingFront"), 1) // Maintenance - // Hatch: Any - // High Power - // Casing on - // the front - // side - .toolTipFinisher(CommonValues.TEC_MARK_EM); - return tt; - } - - @Override - @SideOnly(Side.CLIENT) - protected ResourceLocation getActivitySound() { - return GT_MetaTileEntity_EM_quantizer.activitySound; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - structureBuild_EM("main", 1, 1, 0, stackSize, hintsOnly); - } - - @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; - } - - @Override - public String[] getStructureDescription(ItemStack stackSize) { - return description; - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java deleted file mode 100644 index 97bcb00c5..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java +++ /dev/null @@ -1,247 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi; - -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.thing.metaTileEntity.multi.base.LedStatus.STATUS_LOW; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_NEUTRAL; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_OK; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_TOO_HIGH; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_TOO_LOW; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_WRONG; -import static com.github.technus.tectech.util.CommonValues.V; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; -import static net.minecraft.util.StatCollector.translateToLocal; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputElemental; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; -import com.github.technus.tectech.util.CommonValues; -import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; - -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_junction 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[] description = new String[] { - EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", - translateToLocal("gt.blockmachines.multimachine.em.junction.hint.0"), // 1 - Classic Hatches or High Power - // Casing - translateToLocal("gt.blockmachines.multimachine.em.junction.hint.1"), // 2 - Elemental Hatches or Molecular - // Casing - }; - - private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition - .builder() - .addShape( - "main", - new String[][] { { "CCC", "C~C", "CCC" }, { "AAA", "AAA", "AAA" }, { "DDD", "DAD", "DDD" }, - { "DDD", "DDD", "DDD" } }) - .addShape( - "mainBig", - new String[][] { { " A ", " CCC ", "AC~CA", " CCC ", " A " }, - { " DDD ", "DAAAD", "DAAAD", "DAAAD", " DDD " }, - { "ADDDA", "DAAAD", "DABAD", "DAAAD", "ADDDA" }, - { " DDD ", "DAAAD", "DAAAD", "DAAAD", " DDD " }, - { " A ", "DDDDD", "ADDDA", "DDDDD", " A " } }) - .addElement('A', ofBlock(sBlockCasingsTT, 4)).addElement('B', ofBlock(sBlockCasingsTT, 5)) - .addElement( - 'C', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_junction::addClassicToMachineList, - textureOffset, - 1, - sBlockCasingsTT, - 0)) - .addElement( - 'D', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_junction::addElementalToMachineList, - textureOffset + 4, - 2, - sBlockCasingsTT, - 4)) - .build(); - // endregion - - // region parameters - private static final INameFunction ROUTE_NAME = (base, - p) -> (p.parameterId() == 0 ? translateToLocal("tt.keyword.Source") + " " - : translateToLocal("tt.keyword.Destination") + " ") + p.hatchId(); - private static final IStatusFunction SRC_STATUS = (base, p) -> { - double v = p.get(); - if (Double.isNaN(v)) return STATUS_WRONG; - v = (int) v; - if (v < 0) return STATUS_TOO_LOW; - if (v == 0) return STATUS_NEUTRAL; - if (v > base.eOutputHatches.size()) return STATUS_TOO_HIGH; - return STATUS_OK; - }; - private static final IStatusFunction DST_STATUS = (base, p) -> { - if (base.src[p.hatchId()].getStatus(false) == STATUS_OK) { - double v = p.get(); - if (Double.isNaN(v)) return STATUS_WRONG; - v = (int) v; - if (v < 0) return STATUS_TOO_LOW; - if (v == 0) return STATUS_LOW; - if (v > base.eInputHatches.size()) return STATUS_TOO_HIGH; - return STATUS_OK; - } - return STATUS_NEUTRAL; - }; - protected Parameters.Group.ParameterIn[] src; - protected Parameters.Group.ParameterIn[] dst; - // endregion - - public GT_MetaTileEntity_EM_junction(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_junction(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_junction(mName); - } - - @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - int meta = iGregTechTileEntity - .getMetaIDAtSideAndDistance(iGregTechTileEntity.getFrontFacing().getOpposite(), 2); - if (meta == 4) { - return structureCheck_EM("main", 1, 1, 0); - } else if (meta == 5) { - return structureCheck_EM("mainBig", 2, 2, 0); - } - return false; - } - - @Override - public boolean checkRecipe_EM(ItemStack itemStack) { - for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { - if (in.getContentHandler().hasStacks()) { - mEUt = -(int) V[8]; - eAmpereFlow = 1 + (eInputHatches.size() + eOutputHatches.size() >> 1); - mMaxProgresstime = 20; - mEfficiencyIncrease = 10000; - return true; - } - } - return false; - } - - @Override - public void outputAfterRecipe_EM() { - double src, dst; - for (int i = 0; i < 10; i++) { - src = this.src[i].get(); - dst = this.dst[i].get(); - if (Double.isNaN(src) || Double.isNaN(dst)) { - continue; - } - int inIndex = (int) src - 1; - if (inIndex < 0 || inIndex >= eInputHatches.size()) { - continue; - } - int outIndex = (int) dst - 1; - GT_MetaTileEntity_Hatch_InputElemental in = eInputHatches.get(inIndex); - if (outIndex == -1) { // param==0 -> null the content - cleanHatchContentEM_EM(in); - } else { - if (outIndex < 0 || outIndex >= eOutputHatches.size()) { - continue; - } - GT_MetaTileEntity_Hatch_OutputElemental out = eOutputHatches.get(outIndex); - out.getContentHandler().putUnifyAll(in.getContentHandler()); - in.getContentHandler().clear(); - } - } - } - - @Override - public GT_Multiblock_Tooltip_Builder createTooltip() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(translateToLocal("gt.blockmachines.multimachine.em.junction.name")) // Machine Type: Matter - // Junction - .addInfo(translateToLocal("gt.blockmachines.multimachine.em.junction.desc.0")) // Controller block of - // the Matter Junction - .addInfo(translateToLocal("gt.blockmachines.multimachine.em.junction.desc.1")) // Used to route and - // distribute - // elemental matter - .addInfo(translateToLocal("gt.blockmachines.multimachine.em.junction.desc.2")) // Needs a Parametrizer - // to be configured - .addInfo(translateToLocal("tt.keyword.Structure.StructureTooComplex")) // The structure is too complex! - .addSeparator().beginStructureBlock(3, 3, 4, false) - .addOtherStructurePart( - translateToLocal("tt.keyword.Structure.ElementalOutput"), - translateToLocal("tt.keyword.Structure.AnyOuterMolecularCasing3rd4th"), - 2) // Elemental Output Hatch: Any outer Molecular Casing on the 3rd or 4th slice - .addOtherStructurePart( - translateToLocal("tt.keyword.Structure.ElementalInput"), - translateToLocal("tt.keyword.Structure.AnyOuterMolecularCasing3rd4th"), - 2) // Elemental Input Hatch: Any outer Molecular Casing on the 3rd or 4th slice - .addOtherStructurePart( - translateToLocal("gt.blockmachines.hatch.param.tier.05.name"), - translateToLocal("tt.keyword.Structure.Optional") + " " - + translateToLocal("tt.keyword.Structure.AnyHighPowerCasingFront"), - 2) // Parametrizer: (optional) Any High Power Casing on the front side - .addEnergyHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasingFront"), 1) // Energy Hatch: - // Any High Power - // Casing on the - // front side - .addMaintenanceHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasingFront"), 1) // Maintenance - // Hatch: Any - // High Power - // Casing on - // the front - // side - .toolTipFinisher(CommonValues.TEC_MARK_EM); - return tt; - } - - @Override - protected void parametersInstantiation_EM() { - src = new Parameters.Group.ParameterIn[10]; - dst = new Parameters.Group.ParameterIn[10]; - for (int i = 0; i < 10; i++) { - Parameters.Group hatch = parametrization.getGroup(i); - src[i] = hatch.makeInParameter(0, i, ROUTE_NAME, SRC_STATUS); - dst[i] = hatch.makeInParameter(1, i, ROUTE_NAME, DST_STATUS); - } - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - if ((stackSize.stackSize & 1) == 1) { - structureBuild_EM("main", 1, 1, 0, stackSize, hintsOnly); - } else { - structureBuild_EM("mainBig", 2, 2, 0, stackSize, hintsOnly); - } - } - - @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; - } - - @Override - public String[] getStructureDescription(ItemStack stackSize) { - return description; - } -} 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 deleted file mode 100644 index 66c51ff0d..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java +++ /dev/null @@ -1,296 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition.DEFAULT_ENERGY_LEVEL; -import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition.STABLE_RAW_LIFE_TIME; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refMass; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refUnstableMass; -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.TT_Utility.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; - -import java.util.ArrayList; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.oredict.OreDictionary; - -import com.github.technus.tectech.Reference; -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidQuantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemQuantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictQuantizationInfo; -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 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 gregtech.api.util.GT_Multiblock_Tooltip_Builder; - -/** - * Created by danie_000 on 17.12.2016. - */ -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 = IStructureDefinition - .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('D', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement( - 'C', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_quantizer::addClassicToMachineList, - textureOffset, - 1, - sBlockCasingsTT, - 0)) - .addElement( - 'F', - ofHatchAdder(GT_MetaTileEntity_EM_quantizer::addElementalOutputToMachineList, textureOffset + 4, 2)) - .addElement( - 'E', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_quantizer::addElementalMufflerToMachineList, - textureOffset + 4, - 3, - sBlockCasingsTT, - 4)) - .build(); - - 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 - translateToLocal("gt.blockmachines.multimachine.em.mattertoem.hint.1"), // 2 - Elemental Output Hatch - translateToLocal("gt.blockmachines.multimachine.em.mattertoem.hint.2"), // 3 - Elemental Overflow Hatches or - // Molecular - // Casing - }; - // endregion - - public GT_MetaTileEntity_EM_quantizer(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_quantizer(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_quantizer(mName); - } - - @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM("main", 1, 1, 0); - } - - @Override - public boolean checkRecipe_EM(ItemStack itemStack) { // TODO implement instance quantization - if (GregTech_API.sPostloadFinished) { - ArrayList storedInputs = getStoredInputs(); - ItemStack[] inI = storedInputs.toArray(nullItem); - if (inI.length > 0) { - for (ItemStack is : inI) { - // ITEM STACK quantization - EMItemQuantizationInfo aIQI = TecTech.transformationInfo.getItemQuantization() - .get(new EMItemQuantizationInfo(is, false, null)); - if (aIQI == null) { - aIQI = TecTech.transformationInfo.getItemQuantization() - .get(new EMItemQuantizationInfo(is, true, null)); // todo check if works? - } - if (aIQI == null) { - // ORE DICT quantization //todo fix for uranium? - int[] oreIDs = OreDictionary.getOreIDs(is); - for (int ID : oreIDs) { - if (DEBUG_MODE) { - TecTech.LOGGER.info( - "Quantifier-Ore-recipe " + is.getItem().getUnlocalizedName() - + '.' - + is.getItemDamage() - + ' ' - + OreDictionary.getOreName(ID)); - } - EMOredictQuantizationInfo aOQI = TecTech.transformationInfo.getOredictQuantization() - .get(ID); - if (aOQI == null) { - continue; - } - IEMStack into = aOQI.getOut(); - if (into != null && isInputEqual( - true, - false, - nullFluid, - new ItemStack[] { - new ItemStack(is.getItem(), aOQI.getAmount(), is.getItemDamage()) }, - null, - inI)) { - startRecipe(into); - return true; - } - } - } else { - // Do ITEM STACK quantization - if (DEBUG_MODE) { - TecTech.LOGGER.info( - "Quantifier-Item-recipe " + is.getItem().getUnlocalizedName() - + '.' - + is.getItemDamage()); - } - IEMStack into = aIQI.output(); - if (into != null && isInputEqual( - true, - false, - nullFluid, - new ItemStack[] { - new ItemStack(is.getItem(), aIQI.input().stackSize, is.getItemDamage()) }, - null, - inI)) { - startRecipe(into); - return true; - } - } - } - } - ArrayList storedFluids = getStoredFluids(); - FluidStack[] inF = storedFluids.toArray(nullFluid); - if (inF.length > 0) { - for (FluidStack fs : inF) { - EMFluidQuantizationInfo aFQI = TecTech.transformationInfo.getFluidQuantization() - .get(fs.getFluid().getID()); - if (aFQI == null) { - continue; - } - IEMStack into = aFQI.output(); - if (into != null && fs.amount >= aFQI.input().amount - && isInputEqual( - true, - false, - new FluidStack[] { aFQI.input() }, - nullItem, - inF, - (ItemStack[]) null)) { - startRecipe(into); - return true; - } - } - } - } - return false; - } - - private void startRecipe(IEMStack into) { - mMaxProgresstime = 20; - mEfficiencyIncrease = 10000; - double mass = into.getMass(); - double euMult = Math.abs(mass / refMass); - eAmpereFlow = (int) Math.ceil(Math.sqrt(Math.sqrt(euMult))); - if (mass > refUnstableMass - || into.getDefinition().getRawTimeSpan(DEFAULT_ENERGY_LEVEL) < STABLE_RAW_LIFE_TIME) { - mEUt = (int) -V[8]; - } else { - mEUt = (int) -V[6]; - } - outputEM = new EMInstanceStackMap[] { - into instanceof EMInstanceStack ? new EMInstanceStackMap((EMInstanceStack) into) - : new EMInstanceStackMap(new EMInstanceStack(into.getDefinition(), into.getAmount())) }; - } - - @Override - public void outputAfterRecipe_EM() { - if (eOutputHatches.size() < 1) { - stopMachine(); - return; - } - eOutputHatches.get(0).getContentHandler().putUnifyAll(outputEM[0]); - outputEM = null; - } - - @Override - public GT_Multiblock_Tooltip_Builder createTooltip() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(translateToLocal("gt.blockmachines.multimachine.em.mattertoem.name")) // Machine Type: Matter - // Quantizer - .addInfo(translateToLocal("gt.blockmachines.multimachine.em.mattertoem.desc.0")) // Controller block of - // the Matter - // Quantizer - .addInfo(translateToLocal("gt.blockmachines.multimachine.em.mattertoem.desc.1")) // Transforms items - // into their - // elemental form - .addInfo(translateToLocal("tt.keyword.Structure.StructureTooComplex")) // The structure is too complex! - .addSeparator().beginStructureBlock(3, 3, 4, false) - .addOtherStructurePart( - translateToLocal("tt.keyword.Structure.ElementalOutput"), - translateToLocal("tt.keyword.Structure.BackCenter"), - 2) // Elemental Output Hatch: Back center - .addOtherStructurePart( - translateToLocal("tt.keyword.Structure.ElementalOverflow"), - translateToLocal("tt.keyword.Structure.AnyOuterMolecularCasing3rd"), - 3) // Elemental Overflow Hatch: Any outer Molecular Casing on the 3rd slice - .addInputBus(translateToLocal("tt.keyword.Structure.AnyHighPowerCasingFront"), 1) // Input Bus: Any High - // Power Casing on the - // front side - .addEnergyHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasingFront"), 1) // Energy Hatch: - // Any High Power - // Casing on the - // front side - .addMaintenanceHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasingFront"), 1) // Maintenance - // Hatch: Any - // High Power - // Casing on - // the front - // side - .toolTipFinisher(CommonValues.TEC_MARK_EM); - return tt; - } - - public static final ResourceLocation activitySound = new ResourceLocation(Reference.MODID + ":fx_mid_freq"); - - @Override - @SideOnly(Side.CLIENT) - protected ResourceLocation getActivitySound() { - return activitySound; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - structureBuild_EM("main", 1, 1, 0, stackSize, hintsOnly); - } - - @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; - } - - @Override - public String[] getStructureDescription(ItemStack stackSize) { - return description; - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index c9cf28ca4..a1fcf4420 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -4,8 +4,6 @@ import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting.crafter; -import static com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine.machine; import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.util.CommonValues.VN; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; @@ -77,6 +75,8 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockBase_EM implements ISurvivalConstructable { + public static final String machine = "EM Machinery"; + public static final String crafter = "EM Crafting"; // region variables private final ArrayList eHolders = new ArrayList<>(); private GT_Recipe.GT_Recipe_AssemblyLine tRecipe; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java deleted file mode 100644 index 2ef33377c..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java +++ /dev/null @@ -1,620 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi; - -import static com.github.technus.tectech.recipe.TT_recipe.E_RECIPE_ID; -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.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting.crafter; -import static com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine.machine; -import static com.github.technus.tectech.util.CommonValues.TEC_MARK_SHORT; -import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.CommonValues.VN; -import static com.github.technus.tectech.util.TT_Utility.areBitsSet; -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; -import static net.minecraft.util.StatCollector.translateToLocalFormatted; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; - -import org.apache.commons.lang3.reflect.FieldUtils; -import org.jetbrains.annotations.NotNull; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition; -import com.github.technus.tectech.recipe.TT_recipe; -import com.github.technus.tectech.thing.CustomItemList; -import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.thing.item.ElementalDefinitionScanStorage_EM; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; -import com.github.technus.tectech.util.CommonValues; -import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; - -import gregtech.api.enums.ItemList; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.recipe.check.CheckRecipeResult; -import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.recipe.check.SimpleCheckRecipeResult; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - - // region variables - public static final int SCAN_DO_NOTHING = 0, SCAN_GET_NOMENCLATURE = 1 << 0, SCAN_GET_DEPTH_LEVEL = 1 << 1, - SCAN_GET_AMOUNT = 1 << 2, SCAN_GET_CHARGE = 1 << 3, SCAN_GET_MASS = 1 << 4, SCAN_GET_ENERGY = 1 << 5, - SCAN_GET_ENERGY_LEVEL = 1 << 6, SCAN_GET_TIMESPAN_INFO = 1 << 7, SCAN_GET_ENERGY_STATES = 1 << 8, - SCAN_GET_COLORABLE = 1 << 9, SCAN_GET_COLOR_VALUE = 1 << 10, SCAN_GET_AGE = 1 << 11, - SCAN_GET_TIMESPAN_MULT = 1 << 12, SCAN_GET_CLASS_TYPE = 1 << 13, SCAN_GET_TOO_BIG = 1 << 14; // should be - // the sum of - // all flags +1 - - private TT_recipe.TT_EMRecipe.TT_EMRecipe eRecipe; - private EMDefinitionStack objectResearched; - private EMInstanceStackMap objectsScanned; - private String machineType; - private long computationRemaining, computationRequired; - private int[] scanComplexity; - - private String clientLocale = "en_US"; - // endregion - - // region structure - private static final String[] description = new String[] { - EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", - translateToLocal("gt.blockmachines.multimachine.em.scanner.hint.0"), // 1 - Classic Hatches or High Power - // Casing - translateToLocal("gt.blockmachines.multimachine.em.scanner.hint.1"), // 2 - Elemental Input Hatches or - // Molecular Casing - translateToLocal("gt.blockmachines.multimachine.em.scanner.hint.2"), // 3 - Elemental Output Hatches or - // Molecular Casing - translateToLocal("gt.blockmachines.multimachine.em.scanner.hint.3"), // 4 - Elemental Overflow Hatches or - // Molecular - // Casing - }; - - private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition - .builder() - .addShape( - "main", - transpose( - new String[][] { { "CCCCC", "BBBBB", "BBDBB", "BDDDB", "BDDDB", "BDDDB", "BBDBB", "EEEEE" }, - { "CAAAC", "BBBBB", "BDDDB", "D---D", "D---D", "D---D", "BDDDB", "EBBBE" }, - { "CA~AC", "BBBBB", "DDDDD", "D---D", "D- -D", "D---D", "DDGDD", "EBFBE" }, - { "CAAAC", "BBBBB", "BDDDB", "D---D", "D---D", "D---D", "BDDDB", "EBBBE" }, - { "CCCCC", "BBBBB", "BBDBB", "BDDDB", "BDDDB", "BDDDB", "BBDBB", "EEEEE" } })) - .addElement('A', ofBlock(sBlockCasingsTT, 0)).addElement('B', ofBlock(sBlockCasingsTT, 4)) - .addElement('D', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement( - 'C', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_scanner::addClassicToMachineList, - textureOffset, - 1, - sBlockCasingsTT, - 0)) - .addElement( - 'F', - ofHatchAdder(GT_MetaTileEntity_EM_scanner::addElementalInputToMachineList, textureOffset + 4, 2)) - .addElement( - 'G', - ofHatchAdder(GT_MetaTileEntity_EM_scanner::addElementalOutputToMachineList, textureOffset + 4, 3)) - .addElement( - 'E', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_scanner::addElementalMufflerToMachineList, - textureOffset + 4, - 4, - sBlockCasingsTT, - 4)) - .build(); - // endregion - - // region parameters - private static final INameFunction CONFIG_NAME = (base, p) -> "Config at Depth: " - + (p.hatchId() * 2 + p.parameterId()); - private static final IStatusFunction CONFIG_STATUS = (base, p) -> { - double v = p.get(); - if (Double.isNaN(v)) { - return LedStatus.STATUS_WRONG; - } - v = (int) v; - if (v == 0) return LedStatus.STATUS_NEUTRAL; - if (v >= SCAN_GET_TOO_BIG) return LedStatus.STATUS_TOO_HIGH; - if (v < 0) return LedStatus.STATUS_TOO_LOW; - return LedStatus.STATUS_OK; - }; - protected Parameters.Group.ParameterIn[] scanConfiguration; - // endregion - - public GT_MetaTileEntity_EM_scanner(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - eDismantleBoom = true; - } - - public GT_MetaTileEntity_EM_scanner(String aName) { - super(aName); - eDismantleBoom = true; - } - - private void addComputationRequirements(int depthPlus, int capabilities) { - if (areBitsSet(SCAN_GET_NOMENCLATURE, capabilities)) { - computationRequired += depthPlus * 3L; - eRequiredData += depthPlus; - } - if (areBitsSet(SCAN_GET_DEPTH_LEVEL, capabilities)) { - computationRequired += depthPlus * 10L; - eRequiredData += depthPlus; - } - if (areBitsSet(SCAN_GET_AMOUNT, capabilities)) { - computationRequired += depthPlus * 64L; - eRequiredData += depthPlus * 8L; - } - if (areBitsSet(SCAN_GET_CHARGE, capabilities)) { - computationRequired += depthPlus * 128L; - eRequiredData += depthPlus * 4L; - } - if (areBitsSet(SCAN_GET_MASS, capabilities)) { - computationRequired += depthPlus * 256L; - eRequiredData += depthPlus * 4L; - } - if (areBitsSet(SCAN_GET_ENERGY, capabilities)) { - computationRequired += depthPlus * 256L; - eRequiredData += depthPlus * 16L; - } - if (areBitsSet(SCAN_GET_ENERGY_LEVEL, capabilities)) { - computationRequired += depthPlus * 256L; - eRequiredData += depthPlus * 16L; - } - if (areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)) { - computationRequired += depthPlus * 1024L; - eRequiredData += depthPlus * 32L; - } - if (areBitsSet(SCAN_GET_ENERGY_STATES, capabilities)) { - computationRequired += depthPlus * 2048L; - eRequiredData += depthPlus * 32L; - } - if (areBitsSet(SCAN_GET_COLORABLE, capabilities)) { - computationRequired += depthPlus * 512L; - eRequiredData += depthPlus * 48L; - } - if (areBitsSet(SCAN_GET_COLOR_VALUE, capabilities)) { - computationRequired += depthPlus * 1024L; - eRequiredData += depthPlus * 48L; - } - if (areBitsSet(SCAN_GET_AGE, capabilities)) { - computationRequired += depthPlus * 2048L; - eRequiredData += depthPlus * 64L; - } - if (areBitsSet(SCAN_GET_TIMESPAN_MULT, capabilities)) { - computationRequired += depthPlus * 2048L; - eRequiredData += depthPlus * 64L; - } - if (areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { - computationRequired += depthPlus * 2L; - eRequiredData += depthPlus; - } - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_scanner(mName); - } - - @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - if (!structureCheck_EM("main", 2, 2, 0)) { - return false; - } - return eInputHatches.size() == 1 && eOutputHatches.size() == 1 - && eOutputHatches.get(0).getBaseMetaTileEntity().getFrontFacing() - == iGregTechTileEntity.getFrontFacing(); - } - - @Override - @NotNull - protected CheckRecipeResult checkProcessing_EM() { - ItemStack controllerStack = getControllerSlot(); - eRecipe = null; - if (!eInputHatches.isEmpty() && eInputHatches.get(0).getContentHandler().hasStacks() - && !eOutputHatches.isEmpty()) { - EMInstanceStackMap researchEM = eInputHatches.get(0).getContentHandler(); - if (ItemList.Tool_DataOrb.isStackEqual(controllerStack, false, true)) { - GT_Recipe scannerRecipe = null; - for (EMInstanceStack stackEM : researchEM.valuesToArray()) { - objectsScanned = null; - eRecipe = TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.findRecipe(stackEM.getDefinition()); - if (eRecipe != null) { - scannerRecipe = eRecipe.scannerRecipe; - machineType = machine; - objectResearched = new EMDefinitionStack(stackEM.getDefinition(), 1); - // cleanMassEM_EM(objectResearched.getMass()); - researchEM.removeKey(objectResearched.getDefinition()); - break; - } - eRecipe = TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.findRecipe(stackEM.getDefinition()); - if (eRecipe != null) { - scannerRecipe = eRecipe.scannerRecipe; - machineType = crafter; - objectResearched = new EMDefinitionStack(stackEM.getDefinition(), 1); - // cleanMassEM_EM(objectResearched.getMass()); - researchEM.removeKey(objectResearched.getDefinition()); - break; - } - cleanStackEM_EM(stackEM); - researchEM.removeKey(stackEM.getDefinition()); - } - if (eRecipe != null && scannerRecipe != null) { // todo make sure it werks - computationRequired = computationRemaining = scannerRecipe.mDuration * 20L; - mMaxProgresstime = 20; // const - mEfficiencyIncrease = 10000; - eRequiredData = (short) (scannerRecipe.mSpecialValue >>> 16); - eAmpereFlow = (short) (scannerRecipe.mSpecialValue & 0xFFFF); - mEUt = scannerRecipe.mEUt; - return SimpleCheckRecipeResult.ofSuccess("researching"); - } - } else if (CustomItemList.scanContainer.isStackEqual(controllerStack, false, true)) { - eRecipe = null; - if (researchEM.hasStacks()) { - objectsScanned = researchEM.takeAll(); - cleanMassEM_EM(objectsScanned.getMass()); - - computationRequired = 0; - eRequiredData = 0; - eAmpereFlow = objectsScanned.size() + TecTech.RANDOM.next(objectsScanned.size()); - mEUt = -(int) V[8]; - - // get depth scan complexity array - { - int[] scanComplexityTemp = new int[20]; - for (int i = 0; i < 20; i++) { - scanComplexityTemp[i] = (int) scanConfiguration[i].get(); - } - int maxDepth = 0; - for (int i = 0; i < 20; i++) { - if (scanComplexityTemp[i] != SCAN_DO_NOTHING) { - maxDepth = i; - addComputationRequirements(i + 1, scanComplexityTemp[i]); - } - } - maxDepth += 1; // from index to len - scanComplexity = new int[maxDepth]; - System.arraycopy(scanComplexityTemp, 0, scanComplexity, 0, maxDepth); - } - - computationRemaining = computationRequired *= 20; - mMaxProgresstime = 20; // const - mEfficiencyIncrease = 10000; - return SimpleCheckRecipeResult.ofSuccess("researching"); - } - } else { - return CheckRecipeResultRegistry.NO_DATA_STICKS; - } - } - objectResearched = null; - computationRemaining = 0; - return SimpleCheckRecipeResult.ofFailure("no_research_item"); - } - - @Override - public void outputAfterRecipe_EM() { - if (eRecipe != null && ItemList.Tool_DataOrb.isStackEqual(mInventory[1], false, true)) { - - mInventory[1].setStackDisplayName( - GT_LanguageManager.getTranslation(eRecipe.mOutputs[0].getDisplayName()) + ' ' - + machineType - + " Construction Data"); - NBTTagCompound tNBT = mInventory[1].getTagCompound(); // code above makes it not null - - tNBT.setString("eMachineType", machineType); - tNBT.setTag(E_RECIPE_ID, objectResearched.toNBT(TecTech.definitionsRegistry)); - tNBT.setString( - "author", - TEC_MARK_SHORT + EnumChatFormatting.WHITE + ' ' + machineType + " EM Recipe Generator"); - } else if (objectsScanned != null && CustomItemList.scanContainer.isStackEqual(mInventory[1], false, true)) { - ElementalDefinitionScanStorage_EM.setContent(mInventory[1], objectsScanned, scanComplexity); - } - objectResearched = null; - computationRemaining = 0; - } - - @Override - public GT_Multiblock_Tooltip_Builder createTooltip() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(translateToLocal("gt.blockmachines.multimachine.em.scanner.name")) // Machine Type: Elemental - // Scanner - .addInfo(translateToLocal("gt.blockmachines.multimachine.em.scanner.desc.0")) // Controller block of the - // Elemental Scanner - .addInfo(translateToLocal("tt.keyword.Structure.StructureTooComplex")) // The structure is too complex! - .addSeparator().beginStructureBlock(5, 5, 8, false) - .addOtherStructurePart( - translateToLocal("tt.keyword.Structure.ElementalInput"), - translateToLocal("tt.keyword.Structure.BackCenter"), - 2) // Elemental Input Hatch: Back Center - .addOtherStructurePart( - translateToLocal("tt.keyword.Structure.ElementalOutput"), - translateToLocal("tt.keyword.Structure.AnyMolecularCasing3D"), - 3) // Elemental Output Hatch: Any Molecular Casing with 3 dot - .addEnergyHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasing1D"), 1) // Energy Hatch: Any - // High Power Casing - // with 1 dot - .addMaintenanceHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasing1D"), 1) // Maintenance - // Hatch: Any - // High Power - // Casing with 1 - // dot - .toolTipFinisher(CommonValues.TEC_MARK_EM); - return tt; - } - - @Override - public String[] getInfoData() { - long storedEnergy = 0; - long maxEnergy = 0; - for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); - maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); - } - } - for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); - maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); - } - } - - return new String[] { translateToLocalFormatted("tt.keyphrase.Energy_Hatches", clientLocale) + ":", - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) - + EnumChatFormatting.RESET - + " EU / " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(maxEnergy) - + EnumChatFormatting.RESET - + " EU", - (mEUt <= 0 ? translateToLocalFormatted("tt.keyphrase.Probably_uses", clientLocale) + ": " - : translateToLocalFormatted("tt.keyphrase.Probably_makes", clientLocale) + ": ") - + EnumChatFormatting.RED - + GT_Utility.formatNumbers(Math.abs(mEUt)) - + EnumChatFormatting.RESET - + " EU/t " - + translateToLocalFormatted("tt.keyword.at", clientLocale) - + " " - + EnumChatFormatting.RED - + GT_Utility.formatNumbers(eAmpereFlow) - + EnumChatFormatting.RESET - + " A", - translateToLocalFormatted("tt.keyphrase.Tier_Rating", clientLocale) + ": " - + EnumChatFormatting.YELLOW - + VN[getMaxEnergyInputTier_EM()] - + EnumChatFormatting.RESET - + " / " - + EnumChatFormatting.GREEN - + VN[getMinEnergyInputTier_EM()] - + EnumChatFormatting.RESET - + " " - + translateToLocalFormatted("tt.keyphrase.Amp_Rating", clientLocale) - + ": " - + EnumChatFormatting.GREEN - + GT_Utility.formatNumbers(eMaxAmpereFlow) - + EnumChatFormatting.RESET - + " A", - translateToLocalFormatted("tt.keyword.Problems", clientLocale) + ": " - + EnumChatFormatting.RED - + (getIdealStatus() - getRepairStatus()) - + EnumChatFormatting.RESET - + " " - + translateToLocalFormatted("tt.keyword.Efficiency", clientLocale) - + ": " - + EnumChatFormatting.YELLOW - + mEfficiency / 100.0F - + EnumChatFormatting.RESET - + " %", - translateToLocalFormatted("tt.keyword.PowerPass", clientLocale) + ": " - + EnumChatFormatting.BLUE - + ePowerPass - + EnumChatFormatting.RESET - + " " - + translateToLocalFormatted("tt.keyword.SafeVoid", clientLocale) - + ": " - + EnumChatFormatting.BLUE - + eSafeVoid, - translateToLocalFormatted("tt.keyphrase.Computation_Available", clientLocale) + ": " - + EnumChatFormatting.GREEN - + GT_Utility.formatNumbers(eAvailableData) - + EnumChatFormatting.RESET - + " / " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(eRequiredData) - + EnumChatFormatting.RESET, - translateToLocalFormatted("tt.keyphrase.Computation_Remaining", clientLocale) + ":", - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(computationRemaining / 20L) - + EnumChatFormatting.RESET - + " / " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(computationRequired / 20L) }; - } - - @Override - public void onRemoval() { - super.onRemoval(); - } - - @Override - protected void parametersInstantiation_EM() { - scanConfiguration = new Parameters.Group.ParameterIn[20]; - for (int i = 0; i < 10; i++) { - Parameters.Group hatch = parametrization.getGroup(i); - scanConfiguration[i * 2] = hatch.makeInParameter(0, 0, CONFIG_NAME, CONFIG_STATUS); - scanConfiguration[i * 2 + 1] = hatch.makeInParameter(1, 0, CONFIG_NAME, CONFIG_STATUS); - } - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setLong("eComputationRemaining", computationRemaining); - aNBT.setLong("eComputationRequired", computationRequired); - if (objectResearched != null) { - aNBT.setTag("eObject", objectResearched.toNBT(TecTech.definitionsRegistry)); - } else { - aNBT.removeTag("eObject"); - } - if (scanComplexity != null) { - aNBT.setIntArray("eScanComplexity", scanComplexity); - } else { - aNBT.removeTag("eScanComplexity"); - } - if (objectsScanned != null) { - aNBT.setTag("eScanObjects", objectsScanned.toNBT(TecTech.definitionsRegistry)); - } else { - aNBT.removeTag("eScanObjects"); - } - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - computationRemaining = aNBT.getLong("eComputationRemaining"); - computationRequired = aNBT.getLong("eComputationRequired"); - if (aNBT.hasKey("eObject")) { - objectResearched = EMDefinitionStack.fromNBT(TecTech.definitionsRegistry, aNBT.getCompoundTag("eObject")); - if (objectResearched.getDefinition() == EMPrimitiveDefinition.nbtE__) { - objectResearched = null; - } - } else { - objectResearched = null; - } - if (aNBT.hasKey("eScanComplexity")) { - scanComplexity = aNBT.getIntArray("eScanComplexity"); - } else { - scanComplexity = null; - } - try { - if (aNBT.hasKey("eScanObjects")) { - objectsScanned = EMInstanceStackMap - .fromNBT(TecTech.definitionsRegistry, aNBT.getCompoundTag("eScanObjects")); - } - } catch (EMException e) { - objectsScanned = new EMInstanceStackMap(); - } - } - - @Override - public void stopMachine() { - super.stopMachine(); - computationRequired = computationRemaining = 0; - objectResearched = null; - } - - @Override - public void onFirstTick_EM(IGregTechTileEntity aBaseMetaTileEntity) { - if (aBaseMetaTileEntity.isServerSide()) { - if (computationRemaining > 0 && objectResearched != null) { - eRecipe = null; - if (ItemList.Tool_DataOrb.isStackEqual(mInventory[1], false, true)) { - eRecipe = TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.findRecipe(objectResearched.getDefinition()); - if (eRecipe != null) { - machineType = machine; - } else { - eRecipe = TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM - .findRecipe(objectResearched.getDefinition()); - if (eRecipe != null) { - machineType = crafter; - } - } - } - if (eRecipe == null) { - objectResearched = null; - eRequiredData = 0; - computationRequired = computationRemaining = 0; - mMaxProgresstime = 0; - mEfficiencyIncrease = 0; - } - } - } - } - - @Override - public boolean onRunningTick(ItemStack aStack) { - if (computationRemaining <= 0) { - computationRemaining = 0; - mProgresstime = mMaxProgresstime; - return true; - } else { - computationRemaining -= eAvailableData; - mProgresstime = 1; - return super.onRunningTick(aStack); - } - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - super.onRightclick(aBaseMetaTileEntity, aPlayer); - - if (!aBaseMetaTileEntity.isClientSide() && aPlayer instanceof EntityPlayerMP) { - try { - EntityPlayerMP player = (EntityPlayerMP) aPlayer; - clientLocale = (String) FieldUtils.readField(player, "translator", true); - } catch (Exception e) { - clientLocale = "en_US"; - } - } else { - return true; - } - return true; - } - - @Override - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isActive() && (aTick & 0x2) == 0 && aBaseMetaTileEntity.isClientSide()) { - int xDir = aBaseMetaTileEntity.getBackFacing().offsetX * 4 + aBaseMetaTileEntity.getXCoord(); - int yDir = aBaseMetaTileEntity.getBackFacing().offsetY * 4 + aBaseMetaTileEntity.getYCoord(); - int zDir = aBaseMetaTileEntity.getBackFacing().offsetZ * 4 + aBaseMetaTileEntity.getZCoord(); - aBaseMetaTileEntity.getWorld().markBlockRangeForRenderUpdate(xDir, yDir, zDir, xDir, yDir, zDir); - } - } - - @Override - public int getInventoryStackLimit() { - return 1; - } - - @Override - public void construct(ItemStack trigger, boolean hintsOnly) { - structureBuild_EM("main", 2, 2, 0, trigger, hintsOnly); - } - - @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; - } - - @Override - public String[] getStructureDescription(ItemStack stackSize) { - return description; - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java deleted file mode 100644 index 2bbaeb9df..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi; - -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.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; -import static net.minecraft.util.StatCollector.translateToLocal; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -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 gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - - // region structure - private static final String[] description = new String[] { - EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", - translateToLocal("gt.blockmachines.multimachine.em.stabilizer.hint.0"), // 1 - Classic Hatches or High Power - // Casing - translateToLocal("gt.blockmachines.multimachine.em.stabilizer.hint.1"), // 2 - Elemental Hatches or - // Molecular Casing - }; - - private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition - .builder() - .addShape( - "main", - transpose( - new String[][] { { " AFA ", "BCBCB", "FBGBF", "BCBCB", " AFA " }, - { "AEEEA", "CBBBC", "BBDBB", "CBBBC", "AEEEA" }, - { "FE~EF", "BBBBB", "GDDDG", "BBBBB", "FEEEF" }, - { "AEEEA", "CBBBC", "BBDBB", "CBBBC", "AEEEA" }, - { " AFA ", "BCBCB", "FBGBF", "BCBCB", " AFA " } })) - .addElement('A', ofBlock(sBlockCasingsTT, 4)).addElement('B', ofBlock(sBlockCasingsTT, 5)) - .addElement('C', ofBlock(sBlockCasingsTT, 6)).addElement('D', ofBlock(sBlockCasingsTT, 9)) - .addElement('F', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement( - 'E', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_stabilizer::addClassicToMachineList, - textureOffset, - 1, - sBlockCasingsTT, - 0)) - .addElement( - 'G', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_stabilizer::addElementalToMachineList, - textureOffset + 4, - 2, - sBlockCasingsTT, - 4)) - .build(); - // endregion - - public GT_MetaTileEntity_EM_stabilizer(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_stabilizer(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_stabilizer(mName); - } - - @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM("main", 2, 2, 0); - } - - @Override - public GT_Multiblock_Tooltip_Builder createTooltip() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(translateToLocal("gt.blockmachines.multimachine.em.stabilizer.name")) // Machine Type: - // Elemental Stabilizer - .addInfo(translateToLocal("gt.blockmachines.multimachine.em.stabilizer.desc.0")) // Controller block of - // the - // Elemental Stabilizer - .addInfo(translateToLocal("tt.keyword.Structure.StructureTooComplex")) // The structure is too complex! - .addSeparator().beginStructureBlock(5, 5, 5, false) - .addOtherStructurePart( - translateToLocal("tt.keyword.Structure.Elemental"), - translateToLocal("tt.keyword.Structure.SideCenter"), - 2) // Elemental Hatch: Side center - .addEnergyHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasing"), 1) // Energy Hatch: Any - // High Power Casing - .addMaintenanceHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasing"), 1) // Maintenance - // Hatch: Any High - // Power Casing - .toolTipFinisher(CommonValues.TEC_MARK_EM); - return tt; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - structureBuild_EM("main", 2, 2, 0, stackSize, hintsOnly); - } - - @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; - } - - @Override - public String[] getStructureDescription(ItemStack stackSize) { - return description; - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java index c4be17ea4..26525eb53 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java @@ -7,7 +7,6 @@ import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_LOW; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_NEUTRAL; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_OK; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_TOO_HIGH; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_TOO_LOW; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_WRONG; import static com.github.technus.tectech.util.CommonValues.V; @@ -95,7 +94,6 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas if (Double.isNaN(v)) return STATUS_WRONG; v = (int) v; if (v <= 0) return STATUS_TOO_LOW; - if (v >= base.eOutputHatches.size()) return STATUS_TOO_HIGH; return STATUS_OK; } return STATUS_NEUTRAL; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java deleted file mode 100644 index 2a77f905a..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java +++ /dev/null @@ -1,172 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi; - -import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; -import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; -import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; -import static net.minecraft.util.StatCollector.translateToLocal; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; - -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.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; -import com.github.technus.tectech.util.CommonValues; -import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { // TODO - // MAKE - // COMPATIBLE - // WITH - // STARGATES - // XD - // region variables - - private static Textures.BlockIcons.CustomIcon ScreenOFF; - private static Textures.BlockIcons.CustomIcon ScreenON; - // endregion - - // region structure - private static final String[] description = new String[] { - EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", - translateToLocal("gt.blockmachines.multimachine.em.wormhole.hint.0"), // 1 - Classic Hatches or High Power - // Casing - translateToLocal("gt.blockmachines.multimachine.em.wormhole.hint.1"), // 2 - Elemental Hatches or Molecular - // Casing - }; - - private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition - .builder() - .addShape( - "main", - transpose( - new String[][] { - { " ", " ", " ", " ", " ", " D ", - " DDDDD ", " DGGGD ", " DGGGD ", " DGGGD ", " DDDDD " }, - { " ", " ", " ", " D ", " D ", " D ", - " DDAAADD ", " EABBBAE ", " EABBBAE ", " EABBBAE ", " DDAAADD " }, - { " ", " D ", " D ", " D ", " ", " ", - "DDA ADD", "DABFFFBAD", "DABCCCBAD", "DABFFFBAD", "DDA ADD" }, - { " EEE ", " DDD ", " F F ", " ", " ", " ", - "DA AD", "GBF FBG", "GBC CBG", "GBF FBG", "DA AD" }, - { " E~E ", " DDBDD ", " D D ", " DD DD ", " D D ", "DD DD", - "DA AD", "GBF FBG", "GBC CBG", "GBF FBG", "DA AD" }, - { " EEE ", " DDD ", " F F ", " ", " ", " ", - "DA AD", "GBF FBG", "GBC CBG", "GBF FBG", "DA AD" }, - { " ", " D ", " D ", " D ", " ", " ", - "DDA ADD", "DABFFFBAD", "DABCCCBAD", "DABFFFBAD", "DDA ADD" }, - { " ", " ", " ", " D ", " D ", " D ", - " DDAAADD ", " EABBBAE ", " EABBBAE ", " EABBBAE ", " DDAAADD " }, - { " ", " ", " ", " ", " ", " D ", - " DDDDD ", " DGGGD ", " DGGGD ", " DGGGD ", " DDDDD " } })) - .addElement('A', ofBlock(sBlockCasingsTT, 5)).addElement('B', ofBlock(sBlockCasingsTT, 10)) - .addElement('C', ofBlock(sBlockCasingsTT, 11)).addElement('D', ofBlock(sBlockCasingsTT, 12)) - .addElement('F', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement( - 'E', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_wormhole::addClassicToMachineList, - textureOffset, - 1, - sBlockCasingsTT, - 0)) - .addElement( - 'G', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_wormhole::addElementalToMachineList, - textureOffset + 4, - 2, - sBlockCasingsTT, - 4)) - .build(); - // endregion - - public GT_MetaTileEntity_EM_wormhole(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_wormhole(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_wormhole(mName); - } - - @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM("main", 4, 4, 0); - } - - @Override - public GT_Multiblock_Tooltip_Builder createTooltip() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(translateToLocal("gt.blockmachines.multimachine.em.wormhole.name")) // Machine Type: Wormhole - .addInfo(translateToLocal("gt.blockmachines.multimachine.em.wormhole.desc.0")) // Controller block of - // the Wormhole - .addInfo(translateToLocal("tt.keyword.Structure.StructureTooComplex")) // The structure is too complex! - .addSeparator().beginStructureBlock(9, 9, 11, false) - .addOtherStructurePart( - translateToLocal("tt.keyword.Structure.Elemental"), - translateToLocal("tt.keyword.Structure.AnyMolecularCasing"), - 2) // Elemental Hatch: Any Molecular Casing - .addEnergyHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasing"), 1) // Energy Hatch: Any - // High Power Casing - .addMaintenanceHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasing"), 1) // Maintenance - // Hatch: Any High - // Power Casing - .toolTipFinisher(CommonValues.TEC_MARK_EM); - return tt; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aBlockIconRegister) { - ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_WH"); - ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_WH_ACTIVE"); - super.registerIcons(aBlockIconRegister); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, - int colorIndex, boolean aActive, boolean aRedstone) { - if (side == facing) { - return new ITexture[] { Textures.BlockIcons.casingTexturePages[texturePage][4], - new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF) }; - } - return new ITexture[] { Textures.BlockIcons.casingTexturePages[texturePage][4] }; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - structureBuild_EM("main", 4, 4, 0, stackSize, hintsOnly); - } - - @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; - } - - @Override - public String[] getStructureDescription(ItemStack stackSize) { - return description; - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java deleted file mode 100644 index 1e0456f75..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi; - -import net.minecraft.item.ItemStack; - -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; - -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - -@Deprecated -public class GT_MetaTileEntity_TM_proccessingStack extends GT_MetaTileEntity_MultiblockBase_EM - implements IConstructable { - - protected GT_MetaTileEntity_TM_proccessingStack(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - @Override - public IStructureDefinition getStructure_EM() { - return null; - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) {} - - @Override - public String[] getStructureDescription(ItemStack stackSize) { - return new String[0]; - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return null; - } - /* - * //region variables private boolean hasBeenPausedThisCycle = false; //endregion //region structure //use multi A - * energy inputs, use less power the longer it runs private static final String[][] base = new String[][]{ {" ",}, - * {" 0 ",}, {" ",}, }; private static final String[][] slice = new String[][]{ {"111",}, {"101",}, {"111",}, }; - * private static final String[][] cap = new String[][]{ {" ",}, {" 0 ",}, {" ",}, }; private static final - * Block[] blockType = new Block[]{sBlockCasings4}; private static final byte[] blockMeta = new byte[]{1}; private - * static final IHatchAdder[] addingMethods = adders( - * GT_MetaTileEntity_TM_proccessingStack::addClassicToMachineList); private static final short[] casingTextures = - * new short[]{49}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasings4}; private static - * final byte[] blockMetaFallback = new byte[]{1}; private static final String[] description = new String[]{ - * EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", - * translateToLocal("gt.blockmachines.multimachine.tm.proccessingStack.hint.0"), - * translateToLocal("gt.blockmachines.multimachine.tm.proccessingStack.hint.1"), }; //endregion public - * GT_MetaTileEntity_TM_proccessingStack(int aID, String aName, String aNameRegional) { super(aID, aName, - * aNameRegional); } public GT_MetaTileEntity_TM_proccessingStack(String aName) { super(aName); } - * @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new - * GT_MetaTileEntity_TM_proccessingStack(mName); } - * @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { return - * false; //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, - * blockMetaFallback, 1, 0, 0); } - * @Override public boolean checkRecipe_EM(ItemStack itemStack) { return true; } - * @Override public void outputAfterRecipe_EM() { } - * @Override public String[] getDescription() { return new String[]{ CommonValues.BASS_MARK, - * translateToLocal("gt.blockmachines.multimachine.tm.proccessingStack.desc.0"), EnumChatFormatting.AQUA.toString() - * + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.tm.proccessingStack.desc.1"), - * EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.multimachine.tm.proccessingStack.desc.2"), }; } - * @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, byte - * aFacing, byte colorIndex, boolean aActive, boolean aRedstone) { if (side == facing) { return new - * ITexture[]{Textures.BlockIcons.casingTexturePages[0][49], new TT_RenderedExtendedFacingTexture(aActive ? - * Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : - * Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)}; } else if (side == - * GT_Utility.getOppositeSide(aFacing)) { return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][49], - * aActive ? Textures.BlockIcons.casingTexturePages[0][52] : Textures.BlockIcons.casingTexturePages[0][53]}; } - * return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][49]}; } - * @Override public boolean onRunningTick(ItemStack aStack) { return true; } - * @Override public void construct(ItemStack stackSize, boolean hintsOnly) { //StructureBuilderExtreme(shape, - * blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), this, hintsOnly); } - * @Override public String[] getStructureDescription(ItemStack stackSize) { return description; } - */ -} 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 fa8b81966..606eddabf 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 @@ -3,15 +3,11 @@ import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.loader.TecTechConfig.POWERLESS_MODE; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; -import static com.github.technus.tectech.util.CommonValues.MOVE_AT; import static com.github.technus.tectech.util.CommonValues.MULTI_CHECK_AT; -import static com.github.technus.tectech.util.CommonValues.MULTI_PURGE_1_AT; -import static com.github.technus.tectech.util.CommonValues.MULTI_PURGE_2_AT; import static com.github.technus.tectech.util.CommonValues.RECIPE_AT; import static com.github.technus.tectech.util.CommonValues.TEC_MARK_GENERAL; import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.util.CommonValues.VN; -import static com.github.technus.tectech.util.DoubleCount.div; import static com.github.technus.tectech.util.TT_Utility.getTier; import static gregtech.api.enums.GT_HatchElement.InputBus; import static gregtech.api.enums.GT_HatchElement.InputHatch; @@ -42,20 +38,12 @@ import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; import com.github.technus.tectech.thing.gui.TecTechUITextures; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DataConnector; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_ElementalContainer; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputData; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputElemental; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OverflowElemental; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Param; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Uncertainty; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; @@ -143,13 +131,6 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM // tho) // HATCHES!!!, should be added and removed in check machine - - // EM in/out - protected ArrayList eInputHatches = new ArrayList<>(); - protected ArrayList eOutputHatches = new ArrayList<>(); - // EM overflow output - protected ArrayList eMufflerHatches = new ArrayList<>(); - // extra hatches protected ArrayList eParamHatches = new ArrayList<>(); protected ArrayList eUncertainHatches = new ArrayList<>(); // multi amp hatches in/out @@ -185,10 +166,6 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM // Max timeout of computation in ticks protected static int MAX_COMPUTATION_TIMEOUT = 100; - // storage for output EM that will be auto handled in case of failure to finish recipe - // if you succed to use a recipe - be sure to output EM from outputEM to hatches in the output method - protected EMInstanceStackMap[] outputEM; - // are parameters correct - change in check recipe/output/update params etc. (maintenance status boolean) protected boolean eParameters = true; @@ -531,7 +508,7 @@ public void registerIcons(IIconRegister aBlockIconRegister) { * * @param aBaseMetaTileEntity * @param side - * @param aFacing + * @param facing * @param colorIndex * @param aActive * @param aRedstone @@ -608,28 +585,6 @@ public int getDamageToComponent(ItemStack itemStack) { @Override public void onRemoval() { try { - if (eOutputHatches != null) { - for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eOutputHatches) { - hatch_elemental.id = -1; - } - for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eInputHatches) { - hatch_elemental.id = -1; - } - for (GT_MetaTileEntity_Hatch_OutputData hatch_data : eOutputData) { - hatch_data.id = -1; - hatch_data.q = null; - } - for (GT_MetaTileEntity_Hatch_InputData hatch_data : eInputData) { - hatch_data.id = -1; - } - for (GT_MetaTileEntity_Hatch_Uncertainty hatch : eUncertainHatches) { - hatch.getBaseMetaTileEntity().setActive(false); - } - for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) { - hatch.getBaseMetaTileEntity().setActive(false); - } - } - cleanOutputEM_EM(); if (ePowerPass && getEUVar() > V[3] || eDismantleBoom && mMaxProgresstime > 0 && areChunksAroundLoaded_EM()) { explodeMultiblock(); @@ -838,19 +793,8 @@ public void saveNBTData(NBTTagCompound aNBT) { } } - if (outputEM != null) { - aNBT.setInteger("eOutputStackCount", outputEM.length); - NBTTagCompound output = new NBTTagCompound(); - for (int i = 0; i < outputEM.length; i++) { - if (outputEM[i] != null) { - output.setTag(Integer.toString(i), outputEM[i].toNBT(TecTech.definitionsRegistry)); - } - } - aNBT.setTag("outputEM", output); - } else { - aNBT.setInteger("eOutputStackCount", 0); - aNBT.removeTag("outputEM"); - } + aNBT.setInteger("eOutputStackCount", 0); + aNBT.removeTag("outputEM"); NBTTagCompound paramI = new NBTTagCompound(); for (int i = 0; i < parametrization.iParamsIn.length; i++) { @@ -922,27 +866,6 @@ public void loadNBTData(NBTTagCompound aNBT) { } } - int outputLen = aNBT.getInteger("eOutputStackCount"); - if (outputLen > 0) { - outputEM = new EMInstanceStackMap[outputLen]; - NBTTagCompound compound = aNBT.getCompoundTag("outputEM"); - for (int i = 0; i < outputEM.length; i++) { - if (compound.hasKey(Integer.toString(i))) { - try { - outputEM[i] = EMInstanceStackMap - .fromNBT(TecTech.definitionsRegistry, compound.getCompoundTag(Integer.toString(i))); - } catch (EMException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - outputEM[i] = null; - } - } - } - } else { - outputEM = null; - } - if (aNBT.hasKey("eParamsIn") && aNBT.hasKey("eParamsOut") && aNBT.hasKey("eParamsB")) { NBTTagCompound paramI = aNBT.getCompoundTag("eParamsIn"); NBTTagCompound paramO = aNBT.getCompoundTag("eParamsOut"); @@ -986,26 +909,12 @@ public GT_Recipe.GT_Recipe_Map getRecipeMap() { return null; } - /** - * does some validation and cleaning, dont touch i think - */ - @Override - public void updateSlots() { - super.updateSlots(); - purgeAllOverflowEM_EM(); - } - - // endregion - - // region RATHER LEAVE ALONE Section - /** * Override if needed but usually call super method at start! On machine stop - NOT called directly when soft * hammered to offline state! - it SHOULD cause a full stop like power failure does */ @Override public void stopMachine() { - cleanOrExplode(); for (GT_MetaTileEntity_Hatch_OutputData data : eOutputData) { data.q = null; @@ -1026,7 +935,6 @@ public void stopMachine() { * After recipe check failed helper method so i don't have to set that params to nothing at all times */ protected void afterRecipeCheckFailed() { - cleanOrExplode(); for (GT_MetaTileEntity_Hatch_OutputData data : eOutputData) { data.q = null; @@ -1041,30 +949,6 @@ protected void afterRecipeCheckFailed() { eAvailableData = 0; } - private void cleanOrExplode() { - if (outputEM != null) { - float mass = 0; - for (EMInstanceStackMap tree : outputEM) { - if (tree != null) { - mass += tree.getMass(); - } - } - if (mass > 0) { - if (eMufflerHatches.size() < 1) { - explodeMultiblock(); - } else { - mass /= eMufflerHatches.size(); - for (GT_MetaTileEntity_Hatch_OverflowElemental dump : eMufflerHatches) { - if (dump.addOverflowMatter(mass)) { - explodeMultiblock(); - } - } - } - } - outputEM = null; - } - } - /** * cyclic check even when not working, called LESS frequently * @@ -1249,13 +1133,6 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { || eDismantleBoom && mMaxProgresstime > 0 && areChunksAroundLoaded_EM()) { explodeMultiblock(); } - if (outputEM != null) { - for (EMInstanceStackMap tree : outputEM) { - if (tree != null && tree.hasStacks()) { - explodeMultiblock(); - } - } - } } if (eUncertainHatches.size() > 1) { @@ -1282,12 +1159,8 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (mStartUpCheck < 0) { // E if (mMachine) { // S byte Tick = (byte) (aTick % 20); - if (MULTI_PURGE_1_AT == Tick || MULTI_PURGE_2_AT == Tick) { - purgeAllOverflowEM_EM(); - } else if (MULTI_CHECK_AT == Tick) { + if (MULTI_CHECK_AT == Tick) { maintenance_EM(); - } else if (MOVE_AT == Tick && eSafeVoid) { - safeVoid_EM(); } if (getRepairStatus() >= minRepairStatus) { // S @@ -1300,7 +1173,6 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (mMaxProgresstime > 0 && doRandomMaintenanceDamage()) { // Start if (onRunningTick(mInventory[1])) { // Compute EU - cleanMassEM_EM(getExcessMassPerTick_EM(mInventory[1])); if (!polluteEnvironment(getPollutionPerTick(mInventory[1]))) { stopMachine(); } @@ -1310,7 +1182,6 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { hatchesStatusUpdate_EM(); outputAfterRecipe_EM(); - cleanOutputEM_EM(); addClassicOutputs_EM(); @@ -1403,39 +1274,6 @@ protected void addClassicOutputs_EM() { mOutputFluids = null; } - protected void safeVoid_EM() { - for (GT_MetaTileEntity_Hatch_OverflowElemental voider : eMufflerHatches) { - if (voider.overflowMax < voider.getOverflowMatter()) { - continue; - } - double remaining = voider.overflowMax - voider.getOverflowMatter(); - for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { - for (EMInstanceStack instance : in.getContentHandler().valuesToArray()) { - double qty = div(remaining, instance.getDefinition().getMass()); - if (qty > 0) { - qty = min(qty, instance.getAmount()); - if (voider.addOverflowMatter(instance.getDefinition().getMass() * qty)) { - voider.setOverflowMatter(voider.overflowMax); - } - in.getContentHandler().removeAmount(new EMDefinitionStack(instance.getDefinition(), qty)); - } - } - } - for (GT_MetaTileEntity_Hatch_OutputElemental out : eOutputHatches) { - for (EMInstanceStack instance : out.getContentHandler().valuesToArray()) { - double qty = div(remaining, instance.getDefinition().getMass()); - if (qty > 0) { - qty = min(qty, instance.getAmount()); - if (voider.addOverflowMatter(instance.getDefinition().getMass() * qty)) { - voider.setOverflowMatter(voider.overflowMax); - } - out.getContentHandler().removeAmount(new EMDefinitionStack(instance.getDefinition(), qty)); - } - } - } - } - } - protected void maintenance_EM() { if (GT_MetaTileEntity_MultiBlockBase.disableMaintenance) { mWrench = true; @@ -1492,17 +1330,6 @@ protected void clearHatches_EM() { mMufflerHatches.clear(); mMaintenanceHatches.clear(); - for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eOutputHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_elemental)) { - hatch_elemental.id = -1; - } - } - for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eInputHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_elemental)) { - hatch_elemental.id = -1; - } - } - for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eOutputData) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) { hatch_data.id = -1; @@ -1527,10 +1354,7 @@ protected void clearHatches_EM() { eUncertainHatches.clear(); eEnergyMulti.clear(); - eInputHatches.clear(); - eOutputHatches.clear(); eParamHatches.clear(); - eMufflerHatches.clear(); eDynamoMulti.clear(); eOutputData.clear(); eInputData.clear(); @@ -1538,19 +1362,7 @@ protected void clearHatches_EM() { protected void setupHatches_EM() { short id = 1; - for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eOutputHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_elemental)) { - hatch_elemental.id = id++; - } - } - id = 1; - for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eInputHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_elemental)) { - hatch_elemental.id = id++; - } - } - id = 1; for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eOutputData) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) { hatch_data.id = id++; @@ -2042,99 +1854,6 @@ public List getExoticEnergyHatches() { return list; } - // endregion - - // region convenience copies input and output EM - // new Method - public final EMInstanceStackMap getInputsClone_EM() { - EMInstanceStackMap in = new EMInstanceStackMap(); - for (GT_MetaTileEntity_Hatch_ElementalContainer hatch : eInputHatches) { - in.putUnifyAll(hatch.getContentHandler()); - } - return in.hasStacks() ? in : null; - } - - // new Method - public final EMInstanceStackMap getOutputsClone_EM() { - EMInstanceStackMap out = new EMInstanceStackMap(); - for (GT_MetaTileEntity_Hatch_ElementalContainer hatch : eOutputHatches) { - out.putUnifyAll(hatch.getContentHandler()); - } - return out.hasStacks() ? out : null; - } - // endregion - - // region em cleaning - private void purgeAllOverflowEM_EM() { - float mass = 0; - for (GT_MetaTileEntity_Hatch_InputElemental tHatch : eInputHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - tHatch.updateSlots(); - } - mass += tHatch.overflowMatter; - tHatch.overflowMatter = 0; - } - for (GT_MetaTileEntity_Hatch_OutputElemental tHatch : eOutputHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - tHatch.updateSlots(); - } - mass += tHatch.overflowMatter; - tHatch.overflowMatter = 0; - } - cleanMassEM_EM(mass); - } - - public void cleanHatchContentEM_EM(GT_MetaTileEntity_Hatch_ElementalContainer target) { - if (target == null) { - return; - } - cleanMassEM_EM(target.getContentHandler().getMass()); - } - - public void cleanStackEM_EM(EMInstanceStack target) { - if (target == null) { - return; - } - cleanMassEM_EM(target.getMass()); - } - - public void cleanMassEM_EM(double mass) { - if (mass > 0) { - if (eMufflerHatches.size() < 1) { - TecTech.anomalyHandler.addAnomaly(getBaseMetaTileEntity(), mass); - explodeMultiblock(); - return; - } - mass /= eMufflerHatches.size(); - boolean shouldExplode = false; - for (GT_MetaTileEntity_Hatch_OverflowElemental dump : eMufflerHatches) { - if (dump.addOverflowMatter(mass)) { - shouldExplode = true; - } - } - if (shouldExplode) { - explodeMultiblock(); - } - } - } - - private void cleanOutputEM_EM() { - if (outputEM == null) { - return; - } - float mass = 0; - for (EMInstanceStackMap map : outputEM) { - if (map != null) { - mass += map.getMass(); - } - } - outputEM = null; - cleanMassEM_EM(mass); - } - // endregion - - // region EXPLOSIONS - @Override public boolean explodesOnComponentBreak(ItemStack itemStack) { return false; @@ -2171,9 +1890,6 @@ public final void explodeMultiblock() { mEnergyHatches, mMaintenanceHatches, eParamHatches, - eInputHatches, - eOutputHatches, - eMufflerHatches, eEnergyMulti, eUncertainHatches, eDynamoMulti, @@ -2245,21 +1961,12 @@ public final boolean addToMachineList(IGregTechTileEntity aTileEntity, int aBase if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { return mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputElemental) { - return eInputHatches.add((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputElemental) { - return eOutputHatches.add((GT_MetaTileEntity_Hatch_OutputElemental) aMetaTileEntity); - } if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Param) { return eParamHatches.add((GT_MetaTileEntity_Hatch_Param) aMetaTileEntity); } if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Uncertainty) { return eUncertainHatches.add((GT_MetaTileEntity_Hatch_Uncertainty) aMetaTileEntity); } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OverflowElemental) { - return eMufflerHatches.add((GT_MetaTileEntity_Hatch_OverflowElemental) aMetaTileEntity); - } if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyMulti) { return eEnergyMulti.add((GT_MetaTileEntity_Hatch_EnergyMulti) aMetaTileEntity); } @@ -2345,30 +2052,7 @@ public final boolean addElementalToMachineList(IGregTechTileEntity aTileEntity, if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) { ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputElemental) { - return eInputHatches.add((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputElemental) { - return eOutputHatches.add((GT_MetaTileEntity_Hatch_OutputElemental) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OverflowElemental) { - return eMufflerHatches.add((GT_MetaTileEntity_Hatch_OverflowElemental) aMetaTileEntity); - } - return false; - } - public final boolean addClassicMufflerToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - return mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); - } return false; } @@ -2380,10 +2064,7 @@ public final boolean addElementalMufflerToMachineList(IGregTechTileEntity aTileE if (aMetaTileEntity == null) { return false; } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OverflowElemental) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - return eMufflerHatches.add((GT_MetaTileEntity_Hatch_OverflowElemental) aMetaTileEntity); - } + return false; } @@ -2400,10 +2081,7 @@ public final boolean addMufflerToMachineList(IGregTechTileEntity aTileEntity, in ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); return mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OverflowElemental) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - return eMufflerHatches.add((GT_MetaTileEntity_Hatch_OverflowElemental) aMetaTileEntity); - } + return false; } @@ -2430,11 +2108,7 @@ public final boolean addInputToMachineList(IGregTechTileEntity aTileEntity, int ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = getRecipeMap(); return mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputElemental) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - // ((GT_MetaTileEntity_Hatch_Elemental) aMetaTileEntity).mRecipeMap = getRecipeMap(); - return eInputHatches.add((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity); - } + return false; } @@ -2455,10 +2129,7 @@ public final boolean addOutputToMachineList(IGregTechTileEntity aTileEntity, int ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); return mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputElemental) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - return eOutputHatches.add((GT_MetaTileEntity_Hatch_OutputElemental) aMetaTileEntity); - } + return false; } @@ -2541,32 +2212,12 @@ public final boolean addElementalInputToMachineList(IGregTechTileEntity aTileEnt if (aMetaTileEntity == null) { return false; } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputElemental) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - // ((GT_MetaTileEntity_Hatch_Elemental) aMetaTileEntity).mRecipeMap = getRecipeMap(); - return eInputHatches.add((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity); - } - return false; - } - // NEW METHOD - public final boolean addElementalOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputElemental) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - return eOutputHatches.add((GT_MetaTileEntity_Hatch_OutputElemental) aMetaTileEntity); - } return false; } // NEW METHOD - public final boolean addClassicInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + public final boolean addElementalOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { if (aTileEntity == null) { return false; } @@ -2574,40 +2225,7 @@ public final boolean addClassicInputToMachineList(IGregTechTileEntity aTileEntit if (aMetaTileEntity == null) { return false; } - if (aMetaTileEntity instanceof IDualInputHatch) { - ((IDualInputHatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - return mDualInputHatches.add((IDualInputHatch) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = getRecipeMap(); - return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = getRecipeMap(); - return mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); - } - return false; - } - // NEW METHOD - public final boolean addClassicOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - return mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - return mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); - } return false; } @@ -2736,39 +2354,12 @@ protected static IStructureEleme HatchElement.DynamoMulti, HatchElement.InputData, HatchElement.OutputData, - HatchElement.Uncertainty, - HatchElement.InputElemental, - HatchElement.OutputElemental, - HatchElement.OverflowElemental) + HatchElement.Uncertainty) .casingIndex(casingIndex).dot(dot).buildAndChain(casingBlock, casingMeta); } public enum HatchElement implements IHatchElement { - InputElemental(GT_MetaTileEntity_MultiblockBase_EM::addElementalInputToMachineList, - GT_MetaTileEntity_Hatch_InputElemental.class) { - - @Override - public long count(GT_MetaTileEntity_MultiblockBase_EM t) { - return t.eInputHatches.size(); - } - }, - OutputElemental(GT_MetaTileEntity_MultiblockBase_EM::addElementalOutputToMachineList, - GT_MetaTileEntity_Hatch_OutputElemental.class) { - - @Override - public long count(GT_MetaTileEntity_MultiblockBase_EM t) { - return t.eOutputHatches.size(); - } - }, - OverflowElemental(GT_MetaTileEntity_MultiblockBase_EM::addElementalMufflerToMachineList, - GT_MetaTileEntity_Hatch_OverflowElemental.class) { - - @Override - public long count(GT_MetaTileEntity_MultiblockBase_EM t) { - return t.eMufflerHatches.size(); - } - }, Param(GT_MetaTileEntity_MultiblockBase_EM::addParametrizerToMachineList, GT_MetaTileEntity_Hatch_Param.class) { @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java deleted file mode 100644 index 79f87d2ea..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java +++ /dev/null @@ -1,864 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi.em_collider; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; -import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; -import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; -import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_OK; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_TOO_HIGH; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_TOO_LOW; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_WRONG; -import static com.github.technus.tectech.util.DoubleCount.add; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; -import static net.minecraft.util.StatCollector.translateToLocal; - -import java.util.HashMap; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition; -import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; -import com.github.technus.tectech.util.CommonValues; -import com.gtnewhorizon.structurelib.StructureLibAPI; -import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - - // region variables - private static Textures.BlockIcons.CustomIcon ScreenOFF; - private static Textures.BlockIcons.CustomIcon ScreenON; - private static Textures.BlockIcons.CustomIcon ScreenON_Slave; - private static Textures.BlockIcons.CustomIcon ScreenOFF_Slave; - - protected static final byte FUSE_MODE = 0, COLLIDE_MODE = 1; - private static double MASS_TO_EU_INSTANT; - private static int STARTUP_COST, KEEPUP_COST; - - protected byte eTier = 0; - protected EMInstanceStack stack; - private long plasmaEnergy; - - protected boolean started = false; - // endregion - - // region collision handlers - public static final HashMap FUSE_HANDLERS = new HashMap<>(); - public static final HashMap PRIMITIVE_FUSE_HANDLERS = new HashMap<>(); - - static { - FUSE_HANDLERS.put( - ((long) EMAtomDefinition.getClassTypeStatic() << 16) | EMAtomDefinition.getClassTypeStatic(), - new IColliderHandler() { - - @Override - public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { - try { - EMDefinitionStackMap defs = new EMDefinitionStackMap(); - defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); - defs.putUnifyAllExact(in2.getDefinition().getSubParticles()); - EMAtomDefinition atom = new EMAtomDefinition( - defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new EMInstanceStack(atom, Math.min(in1.getAmount(), in2.getAmount()))); - } catch (Exception e) { - out.putUnifyAll(in1, in2); - return; - } - if (in1.getAmount() > in2.getAmount()) { - out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); - } else if (in2.getAmount() > in1.getAmount()) { - out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); - } - } - - @Override - public byte getRequiredTier() { - return 1; - } - }); - registerSimpleAtomFuse(EMHadronDefinition.getClassTypeStatic()); - registerSimpleAtomFuse(EMComplexAspectDefinition.getClassTypeStatic()); - registerSimpleAtomFuse(EMPrimitiveTemplate.getClassTypeStatic()); - - FUSE_HANDLERS.put( - ((long) EMHadronDefinition.getClassTypeStatic() << 16) | EMHadronDefinition.getClassTypeStatic(), - new IColliderHandler() { - - @Override - public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { - try { - EMDefinitionStackMap defs = new EMDefinitionStackMap(); - defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); - defs.putUnifyAllExact(in2.getDefinition().getSubParticles()); - EMHadronDefinition hadron = new EMHadronDefinition( - defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount()))); - } catch (Exception e) { - out.putUnifyAll(in1, in2); - return; - } - if (in1.getAmount() > in2.getAmount()) { - out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); - } else if (in2.getAmount() > in1.getAmount()) { - out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); - } - } - - @Override - public byte getRequiredTier() { - return 2; - } - }); - FUSE_HANDLERS.put( - ((long) EMHadronDefinition.getClassTypeStatic() << 16) | EMPrimitiveTemplate.getClassTypeStatic(), - new IColliderHandler() { - - @Override - public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { - try { - EMDefinitionStackMap defs = new EMDefinitionStackMap(); - defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); - defs.putUnifyExact(in2.getDefinition().getStackForm(1)); - EMHadronDefinition hadron = new EMHadronDefinition( - defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount()))); - } catch (Exception e) { - out.putUnifyAll(in1, in2); - return; - } - if (in1.getAmount() > in2.getAmount()) { - out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); - } else if (in2.getAmount() > in1.getAmount()) { - out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); - } - } - - @Override - public byte getRequiredTier() { - return 2; - } - }); - - registerSimpleAspectFuse(EMComplexAspectDefinition.getClassTypeStatic()); - registerSimpleAspectFuse(EMPrimitiveTemplate.getClassTypeStatic()); - - FUSE_HANDLERS.put( - ((long) EMPrimitiveTemplate.getClassTypeStatic() << 16) | EMPrimitiveTemplate.getClassTypeStatic(), - new IColliderHandler() { - - @Override - public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { - IPrimitiveColliderHandler collisionHandler = PRIMITIVE_FUSE_HANDLERS.get( - in1.getDefinition().getClass().getName() + '\0' - + in2.getDefinition().getClass().getName()); - if (collisionHandler != null) { - collisionHandler.collide(in2, in1, out); - } else { - out.putUnifyAll(in1, in2); - } - } - - @Override - public byte getRequiredTier() { - return 2; - } - }); - - PRIMITIVE_FUSE_HANDLERS - .put(EMQuarkDefinition.class.getName() + '\0' + EMQuarkDefinition.class.getName(), (in1, in2, out) -> { - try { - EMDefinitionStackMap defs = new EMDefinitionStackMap(); - defs.putUnifyExact(in1.getDefinition().getStackForm(1)); - defs.putUnifyExact(in2.getDefinition().getStackForm(1)); - EMHadronDefinition hadron = new EMHadronDefinition( - defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount()))); - } catch (Exception e) { - out.putUnifyAll(in1, in2); - return; - } - if (in1.getAmount() > in2.getAmount()) { - out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); - } else if (in2.getAmount() > in1.getAmount()) { - out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); - } - }); - PRIMITIVE_FUSE_HANDLERS.put( - EMPrimalAspectDefinition.class.getName() + '\0' + EMPrimalAspectDefinition.class.getName(), - (in1, in2, out) -> { - if (fuseAspects(in1, in2, out)) return; - if (in1.getAmount() > in2.getAmount()) { - out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); - } else if (in2.getAmount() > in1.getAmount()) { - out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); - } - }); - } - - private static boolean fuseAspects(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { - try { - EMDefinitionStackMap defs = new EMDefinitionStackMap(); - defs.putUnifyExact(in1.getDefinition().getStackForm(1)); - defs.putUnifyExact(in2.getDefinition().getStackForm(1)); - EMComplexAspectDefinition aspect = new EMComplexAspectDefinition( - defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new EMInstanceStack(aspect, Math.min(in1.getAmount(), in2.getAmount()))); - } catch (Exception e) { - out.putUnifyAll(in1, in2); - return true; - } - return false; - } - - private static void registerSimpleAspectFuse(int classTypeStatic) { - FUSE_HANDLERS.put( - ((long) EMComplexAspectDefinition.getClassTypeStatic() << 16) | classTypeStatic, - new IColliderHandler() { - - @Override - public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { - if (fuseAspects(in1, in2, out)) return; - if (in1.getAmount() > in2.getAmount()) { - out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); - } else if (in2.getAmount() > in1.getAmount()) { - out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); - } - } - - @Override - public byte getRequiredTier() { - return 1; - } - }); - } - - private static void registerSimpleAtomFuse(int classTypeStatic) { - FUSE_HANDLERS - .put(((long) EMAtomDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() { - - @Override - public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { - try { - EMDefinitionStackMap defs = new EMDefinitionStackMap(); - defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); - defs.putUnifyExact(in2.getDefinition().getStackForm(1)); - EMAtomDefinition atom = new EMAtomDefinition( - defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new EMInstanceStack(atom, Math.min(in1.getAmount(), in2.getAmount()))); - } catch (Exception e) { - out.putUnifyAll(in1, in2); - return; - } - if (in1.getAmount() > in2.getAmount()) { - out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); - } else if (in2.getAmount() > in1.getAmount()) { - out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); - } - } - - @Override - public byte getRequiredTier() { - return 1; - } - }); - } - // endregion - - // region parameters - protected Parameters.Group.ParameterIn mode; - private static final IStatusFunction MODE_STATUS = (base_EM, p) -> { - if (base_EM.isMaster()) { - double mode = p.get(); - if (mode == FUSE_MODE || mode == COLLIDE_MODE) { - return STATUS_OK; - } else if (mode > 1) { - return STATUS_TOO_HIGH; - } else if (mode < 0) { - return STATUS_TOO_LOW; - } - return STATUS_WRONG; - } - return STATUS_OK; - }; - private static final INameFunction MODE_NAME = (base_EM, p) -> { - if (base_EM.isMaster()) { - double mode = p.get(); - if (mode == FUSE_MODE) { - return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.0"); // Mode: Fuse - } else if (mode == COLLIDE_MODE) { - return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.1"); // Mode: Collide - } - return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.2"); // Mode: Undefined - } - return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.3"); // Currently Slaves... - }; - // endregion - - // region structure - // use multi A energy inputs, use less power the longer it runs - private static final String[] description = new String[] { - EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", - translateToLocal("gt.blockmachines.multimachine.em.collider.hint.0"), // 1 - Classic Hatches or High Power - // Casing - translateToLocal("gt.blockmachines.multimachine.em.collider.hint.1"), // 2 - Elemental Input Hatches or - // Molecular Casing - translateToLocal("gt.blockmachines.multimachine.em.collider.hint.2"), // 3 - Elemental Output Hatches or - // Molecular Casing - translateToLocal("gt.blockmachines.multimachine.em.collider.hint.3"), // 4 - Elemental Overflow Hatches or - // Molecular - // Casing - translateToLocal("gt.blockmachines.multimachine.em.collider.hint.4"), // General - Another Controller facing - // opposite - // direction - }; - - private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition - .builder() - .addShape( - "tier1", - transpose( - new String[][] { { " A A A ", " AAAAAAA ", - " bbbbIIIbbbb ", " bAAAAAAAAAAAb ", " bAAAA AAAAb ", - " bAAA AAAb ", " bAAA AAAb ", " bAA AAb ", - " AbAA AAbA ", "AAbA AbAA", " AIA AIA ", - "AAIA AIAA", " AIA AIA ", "AAbA AbAA", - " AbAA AAbA ", " bAA AAb ", " bAAA AAAb ", - " bAAA AAAb ", " bAAAAbJJJbAAAAb ", " bAHHbbbbbHHAb ", - " bbbbGFGbbbb " }, - { " AAAAA ", " AADDDDDAA ", " cDDeeeeeDDc ", - " cDeeDDDDDeeDc ", " cDeDD DDeDc ", - " cDeD DeDc ", " cDeD DeDc ", - " ADeD DeDA ", " ADeD DeDA ", - "ADeD DeDA", "ADeD DeDA", - "ADeD DeDA", "ADeD DeDA", - "ADeD DeDA", " ADeD DeDA ", - " ADeD DeDA ", " cDeD DeDc ", - " cDeD DeDc ", " cDeDDbJ~JbDDeDc ", - " cDeeDDDDDeeDc ", " cDDeeeeeDDc " }, - { " A A A ", " AAAAAAA ", " bbbbIIIbbbb ", - " bAAAAAAAAAAAb ", " bAAAA AAAAb ", - " bAAA AAAb ", " bAAA AAAb ", - " bAA AAb ", " AbAA AAbA ", - "AAbA AbAA", " AIA AIA ", - "AAIA AIAA", " AIA AIA ", - "AAbA AbAA", " AbAA AAbA ", - " bAA AAb ", " bAAA AAAb ", - " bAAA AAAb ", " bAAAAbJJJbAAAAb ", - " bAHHbbbbbHHAb ", " bbbbGFGbbbb " } })) - .addShape( - "tier2", - transpose( - new String[][] { { " A A A ", " AAAAAAA ", - " BBBBIIIBBBB ", " BAAAAAAAAAAAB ", " BAAAA AAAAB ", - " BAAA AAAB ", " BAAA AAAB ", " BAA AAB ", - " ABAA AABA ", "AABA ABAA", " AIA AIA ", - "AAIA AIAA", " AIA AIA ", "AABA ABAA", - " ABAA AABA ", " BAA AAB ", " BAAA AAAB ", - " BAAA AAAB ", " BAAAABJJJBAAAAB ", " BAHHBBBBBHHAB ", - " BBBBGFGBBBB " }, - { " AAAAA ", " AADDDDDAA ", " CDDEEEEEDDC ", - " CDEEDDDDDEEDC ", " CDEDD DDEDC ", - " CDED DEDC ", " CDED DEDC ", - " ADED DEDA ", " ADED DEDA ", - "ADED DEDA", "ADED DEDA", - "ADED DEDA", "ADED DEDA", - "ADED DEDA", " ADED DEDA ", - " ADED DEDA ", " CDED DEDC ", - " CDED DEDC ", " CDEDDBJ~JBDDEDC ", - " CDEEDDDDDEEDC ", " CDDEEEEEDDC " }, - { " A A A ", " AAAAAAA ", " BBBBIIIBBBB ", - " BAAAAAAAAAAAB ", " BAAAA AAAAB ", - " BAAA AAAB ", " BAAA AAAB ", - " BAA AAB ", " ABAA AABA ", - "AABA ABAA", " AIA AIA ", - "AAIA AIAA", " AIA AIA ", - "AABA ABAA", " ABAA AABA ", - " BAA AAB ", " BAAA AAAB ", - " BAAA AAAB ", " BAAAABJJJBAAAAB ", - " BAHHBBBBBHHAB ", " BBBBGFGBBBB " } })) - .addElement('A', ofBlock(sBlockCasingsTT, 4)).addElement('b', ofBlock(sBlockCasingsTT, 4)) - .addElement('B', ofBlock(sBlockCasingsTT, 5)).addElement('c', ofBlock(sBlockCasingsTT, 4)) - .addElement('C', ofBlock(sBlockCasingsTT, 6)).addElement('D', ofBlock(sBlockCasingsTT, 7)) - .addElement('e', ofBlock(sBlockCasingsTT, 8)).addElement('E', ofBlock(sBlockCasingsTT, 9)) - .addElement('I', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement( - 'J', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_collider::addClassicToMachineList, - textureOffset, - 1, - sBlockCasingsTT, - 0)) - .addElement( - 'H', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_collider::addElementalInputToMachineList, - textureOffset + 4, - 2, - sBlockCasingsTT, - 4)) - .addElement( - 'F', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_collider::addElementalOutputToMachineList, - textureOffset + 4, - 3, - sBlockCasingsTT, - 4)) - .addElement( - 'G', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_collider::addElementalMufflerToMachineList, - textureOffset + 4, - 4, - sBlockCasingsTT, - 4)) - .build(); - - @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; - } - - // endregion - - public GT_MetaTileEntity_EM_collider(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_collider(String aName) { - super(aName); - } - - public static void setValues(int heliumPlasmaValue) { - double MASS_TO_EU_PARTIAL = heliumPlasmaValue / (1.75893000478707E07 * EM_COUNT_PER_MATERIAL_AMOUNT); // mass - // diff - MASS_TO_EU_INSTANT = MASS_TO_EU_PARTIAL * 20; - STARTUP_COST = -heliumPlasmaValue * 10000; - KEEPUP_COST = -heliumPlasmaValue; - } - - protected double fuse(GT_MetaTileEntity_EM_collider partner) { // /CAN MAKE EU - if (partner.stack != null && stack != null) { // todo add single event mode as an option - boolean check = stack.getDefinition().fusionMakesEnergy(stack.getEnergy()) - && partner.stack.getDefinition().fusionMakesEnergy(partner.stack.getEnergy()); - - EMInstanceStack stack2 = partner.stack; - double preMass = add(stack2.getMass(), stack.getMass()); - // System.out.println("preMass = " + preMass); - - EMInstanceStackMap map = new EMInstanceStackMap(); - IColliderHandler colliderHandler; - if (stack2.getDefinition().getMatterMassType() > stack.getDefinition().getMatterMassType()) { // always - // bigger - // first - colliderHandler = FUSE_HANDLERS.get( - (long) (stack2.getDefinition().getMatterMassType() << 16) - | stack.getDefinition().getMatterMassType()); - if (handleRecipe(stack2, map, colliderHandler)) return 0; - } else { - colliderHandler = FUSE_HANDLERS.get( - (long) (stack.getDefinition().getMatterMassType() << 16) - | stack2.getDefinition().getMatterMassType()); - if (handleRecipe(stack2, map, colliderHandler)) return 0; - } - for (EMInstanceStack newStack : map.valuesToArray()) { - check &= newStack.getDefinition().fusionMakesEnergy(newStack.getEnergy()); - } - // System.out.println("outputEM[0].getMass() = " + outputEM[0].getMass()); - outputEM = new EMInstanceStackMap[] { map }; - - partner.stack = stack = null; - - return check ? preMass - map.getMass() : Math.min(preMass - map.getMass(), 0); - } - return 0; - } - - protected double collide(GT_MetaTileEntity_EM_collider partner) { // DOES NOT MAKE EU! - if (partner.stack != null && stack != null) { // todo add single event mode as an option - EMInstanceStack stack2 = partner.stack; - double preMass = stack2.getMass() + stack.getMass(); - // System.out.println("preMass = " + preMass); - - EMInstanceStackMap map = new EMInstanceStackMap(); - IColliderHandler colliderHandler; - if (stack2.getDefinition().getMatterMassType() > stack.getDefinition().getMatterMassType()) { // always - // bigger - // first - colliderHandler = FUSE_HANDLERS.get( - (long) (stack2.getDefinition().getMatterMassType() << 16) - | stack.getDefinition().getMatterMassType()); - if (handleRecipe(stack2, map, colliderHandler)) return 0; - } else { - colliderHandler = FUSE_HANDLERS.get( - (long) (stack.getDefinition().getMatterMassType() << 16) - | stack2.getDefinition().getMatterMassType()); - if (handleRecipe(stack2, map, colliderHandler)) return 0; - } - outputEM = new EMInstanceStackMap[] { map }; - - partner.stack = stack = null; - - return Math.min(preMass - map.getMass(), 0); - } - return 0; - } - - private boolean handleRecipe(EMInstanceStack stack2, EMInstanceStackMap map, IColliderHandler colliderHandler) { - if (colliderHandler != null && eTier >= colliderHandler.getRequiredTier()) { - colliderHandler.collide(stack2, stack, map); - } else { - map.putUnifyAll(stack, stack2); - outputEM = new EMInstanceStackMap[] { map }; - return true; - } - return false; - } - - protected GT_MetaTileEntity_EM_collider getPartner() { - IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); - int xDir = iGregTechTileEntity.getBackFacing().offsetX * 4; - int yDir = iGregTechTileEntity.getBackFacing().offsetY * 4; - int zDir = iGregTechTileEntity.getBackFacing().offsetZ * 4; - IGregTechTileEntity gregTechBaseTileEntity = iGregTechTileEntity.getIGregTechTileEntityOffset(xDir, yDir, zDir); - if (gregTechBaseTileEntity != null) { - IMetaTileEntity gregTechMetaTileEntity = gregTechBaseTileEntity.getMetaTileEntity(); - return gregTechMetaTileEntity instanceof GT_MetaTileEntity_EM_collider - && ((GT_MetaTileEntity_EM_collider) gregTechMetaTileEntity).mMachine - && gregTechBaseTileEntity.getBackFacing() == iGregTechTileEntity.getFrontFacing() - ? (GT_MetaTileEntity_EM_collider) gregTechMetaTileEntity - : null; - } - return null; - } - - protected final boolean isMaster() { - return getBaseMetaTileEntity().getFrontFacing().ordinal() % 2 == 0; - } - - private void makeEU(double massDiff) { - plasmaEnergy += massDiff * MASS_TO_EU_INSTANT; - if (DEBUG_MODE) { - System.out.println("plasmaEnergy = " + plasmaEnergy); - } - } - - private EMInstanceStackMap tickStack() { - if (stack == null) { - return null; - } - stack.setAge(stack.getAge() + 1); - EMDecayResult newInstances = stack.decay(1, stack.getAge(), 0); - if (newInstances == null) { - stack.nextColor(); - return null; - } else { - stack = newInstances.getOutput().removeKey(newInstances.getOutput().getLast().getDefinition()); - return newInstances.getOutput(); - } - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_collider(mName); - } - - @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - int xDir = iGregTechTileEntity.getBackFacing().offsetX * 2; - int zDir = iGregTechTileEntity.getBackFacing().offsetZ * 2; - if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir) != sBlockCasingsTT) { - eTier = 0; - return false; - } - - if (iGregTechTileEntity.getMetaIDOffset(xDir, 0, zDir) == 8) { - eTier = 1; - } else if (iGregTechTileEntity.getMetaIDOffset(xDir, 0, zDir) == 9) { - eTier = 2; - } else { - eTier = 0; - return false; - } - if (structureCheck_EM("tier" + eTier, 11, 1, 18)) { - return true; - } - eTier = 0; - return false; - } - - @Override - public boolean checkRecipe_EM(ItemStack itemStack) { - GT_MetaTileEntity_EM_collider partner = getPartner(); - if (partner == null) { - return false; - } - mEfficiencyIncrease = 10000; - if (started) { - if (stack == null) { - for (GT_MetaTileEntity_Hatch_InputElemental inputElemental : eInputHatches) { - EMInstanceStackMap container = inputElemental.getContentHandler(); - if (container.isEmpty()) { - continue; - } - stack = container.removeKey(container.getFirst().getDefinition()); - long eut = KEEPUP_COST + (long) (KEEPUP_COST - * Math.abs(stack.getMass() / EMAtomDefinition.getSomethingHeavy().getMass())) / 2; - if (eut < Integer.MIN_VALUE + 7) { - return false; - } - mMaxProgresstime = 20; - mEUt = (int) eut; - eAmpereFlow = 5; - return true; - } - mMaxProgresstime = 20; - mEUt = KEEPUP_COST; - eAmpereFlow = 1; - return true; - } - mMaxProgresstime = 20; - mEUt = KEEPUP_COST; - eAmpereFlow = 2; - } else { - started = true; - mMaxProgresstime = 20; - mEUt = STARTUP_COST; - eAmpereFlow = 10; - } - return true; - } - - @Override - public void outputAfterRecipe_EM() { - GT_MetaTileEntity_EM_collider partner = getPartner(); - if (partner == null) { - if (stack != null) { - cleanMassEM_EM(stack.getMass()); - stack = null; - } - return; - } - if (isMaster()) { - switch ((int) mode.get()) { - case FUSE_MODE: - makeEU(fuse(partner)); - break; - case COLLIDE_MODE: - collide(partner); // todo - break; - default: { - outputEM = new EMInstanceStackMap[2]; - outputEM[1] = tickStack(); - if (outputEM[1] == null) { - outputEM[1] = partner.tickStack(); - } else { - EMInstanceStackMap map = partner.tickStack(); - if (map != null) { - outputEM[1].putUnifyAll(map); - } - } - } - } - if (outputEM != null) { - for (int i = 0, lim = Math.min(outputEM.length, eOutputHatches.size()); i < lim; i++) { - if (outputEM[i] != null) { - eOutputHatches.get(i).getContentHandler().putUnifyAll(outputEM[i]); - outputEM[i] = null; - } - } - } - } - } - - @Override - public GT_Multiblock_Tooltip_Builder createTooltip() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(translateToLocal("gt.blockmachines.multimachine.em.collider.name")) // Machine Type: Matter - // Collider - .addInfo(translateToLocal("gt.blockmachines.multimachine.em.collider.desc.0")) // Controller block of - // the Matter Collider - .addInfo(translateToLocal("gt.blockmachines.multimachine.em.collider.desc.1")) // This machine needs a - // mirrored - // copy of it to work - .addInfo(translateToLocal("gt.blockmachines.multimachine.em.collider.desc.2")) // One needs to be set to - // 'Fuse - // Mode' and the other to 'Collide - // Mode' - .addInfo(translateToLocal("gt.blockmachines.multimachine.em.collider.desc.3")) // Fuses two elemental - // matter to - // create another (and power) - .addInfo(translateToLocal("tt.keyword.Structure.StructureTooComplex")) // The structure is too complex! - .addSeparator().beginStructureBlock(21, 3, 23, false) - .addOtherStructurePart( - translateToLocal("gt.blockmachines.multimachine.em.collider.name"), - translateToLocal("gt.blockmachines.multimachine.em.collider.Structure.AdditionalCollider"), - 2) // Matter Collider: Needs another Matter Collider that is mirrored to this one - .addOtherStructurePart( - translateToLocal("tt.keyword.Structure.ElementalInput"), - translateToLocal("tt.keyword.Structure.AnyMolecularCasing2D"), - 2) // Elemental Input Hatch: Any Molecular Casing with 2 dots - .addOtherStructurePart( - translateToLocal("tt.keyword.Structure.ElementalOutput"), - translateToLocal("tt.keyword.Structure.AnyMolecularCasing3D"), - 2) // Elemental Output Hatch: Any Molecular Casing with 3 dots - .addOtherStructurePart( - translateToLocal("tt.keyword.Structure.ElementalOverflow"), - translateToLocal("tt.keyword.Structure.AnyMolecularCasing4D"), - 2) // Elemental Overflow Hatch: Any Molecular Casing with 4 dots - .addEnergyHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasing"), 1) // Energy Hatch: Any - // High Power Casing - .addMaintenanceHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasing"), 1) // Maintenance - // Hatch: Any High - // Power Casing - .toolTipFinisher(CommonValues.TEC_MARK_EM); - return tt; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aBlockIconRegister) { - ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER"); - ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_ACTIVE"); - ScreenOFF_Slave = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_SLAVE"); - ScreenON_Slave = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_ACTIVE_SLAVE"); - super.registerIcons(aBlockIconRegister); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, - int colorIndex, boolean aActive, boolean aRedstone) { - if (side == facing) { - if (facing.ordinal() % 2 == 0) { - return new ITexture[] { Textures.BlockIcons.casingTexturePages[texturePage][4], - new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF) }; - } else { - return new ITexture[] { Textures.BlockIcons.casingTexturePages[texturePage][4], - new TT_RenderedExtendedFacingTexture(aActive ? ScreenON_Slave : ScreenOFF_Slave) }; - } - } - return new ITexture[] { Textures.BlockIcons.casingTexturePages[texturePage][4] }; - } - - @Override - protected void parametersInstantiation_EM() { - Parameters.Group hatch_0 = parametrization.getGroup(0); - mode = hatch_0.makeInParameter(0, FUSE_MODE, MODE_NAME, MODE_STATUS); - } - - @Override - public void parametersStatusesWrite_EM(boolean machineBusy) { - if (isMaster()) { - super.parametersStatusesWrite_EM(machineBusy); - } - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setByte("eTier", eTier); // collider tier - aNBT.setBoolean("eStarted", started); - if (stack != null) { - aNBT.setTag("eStack", stack.toNBT(TecTech.definitionsRegistry)); - } - aNBT.setLong("ePlasmaEnergy", plasmaEnergy); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - eTier = aNBT.getByte("eTier"); // collider tier - started = aNBT.getBoolean("eStarted"); - if (aNBT.hasKey("eStack")) { - stack = EMInstanceStack.fromNBT(TecTech.definitionsRegistry, aNBT.getCompoundTag("eStack")); - } - plasmaEnergy = aNBT.getLong("ePlasmaEnergy"); - } - - @Override - public void stopMachine() { - started = false; - if (stack != null) { - cleanMassEM_EM(stack.getMass()); - stack = null; - } - super.stopMachine(); - } - - @Override - protected void afterRecipeCheckFailed() { - started = false; - if (stack != null) { - cleanMassEM_EM(stack.getMass()); - stack = null; - } - getBaseMetaTileEntity().disableWorking(); - super.afterRecipeCheckFailed(); - } - - @Override - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (!aBaseMetaTileEntity.isAllowedToWork()) { - started = false; - } - super.onPreTick(aBaseMetaTileEntity, aTick); - } - - @Override - public void construct(ItemStack trigger, boolean hintsOnly) { - IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); - int xDir = iGregTechTileEntity.getBackFacing().offsetX * 4; - int yDir = iGregTechTileEntity.getBackFacing().offsetY * 4; - int zDir = iGregTechTileEntity.getBackFacing().offsetZ * 4; - if (hintsOnly) { - StructureLibAPI.hintParticle( - iGregTechTileEntity.getWorld(), - iGregTechTileEntity.getXCoord() + xDir, - iGregTechTileEntity.getYCoord() + yDir, - iGregTechTileEntity.getZCoord() + zDir, - StructureLibAPI.getBlockHint(), - 12); - } - structureBuild_EM("tier" + (((trigger.stackSize - 1) % 2) + 1), 11, 1, 18, trigger, hintsOnly); - } - - @Override - public String[] getStructureDescription(ItemStack stackSize) { - return description; - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IColliderHandler.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IColliderHandler.java deleted file mode 100644 index 84af177ac..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IColliderHandler.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi.em_collider; - -public interface IColliderHandler extends IPrimitiveColliderHandler { - - byte getRequiredTier(); -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IPrimitiveColliderHandler.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IPrimitiveColliderHandler.java deleted file mode 100644 index 718e08787..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IPrimitiveColliderHandler.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi.em_collider; - -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; - -public interface IPrimitiveColliderHandler { - - void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out); -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java deleted file mode 100644 index d0855a73e..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java +++ /dev/null @@ -1,228 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_OK; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_TOO_HIGH; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_TOO_LOW; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_WRONG; -import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.DoubleCount.div; -import static com.github.technus.tectech.util.DoubleCount.mul; -import static com.github.technus.tectech.util.DoubleCount.sub; - -import java.util.Arrays; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; - -/** - * Created by danie_000 on 24.12.2017. - */ -public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehaviour { - - private final byte tier; - private double maxRPM; - private final double radius; - private final double maxRCF; - private final double maxForce; - private final double maxCapacity; - private Parameters.Group.ParameterIn settingRPM, settingFraction; - private static final INameFunction rpmName = (gt_metaTileEntity_em_machine, - iParameter) -> "RPM Setting"; - private final IStatusFunction rpmStatus = (gt_metaTileEntity_em_machine, - iParameter) -> { - double v = iParameter.get(); - if (Double.isNaN(v)) { - return STATUS_WRONG; - } - if (v <= 0) { - return STATUS_TOO_LOW; - } else if (v > maxRPM) { - return STATUS_TOO_HIGH; - } - return STATUS_OK; - }; - private static final INameFunction fractionName = (gt_metaTileEntity_em_machine, - iParameter) -> "Fraction Count"; - private static final IStatusFunction fractionStatus = (gt_metaTileEntity_em_machine, - iParameter) -> { - double v = iParameter.get(); - if (Double.isNaN(v)) { - return STATUS_WRONG; - } - v = (int) v; - if (v <= 1) { - return STATUS_TOO_LOW; - } else if (v > 6) { - return STATUS_TOO_HIGH; - } - return STATUS_OK; - }; - // private final static String[] DESCRIPTION_O =new String[]{"RPM Setting","RCF Setting","Radius [mm]","Max - // RPM","Max Force [eV/c^2 * m/s]","Max Capacity [eV/c^2]","Max Power Usage[EU/t]","Max Recipe Rime [tick]"}; - - private static final double[ /* tier+5 */][ /* outputHatches+2 */] MIXING_FACTORS = new double[][] { - { .45, .85, .95, 1, 1, }, { .4, .75, .9, .95, 1, }, { .35, .45, .75, .9, .95, }, { .25, .3, .45, .75, .9, }, - { .2, .25, .3, .45, .75, }, { .1, .15, .2, .3, .45, }, { .05, .1, .15, .2, .25, }, - { .01, .05, .1, .15, .2, }, }; - - // 6 to 12 recommended - public Behaviour_Centrifuge(int desiredTier) { - tier = (byte) desiredTier; - radius = 0.5D - (12D - tier) / 64D; - maxRCF = Math.pow(Math.E, tier) * 12D; - maxRPM = Math.sqrt(maxRCF / (0.001118D * radius)); - double maxSafeMass = EMAtomDefinition.getSomethingHeavy().getMass() * (1 << tier); - maxForce = maxSafeMass * maxRCF; // (eV/c^2 * m/s) / g - maxCapacity = maxSafeMass * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED * radius; // eV/c^2 - } - - private double getRCF(double RPM) { - return RPM * RPM * radius * 0.001118; - } - - private void addRandomly(EMInstanceStack me, EMInstanceStackMap[] toThis, int fractionCount) { - double amountPerFraction = div(me.getAmount(), fractionCount); - EMInstanceStack[] stacks = new EMInstanceStack[fractionCount]; - for (int i = 0; i < fractionCount; i++) { - stacks[i] = me.clone(); - stacks[i].setAmount(amountPerFraction); - toThis[i].putReplace(stacks[i]); - } - } - - @Override - public void parametersInstantiation(GT_MetaTileEntity_EM_machine te, Parameters parameters) { - Parameters.Group hatch1 = parameters.getGroup(7); - settingRPM = hatch1.makeInParameter(0, 0, rpmName, rpmStatus); - settingFraction = hatch1.makeInParameter(1, 2, fractionName, fractionStatus); - } - - @Override - public boolean checkParametersInAndSetStatuses(GT_MetaTileEntity_EM_machine te, Parameters parameters) { - return settingRPM.getStatus(true).isOk && settingFraction.getStatus(true).isOk; - } - - @Override - public MultiblockControl process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, - Parameters parameters) { - EMInstanceStackMap input = inputs[0]; - if (input == null || input.isEmpty()) return null; // nothing in only valid input - - EMInstanceStack[] stacks = input.valuesToArray(); - - double inputMass = 0; - for (EMInstanceStack stack : stacks) { - inputMass += Math.abs(stack.getMass()); - } - double excessMass = 0; - while (inputMass > maxCapacity) { - EMInstanceStack randomStack = stacks[TecTech.RANDOM.nextInt(stacks.length)]; - double amountToRemove = TecTech.RANDOM.nextDouble() / 10D * randomStack.getAmount(); - randomStack.setAmount(sub(randomStack.getAmount(), amountToRemove)); // mutates the parent InstanceStackMap - if (randomStack.isInvalidAmount()) { - input.removeKey(randomStack.getDefinition()); - stacks = input.valuesToArray(); - } - double mass = Math.abs(randomStack.getDefinition().getMass()) * amountToRemove; - excessMass += mass; - inputMass -= mass; - } - - inputMass = Math.abs(input.getMass()); - - double RCF = getRCF(settingRPM.get()); - if (inputMass * RCF > maxForce) return new MultiblockControl<>(excessMass); // AND THEN IT EXPLODES - - // how many output hatches to use - int fractionCount = (int) settingFraction.get(); - EMInstanceStackMap[] outputs = new EMInstanceStackMap[fractionCount]; - for (int i = 0; i < fractionCount; i++) { - outputs[i] = new EMInstanceStackMap(); - } - - // mixing factor... - double mixingFactor = Math.min(1d - (RCF / maxRCF) * (1d - MIXING_FACTORS[tier - 5][fractionCount - 2]), 1); - if (DEBUG_MODE) { - TecTech.LOGGER.info("mixingFactor " + mixingFactor); - } - - int mEut = (int) (Math.pow(settingRPM.get() / maxRPM, 3D) * V[tier]); - mEut = Math.max(mEut, 512); - mEut = -mEut; - int mTicks = (int) (20 * (inputMass / maxCapacity) * (fractionCount - 1)); - mTicks = Math.max(mTicks, 20); - - // take all from hatch handler and put into new map - this takes from hatch to inner data storage - stacks = input.takeAll().valuesToArray(); // cleanup stacks - if (stacks.length > 1) { - Arrays.sort(stacks, (o1, o2) -> { - double m1 = o1.getDefinition().getMass(); - double m2 = o2.getDefinition().getMass(); - if (m1 < m2) return -1; - if (m1 > m2) return 1; - return o1.compareTo(o2); - }); - - double absMassPerOutput = 0; // "volume" - for (EMInstanceStack stack : stacks) { - double tempMass = Math.abs(stack.getMass()); - if (tempMass != 0) { - double amount = stack.getAmount(); - stack.setAmount(mul(stack.getAmount(), mixingFactor)); - addRandomly(stack, outputs, fractionCount); - stack.setAmount(sub(amount, stack.getAmount())); - absMassPerOutput += tempMass; - } - } - absMassPerOutput = div(absMassPerOutput, fractionCount); - if (DEBUG_MODE) { - TecTech.LOGGER.info("absMassPerOutput " + absMassPerOutput); - } - - nextFraction: for (int fraction = 0; fraction < fractionCount - 1; fraction++) { - double remaining = absMassPerOutput; - for (int stackNo = 0; stackNo < stacks.length; stackNo++) { - if (stacks[stackNo] != null) { - double stackMass = Math.abs(stacks[stackNo].getMass()); - double amount = div(remaining, Math.abs(stacks[stackNo].getDefinition().getMass())); - - if (stackMass == 0) { - addRandomly(stacks[stackNo], outputs, fractionCount); - stacks[stackNo] = null; - } else if (amount >= stacks[stackNo].getAmount()) { - remaining = sub(remaining, stackMass); - outputs[fraction].putUnify(stacks[stackNo]); - stacks[stackNo] = null; - } else if (amount > 0) { - remaining = sub(remaining, mul(amount, stacks[stackNo].getDefinition().getMass())); - EMInstanceStack clone = stacks[stackNo].clone(); - clone.setAmount(amount); - outputs[fraction].putUnify(clone); - stacks[stackNo].setAmount(sub(stacks[stackNo].getAmount(), amount)); - - } else { - continue nextFraction; - } - } - } - } - // add remaining - for (EMInstanceStack stack : stacks) { - if (stack != null) { - outputs[fractionCount - 1].putUnify(stack); - } - } - } else { - addRandomly(stacks[0], outputs, fractionCount); - } - return new MultiblockControl<>(outputs, mEut, 1, 0, 10000, mTicks, 0, excessMass); - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java deleted file mode 100644 index b28e50eec..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; - -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; - -/** - * Created by danie_000 on 24.12.2017. - */ -public class Behaviour_Electrolyzer implements GT_MetaTileEntity_EM_machine.IBehaviour { - - final int tier; - - public Behaviour_Electrolyzer(int tier) { - this.tier = tier; - } - - @Override - public void parametersInstantiation(GT_MetaTileEntity_EM_machine te, Parameters parameters) {} - - @Override - public boolean checkParametersInAndSetStatuses(GT_MetaTileEntity_EM_machine te, Parameters parameters) { - return false; - } - - @Override - public MultiblockControl process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, - Parameters parameters) { - return null; - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java deleted file mode 100644 index 5a17bfbf3..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java +++ /dev/null @@ -1,243 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_HIGH; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_LOW; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_OK; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_TOO_HIGH; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_TOO_LOW; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_WRONG; -import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.DoubleCount.mul; -import static com.github.technus.tectech.util.DoubleCount.sub; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; - -/** - * Created by danie_000 on 24.12.2017. - */ -public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_machine.IBehaviour { - - private final byte tier; - private int ticks; - private byte precisionFull, precisionMinimal; - private double maxCapacity; - private double maxCharge; - private int offsetMax; - private Parameters.Group.ParameterIn fullSetting, minimalSetting, offsetSetting; - private static final INameFunction fullName = (gt_metaTileEntity_em_machine, - iParameter) -> "Full Precision Input [e/3]"; - private final IStatusFunction fullStatus = (gt_metaTileEntity_em_machine, - iParameter) -> { - double v = iParameter.get(); - if (Double.isNaN(v)) { - return STATUS_WRONG; - } - v = (int) v; - if (Double.isInfinite(v) && v > 0) { - return STATUS_TOO_HIGH; - } else if (v > precisionFull) { - return STATUS_HIGH; - } else if (v < precisionFull) { - return STATUS_TOO_LOW; - } - return STATUS_OK; - }; - private static final INameFunction minimalName = (gt_metaTileEntity_em_machine, - iParameter) -> "Minimal Precision Input [e/3]"; - private final IStatusFunction minimalStatus = (gt_metaTileEntity_em_machine, - iParameter) -> { - double minimal = iParameter.get(); - double full = fullSetting.get(); - if (Double.isInfinite(minimal) && minimal > 0) { - return STATUS_TOO_HIGH; - } else if (minimal > precisionMinimal) { - if (minimal > full) { - return STATUS_TOO_HIGH; - } else { - return STATUS_HIGH; - } - } else if (minimal == precisionMinimal) { - if (minimal > full) { - return STATUS_TOO_HIGH; - } else { - return STATUS_OK; - } - } else if (minimal < precisionMinimal) { - return STATUS_TOO_LOW; - } else { - return STATUS_WRONG; - } - }; - private static final INameFunction offsetName = (gt_metaTileEntity_em_machine, - iParameter) -> "Offset Input [e/3]"; - private final IStatusFunction offsetStatus = (gt_metaTileEntity_em_machine, - iParameter) -> { - double offset = iParameter.get(); - if (offset > offsetMax) { - return STATUS_TOO_HIGH; - } else if (offset > 0) { - return STATUS_HIGH; - } else if (offset == 0) { - return STATUS_OK; - } else if (offset >= -offsetMax) { - return STATUS_LOW; - } else if (offset < -offsetMax) { - return STATUS_TOO_LOW; - } else { - return STATUS_WRONG; - } - }; - // private final static String[] DESCRIPTION_O =new String[]{"Full Precision Limit [e/3]","Minimal Precision Limit - // [e/3]","Offset Limit [e/3]",null,"Max Charge [e/3]","Max Capacity [eV/c^2]","Max Power Usage[EU/t]","Max Recipe - // Rime [tick]"}; - - public Behaviour_ElectromagneticSeparator(int desiredTier) { - tier = (byte) desiredTier; - ticks = Math.max(20, (1 << (12 - desiredTier)) * 20); - maxCapacity = EMAtomDefinition.getSomethingHeavy().getMass() * (2 << tier) - * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; - maxCharge = 144D * (1 << (tier - 5)); - switch (tier) { - case 12: - precisionFull = 1; - precisionMinimal = 1; - break; - case 11: - precisionFull = 2; - precisionMinimal = 1; - break; - case 10: - precisionFull = 3; - precisionMinimal = 1; - break; - case 9: - precisionFull = 3; - precisionMinimal = 2; - break; - case 8: - precisionFull = 3; - precisionMinimal = 3; - break; - case 7: - precisionFull = 6; - precisionMinimal = 3; - break; - case 6: - precisionFull = 12; - precisionMinimal = 3; - break; - case 5: - precisionFull = 24; - precisionMinimal = 6; - break; - default: - precisionFull = precisionMinimal = Byte.MAX_VALUE; - } - offsetMax = 1 << ((tier - 8) << 1); - } - - @Override - public void parametersInstantiation(GT_MetaTileEntity_EM_machine te, Parameters parameters) { - Parameters.Group hatch1 = parameters.getGroup(7); - fullSetting = hatch1.makeInParameter(0, 0, fullName, fullStatus); - minimalSetting = hatch1.makeInParameter(1, 2, minimalName, minimalStatus); - Parameters.Group hatch2 = parameters.getGroup(8); - offsetSetting = hatch2.makeInParameter(0, 0, offsetName, offsetStatus); - } - - @Override - public boolean checkParametersInAndSetStatuses(GT_MetaTileEntity_EM_machine te, Parameters parameters) { - return fullSetting.getStatus(true).isOk && minimalSetting.getStatus(true).isOk - && offsetSetting.getStatus(true).isOk; - } - - @Override - public MultiblockControl process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, - Parameters parameters) { - EMInstanceStackMap input = inputs[0]; - if (input == null || input.isEmpty()) return null; // nothing in only valid input - - EMInstanceStack[] stacks = input.valuesToArray(); - - double inputMass = 0; - for (EMInstanceStack stack : stacks) { - inputMass += Math.abs(stack.getMass()); - } - float excessMass = 0; - while (inputMass > maxCapacity) { - EMInstanceStack randomStack = stacks[TecTech.RANDOM.nextInt(stacks.length)]; - double amountToRemove = TecTech.RANDOM.nextDouble() / 10D * randomStack.getAmount(); - randomStack.setAmount(sub(randomStack.getAmount(), amountToRemove)); // mutates the parent InstanceStackMap - if (randomStack.isInvalidAmount()) { - input.removeKey(randomStack.getDefinition()); - } - double mass = Math.abs(randomStack.getDefinition().getMass()) * amountToRemove; - excessMass += mass; - inputMass -= mass; - } - - double totalCharge = Math.abs(input.getCharge()); - if (totalCharge > maxCharge) return new MultiblockControl<>(excessMass); // AND THEN IT EXPLODES - - int mEut = (int) ((totalCharge / maxCharge) * V[tier]); - mEut = Math.max(mEut, 512); - int mTicks = (int) (ticks * (inputMass / maxCapacity)); - mTicks = Math.max(mTicks, 20); - - EMInstanceStackMap[] outputs = new EMInstanceStackMap[3]; - for (int i = 0; i < 3; i++) { - outputs[i] = new EMInstanceStackMap(); - } - - double offsetIn = offsetSetting.get(); - double precisionFullIn = fullSetting.get(); - double precisionMinimalIn = minimalSetting.get(); - double levelsCountPlus1 = precisionFullIn - precisionMinimalIn + 1; - - // take all from hatch handler and put into new map - this takes from hatch to inner data storage - stacks = input.takeAll().valuesToArray(); // cleanup stacks - for (EMInstanceStack stack : stacks) { - double charge = stack.getDefinition().getCharge() - offsetIn; - if (charge < precisionMinimalIn && charge > -precisionMinimalIn) { - outputs[1].putReplace(stack); - } else if (charge >= precisionFullIn) { - outputs[2].putReplace(stack); - } else if (charge <= -precisionFullIn) { - outputs[0].putReplace(stack); - } else { - double amount = mul(stack.getAmount(), (Math.abs(charge) - precisionMinimalIn + 1D) / levelsCountPlus1); // todo - // check - if (amount < stack.getAmount()) { - EMInstanceStack clone = stack.clone(); - clone.setAmount(sub(clone.getAmount(), amount)); - outputs[1].putReplace(clone); - - stack.setAmount(amount); - } - if (charge > 0) { - outputs[2].putReplace(stack); - } else { - outputs[0].putReplace(stack); - } - } - } - - return new MultiblockControl<>( - outputs, - mEut, - 1 + ((int) Math.abs(offsetIn)) / 3, - 0, - 10000, - mTicks, - 0, - excessMass); - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java deleted file mode 100644 index d8c82c576..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; - -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; - -/** - * Created by danie_000 on 24.12.2017. - */ -public class Behaviour_PrecisionLaser implements GT_MetaTileEntity_EM_machine.IBehaviour { - - final int tier; - - public Behaviour_PrecisionLaser(int tier) { - this.tier = tier; - } - - @Override - public void parametersInstantiation(GT_MetaTileEntity_EM_machine te, Parameters parameters) {} - - @Override - public boolean checkParametersInAndSetStatuses(GT_MetaTileEntity_EM_machine te, Parameters parameters) { - return false; - } - - @Override - public MultiblockControl process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, - Parameters parameters) { - return null; - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java deleted file mode 100644 index 644ee52ec..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; - -import static com.github.technus.tectech.util.CommonValues.V; - -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; - -/** - * Created by danie_000 on 24.12.2017. - */ -public class Behaviour_Recycler implements GT_MetaTileEntity_EM_machine.IBehaviour { - - private final int tier; - private final double coeff; - - public Behaviour_Recycler(int tier) { - this.tier = tier; - coeff = (1D / Math.pow(2D, tier - 4)); - } - - @Override - public void parametersInstantiation(GT_MetaTileEntity_EM_machine te, Parameters parameters) {} - - @Override - public boolean checkParametersInAndSetStatuses(GT_MetaTileEntity_EM_machine te, Parameters parameters) { - return true; - } - - @Override - public MultiblockControl process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, - Parameters parameters) { - double mass = 0; - for (EMInstanceStackMap input : inputs) { - if (input != null) { - mass += input.getMass(); - } - } - return new MultiblockControl<>(null, (int) V[tier], 4, 0, 10000, 20, 0, mass * coeff); - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java deleted file mode 100644 index 8e3036b0a..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; - -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; - -/** - * Created by danie_000 on 24.12.2017. - */ -public class Behaviour_Scanner implements GT_MetaTileEntity_EM_machine.IBehaviour { - - final int tier; - - public Behaviour_Scanner(int tier) { - this.tier = tier; - } - - @Override - public void parametersInstantiation(GT_MetaTileEntity_EM_machine te, Parameters parameters) {} - - @Override - public boolean checkParametersInAndSetStatuses(GT_MetaTileEntity_EM_machine te, Parameters parameters) { - return false; - } - - @Override - public MultiblockControl process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, - Parameters parameters) { - return null; - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java deleted file mode 100644 index 374316405..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java +++ /dev/null @@ -1,391 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; - -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.thing.metaTileEntity.multi.base.LedStatus.STATUS_LOW; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_NEUTRAL; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_OK; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_TOO_HIGH; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_TOO_LOW; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_WRONG; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; -import static net.minecraft.util.StatCollector.translateToLocal; - -import java.util.HashMap; -import java.util.function.Supplier; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -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.thing.metaTileEntity.multi.base.INameFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; -import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.TT_Utility; -import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; - -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - - // region variables - public static final String machine = "EM Machinery"; - - private ItemStack loadedMachine; - private IBehaviour currentBehaviour; - // endregion - - // region structure - private static final String[] description = new String[] { - EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", - translateToLocal("gt.blockmachines.multimachine.em.processing.hint.0"), // 1 - Classic Hatches or High Power - // Casing - translateToLocal("gt.blockmachines.multimachine.em.processing.hint.1"), // 2 - Elemental Hatches or - // Molecular Casing - }; - - private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition - .builder() - .addShape( - "main", - transpose( - new String[][] { { " A ", " AAA ", " EBE ", " ECE ", " EBE ", " AAA ", " A " }, - { " DDD ", "AAAAA", "E---E", "E---E", "E---E", "AAAAA", " FFF " }, - { "AD-DA", "AA~AA", "B---B", "C- -C", "B---B", "AA-AA", "AFFFA" }, - { " DDD ", "AAAAA", "E---E", "E---E", "E---E", "AAAAA", " FFF " }, - { " A ", " AAA ", " EBE ", " ECE ", " EBE ", " AAA ", " A " } })) - .addElement('A', ofBlock(sBlockCasingsTT, 4)).addElement('B', ofBlock(sBlockCasingsTT, 5)) - .addElement('C', ofBlock(sBlockCasingsTT, 6)).addElement('E', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement( - 'D', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_machine::addClassicToMachineList, - textureOffset, - 1, - sBlockCasingsTT, - 0)) - .addElement( - 'F', - ofHatchAdderOptional( - GT_MetaTileEntity_EM_machine::addElementalToMachineList, - textureOffset + 4, - 2, - sBlockCasingsTT, - 4)) - .build(); - // endregion - - // region parameters - protected Parameters.Group.ParameterIn[] inputMux; - protected Parameters.Group.ParameterIn[] outputMux; - private static final IStatusFunction SRC_STATUS = (base, p) -> { - double v = p.get(); - if (Double.isNaN(v)) return STATUS_WRONG; - v = (int) v; - if (v < 0) return STATUS_TOO_LOW; - if (v == 0) return STATUS_NEUTRAL; - if (v >= base.eInputHatches.size()) return STATUS_TOO_HIGH; - return STATUS_OK; - }; - private static final IStatusFunction DST_STATUS = (base, p) -> { - if (base.inputMux[p.hatchId()].getStatus(false) == STATUS_OK) { - double v = p.get(); - if (Double.isNaN(v)) return STATUS_WRONG; - v = (int) v; - if (v < 0) return STATUS_TOO_LOW; - if (v == 0) return STATUS_LOW; - if (v >= base.eInputHatches.size()) return STATUS_TOO_HIGH; - return STATUS_OK; - } - return STATUS_NEUTRAL; - }; - private static final INameFunction ROUTE_NAME = (base, - p) -> (p.parameterId() == 0 ? translateToLocal("tt.keyword.Source") + " " - : translateToLocal("tt.keyword.Destination") + " ") + p.hatchId(); - // endregion - - public GT_MetaTileEntity_EM_machine(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_machine(String aName) { - super(aName); - } - - private boolean setCurrentBehaviour() { - ItemStack newMachine = mInventory[1]; - if (ItemStack.areItemStacksEqual(newMachine, loadedMachine)) { - return false; - } - loadedMachine = newMachine; - Supplier behaviourSupplier = GT_MetaTileEntity_EM_machine.BEHAVIOUR_MAP - .get(new TT_Utility.ItemStack_NoNBT(newMachine)); - if (currentBehaviour == null && behaviourSupplier == null) { - return false; - } - if (currentBehaviour != null) { - for (int i = 6; i < 10; i++) { - parametrization.removeGroup(i); - } - } - if (behaviourSupplier != null) { - currentBehaviour = behaviourSupplier.get(); - currentBehaviour.parametersInstantiation(this, parametrization); - for (int i = 6; i < 10; i++) { - parametrization.setToDefaults(i, true, true); - } - } else { - currentBehaviour = null; - } - - return true; - } - - private static final HashMap> BEHAVIOUR_MAP = new HashMap<>(); - - public static void registerBehaviour(Supplier behaviour, ItemStack is) { - BEHAVIOUR_MAP.put(new TT_Utility.ItemStack_NoNBT(is), behaviour); - TecTech.LOGGER.info( - "Registered EM machine behaviour " + behaviour.get().getClass().getSimpleName() - + ' ' - + new TT_Utility.ItemStack_NoNBT(is).toString()); - } - - public interface IBehaviour { - - /** - * instantiate parameters, u can also check machine tier here - * - * @param te - * @param parameters - */ - void parametersInstantiation(GT_MetaTileEntity_EM_machine te, Parameters parameters); - - /** - * handle parameters per recipe - * - * @param te this te instance - * @param parameters of this te - * @return return true if machine can start with current parameters, false if not - */ - boolean checkParametersInAndSetStatuses(GT_MetaTileEntity_EM_machine te, Parameters parameters); - - /** - * do recipe handling - * - * @param inputs from muxed inputs - * @param parameters array passed from previous method! - * @return null if recipe should not start, control object to set machine state and start recipe - */ - MultiblockControl process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, - Parameters parameters); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_machine(mName); - } - - @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM("main", 2, 2, 1); - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - if (aNBT.hasKey("eLoadedMachine")) { - loadedMachine = ItemStack.loadItemStackFromNBT(aNBT.getCompoundTag("eLoadedMachine")); - } - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - if (loadedMachine != null) { - aNBT.setTag("eLoadedMachine", loadedMachine.writeToNBT(new NBTTagCompound())); - } - } - - @Override - protected void parametersInstantiation_EM() { - inputMux = new Parameters.Group.ParameterIn[6]; - outputMux = new Parameters.Group.ParameterIn[6]; - for (int i = 0; i < 6; i++) { - Parameters.Group hatch = parametrization.getGroup(i); - inputMux[i] = hatch.makeInParameter(0, i, ROUTE_NAME, SRC_STATUS); - outputMux[i] = hatch.makeInParameter(1, i, ROUTE_NAME, DST_STATUS); - } - } - - @Override - public GT_Multiblock_Tooltip_Builder createTooltip() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(translateToLocal("gt.blockmachines.multimachine.em.processing.name")) // Machine Type: Quantum - // Processing machine - .addInfo(translateToLocal("gt.blockmachines.multimachine.em.processing.desc.0")) // Controller block of - // the - // Quantum Processing machine - .addInfo(translateToLocal("tt.keyword.Structure.StructureTooComplex")) // The structure is too complex! - .addSeparator().beginStructureBlock(5, 5, 7, false) - .addOtherStructurePart( - translateToLocal("tt.keyword.Structure.Elemental"), - translateToLocal("tt.keyword.Structure.AnyMolecularCasing2D"), - 2) // Elemental Hatch: Any Molecular Casing with 2 dots - .addOtherStructurePart( - translateToLocal("tt.keyword.Parametrizer"), - translateToLocal("tt.keyword.Structure.AnyHighPowerCasing"), - 1) // Parametrizer: Any High Power Casing - .addEnergyHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasing"), 1) // Energy Hatch: Any - // High Power Casing - .addMaintenanceHatch(translateToLocal("tt.keyword.Structure.AnyHighPowerCasing"), 1) // Maintenance - // Hatch: Any High - // Power Casing - .toolTipFinisher(CommonValues.TEC_MARK_EM); - return tt; - } - - @Override - public void onFirstTick_EM(IGregTechTileEntity aBaseMetaTileEntity) { - setCurrentBehaviour(); - } - - @Override - public void onRemoval() { - super.onRemoval(); - } - - @Override - public boolean checkRecipe_EM(ItemStack itemStack) { - setCurrentBehaviour(); - if (currentBehaviour == null) { - return false; - } - - if (!currentBehaviour.checkParametersInAndSetStatuses(this, parametrization)) { - return false; - } - - EMInstanceStackMap[] handles = new EMInstanceStackMap[6]; - for (int i = 0; i < 6; i++) { - int pointer = (int) inputMux[i].get(); - if (pointer >= 0 && pointer < eInputHatches.size()) { - handles[i] = eInputHatches.get(pointer).getContentHandler(); - } - } - - for (int i = 1; i < 6; i++) { - if (handles[i] != null) { - for (int j = 0; j < i; j++) { - if (handles[i] == handles[j]) { - return false; - } - } - } - } - - MultiblockControl control = currentBehaviour.process(handles, this, parametrization); - if (control == null) { - return false; - } - cleanMassEM_EM(control.getExcessMass()); - if (control.shouldExplode()) { - explodeMultiblock(); - return false; - } - // update other parameters - outputEM = control.getValue(); - mEUt = control.getEUT(); - eAmpereFlow = control.getAmperage(); - mMaxProgresstime = control.getMaxProgressTime(); - eRequiredData = control.getRequiredData(); - mEfficiencyIncrease = control.getEffIncrease(); - boolean polluted = polluteEnvironment(control.getPollutionToAdd()); - return polluted; - } - - @Override - public void stopMachine() { - super.stopMachine(); - } - - @Override - protected void afterRecipeCheckFailed() { - super.afterRecipeCheckFailed(); - } - - @Override - public void outputAfterRecipe_EM() { - if (setCurrentBehaviour()) { - return; - } - - EMInstanceStackMap[] handles = new EMInstanceStackMap[6]; - for (int i = 0; i < 6; i++) { - int pointer = (int) outputMux[i].get(); - if (pointer >= 0 && pointer < eOutputHatches.size()) { - handles[i] = eOutputHatches.get(pointer).getContentHandler(); - } - } - // output - for (int i = 0; i < 6 && i < outputEM.length; i++) { - if (handles[i] != null && outputEM[i] != null && outputEM[i].hasStacks()) { - handles[i].putUnifyAll(outputEM[i]); - outputEM[i] = null; - } - } - // all others are handled by base multi block code - cleaning is automatic - } - - @Override - public void parametersStatusesWrite_EM(boolean machineBusy) { - if (!machineBusy) { - setCurrentBehaviour(); - } - super.parametersStatusesWrite_EM(machineBusy); - } - - @Override - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isClientSide() && (aTick & 0x2) == 0) { - if ((aTick & 0x10) == 0) { - setCurrentBehaviour(); - } - if (aBaseMetaTileEntity.isActive()) { - int xDir = aBaseMetaTileEntity.getBackFacing().offsetX * 2 + aBaseMetaTileEntity.getXCoord(); - int yDir = aBaseMetaTileEntity.getBackFacing().offsetY * 2 + aBaseMetaTileEntity.getYCoord(); - int zDir = aBaseMetaTileEntity.getBackFacing().offsetZ * 2 + aBaseMetaTileEntity.getZCoord(); - aBaseMetaTileEntity.getWorld().markBlockRangeForRenderUpdate(xDir, yDir, zDir, xDir, yDir, zDir); - } - } - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - structureBuild_EM("main", 2, 2, 1, stackSize, hintsOnly); - } - - @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; - } - - @Override - public String[] getStructureDescription(ItemStack stackSize) { - return description; - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_PipeBlock_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_PipeBlock_EM.java deleted file mode 100644 index c90e3fb79..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_PipeBlock_EM.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.pipe; - -import static net.minecraft.util.StatCollector.translateToLocal; - -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import org.apache.commons.lang3.ArrayUtils; - -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - -public class GT_MetaTileEntity_PipeBlock_EM extends GT_MetaTileEntity_Pipe_EM { - - public GT_MetaTileEntity_PipeBlock_EM(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_PipeBlock_EM(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { - return new GT_MetaTileEntity_PipeBlock_EM(mName); - } - - @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { - return AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1, aY + 1, aZ + 1); - } - - @Override - public float getThickNess() { - return 1f; - } - - @Override - public float getExplosionResistance(ForgeDirection side) { - return 1000.0f; - } - - @Override - public String[] getDescription() { - return ArrayUtils.add( - super.getDescription(), - EnumChatFormatting.DARK_AQUA.toString() + EnumChatFormatting.BOLD - + translateToLocal("gt.blockmachines.pipe.desc.4")); - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java deleted file mode 100644 index 1eb2384ff..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java +++ /dev/null @@ -1,284 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.pipe; - -import static gregtech.api.enums.Dyes.MACHINE_METAL; -import static net.minecraft.util.StatCollector.translateToLocal; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.loader.NetworkDispatcher; -import com.github.technus.tectech.mechanics.pipe.IActivePipe; -import com.github.technus.tectech.mechanics.pipe.IConnectsToElementalPipe; -import com.github.technus.tectech.mechanics.pipe.PipeActivityMessage; -import com.github.technus.tectech.util.CommonValues; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.GT_Mod; -import gregtech.api.enums.Dyes; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IColoredTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.BaseMetaPipeEntity; -import gregtech.api.metatileentity.MetaPipeEntity; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.common.GT_Client; - -/** - * Created by Tec on 26.02.2017. - */ -public class GT_MetaTileEntity_Pipe_EM extends MetaPipeEntity implements IConnectsToElementalPipe, IActivePipe { - - private static Textures.BlockIcons.CustomIcon EMpipe; - static Textures.BlockIcons.CustomIcon EMcandy, EMCandyActive; - public byte connectionCount = 0; - - private boolean active; - - public GT_MetaTileEntity_Pipe_EM(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional, 0); - } - - public GT_MetaTileEntity_Pipe_EM(String aName) { - super(aName, 0); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { - return new GT_MetaTileEntity_Pipe_EM(mName); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aBlockIconRegister) { - EMpipe = new Textures.BlockIcons.CustomIcon("iconsets/EM_PIPE"); - EMcandy = new Textures.BlockIcons.CustomIcon("iconsets/EM_CANDY"); - EMCandyActive = new Textures.BlockIcons.CustomIcon("iconsets/EM_CANDY_ACTIVE"); - super.registerIcons(aBlockIconRegister); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, int aConnections, - int colorIndex, boolean aConnected, boolean aRedstone) { - return new ITexture[] { new GT_RenderedTexture(EMpipe), - new GT_RenderedTexture( - getActive() ? EMCandyActive : EMcandy, - Dyes.getModulation(colorIndex, MACHINE_METAL.getRGBA())) }; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity iGregTechTileEntity, int i, ForgeDirection side, - ItemStack itemStack) { - return false; - } - - @Override - public boolean allowPullStack(IGregTechTileEntity iGregTechTileEntity, int i, ForgeDirection side, - ItemStack itemStack) { - return false; - } - - @Override - public void loadNBTData(NBTTagCompound nbtTagCompound) { - active = nbtTagCompound.getBoolean("eActive"); - } - - @Override - public void saveNBTData(NBTTagCompound nbtTagCompound) { - nbtTagCompound.setBoolean("eActive", active); - } - - @Override - public boolean renderInside(ForgeDirection side) { - return false; - } - - @Override - public byte getTileEntityBaseType() { - return 4; - } - - @Override - public String[] getDescription() { - return new String[] { CommonValues.TEC_MARK_EM, - translateToLocal("gt.blockmachines.pipe.elementalmatter.desc.0"), // Quantum tunneling device. - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD - + translateToLocal("gt.blockmachines.pipe.elementalmatter.desc.1"), // Not a portal!!! - EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.pipe.elementalmatter.desc.2"), // Must be - // painted - // to work - EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.pipe.elementalmatter.desc.3") // Do not - // cross, - // split or - // turn - }; - } - - @Override - public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { - if (getBaseMetaTileEntity().isClientSide()) { - NetworkDispatcher.INSTANCE.sendToServer(new PipeActivityMessage.PipeActivityQuery(this)); - } - onPostTick(aBaseMetaTileEntity, 31); - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide()) { - if ((aTick & 31) == 31) { - if (TecTech.RANDOM.nextInt(15) == 0) { - NetworkDispatcher.INSTANCE.sendToAllAround( - new PipeActivityMessage.PipeActivityData(this), - aBaseMetaTileEntity.getWorld().provider.dimensionId, - aBaseMetaTileEntity.getXCoord(), - aBaseMetaTileEntity.getYCoord(), - aBaseMetaTileEntity.getZCoord(), - 256); - } - if (active) { - active = false; - } - mConnections = 0; - connectionCount = 0; - if (aBaseMetaTileEntity.getColorization() < 0) { - return; - } - for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { - final ForgeDirection oppositeSide = side.getOpposite(); - // if (!aBaseMetaTileEntity.getCoverBehaviorAtSide(b0).alwaysLookConnected(b0, - // aBaseMetaTileEntity.getCoverIDAtSide(b0), aBaseMetaTileEntity.getCoverDataAtSide(b0), - // aBaseMetaTileEntity)) { - TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(side); - if (tTileEntity instanceof IColoredTileEntity) { - // if (aBaseMetaTileEntity.getColorization() >= 0) { - byte tColor = ((IColoredTileEntity) tTileEntity).getColorization(); - if (tColor != aBaseMetaTileEntity.getColorization()) { - continue; - } - // } - } - if (tTileEntity instanceof IConnectsToElementalPipe - && ((IConnectsToElementalPipe) tTileEntity).canConnect(oppositeSide)) { - mConnections |= 1 << side.ordinal(); - connectionCount++; - } else if (tTileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tTileEntity) - .getMetaTileEntity() instanceof IConnectsToElementalPipe) { - if (((IConnectsToElementalPipe) ((IGregTechTileEntity) tTileEntity).getMetaTileEntity()) - .canConnect(oppositeSide)) { - mConnections |= 1 << side.ordinal(); - connectionCount++; - } - } - } - } - } else if (aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected == 4) { - aBaseMetaTileEntity.issueTextureUpdate(); - } - } - - @Override - public boolean canConnect(ForgeDirection side) { - return true; - } - - @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { - float tSpace = (1f - 0.5f) / 2; - float tSide0 = tSpace; - float tSide1 = 1f - tSpace; - float tSide2 = tSpace; - float tSide3 = 1f - tSpace; - float tSide4 = tSpace; - float tSide5 = 1f - tSpace; - - if (getBaseMetaTileEntity().getCoverIDAtSide(ForgeDirection.DOWN) != 0) { - tSide0 = tSide2 = tSide4 = 0; - tSide3 = tSide5 = 1; - } - if (getBaseMetaTileEntity().getCoverIDAtSide(ForgeDirection.UP) != 0) { - tSide2 = tSide4 = 0; - tSide1 = tSide3 = tSide5 = 1; - } - if (getBaseMetaTileEntity().getCoverIDAtSide(ForgeDirection.NORTH) != 0) { - tSide0 = tSide2 = tSide4 = 0; - tSide1 = tSide5 = 1; - } - if (getBaseMetaTileEntity().getCoverIDAtSide(ForgeDirection.SOUTH) != 0) { - tSide0 = tSide4 = 0; - tSide1 = tSide3 = tSide5 = 1; - } - if (getBaseMetaTileEntity().getCoverIDAtSide(ForgeDirection.WEST) != 0) { - tSide0 = tSide2 = tSide4 = 0; - tSide1 = tSide3 = 1; - } - if (getBaseMetaTileEntity().getCoverIDAtSide(ForgeDirection.EAST) != 0) { - tSide0 = tSide2 = 0; - tSide1 = tSide3 = tSide5 = 1; - } - - byte tConn = ((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections; - if ((tConn & 1 << ForgeDirection.DOWN.ordinal()) != 0) { - tSide0 = 0f; - } - if ((tConn & 1 << ForgeDirection.UP.ordinal()) != 0) { - tSide1 = 1f; - } - if ((tConn & 1 << ForgeDirection.NORTH.ordinal()) != 0) { - tSide2 = 0f; - } - if ((tConn & 1 << ForgeDirection.SOUTH.ordinal()) != 0) { - tSide3 = 1f; - } - if ((tConn & 1 << ForgeDirection.WEST.ordinal()) != 0) { - tSide4 = 0f; - } - if ((tConn & 1 << ForgeDirection.EAST.ordinal()) != 0) { - tSide5 = 1f; - } - - return AxisAlignedBB - .getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3); - } - - @Override - public float getThickNess() { - if (GT_Mod.instance.isClientSide() && GT_Client.hideValue == 1) { - return 0.0625F; - } - return 0.5f; - } - - @Override - public void markUsed() { - this.active = true; - } - - @Override - public void setActive(boolean state) { - if (state != active) { - active = state; - getBaseMetaTileEntity().issueTextureUpdate(); - } - } - - @Override - public boolean getActive() { - return active; - } - - @Override - public void onRemoval() { - if (getActive()) { - TecTech.anomalyHandler.addAnomaly(getBaseMetaTileEntity(), 1e10f); - } - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Energy.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Energy.java index 8e8bc5e8f..fd0ed62b6 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Energy.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Energy.java @@ -1,7 +1,5 @@ package com.github.technus.tectech.thing.metaTileEntity.pipe; -import static com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_EM.EMCandyActive; -import static com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_EM.EMcandy; import static gregtech.api.enums.Dyes.MACHINE_METAL; import static net.minecraft.util.StatCollector.translateToLocal; @@ -39,6 +37,7 @@ public class GT_MetaTileEntity_Pipe_Energy extends MetaPipeEntity implements IConnectsToEnergyTunnel, IActivePipe { + static Textures.BlockIcons.CustomIcon EMcandy, EMCandyActive; private static Textures.BlockIcons.CustomIcon EMpipe; public byte connectionCount = 0; @@ -60,6 +59,8 @@ public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister aBlockIconRegister) { + EMcandy = new Textures.BlockIcons.CustomIcon("iconsets/EM_CANDY"); + EMCandyActive = new Textures.BlockIcons.CustomIcon("iconsets/EM_CANDY_ACTIVE"); EMpipe = new Textures.BlockIcons.CustomIcon("iconsets/EM_LASER"); super.registerIcons(aBlockIconRegister); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java deleted file mode 100644 index e5d79ca9b..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.single; - -import static com.github.technus.tectech.thing.metaTileEntity.Textures.MACHINE_CASINGS_TT; -import static com.github.technus.tectech.util.CommonValues.V; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; - -import com.github.technus.tectech.util.TT_Utility; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; -import gregtech.api.objects.GT_RenderedTexture; - -/** - * Created by Tec on 23.03.2017. - */ -public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine { - - public static GT_RenderedTexture READER_ONLINE, READER_OFFLINE; - - public GT_MetaTileEntity_DataReader(int aID, String aName, String aNameRegional, int aTier) { - super( - aID, - aName, - aNameRegional, - aTier, - 1, - new String[] { EnumChatFormatting.DARK_RED + "Deprecated" }, - 1, - 1, - "dataReader.png", - ""); - TT_Utility.setTier(aTier, this); - } - - public GT_MetaTileEntity_DataReader(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 1, aDescription, aTextures, 1, 1, "dataReader.png", ""); - TT_Utility.setTier(aTier, this); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_DataReader(mName, mTier, mDescriptionArray, mTextures); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aBlockIconRegister) { - super.registerIcons(aBlockIconRegister); - READER_ONLINE = new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("iconsets/READER_ONLINE")); - READER_OFFLINE = new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("iconsets/READER_OFFLINE")); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, - int colorIndex, boolean aActive, boolean aRedstone) { - if (aBaseMetaTileEntity.getWorld() == null) { - if (side == facing) { - return new ITexture[] { MACHINE_CASINGS_TT[mTier][colorIndex + 1], - aActive ? READER_ONLINE : READER_OFFLINE }; - } - return new ITexture[] { MACHINE_CASINGS_TT[mTier][colorIndex + 1] }; - } - if (side == mMainFacing) { - return new ITexture[] { MACHINE_CASINGS_TT[mTier][colorIndex + 1], - aActive ? READER_ONLINE : READER_OFFLINE }; - } else if (side == facing) { - return new ITexture[] { MACHINE_CASINGS_TT[mTier][colorIndex + 1], - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; - } - return new ITexture[] { MACHINE_CASINGS_TT[mTier][colorIndex + 1] }; - } - - @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - return null; - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - return false; - } - - @Override - public int checkRecipe() { - return DID_NOT_FIND_RECIPE; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - aBaseMetaTileEntity.setActive(getOutputAt(0) != null || mMaxProgresstime > 0); - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isElectric() { - return true; - } - - @Override - public boolean isEnetInput() { - return true; - } - - @Override - public boolean isInputFacing(ForgeDirection side) { - return side != getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public boolean isOutputFacing(ForgeDirection side) { - return side != getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public long maxEUInput() { - return V[mTier]; - } - - @Override - public long maxEUStore() { - return maxEUInput() * 16L; - } - - @Override - public long getMinimumStoredEU() { - return maxEUInput() * 4L; - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPollutor.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPollutor.java index 3a44c133f..d51cd9e27 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPollutor.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPollutor.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.single; -import static com.github.technus.tectech.thing.metaTileEntity.Textures.MACHINE_CASINGS_TT; +import static com.github.technus.tectech.thing.metaTileEntity.Textures.*; import static net.minecraft.util.StatCollector.translateToLocal; import java.util.function.Consumer; @@ -13,7 +13,6 @@ import net.minecraftforge.common.util.ForgeDirection; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OverflowElemental; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.util.TT_Utility; import com.gtnewhorizons.modularui.api.drawable.IDrawable; @@ -45,7 +44,6 @@ public class GT_MetaTileEntity_DebugPollutor extends GT_MetaTileEntity_TieredMac private static GT_RenderedTexture POLLUTOR; public int pollution = 0; - public float anomaly = 0; public GT_MetaTileEntity_DebugPollutor(int aID, String aName, String aNameRegional, int aTier) { super( @@ -82,10 +80,7 @@ public void registerIcons(IIconRegister aBlockIconRegister) { public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, int colorIndex, boolean aActive, boolean aRedstone) { return new ITexture[] { MACHINE_CASINGS_TT[mTier][colorIndex + 1], - side != facing - ? aActive ? new GT_RenderedTexture(GT_MetaTileEntity_Hatch_OverflowElemental.MufflerEM) - : new GT_RenderedTexture(GT_MetaTileEntity_Hatch_OverflowElemental.MufflerEMidle) - : POLLUTOR }; + (side == facing) ? POLLUTOR : OVERLAYS_ENERGY_OUT_LASER_TT[mTier] }; } @Override @@ -108,14 +103,11 @@ public boolean allowPullStack(IGregTechTileEntity iGregTechTileEntity, int i, Fo @Override public void saveNBTData(NBTTagCompound aNBT) { aNBT.setInteger("ePollution", pollution); - aNBT.setFloat("eAnomaly", anomaly); } @Override public void loadNBTData(NBTTagCompound aNBT) { pollution = aNBT.getInteger("ePollution"); - anomaly = aNBT.getFloat("eAnomaly"); - getBaseMetaTileEntity().setActive(anomaly > 0 || pollution > 0); } @Override @@ -126,10 +118,6 @@ public boolean isSimpleMachine() { @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isServerSide()) { - aBaseMetaTileEntity.setActive(anomaly > 0 || pollution > 0); - if (anomaly > 0) { - TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity, anomaly); - } if (pollution > 0) { GT_Pollution.addPollution(aBaseMetaTileEntity, pollution); } @@ -182,10 +170,7 @@ public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildCont new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK).setSize(90, 72).setPos(43, 4)) .widget( TextWidget.dynamicString(() -> "Pollution: " + pollution) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setPos(46, 8)) - .widget( - TextWidget.dynamicString(() -> "Anomaly: " + anomaly).setDefaultColor(COLOR_TEXT_WHITE.get()) - .setPos(46, 16)); + .setDefaultColor(COLOR_TEXT_WHITE.get()).setPos(46, 8)); addChangeNumberButton( builder, @@ -203,8 +188,6 @@ public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildCont 64, 7, 22); - addChangeNumberButton(builder, GT_UITextures.OVERLAY_BUTTON_MINUS_LARGE, val -> anomaly -= val, 512, 64, 7, 40); - addChangeNumberButton(builder, GT_UITextures.OVERLAY_BUTTON_MINUS_LARGE, val -> anomaly /= val, 512, 64, 7, 58); addChangeNumberButton(builder, GT_UITextures.OVERLAY_BUTTON_MINUS_SMALL, val -> pollution -= val, 16, 1, 25, 4); addChangeNumberButton( @@ -215,8 +198,6 @@ public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildCont 2, 25, 22); - addChangeNumberButton(builder, GT_UITextures.OVERLAY_BUTTON_MINUS_SMALL, val -> anomaly -= val, 16, 1, 25, 40); - addChangeNumberButton(builder, GT_UITextures.OVERLAY_BUTTON_MINUS_SMALL, val -> anomaly /= val, 16, 2, 25, 58); addChangeNumberButton(builder, GT_UITextures.OVERLAY_BUTTON_PLUS_SMALL, val -> pollution += val, 16, 1, 133, 4); addChangeNumberButton( @@ -227,8 +208,6 @@ public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildCont 2, 133, 22); - addChangeNumberButton(builder, GT_UITextures.OVERLAY_BUTTON_PLUS_SMALL, val -> anomaly += val, 16, 1, 133, 40); - addChangeNumberButton(builder, GT_UITextures.OVERLAY_BUTTON_PLUS_SMALL, val -> anomaly *= val, 16, 2, 133, 58); addChangeNumberButton( builder, @@ -246,33 +225,14 @@ public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildCont 64, 151, 22); - addChangeNumberButton( - builder, - GT_UITextures.OVERLAY_BUTTON_PLUS_LARGE, - val -> anomaly += val, - 512, - 64, - 151, - 40); - addChangeNumberButton( - builder, - GT_UITextures.OVERLAY_BUTTON_PLUS_LARGE, - val -> anomaly *= val, - 512, - 64, - 151, - 58); + } private void addChangeNumberButton(ModularWindow.Builder builder, IDrawable overlay, Consumer setter, int changeNumberShift, int changeNumber, int xPos, int yPos) { - builder.widget(new ButtonWidget().setOnClick((clickData, widget) -> { - setter.accept(clickData.shift ? changeNumberShift : changeNumber); - if (anomaly == Float.POSITIVE_INFINITY) { - anomaly = Float.MAX_VALUE; - } else if (anomaly == Float.NEGATIVE_INFINITY) { - anomaly = -Float.MAX_VALUE; - } - }).setBackground(GT_UITextures.BUTTON_STANDARD, overlay).setSize(18, 18).setPos(xPos, yPos)); + builder.widget( + new ButtonWidget().setOnClick( + (clickData, widget) -> setter.accept(clickData.shift ? changeNumberShift : changeNumber)) + .setBackground(GT_UITextures.BUTTON_STANDARD, overlay).setSize(18, 18).setPos(xPos, yPos)); } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPowerGenerator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPowerGenerator.java index 9ac34935b..4dceb78d2 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPowerGenerator.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPowerGenerator.java @@ -54,7 +54,7 @@ public class GT_MetaTileEntity_DebugPowerGenerator extends GT_MetaTileEntity_TieredMachineBlock implements IConnectsToEnergyTunnel, IAddUIWidgets, IAddGregtechLogo { - private static GT_RenderedTexture GENNY; + public static GT_RenderedTexture GENNY; private boolean LASER = false; public int EUT = 0, AMP = 0; public boolean producing = true; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_MicroController.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_MicroController.java deleted file mode 100644 index 88f3a78b4..000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_MicroController.java +++ /dev/null @@ -1,198 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.single; - -import static com.github.technus.tectech.thing.metaTileEntity.Textures.MACHINE_CASINGS_TT; -import static com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_DataReader.READER_OFFLINE; -import static com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_DataReader.READER_ONLINE; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; - -import com.github.technus.avrClone.AvrCore; -import com.github.technus.avrClone.instructions.ExecutionEvent; -import com.github.technus.avrClone.instructions.Instruction; -import com.github.technus.avrClone.instructions.InstructionRegistry; -import com.github.technus.avrClone.instructions.exceptions.DebugEvent; -import com.github.technus.avrClone.instructions.exceptions.DelayEvent; -import com.github.technus.avrClone.memory.EepromMemory; -import com.github.technus.avrClone.memory.RemovableMemory; -import com.github.technus.avrClone.memory.program.ProgramMemory; -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.avr.SidedRedstone; -import com.github.technus.tectech.util.TT_Utility; - -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; -import gregtech.api.objects.GT_RenderedTexture; - -public class GT_MetaTileEntity_MicroController extends GT_MetaTileEntity_TieredMachineBlock { - - public static final int OPS_PER_TICK_MAX = 512; - - static { - Instruction.random = TecTech.RANDOM; - } - - public AvrCore core; - private int[] tempData; - public boolean debugRun; - private int delay; - private int maxLoad; - - public static final SidedRedstone sidedRedstone = new SidedRedstone(0x16); - - public GT_MetaTileEntity_MicroController(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 0, "AVR Micro-controller"); - TT_Utility.setTier(aTier, this); - } - - public GT_MetaTileEntity_MicroController(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 0, aDescription, aTextures); - TT_Utility.setTier(aTier, this); - core = new AvrCore(); - core.setUsingImmersiveOperands(false); - core.setInstructionRegistry(InstructionRegistry.INSTRUCTION_REGISTRY_OP); - core.setDataMemory(Math.max(64, 1 << aTier), Math.max(64, 1 << aTier)); - core.setCpuRegisters(0x30); - core.putDataBindings(sidedRedstone); - maxLoad = Math.min(1 << mTier, OPS_PER_TICK_MAX); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { - return new GT_MetaTileEntity_MicroController(mName, mTier, mDescriptionArray, mTextures); - } - - @Override - public void loadNBTData(NBTTagCompound tag) { - NBTTagCompound avr = tag.getCompoundTag("avr"); - debugRun = avr.getBoolean("debugRun"); - delay = avr.getInteger("delay"); - core.active = avr.getBoolean("active"); - core.awoken = (avr.getBoolean("awoken")); - core.programCounter = avr.getInteger("programCounter"); - if (avr.hasKey("instructions")) { - InstructionRegistry registry = InstructionRegistry.REGISTRIES.get(avr.getString("instructionRegistry")); - if (registry != null) { - core.setProgramMemory( - new ProgramMemory( - registry, - avr.getBoolean("immersive"), - avr.getIntArray("instructions"), - avr.getIntArray("param0"), - avr.getIntArray("param1"))); - } - } - if (avr.hasKey("eepromSize")) { - core.restoreEepromDefinition(EepromMemory.make(avr.getInteger("eepromSize"))); - } - if (avr.hasKey("dataMemory")) { - tempData = avr.getIntArray("dataMemory"); - } - core.checkValid(); - } - - @Override - public void saveNBTData(NBTTagCompound tag) { - NBTTagCompound avr = new NBTTagCompound(); - avr.setBoolean("debugRun", debugRun); - avr.setInteger("delay", delay); - avr.setBoolean("active", core.active); - avr.setBoolean("awoken", core.awoken); - avr.setInteger("programCounter", core.programCounter); - ProgramMemory programMemory = core.getProgramMemory(); - if (programMemory != null) { - avr.setIntArray("instructions", programMemory.instructions); - avr.setIntArray("param0", programMemory.param0); - avr.setIntArray("param1", programMemory.param1); - avr.setBoolean("immersive", programMemory.immersiveOperands); - avr.setString("instructionRegistry", programMemory.registry.toString()); - } - RemovableMemory eeprom = core.getEepromMemory(); - if (eeprom != null) { - avr.setInteger("eepromSize", eeprom.getDefinition().getSize()); - } - if (core.dataMemory != null) { - avr.setIntArray("dataMemory", core.dataMemory); - } - tag.setTag("avr", avr); - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (tempData != null) { - // todo discovery of components - core.dataMemory = tempData; - tempData = null; - } - if (aBaseMetaTileEntity.isActive()) { - sidedRedstone.preSync(core, aBaseMetaTileEntity); - core.interruptsHandle(); - if (core.awoken) { - delay = 0; - for (int load = 0; load < maxLoad;) { - load += core.getInstruction().getCost(core); - ExecutionEvent executionEvent = core.cpuCycleForce(); - if (executionEvent != null) { - if (executionEvent.throwable instanceof DelayEvent) { - delay = executionEvent.data[0]; - break; - } else if (executionEvent.throwable instanceof DebugEvent) { - if (debugRun) { - aBaseMetaTileEntity.setActive(false); - break; - } - } - } - } - } else if (delay > 0) { - delay--; - if (delay == 0) { - core.awoken = true; - } - } - sidedRedstone.postSync(core, aBaseMetaTileEntity); - } - core.active = aBaseMetaTileEntity.isActive(); - } - - @Override - public boolean allowPullStack(IGregTechTileEntity iGregTechTileEntity, int i, ForgeDirection side, - ItemStack itemStack) { - return true; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity iGregTechTileEntity, int i, ForgeDirection side, - ItemStack itemStack) { - return true; - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, - int colorIndex, boolean aActive, boolean aRedstone) { - if (aBaseMetaTileEntity.getWorld() == null) { - if (side == facing) { - return new ITexture[] { MACHINE_CASINGS_TT[mTier][colorIndex + 1], - aActive ? READER_ONLINE : READER_OFFLINE }; - } - return new ITexture[] { MACHINE_CASINGS_TT[mTier][colorIndex + 1] }; - } - if (side == aBaseMetaTileEntity.getFrontFacing()) { - return new ITexture[] { MACHINE_CASINGS_TT[mTier][colorIndex + 1], - aActive ? READER_ONLINE : READER_OFFLINE }; - } else if (side == facing) { - return new ITexture[] { MACHINE_CASINGS_TT[mTier][colorIndex + 1], - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; - } - return new ITexture[] { MACHINE_CASINGS_TT[mTier][colorIndex + 1] }; - } - - @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - return null; - } -}