From bebee56cc3602a80d72c9129d26663e7ab776ae5 Mon Sep 17 00:00:00 2001 From: Technus Date: Wed, 16 Aug 2017 17:12:13 +0200 Subject: Add quantum stuff block, recipe adder methods x2 and some more research multiblock code to go with it --- .../assets/tectech/textures/blocks/blockQuantumStuff.png | Bin 0 -> 228 bytes .../tectech/textures/blocks/blockQuantumStuff.png.mcmeta | 5 +++++ 2 files changed, 5 insertions(+) create mode 100644 src/main/resources/assets/tectech/textures/blocks/blockQuantumStuff.png create mode 100644 src/main/resources/assets/tectech/textures/blocks/blockQuantumStuff.png.mcmeta (limited to 'src/main/resources/assets/tectech/textures') diff --git a/src/main/resources/assets/tectech/textures/blocks/blockQuantumStuff.png b/src/main/resources/assets/tectech/textures/blocks/blockQuantumStuff.png new file mode 100644 index 0000000000..d03659020c Binary files /dev/null and b/src/main/resources/assets/tectech/textures/blocks/blockQuantumStuff.png differ diff --git a/src/main/resources/assets/tectech/textures/blocks/blockQuantumStuff.png.mcmeta b/src/main/resources/assets/tectech/textures/blocks/blockQuantumStuff.png.mcmeta new file mode 100644 index 0000000000..60af678259 --- /dev/null +++ b/src/main/resources/assets/tectech/textures/blocks/blockQuantumStuff.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":4 + } +} \ No newline at end of file -- cgit From 9bcccb4f7aacd2744737a4a6a939c7cd9d9fdfc4 Mon Sep 17 00:00:00 2001 From: Technus Date: Sat, 19 Aug 2017 11:04:51 +0200 Subject: Add EM placeholder --- build.properties | 4 +- .../tectech/loader/DreamCraftRecipeLoader.java | 2 + .../technus/tectech/loader/ThingsLoader.java | 6 +- .../github/technus/tectech/recipe/TT_recipe.java | 5 +- .../tectech/thing/item/DefinitionContainer_EM.java | 114 +++++++++++++++++++++ src/main/resources/assets/tectech/lang/en_US.lang | 1 + .../textures/items/itemDefinitionContainer.png | Bin 0 -> 1588 bytes .../items/itemDefinitionContainer.png.mcmeta | 5 + 8 files changed, 130 insertions(+), 7 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/thing/item/DefinitionContainer_EM.java create mode 100644 src/main/resources/assets/tectech/textures/items/itemDefinitionContainer.png create mode 100644 src/main/resources/assets/tectech/textures/items/itemDefinitionContainer.png.mcmeta (limited to 'src/main/resources/assets/tectech/textures') diff --git a/build.properties b/build.properties index 96d7619b5b..16ddc4bb83 100644 --- a/build.properties +++ b/build.properties @@ -6,8 +6,8 @@ ic2.version=2.2.790-experimental codechickenlib.version=1.1.3.140 codechickencore.version=1.0.7.47 nei.version=1.0.5.120 -gregtech.jenkinsbuild=752 -gregtech.version=5.09.31.25 +gregtech.jenkinsbuild=757 +gregtech.version=5.09.31.26 cofhcore.cf=2246/920 cofhcore.version=[1.7.10]3.0.3-303-dev cofhlib.cf=2246/918 diff --git a/src/main/java/com/github/technus/tectech/loader/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/DreamCraftRecipeLoader.java index fdbe8c8e16..8445e38f69 100644 --- a/src/main/java/com/github/technus/tectech/loader/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/DreamCraftRecipeLoader.java @@ -57,8 +57,10 @@ public class DreamCraftRecipeLoader implements Runnable { //Advanced Computer Casing GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_Computer_Casing.get(1, o), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Ultimate, 8), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Cobalt, 64), GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.Superconductor, 4)}, Materials.Tungsten.getMolten(2000), CustomItemList.eM_Computer_Bus.get(1, o), 800, 122880, true); //endregion + //Active Transformer GT_Values.RA.addAssemblerRecipe(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.WetTransformer_ZPM_LuV.get(1, o), com.dreammaster.gthandler.CustomItemList.HighEnergyFlowCircuit.get(2, o), GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.Superconductor, 4), ItemList.Circuit_Chip_UHPIC.get(4)}, Materials.Tungsten.getMolten(500), CustomItemList.Machine_Multi_Transformer.get(1, o), 400, 30720); + //region multiblocks assline //Research Station GT_Values.RA.addAssemblylineRecipe(com.dreammaster.gthandler.CustomItemList.ScannerZPM.get(1), 144000, new ItemStack[]{ diff --git a/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java b/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java index 4704b369ba..a92a5a663d 100644 --- a/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java @@ -8,6 +8,7 @@ import com.github.technus.tectech.thing.casing.GT_Block_HintTT; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.item.ConstructibleTriggerItem; import com.github.technus.tectech.thing.item.DebugContainer_EM; +import com.github.technus.tectech.thing.item.DefinitionContainer_EM; import com.github.technus.tectech.thing.item.ParametrizerMemoryCard; import cpw.mods.fml.common.Loader; import openmodularturrets.blocks.turretbases.TurretBaseEM; @@ -36,9 +37,12 @@ public class ThingsLoader implements Runnable { TecTech.Logger.info("TurretBaseEM registered"); } - DebugContainer_EM.run(); ConstructibleTriggerItem.run(); ParametrizerMemoryCard.run(); + TecTech.Logger.info("Useful item registered"); + + DefinitionContainer_EM.run(); + DebugContainer_EM.run(); TecTech.Logger.info("Debug Items registered"); } } 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 4f8fa30452..5b18af2bb0 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 @@ -1,6 +1,5 @@ package com.github.technus.tectech.recipe; -import com.github.technus.tectech.TecTech; import com.github.technus.tectech.auxiliary.TecTechConfig; import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStack; import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStackMap; @@ -212,9 +211,7 @@ public class TT_recipe extends GT_Recipe { try { return mRecipeMap.get(cElementalDefinitionStack.fromNBT(dataHandler.stackTagCompound.getCompoundTag(E_RECIPE_ID))); }catch (Exception e){ - if (TecTechConfig.DEBUG_MODE) - TecTech.Logger.debug("EM INSTANTIATION FAULT"); - TecTech.Logger.debug(e.getMessage()); + if (TecTechConfig.DEBUG_MODE) e.printStackTrace(); return null; } } diff --git a/src/main/java/com/github/technus/tectech/thing/item/DefinitionContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/DefinitionContainer_EM.java new file mode 100644 index 0000000000..99535b8e23 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/item/DefinitionContainer_EM.java @@ -0,0 +1,114 @@ +package com.github.technus.tectech.thing.item; + +import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.auxiliary.TecTechConfig; +import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStackMap; +import com.github.technus.tectech.elementalMatter.classes.tElementalException; +import cpw.mods.fml.common.registry.GameRegistry; +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 java.util.Collections; +import java.util.List; + +import static com.github.technus.tectech.auxiliary.Reference.MODID; + +/** + * Created by Tec on 15.03.2017. + */ +public class DefinitionContainer_EM extends Item { + public static DefinitionContainer_EM INSTANCE; + + private DefinitionContainer_EM() { + super(); + setMaxStackSize(1); + setUnlocalizedName("em.definitionContainer"); + setTextureName(MODID + ":itemDefinitionContainer"); + } + + //return previous thing + public static cElementalDefinitionStackMap setContent(ItemStack containerItem, cElementalDefinitionStackMap definitions){ + if(containerItem.getItem() instanceof DefinitionContainer_EM) { + NBTTagCompound tNBT = containerItem.stackTagCompound; + if (tNBT == null) tNBT=containerItem.stackTagCompound=new NBTTagCompound(); + + cElementalDefinitionStackMap oldMap=null; + if (tNBT.hasKey("content")) { + try { + oldMap=cElementalDefinitionStackMap.fromNBT(tNBT.getCompoundTag("content")); + } catch (tElementalException e) { + if (TecTechConfig.DEBUG_MODE) e.printStackTrace(); + } + } + tNBT.setTag("info", definitions.getInfoNBT()); + tNBT.setTag("content", definitions.toNBT()); + return oldMap; + } + return null; + } + + public static cElementalDefinitionStackMap getContent(ItemStack containerItem){ + if(containerItem.getItem() instanceof DefinitionContainer_EM){ + NBTTagCompound tNBT = containerItem.stackTagCompound; + + if (tNBT == null || !tNBT.hasKey("content")) return null; + try { + return cElementalDefinitionStackMap.fromNBT(tNBT.getCompoundTag("content")); + } catch (tElementalException e) { + if (TecTechConfig.DEBUG_MODE) e.printStackTrace(); + } + } + return null; + } + + public static cElementalDefinitionStackMap clearContent(ItemStack containerItem){ + if(containerItem.getItem() instanceof DefinitionContainer_EM){ + NBTTagCompound tNBT = containerItem.stackTagCompound; + if (tNBT == null) return null; + + cElementalDefinitionStackMap oldMap=null; + if (tNBT.hasKey("content")) { + try { + oldMap=cElementalDefinitionStackMap.fromNBT(tNBT.getCompoundTag("content")); + } catch (tElementalException e) { + if (TecTechConfig.DEBUG_MODE) e.printStackTrace(); + } + } + tNBT.removeTag("info"); + tNBT.removeTag("content"); + return oldMap; + } + return null; + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { + aList.add(CommonValues.tecMark); + try { + NBTTagCompound tNBT = aStack.getTagCompound(); + if (tNBT != null && tNBT.hasKey("info")) { + aList.add("Should Contain:"); + Collections.addAll(aList, cElementalDefinitionStackMap.infoFromNBT(tNBT.getCompoundTag("info"))); + } else { + aList.add("Recipe Hint"); + } + } catch (Exception e) { + aList.add("---Unexpected Termination---"); + } + } + + public static void run() { + INSTANCE = new DefinitionContainer_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); + } +} diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index e272e43eaa..5d041a12e9 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -2,6 +2,7 @@ itemGroup.TecTech=TecTech Interdimensional tile.quantumGlass.name=Quantum Glass tile.quantumStuff.name=Quantum Stuff item.em.debugContainer.name=Debug EM Container +item.em.definitionContainer.name=EM Recipe Hint item.em.debugBuilder.name=Multiblock Machine Blueprint item.em.parametrizerMemoryCard.name=Parametrizer Memory Card diff --git a/src/main/resources/assets/tectech/textures/items/itemDefinitionContainer.png b/src/main/resources/assets/tectech/textures/items/itemDefinitionContainer.png new file mode 100644 index 0000000000..173d0c4e6c Binary files /dev/null and b/src/main/resources/assets/tectech/textures/items/itemDefinitionContainer.png differ diff --git a/src/main/resources/assets/tectech/textures/items/itemDefinitionContainer.png.mcmeta b/src/main/resources/assets/tectech/textures/items/itemDefinitionContainer.png.mcmeta new file mode 100644 index 0000000000..24f863c95e --- /dev/null +++ b/src/main/resources/assets/tectech/textures/items/itemDefinitionContainer.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":3 + } +} \ No newline at end of file -- cgit From 56846cb2599c7b29ec3af4950b53181daa5200b8 Mon Sep 17 00:00:00 2001 From: Technus Date: Sat, 30 Sep 2017 23:40:11 +0200 Subject: First draft of reactor sim. --- .../technus/tectech/loader/ThingsLoader.java | 4 + .../tectech/thing/block/ReactorSimBlock.java | 90 +++ .../tectech/thing/block/ReactorSimItem.java | 29 + .../thing/tileEntity/ReactorSimTileEntity.java | 698 +++++++++++++++++++++ .../textures/blocks/blockReactorSimulator.png | Bin 0 -> 1147 bytes 5 files changed, 821 insertions(+) create mode 100644 src/main/java/com/github/technus/tectech/thing/block/ReactorSimBlock.java create mode 100644 src/main/java/com/github/technus/tectech/thing/block/ReactorSimItem.java create mode 100644 src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java create mode 100644 src/main/resources/assets/tectech/textures/blocks/blockReactorSimulator.png (limited to 'src/main/resources/assets/tectech/textures') diff --git a/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java b/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java index 7411bc9335..d957152db5 100644 --- a/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java @@ -3,6 +3,7 @@ package com.github.technus.tectech.loader; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.block.QuantumStuffBlock; +import com.github.technus.tectech.thing.block.ReactorSimBlock; import com.github.technus.tectech.thing.casing.GT_Block_CasingsTT; import com.github.technus.tectech.thing.casing.GT_Block_HintTT; import com.github.technus.tectech.thing.casing.TT_Container_Casings; @@ -37,6 +38,9 @@ public class ThingsLoader implements Runnable { TecTech.Logger.info("TurretBaseEM registered"); } + ReactorSimBlock.run(); + TecTech.Logger.info("Reactor Simulator registered"); + ConstructableTriggerItem.run(); ParametrizerMemoryCard.run(); TecTech.Logger.info("Useful item registered"); diff --git a/src/main/java/com/github/technus/tectech/thing/block/ReactorSimBlock.java b/src/main/java/com/github/technus/tectech/thing/block/ReactorSimBlock.java new file mode 100644 index 0000000000..2b3d78cd49 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/block/ReactorSimBlock.java @@ -0,0 +1,90 @@ +package com.github.technus.tectech.thing.block; + +import com.github.technus.tectech.thing.tileEntity.ReactorSimTileEntity; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ic2.core.IC2; +import ic2.core.IHasGui; +import ic2.core.block.TileEntityBlock; +import net.minecraft.block.Block; +import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +import static com.github.technus.tectech.auxiliary.Reference.MODID; + +/** + * Created by danie_000 on 30.09.2017. + */ +public class ReactorSimBlock extends Block implements ITileEntityProvider { + public static ReactorSimBlock INSTANCE; + public static IIcon stuff; + + public ReactorSimBlock() { + super(Material.iron); + this.setBlockBounds(0, 0, 0, 1, 1, 1); + setBlockName("reactorSim"); + setHarvestLevel("wrench", 3); + setHardness(50); + setResistance(30); + setLightOpacity(0); + setStepSound(Block.soundTypeMetal); + setBlockTextureName(MODID + ":blockReactorSimulator"); + } + + @Override + public boolean isOpaqueCube() { + return true; + } + + @Override + public boolean getCanBlockGrass() { + return true; + } + + @Override + public boolean canBeReplacedByLeaves(IBlockAccess world, int x, int y, int z) { + return false; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister p_149651_1_) { + super.registerBlockIcons(p_149651_1_); + stuff = this.blockIcon; + } + + public static void run() { + INSTANCE = new ReactorSimBlock(); + GameRegistry.registerBlock(INSTANCE, ReactorSimItem.class, INSTANCE.getUnlocalizedName()); + GameRegistry.registerTileEntity(ReactorSimTileEntity.class,MODID+"_reactorSim"); + } + + @Override + public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { + return new ReactorSimTileEntity(); + } + + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float a, float b, float c) { + if(entityPlayer.isSneaking()) { + return false; + } else { + TileEntity te = world.getTileEntity(x,y,z); + return te instanceof IHasGui && (!IC2.platform.isSimulating() || IC2.platform.launchGui(entityPlayer, (IHasGui) te)); + } + } + + public void onNeighborBlockChange(World world, int x, int y, int z, Block srcBlock) { + TileEntity te = world.getTileEntity(x,y,z); + if(te instanceof TileEntityBlock) { + ((TileEntityBlock)te).onNeighborUpdate(srcBlock); + } + + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/block/ReactorSimItem.java b/src/main/java/com/github/technus/tectech/thing/block/ReactorSimItem.java new file mode 100644 index 0000000000..c21820eea5 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/block/ReactorSimItem.java @@ -0,0 +1,29 @@ +package com.github.technus.tectech.thing.block; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +import java.util.List; + +import static com.github.technus.tectech.CommonValues.TEC_MARK_GENERAL; + +/** + * Created by danie_000 on 30.09.2017. + */ +public class ReactorSimItem extends ItemBlock { + public static QuantumGlassItem INSTANCE; + + public ReactorSimItem(Block b) { + super(b); + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { + aList.add(TEC_MARK_GENERAL); + aList.add("ReactorSimulator 9001"); + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Explodes, but not as much..."); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java b/src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java new file mode 100644 index 0000000000..63d1d61bfa --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java @@ -0,0 +1,698 @@ +package com.github.technus.tectech.thing.tileEntity; + +import com.github.technus.tectech.auxiliary.Reference; +import ic2.api.energy.event.EnergyTileUnloadEvent; +import ic2.api.reactor.IReactorComponent; +import ic2.core.IC2; +import ic2.core.block.reactor.tileentity.TileEntityNuclearReactorElectric; +import ic2.core.init.MainConfig; +import ic2.core.util.ConfigUtil; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; + +/** + * Created by danie_000 on 30.09.2017. + */ +public class ReactorSimTileEntity extends TileEntityNuclearReactorElectric { + private boolean hadRedstone =true; + + public ReactorSimTileEntity() { + super(); + //this.updateTicker = IC2.random.nextInt(this.getTickRate()); + //this.inputTank = new FluidTank(10000); + //this.outputTank = new FluidTank(10000); + //this.reactorSlot = new InvSlotReactor(this, "reactor", 0, 54); + //this.coolantinputSlot = new InvSlotConsumableLiquidByList(this, "coolantinputSlot", 55, InvSlot.Access.I, 1, InvSlot.InvSide.ANY, InvSlotConsumableLiquid.OpType.Drain, BlocksItems.getFluid(InternalName.fluidCoolant)); + //this.hotcoolinputSlot = new InvSlotConsumableLiquidByTank(this, "hotcoolinputSlot", 56, InvSlot.Access.I, 1, InvSlot.InvSide.ANY, InvSlotConsumableLiquid.OpType.Fill, this.outputTank); + //this.coolantoutputSlot = new InvSlotOutput(this, "coolantoutputSlot", 57, 1); + //this.hotcoolantoutputSlot = new InvSlotOutput(this, "hotcoolantoutputSlot", 58, 1); + } + + @Override + public void onLoaded() { + super.onLoaded(); + if(IC2.platform.isSimulating() && this.addedToEnergyNet) { + MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); + //this.addedToEnergyNet = false; + } + } + + public void onUnloaded() { + addedToEnergyNet=false; + super.onUnloaded(); + } + + @Override + public String getInventoryName() { + return "Nuclear Reactor Simulator"; + } + + //public int gaugeHeatScaled(int i) { + // return i * this.heat / (this.maxHeat / 100 * 85); + //} + + //public void readFromNBT(NBTTagCompound nbttagcompound) { + // super.readFromNBT(nbttagcompound); + // //this.heat = nbttagcompound.getInteger("heat"); + // //this.inputTank.readFromNBT(nbttagcompound.getCompoundTag("inputTank")); + // //this.outputTank.readFromNBT(nbttagcompound.getCompoundTag("outputTank")); + // //this.output = (float)nbttagcompound.getShort("output"); + //} + + //public void writeToNBT(NBTTagCompound nbttagcompound) { + // super.writeToNBT(nbttagcompound); + // //NBTTagCompound inputTankTag = new NBTTagCompound(); + // //this.inputTank.writeToNBT(inputTankTag); + // //nbttagcompound.setTag("inputTank", inputTankTag); + // //NBTTagCompound outputTankTag = new NBTTagCompound(); + // //this.outputTank.writeToNBT(outputTankTag); + // //nbttagcompound.setTag("outputTank", outputTankTag); + // //nbttagcompound.setInteger("heat", this.heat); + // //nbttagcompound.setShort("output", (short)((int)this.getReactorEnergyOutput())); + //} + + //public void setRedstoneSignal(boolean redstone) { + // this.redstone = redstone; + //} + + //public void drawEnergy(double amount) { + //} + + //public float sendEnergy(float send) { + // return 0.0F; + //} + + @Override + public boolean emitsEnergyTo(TileEntity receiver, ForgeDirection direction) { + return false; + } + + @Override + public double getOfferedEnergy() { + return 0; + } + + //public int getSourceTier() { + // return 4; + //} + + @Override + public double getReactorEUEnergyOutput() { + return (double)(this.getReactorEnergyOutput() * 5.0F * ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/nuclear")); + } + + //public List getSubTiles() { + // if(this.subTiles == null) { + // this.subTiles = new ArrayList(); + // this.subTiles.add(this); + // Direction[] arr$ = Direction.directions; + // int len$ = arr$.length; + // + // for(int i$ = 0; i$ < len$; ++i$) { + // Direction dir = arr$[i$]; + // TileEntity te = dir.applyToTileEntity(this); + // if(te instanceof TileEntityReactorChamberElectric && !te.isInvalid()) { + // this.subTiles.add(te); + // } + // } + // } + // + // return this.subTiles; + //} + + //private void processfluidsSlots() { + // RecipeOutput outputinputSlot = this.processInputSlot(true); + // if(outputinputSlot != null) { + // this.processInputSlot(false); + // List outputoutputSlot = outputinputSlot.items; + // this.coolantoutputSlot.add(outputoutputSlot); + // } + // + // RecipeOutput outputoutputSlot1 = this.processOutputSlot(true); + // if(outputoutputSlot1 != null) { + // this.processOutputSlot(false); + // List processResult = outputoutputSlot1.items; + // this.hotcoolantoutputSlot.add(processResult); + // } + // + //} + + //public void refreshChambers() { + // if(this.addedToEnergyNet) { + // MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); + // } + // + // this.subTiles = null; + // if(this.addedToEnergyNet) { + // MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); + // } + // + //} + + @Override + protected void updateEntityServer() { + if(this.updateTicker++ % this.getTickRate() == 0) { + if (!worldObj.isRemote && this.worldObj.doChunksNearChunkExist(this.xCoord, this.yCoord, this.zCoord, 2)) { + if(hadRedstone && !receiveredstone()) hadRedstone=false; + else if(!hadRedstone && receiveredstone()){ + doUpdates(); + hadRedstone=true; + } + markDirty(); + } + } + } + + //public void dropAllUnfittingStuff() { + // int i; + // ItemStack stack; + // for(i = 0; i < this.reactorSlot.size(); ++i) { + // stack = this.reactorSlot.get(i); + // if(stack != null && !this.isUsefulItem(stack, false)) { + // this.reactorSlot.put(i, null); + // this.eject(stack); + // } + // } + // + // for(i = this.reactorSlot.size(); i < this.reactorSlot.rawSize(); ++i) { + // stack = this.reactorSlot.get(i); + // this.reactorSlot.put(i, null); + // this.eject(stack); + // } + // + //} + + //public boolean isUsefulItem(ItemStack stack, boolean forInsertion) { + // Item item = stack.getItem(); + // return (item instanceof IReactorComponent || (item == Ic2Items.TritiumCell.getItem() || item == Ic2Items.reactorDepletedUraniumSimple.getItem() || item == Ic2Items.reactorDepletedUraniumDual.getItem() || item == Ic2Items.reactorDepletedUraniumQuad.getItem() || item == Ic2Items.reactorDepletedMOXSimple.getItem() || item == Ic2Items.reactorDepletedMOXDual.getItem() || item == Ic2Items.reactorDepletedMOXQuad.getItem())); + //} + + //public void eject(ItemStack drop) { + // if(IC2.platform.isSimulating() && drop != null) { + // float f = 0.7F; + // double d = (double)(this.worldObj.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + // double d1 = (double)(this.worldObj.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + // double d2 = (double)(this.worldObj.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + // EntityItem entityitem = new EntityItem(this.worldObj, (double)this.xCoord + d, (double)this.yCoord + d1, (double)this.zCoord + d2, drop); + // entityitem.delayBeforeCanPickup = 10; + // this.worldObj.spawnEntityInWorld(entityitem); + // } + //} + + @Override + public boolean calculateHeatEffects() { + if(this.heat >= 4000 && IC2.platform.isSimulating()) { + float power = (float)this.heat / (float)this.maxHeat; + if(power >= 1.0F) { + this.explode();//ding + return true; + } else { + //int[] coord; + //Block block; + //Material mat; + //if(power >= 0.85F && this.worldObj.rand.nextFloat() <= 0.2F * this.hem) { + // coord = this.getRandCoord(2); + // if(coord != null) { + // block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); + // if(block.isAir(this.worldObj, coord[0], coord[1], coord[2])) { + // this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.fire, 0, 7); + // } else if(block.getBlockHardness(this.worldObj, coord[0], coord[1], coord[2]) >= 0.0F && this.worldObj.getTileEntity(coord[0], coord[1], coord[2]) == null) { + // mat = block.getMaterial(); + // if(mat != Material.rock && mat != Material.iron && mat != Material.lava && mat != Material.ground && mat != Material.clay) { + // this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.fire, 0, 7); + // } else { + // this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.flowing_lava, 15, 7); + // } + // } + // } + //} + // + //if(power >= 0.7F) { + // List var5 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox((double)(this.xCoord - 3), (double)(this.yCoord - 3), (double)(this.zCoord - 3), (double)(this.xCoord + 4), (double)(this.yCoord + 4), (double)(this.zCoord + 4))); + // + // for(int var6 = 0; var6 < var5.size(); ++var6) { + // Entity var7 = (Entity)var5.get(var6); + // var7.attackEntityFrom(IC2DamageSource.radiation, (float)((int)((float)this.worldObj.rand.nextInt(4) * this.hem))); + // } + //} + // + //if(power >= 0.5F && this.worldObj.rand.nextFloat() <= this.hem) { + // coord = this.getRandCoord(2); + // if(coord != null) { + // block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); + // if(block.getMaterial() == Material.water) { + // this.worldObj.setBlockToAir(coord[0], coord[1], coord[2]); + // } + // } + //} + // + //if(power >= 0.4F && this.worldObj.rand.nextFloat() <= this.hem) { + // coord = this.getRandCoord(2); + // if(coord != null && this.worldObj.getTileEntity(coord[0], coord[1], coord[2]) == null) { + // block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); + // mat = block.getMaterial(); + // if(mat == Material.wood || mat == Material.leaves || mat == Material.cloth) { + // this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.fire, 0, 7); + // } + // } + //} + return false; + } + } + return false; + } + + //public int[] getRandCoord(int radius) { + // if(radius <= 0) { + // return null; + // } else { + // int[] c = new int[]{this.xCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius, this.yCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius, this.zCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius}; + // return c[0] == this.xCoord && c[1] == this.yCoord && c[2] == this.zCoord?null:c; + // } + //} + + //public void processChambers() { + // short size = this.getReactorSize(); + // + // for(int pass = 0; pass < 2; ++pass) { + // for(int y = 0; y < 6; ++y) { + // for(int x = 0; x < size; ++x) { + // ItemStack stack = this.reactorSlot.get(x, y); + // if(stack != null && stack.getItem() instanceof IReactorComponent) { + // IReactorComponent comp = (IReactorComponent)stack.getItem(); + // comp.processChamber(this, stack, x, y, pass == 0); + // } + // } + // } + // } + // + //} + + //public boolean produceEnergy() { + // return this.receiveredstone() && ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/generator") > 0.0F; + //} + + //NO need + //public boolean receiveredstone() { + // return this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord) || this.redstone; + //} + + //public short getReactorSize() { + // if(this.worldObj == null) { + // return 9; + // } else { + // short cols = 3; + // Direction[] arr$ = Direction.directions; + // int len$ = arr$.length; + // + // for(int i$ = 0; i$ < len$; ++i$) { + // Direction direction = arr$[i$]; + // TileEntity target = direction.applyToTileEntity(this); + // if(target instanceof TileEntityReactorChamberElectric) { + // ++cols; + // } + // } + // + // return cols; + // } + //} + + //public int getTickRate() { + // return 20; + //} + + //public ContainerBase getGuiContainer(EntityPlayer entityPlayer) { + // return new ContainerNuclearReactor(entityPlayer, this); + //} + + //@SideOnly(Side.CLIENT) + //public GuiScreen getGui(EntityPlayer entityPlayer, boolean isAdmin) { + // return new GuiNuclearReactor(new ContainerNuclearReactor(entityPlayer, this)); + //} + + //public void onGuiClosed(EntityPlayer entityPlayer) {} + + //new method + private void doUpdates(){ + heat=0; + do{ + dropAllUnfittingStuff(); + output = 0.0F; + maxHeat = 10000; + hem = 1.0F; + processChambers(); + }while(!calculateHeatEffects() && output>0); + } + + //region no need to change + //public void onNetworkUpdate(String field) { + // if(field.equals("output")) { + // if(this.output > 0.0F) { + // if(this.lastOutput <= 0.0F) { + // if(this.audioSourceMain == null) { + // this.audioSourceMain = IC2.audioManager.createSource(this, PositionSpec.Center, "Generators/NuclearReactor/NuclearReactorLoop.ogg", true, false, IC2.audioManager.getDefaultVolume()); + // } + // + // if(this.audioSourceMain != null) { + // this.audioSourceMain.play(); + // } + // } + // + // if(this.output < 40.0F) { + // if(this.lastOutput <= 0.0F || this.lastOutput >= 40.0F) { + // if(this.audioSourceGeiger != null) { + // this.audioSourceGeiger.remove(); + // } + // + // this.audioSourceGeiger = IC2.audioManager.createSource(this, PositionSpec.Center, "Generators/NuclearReactor/GeigerLowEU.ogg", true, false, IC2.audioManager.getDefaultVolume()); + // if(this.audioSourceGeiger != null) { + // this.audioSourceGeiger.play(); + // } + // } + // } else if(this.output < 80.0F) { + // if(this.lastOutput < 40.0F || this.lastOutput >= 80.0F) { + // if(this.audioSourceGeiger != null) { + // this.audioSourceGeiger.remove(); + // } + // + // this.audioSourceGeiger = IC2.audioManager.createSource(this, PositionSpec.Center, "Generators/NuclearReactor/GeigerMedEU.ogg", true, false, IC2.audioManager.getDefaultVolume()); + // if(this.audioSourceGeiger != null) { + // this.audioSourceGeiger.play(); + // } + // } + // } else if(this.output >= 80.0F && this.lastOutput < 80.0F) { + // if(this.audioSourceGeiger != null) { + // this.audioSourceGeiger.remove(); + // } + // + // this.audioSourceGeiger = IC2.audioManager.createSource(this, PositionSpec.Center, "Generators/NuclearReactor/GeigerHighEU.ogg", true, false, IC2.audioManager.getDefaultVolume()); + // if(this.audioSourceGeiger != null) { + // this.audioSourceGeiger.play(); + // } + // } + // } else if(this.lastOutput > 0.0F) { + // if(this.audioSourceMain != null) { + // this.audioSourceMain.stop(); + // } + // + // if(this.audioSourceGeiger != null) { + // this.audioSourceGeiger.stop(); + // } + // } + // + // this.lastOutput = this.output; + // } + // + // super.onNetworkUpdate(field); + //} + + //public float getWrenchDropRate() { + // return 1F; + //} + + //public ChunkCoordinates getPosition() { + // return new ChunkCoordinates(this.xCoord, this.yCoord, this.zCoord); + //} + + //public World getWorld() { + // return this.worldObj; + //} + + //public int getHeat() { + // return this.heat; + //} + + //public void setHeat(int heat1) { + // this.heat = heat1; + //} + + //public int addHeat(int amount) { + // this.heat += amount; + // return this.heat; + //} + + //public ItemStack getItemAt(int x, int y) { + // return x >= 0 && x < this.getReactorSize() && y >= 0 && y < 6?this.reactorSlot.get(x, y):null; + //} + + //public void setItemAt(int x, int y, ItemStack item) { + // if(x >= 0 && x < this.getReactorSize() && y >= 0 && y < 6) { + // this.reactorSlot.put(x, y, item); + // } + //} + + @Override + public void explode() { + getWorld().playSoundEffect(xCoord,yCoord,zCoord, Reference.MODID+":microwave_ding", 1, 1); + } + + @Override + public void addEmitHeat(int heat) {} + + //region no need + //public int getMaxHeat() { + // return this.maxHeat; + //} + + //public void setMaxHeat(int newMaxHeat) { + // this.maxHeat = newMaxHeat; + //} + + //public float getHeatEffectModifier() { + // return this.hem; + //} + + //public void setHeatEffectModifier(float newHEM) { + // this.hem = newHEM; + //} + + //public float getReactorEnergyOutput() { + // return this.output; + //} + + //public float addOutput(float energy) { + // return this.output += energy; + //} + + //PRIVATE not used + //private RecipeOutput processInputSlot(boolean simulate) { + // if(!this.coolantinputSlot.isEmpty()) { + // MutableObject output = new MutableObject(); + // if(this.coolantinputSlot.transferToTank(this.inputTank, output, simulate) && (output.getValue() == null || this.coolantoutputSlot.canAdd((ItemStack)output.getValue()))) { + // if(output.getValue() == null) { + // return new RecipeOutput(null); + // } + // + // return new RecipeOutput(null, (ItemStack)output.getValue()); + // } + // } + // + // return null; + //} + + //private RecipeOutput processOutputSlot(boolean simulate) { + // if(!this.hotcoolinputSlot.isEmpty()) { + // MutableObject output = new MutableObject(); + // if(this.hotcoolinputSlot.transferFromTank(this.outputTank, output, simulate) && (output.getValue() == null || this.hotcoolantoutputSlot.canAdd((ItemStack)output.getValue()))) { + // if(output.getValue() == null) { + // return new RecipeOutput(null); + // } + // + // return new RecipeOutput(null, (ItemStack)output.getValue()); + // } + // } + // + // return null; + //} + + @Override + public boolean isFluidCooled() { + return false; + } + + //!!!Private - removed use cases + //private void movefluidinWorld(boolean out) { + // if(out) { + // if(this.inputTank.getFluidAmount() < 1000 && this.outputTank.getFluidAmount() < 1000) { + // this.inputTank.setFluid(null); + // this.outputTank.setFluid(null); + // } else { + // for(int coolantFluid = 1; coolantFluid < 4; ++coolantFluid) { + // for(int coolantBlock = 1; coolantBlock < 4; ++coolantBlock) { + // for(int hotCoolantFluid = 1; hotCoolantFluid < 4; ++hotCoolantFluid) { + // if(this.surroundings[coolantBlock][coolantFluid][hotCoolantFluid] instanceof BlockAir) { + // if(this.inputTank.getFluidAmount() >= 1000) { + // this.worldObj.setBlock(coolantBlock + this.xCoord - 2, coolantFluid + this.yCoord - 2, hotCoolantFluid + this.zCoord - 2, this.inputTank.getFluid().getFluid().getBlock()); + // this.inputTank.drain(1000, true); + // } else if(this.outputTank.getFluidAmount() >= 1000) { + // this.worldObj.setBlock(coolantBlock + this.xCoord - 2, coolantFluid + this.yCoord - 2, hotCoolantFluid + this.zCoord - 2, this.outputTank.getFluid().getFluid().getBlock()); + // this.outputTank.drain(1000, true); + // } + // } + // } + // } + // } + // + // if(this.inputTank.getFluidAmount() < 1000) { + // this.inputTank.setFluid(null); + // } + // + // if(this.outputTank.getFluidAmount() < 1000) { + // this.outputTank.setFluid(null); + // } + // } + // } else { + // Fluid var9 = BlocksItems.getFluid(InternalName.fluidCoolant); + // Block var10 = BlocksItems.getFluidBlock(InternalName.fluidCoolant); + // Fluid var11 = BlocksItems.getFluid(InternalName.fluidHotCoolant); + // Block hotCoolantBlock = BlocksItems.getFluidBlock(InternalName.fluidHotCoolant); + // + // for(int yoffset = 1; yoffset < 4; ++yoffset) { + // for(int xoffset = 1; xoffset < 4; ++xoffset) { + // for(int zoffset = 1; zoffset < 4; ++zoffset) { + // if(this.surroundings[xoffset][yoffset][zoffset] == var10) { + // this.worldObj.setBlock(xoffset + this.xCoord - 2, yoffset + this.yCoord - 2, zoffset + this.zCoord - 2, Blocks.air); + // this.inputTank.fill(new FluidStack(var9, 1000), true); + // } else if(this.surroundings[xoffset][yoffset][zoffset] == hotCoolantBlock) { + // this.worldObj.setBlock(xoffset + this.xCoord - 2, yoffset + this.yCoord - 2, zoffset + this.zCoord - 2, Blocks.air); + // this.outputTank.fill(new FluidStack(var11, 1000), true); + // } + // } + // } + // } + // } + // + //} + + //!!!! PRIVATE - removed use cases + //private boolean readyforpressurizedreactor() { + // Block coolantBlock = BlocksItems.getFluidBlock(InternalName.fluidCoolant); + // Block hotCoolantBlock = BlocksItems.getFluidBlock(InternalName.fluidHotCoolant); + // + // int xoffset; + // int yoffset; + // int zoffset; + // for(xoffset = -2; xoffset < 3; ++xoffset) { + // for(yoffset = -2; yoffset < 3; ++yoffset) { + // for(zoffset = -2; zoffset < 3; ++zoffset) { + // if(this.worldObj.isAirBlock(xoffset + this.xCoord, yoffset + this.yCoord, zoffset + this.zCoord)) { + // this.surroundings[xoffset + 2][yoffset + 2][zoffset + 2] = Blocks.air; + // } else { + // Block block = this.worldObj.getBlock(xoffset + this.xCoord, yoffset + this.yCoord, zoffset + this.zCoord); + // if((block == coolantBlock || block == hotCoolantBlock) && this.worldObj.getBlockMetadata(xoffset + this.xCoord, yoffset + this.yCoord, zoffset + this.zCoord) != 0) { + // this.surroundings[xoffset + 2][yoffset + 2][zoffset + 2] = Blocks.air; + // } else { + // this.surroundings[xoffset + 2][yoffset + 2][zoffset + 2] = block; + // } + // } + // } + // } + // } + // + // for(xoffset = 1; xoffset < 4; ++xoffset) { + // for(yoffset = 1; yoffset < 4; ++yoffset) { + // for(zoffset = 1; zoffset < 4; ++zoffset) { + // if(!(this.surroundings[xoffset][yoffset][zoffset] instanceof BlockGenerator) && !(this.surroundings[xoffset][yoffset][zoffset] instanceof BlockReactorChamber) && this.surroundings[xoffset][yoffset][zoffset] != coolantBlock && this.surroundings[xoffset][yoffset][zoffset] != hotCoolantBlock && !(this.surroundings[xoffset][yoffset][zoffset] instanceof BlockAir)) { + // return false; + // } + // } + // } + // } + // + // for(xoffset = 0; xoffset < 5; ++xoffset) { + // for(yoffset = 0; yoffset < 5; ++yoffset) { + // if(!(this.surroundings[xoffset][4][yoffset] instanceof BlockReactorVessel) && !(this.surroundings[xoffset][4][yoffset] instanceof BlockReactorAccessHatch) && !(this.surroundings[xoffset][4][yoffset] instanceof BlockReactorRedstonePort) && !(this.surroundings[xoffset][4][yoffset] instanceof BlockReactorFluidPort)) { + // return false; + // } + // + // if(!(this.surroundings[xoffset][0][yoffset] instanceof BlockReactorVessel) && !(this.surroundings[xoffset][0][yoffset] instanceof BlockReactorAccessHatch) && !(this.surroundings[xoffset][0][yoffset] instanceof BlockReactorRedstonePort) && !(this.surroundings[xoffset][0][yoffset] instanceof BlockReactorFluidPort)) { + // return false; + // } + // + // if(!(this.surroundings[0][xoffset][yoffset] instanceof BlockReactorVessel) && !(this.surroundings[0][xoffset][yoffset] instanceof BlockReactorAccessHatch) && !(this.surroundings[0][xoffset][yoffset] instanceof BlockReactorRedstonePort) && !(this.surroundings[0][xoffset][yoffset] instanceof BlockReactorFluidPort)) { + // return false; + // } + // + // if(!(this.surroundings[4][xoffset][yoffset] instanceof BlockReactorVessel) && !(this.surroundings[4][xoffset][yoffset] instanceof BlockReactorAccessHatch) && !(this.surroundings[4][xoffset][yoffset] instanceof BlockReactorRedstonePort) && !(this.surroundings[4][xoffset][yoffset] instanceof BlockReactorFluidPort)) { + // return false; + // } + // + // if(!(this.surroundings[yoffset][xoffset][0] instanceof BlockReactorVessel) && !(this.surroundings[yoffset][xoffset][0] instanceof BlockReactorAccessHatch) && !(this.surroundings[yoffset][xoffset][0] instanceof BlockReactorRedstonePort) && !(this.surroundings[yoffset][xoffset][0] instanceof BlockReactorFluidPort)) { + // return false; + // } + // + // if(!(this.surroundings[yoffset][xoffset][4] instanceof BlockReactorVessel) && !(this.surroundings[yoffset][xoffset][4] instanceof BlockReactorAccessHatch) && !(this.surroundings[yoffset][xoffset][4] instanceof BlockReactorRedstonePort) && !(this.surroundings[yoffset][xoffset][4] instanceof BlockReactorFluidPort)) { + // return false; + // } + // } + // } + // + // return true; + //} + + //public int gaugeLiquidScaled(int i, int tank) { + // switch(tank) { + // case 0: + // if(this.inputTank.getFluidAmount() <= 0) { + // return 0; + // } + // + // return this.inputTank.getFluidAmount() * i / this.inputTank.getCapacity(); + // case 1: + // if(this.outputTank.getFluidAmount() <= 0) { + // return 0; + // } + // + // return this.outputTank.getFluidAmount() * i / this.outputTank.getCapacity(); + // default: + // return 0; + // } + //} + + //public FluidTank getinputtank() { + // return this.inputTank; + //} + + //public FluidTank getoutputtank() { + // return this.outputTank; + //} + + //public FluidTankInfo[] getTankInfo(ForgeDirection from) { + // return new FluidTankInfo[]{this.inputTank.getInfo(), this.outputTank.getInfo()}; + //} + + @Override + public boolean canFill(ForgeDirection from, Fluid fluid) { + return false; + } + + @Override + public boolean canDrain(ForgeDirection from, Fluid fluid) { + return false; + } + + @Override + public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { + return 0; + } + + @Override + public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { + return null; + } + + @Override + public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { + return null; + } + + @Override + public int getInventoryStackLimit() { + return 1; + } +} diff --git a/src/main/resources/assets/tectech/textures/blocks/blockReactorSimulator.png b/src/main/resources/assets/tectech/textures/blocks/blockReactorSimulator.png new file mode 100644 index 0000000000..92c6a3691c Binary files /dev/null and b/src/main/resources/assets/tectech/textures/blocks/blockReactorSimulator.png differ -- cgit From f80d0e3467231d67d3da303ca2c1385996febb2a Mon Sep 17 00:00:00 2001 From: Technus Date: Thu, 14 Dec 2017 21:21:18 +0100 Subject: first draft of scanning of em data extraction --- src/main/java/com/github/technus/tectech/Util.java | 12 +++ .../definitions/dComplexAspectDefinition.java | 28 +++++ .../core/cElementalInstanceStackMap.java | 21 +++- .../elementalMatter/core/cElementalStackMap.java | 7 -- .../core/containers/cElementalInstanceStack.java | 44 +++++++- .../core/interfaces/iElementalDefinition.java | 4 + .../core/templates/cElementalDefinition.java | 5 + .../core/templates/cElementalPrimitive.java | 25 +++++ .../definitions/complex/dAtomDefinition.java | 45 ++++++-- .../definitions/complex/dHadronDefinition.java | 55 +++++++--- .../github/technus/tectech/loader/MainLoader.java | 6 +- .../technus/tectech/loader/ThingsLoader.java | 12 +-- .../technus/tectech/recipe/TT_recipeAdder.java | 10 +- .../tectech/thing/item/DebugContainer_EM.java | 100 ------------------ .../item/DebugElementalInstanceContainer_EM.java | 101 ++++++++++++++++++ .../tectech/thing/item/DefinitionContainer_EM.java | 114 -------------------- .../item/ElementalDefinitionContainer_EM.java | 115 +++++++++++++++++++++ .../item/ElementalDefinitionScanStorage_EM.java | 96 +++++++++++++++++ .../multi/GT_MetaTileEntity_EM_scanner.java | 7 ++ .../tileentity/turret/TileTurretHeadEM.java | 4 +- src/main/resources/assets/tectech/lang/en_US.lang | 1 + .../textures/items/itemDefinitionScanStorage.png | Bin 0 -> 7526 bytes .../items/itemDefinitionScanStorage.png.mcmeta | 5 + .../items/itemDefinitionScanStorageOff.png | Bin 0 -> 5511 bytes .../items/itemDefinitionScanStorageOff.png.mcmeta | 5 + 25 files changed, 557 insertions(+), 265 deletions(-) delete mode 100644 src/main/java/com/github/technus/tectech/thing/item/DebugContainer_EM.java create mode 100644 src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/item/DefinitionContainer_EM.java create mode 100644 src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java create mode 100644 src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java create mode 100644 src/main/resources/assets/tectech/textures/items/itemDefinitionScanStorage.png create mode 100644 src/main/resources/assets/tectech/textures/items/itemDefinitionScanStorage.png.mcmeta create mode 100644 src/main/resources/assets/tectech/textures/items/itemDefinitionScanStorageOff.png create mode 100644 src/main/resources/assets/tectech/textures/items/itemDefinitionScanStorageOff.png.mcmeta (limited to 'src/main/resources/assets/tectech/textures') diff --git a/src/main/java/com/github/technus/tectech/Util.java b/src/main/java/com/github/technus/tectech/Util.java index 2f2cc9c298..c0aec1baf8 100644 --- a/src/main/java/com/github/technus/tectech/Util.java +++ b/src/main/java/com/github/technus/tectech/Util.java @@ -11,6 +11,7 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; @@ -815,4 +816,15 @@ public class Util { strings[strings.length-1]=string.substring(lastEnd); return strings; } + + public static String[] infoFromNBT(NBTTagCompound nbt) { + final String[] strings = new String[nbt.getInteger("i")]; + for (int i = 0; i < strings.length; i++) + strings[i] = nbt.getString(Integer.toString(i)); + return strings; + } + + public static boolean areBitsSet(int setBits,int testedValue){ + return (testedValue&setBits)==setBits; + } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/dComplexAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/dComplexAspectDefinition.java index 034aa55642..29a3a714b8 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/dComplexAspectDefinition.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/dComplexAspectDefinition.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.compatibility.thaumcraft.definitions; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.Util; import com.github.technus.tectech.elementalMatter.core.cElementalDecay; import com.github.technus.tectech.elementalMatter.core.cElementalDefinitionStackMap; import com.github.technus.tectech.elementalMatter.core.containers.cElementalDefinitionStack; @@ -13,9 +14,12 @@ import com.github.technus.tectech.elementalMatter.core.transformations.aOredictD import com.github.technus.tectech.elementalMatter.definitions.primitive.eBosonDefinition; import net.minecraft.nbt.NBTTagCompound; +import java.util.ArrayList; + import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.compatibility.thaumcraft.definitions.AspectDefinitionCompat.aspectDefinitionCompat; import static com.github.technus.tectech.elementalMatter.core.cElementalDecay.noDecay; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; /** * Created by Tec on 06.05.2017. @@ -228,4 +232,28 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme public int hashCode() { return hash; } + + + + @Override + public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { + if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) + lines.add("CLASS = "+nbtType+" "+getClassType()); + if(Util.areBitsSet(SCAN_GET_NOMENCLATURE+SCAN_GET_COLOR+SCAN_GET_CHARGE+SCAN_GET_MASS, capabilities)) { + lines.add("NAME = "+getName()); + //lines.add("SYMBOL = "+getSymbol()); + } + if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) + lines.add("CHARGE = "+getCharge()/3f+" eV"); + if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) + lines.add(getColor()<0?"NOT COLORED":"CARRIES COLOR"); + if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) + lines.add("MASS = "+getMass()+" eV/c\u00b2"); + //TODO decay info - no energy states info here + if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ + lines.add(isTimeSpanHalfLife()?"TIME SPAN IS HALF LIFE":"TIME SPAN IS LIFE TIME"); + lines.add("TIME SPAN = "+getRawTimeSpan(energyLevel)+ " s"); + lines.add(" "+"At current energy level"); + } + } } diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalInstanceStackMap.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalInstanceStackMap.java index 5891d4e252..347836764b 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalInstanceStackMap.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalInstanceStackMap.java @@ -7,6 +7,7 @@ import com.github.technus.tectech.elementalMatter.core.interfaces.iHasElementalD import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; +import java.util.ArrayList; import java.util.Iterator; import java.util.Map; import java.util.TreeMap; @@ -307,6 +308,14 @@ public final class cElementalInstanceStackMap implements Comparable getScanInfo(int[] capabilities) { + ArrayList list=new ArrayList<>(16); + for(Map.Entry e:map.entrySet()){ + e.getValue().addScanResults(list,capabilities); + } + return list; + } + public cElementalInstanceStack[] values() { return map.values().toArray(new cElementalInstanceStack[0]); } @@ -370,11 +379,13 @@ public final class cElementalInstanceStackMap implements Comparable info = getScanInfo(capabilities); + nbt.setInteger("i", info.size()); + for (int i = 0; i < info.size(); i++) + nbt.setString(Integer.toString(i), info.get(i)); + return nbt; } public NBTTagCompound toNBT() { diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalStackMap.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalStackMap.java index 55446e9c93..c95427d906 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalStackMap.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalStackMap.java @@ -80,13 +80,6 @@ abstract class cElementalStackMap implements Comparable { return nbt; } - public static String[] infoFromNBT(NBTTagCompound nbt) { - final String[] strings = new String[nbt.getInteger("i")]; - for (int i = 0; i < strings.length; i++) - strings[i] = nbt.getString(Integer.toString(i)); - return strings; - } - public final NBTTagCompound toNBT() { final NBTTagCompound nbt = new NBTTagCompound(); nbt.setInteger("i", map.size()); diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/containers/cElementalInstanceStack.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/containers/cElementalInstanceStack.java index a28fed340e..5a79eeee42 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/core/containers/cElementalInstanceStack.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/containers/cElementalInstanceStack.java @@ -1,14 +1,19 @@ package com.github.technus.tectech.elementalMatter.core.containers; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.Util; import com.github.technus.tectech.elementalMatter.core.cElementalDecay; +import com.github.technus.tectech.elementalMatter.core.cElementalDefinitionStackMap; import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.elementalMatter.core.interfaces.iElementalDefinition; import com.github.technus.tectech.elementalMatter.core.interfaces.iHasElementalDefinition; import com.github.technus.tectech.elementalMatter.core.templates.cElementalDefinition; import net.minecraft.nbt.NBTTagCompound; +import java.util.ArrayList; + import static com.github.technus.tectech.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; /** * Created by danie_000 on 22.10.2016. @@ -147,7 +152,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { return decay(1F,apparentAge,postEnergize); } - public cElementalInstanceStackMap decay(Float lifeTimeMult, long apparentAge, long postEnergize) { + public cElementalInstanceStackMap decay(float lifeTimeMult, long apparentAge, long postEnergize) { long newEnergyLevel=postEnergize+this.energy; if(newEnergyLevel>0) newEnergyLevel-=1; else if(newEnergyLevel<0) newEnergyLevel+=1; @@ -300,6 +305,43 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { return this; } + public void addScanResults(ArrayList lines, int[] detailsOnDepthLevels){ + final int capabilities=detailsOnDepthLevels[0]; + if(Util.areBitsSet(SCAN_GET_DEPTH_LEVEL,capabilities)) + lines.add("DEPTH = "+0); + definition.addScanResults(lines,capabilities,energy); + if(Util.areBitsSet(SCAN_GET_TIMESPAN_MULT,capabilities)) { + lines.add("TIME SPAN MULTIPLIER = " + lifeTimeMult); + if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO,capabilities)) + lines.add("TIME SPAN MULTIPLIED = "+lifeTime+" s"); + } + if(Util.areBitsSet(SCAN_GET_AGE,capabilities)) + lines.add("AGE = " + age+" s"); + if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) + lines.add("COLOR = "+color+" RGB or CMY"); + if(Util.areBitsSet(SCAN_GET_ENERGY_LEVEL,capabilities)) + lines.add("ENERGY LEVEL = "+energy); + if(Util.areBitsSet(SCAN_GET_AMOUNT,capabilities)) + lines.add("AMOUNT = "+amount); + lines.add(null);//def separator + scanContents(lines,definition.getSubParticles(),1,detailsOnDepthLevels); + } + + private void scanContents(ArrayList lines, cElementalDefinitionStackMap definitions, int depth, int[] detailsOnDepthLevels){ + if(definitions!=null && depth,C String getSymbol(); + void addScanResults(ArrayList lines, int capabilities, long energyLevel); + byte getType(); byte getClassType();//bigger number means bigger things usually, but it is just used to differentiate between classes of iED diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalDefinition.java index 021a762f6f..c455506435 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalDefinition.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalDefinition.java @@ -1,17 +1,22 @@ package com.github.technus.tectech.elementalMatter.core.templates; +import com.github.technus.tectech.Util; import com.github.technus.tectech.elementalMatter.core.containers.cElementalDefinitionStack; import com.github.technus.tectech.elementalMatter.core.interfaces.iElementalDefinition; import com.github.technus.tectech.elementalMatter.core.interfaces.iHasElementalDefinition; import net.minecraft.nbt.NBTTagCompound; import java.lang.reflect.Method; +import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +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_TIMESPAN_INFO; /** * Created by danie_000 on 23.01.2017. diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalPrimitive.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalPrimitive.java index 2a2a3459c2..08cf157afb 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalPrimitive.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalPrimitive.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.elementalMatter.core.templates; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.Util; import com.github.technus.tectech.elementalMatter.core.cElementalDecay; import com.github.technus.tectech.elementalMatter.core.cElementalDefinitionStackMap; import com.github.technus.tectech.elementalMatter.core.interfaces.iElementalDefinition; @@ -12,11 +13,13 @@ import net.minecraft.client.Minecraft; import net.minecraft.crash.CrashReport; import net.minecraft.nbt.NBTTagCompound; +import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; /** * Created by danie_000 on 22.10.2016. @@ -176,6 +179,28 @@ public abstract class cElementalPrimitive extends cElementalDefinition { return -128; } + @Override + public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { + if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) + lines.add("CLASS = "+nbtType+" "+getClassType()); + if(Util.areBitsSet(SCAN_GET_NOMENCLATURE+SCAN_GET_COLOR+SCAN_GET_CHARGE+SCAN_GET_MASS, capabilities)) { + lines.add("NAME = "+getName()); + lines.add("SYMBOL = "+getSymbol()); + } + if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) + lines.add("CHARGE = "+getCharge()/3f+" eV"); + if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) + lines.add(getColor()<0?"NOT COLORED":"CARRIES COLOR"); + if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) + lines.add("MASS = "+getMass()+" eV/c\u00b2"); + //TODO decay info - no energy states info here + if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ + lines.add(isTimeSpanHalfLife()?"TIME SPAN IS HALF LIFE":"TIME SPAN IS LIFE TIME"); + lines.add("TIME SPAN = "+getRawTimeSpan(energyLevel)+ " s"); + lines.add(" "+"At current energy level"); + } + } + public static void run() { try { cElementalDefinition.addCreatorFromNBT(nbtType, cElementalPrimitive.class.getMethod("fromNBT", NBTTagCompound.class),(byte)-128); diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/dAtomDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/dAtomDefinition.java index 92ba693889..d8a04d16b3 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/dAtomDefinition.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/dAtomDefinition.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.elementalMatter.definitions.complex; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.Util; import com.github.technus.tectech.XSTR; import com.github.technus.tectech.compatibility.gtpp.GtppAtomLoader; import com.github.technus.tectech.elementalMatter.core.cElementalDecay; @@ -29,6 +30,7 @@ import static com.github.technus.tectech.XSTR.XSTR_INSTANCE; import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__; import static com.github.technus.tectech.elementalMatter.definitions.primitive.eBosonDefinition.deadEnd; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; import static gregtech.api.enums.OrePrefixes.dust; /** @@ -397,7 +399,7 @@ public final class dAtomDefinition extends cElementalDefinition { else if(energy<=0) state = iaea.energeticStatesArray[0]; else state=iaea.energeticStatesArray[(int)energy]; for (int i=0;i decaysList,iaeaNuclide.iaeaDecay decay){ + private boolean getDecay(ArrayList decaysList,iaeaNuclide.iaeaDecay decay, long energy){ cElementalMutableDefinitionStackMap withThis=elementalStacks.toMutable(),newStuff=new cElementalMutableDefinitionStackMap(); switch (decay.decayName){ case "D": { @@ -834,9 +836,16 @@ public final class dAtomDefinition extends cElementalDefinition { } } } break; - case "IT": case "IT?": case "G": - decaysList.add(new cElementalDecay(decay.chance, this, eBosonDefinition.boson_Y__)); - return true; + case "IT": case "IT?": case "G": { + if(energy>0){ + decaysList.add(new cElementalDecay(decay.chance, this, eBosonDefinition.boson_Y__)); + return true; + }else{ + if(DEBUG_MODE) TecTech.Logger.info("Tried to emit Gamma from ground state"); + decaysList.add(new cElementalDecay(decay.chance, this)); + return true; + } + } //break; case "IT+EC+B+": { if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2,eLeptonDefinition.lepton_e1)){ withThis.putUnify(dHadronDefinition.hadron_n2); @@ -1053,7 +1062,7 @@ public final class dAtomDefinition extends cElementalDefinition { @Override public cElementalDecay[] getNaturalDecayInstant() { //disembody - ArrayList decaysInto = new ArrayList(); + ArrayList decaysInto = new ArrayList<>(); for (cElementalDefinitionStack elementalStack : elementalStacks.values()) { if (elementalStack.definition.getType() == 1 || elementalStack.definition.getType() == -1) { //covers both quarks and antiquarks @@ -1405,4 +1414,28 @@ public final class dAtomDefinition extends cElementalDefinition { public int hashCode() { return hash; } + + + + @Override + public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { + if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) + lines.add("CLASS = "+nbtType+" "+getClassType()); + if(Util.areBitsSet(SCAN_GET_NOMENCLATURE+SCAN_GET_AMOUNT+SCAN_GET_COLOR+SCAN_GET_CHARGE+SCAN_GET_MASS, capabilities)) { + lines.add("NAME = "+getName()); + lines.add("SYMBOL = "+getSymbol()); + } + if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) + lines.add("CHARGE = "+getCharge()/3f+" eV"); + if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) + lines.add(getColor()<0?"NOT COLORED":"CARRIES COLOR"); + if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) + lines.add("MASS = "+getMass()+" eV/c\u00b2"); + //TODO decay info - no energy states info here + if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ + lines.add(isTimeSpanHalfLife()?"TIME SPAN IS HALF LIFE":"TIME SPAN IS LIFE TIME"); + lines.add("TIME SPAN = "+getRawTimeSpan(energyLevel)+ " s"); + lines.add(" "+"At current energy level"); + } + } } diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/dHadronDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/dHadronDefinition.java index f7bb9c7f5d..bc985aa5b5 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/dHadronDefinition.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/dHadronDefinition.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.elementalMatter.definitions.complex; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.Util; import com.github.technus.tectech.auxiliary.TecTechConfig; import com.github.technus.tectech.elementalMatter.core.cElementalDecay; import com.github.technus.tectech.elementalMatter.core.cElementalDefinitionStackMap; @@ -22,6 +23,9 @@ import java.util.ArrayList; import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.elementalMatter.definitions.complex.dAtomDefinition.transformation; import static com.github.technus.tectech.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +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_TIMESPAN_INFO; import static gregtech.api.enums.OrePrefixes.dust; /** @@ -121,30 +125,29 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi @Override public String getName() { + StringBuilder name= new StringBuilder(getSimpleName()); + for (cElementalDefinitionStack quark : quarkStacks.values()) { + name.append(" ").append(quark.definition.getSymbol()).append(quark.amount); + } + return name.toString(); + } + + private String getSimpleName() { String name; switch (amount) { case 2: - name = "Meson:"; - break; + return "Meson"; case 3: - name = "Baryon:"; - break; + return "Baryon"; case 4: - name = "Tetraquark:"; - break; + return "Tetraquark"; case 5: - name = "Pentaquark:"; - break; + return "Pentaquark"; case 6: - name = "Hexaquark:"; - break; + return "Hexaquark"; default: - name = "Hadron:"; - } - for (cElementalDefinitionStack quark : quarkStacks.values()) { - name += " " + quark.definition.getSymbol() + quark.amount; + return "Hadron"; } - return name; } @Override @@ -392,4 +395,26 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi public int hashCode() { return hash; } + + @Override + public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { + if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) + lines.add("CLASS = "+nbtType+" "+getClassType()); + if(Util.areBitsSet(SCAN_GET_NOMENCLATURE+SCAN_GET_AMOUNT, capabilities)) { + lines.add("NAME = "+getSimpleName()); + //lines.add("SYMBOL = "+getSymbol()); + } + if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) + lines.add("CHARGE = "+getCharge()/3f+" eV"); + if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) + lines.add(getColor()<0?"NOT COLORED":"CARRIES COLOR"); + if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) + lines.add("MASS = "+getMass()+" eV/c\u00b2"); + //TODO decay info - no energy states info here + if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ + lines.add(isTimeSpanHalfLife()?"TIME SPAN IS HALF LIFE":"TIME SPAN IS LIFE TIME"); + lines.add("TIME SPAN = "+getRawTimeSpan(energyLevel)+ " s"); + lines.add(" "+"At current energy level"); + } + } } 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 4259078c69..bcff2ddfaa 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -9,7 +9,7 @@ import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.item.ConstructableTriggerItem; -import com.github.technus.tectech.thing.item.DebugContainer_EM; +import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; import com.github.technus.tectech.thing.item.ParametrizerMemoryCard; import cpw.mods.fml.common.ProgressManager; import cpw.mods.fml.relauncher.Side; @@ -89,7 +89,7 @@ public final class MainLoader { @SideOnly(Side.CLIENT) @Override public Item getTabIconItem() { - return DebugContainer_EM.INSTANCE; + return DebugElementalInstanceContainer_EM.INSTANCE; } @Override @@ -117,7 +117,7 @@ public final class MainLoader { QuantumGlassBlock.INSTANCE.setCreativeTab(mainTab); TT_Container_Casings.sBlockCasingsTT.setCreativeTab(mainTab); TT_Container_Casings.sHintCasingsTT.setCreativeTab(mainTab); - DebugContainer_EM.INSTANCE.setCreativeTab(mainTab); + DebugElementalInstanceContainer_EM.INSTANCE.setCreativeTab(mainTab); ConstructableTriggerItem.INSTANCE.setCreativeTab(mainTab); ParametrizerMemoryCard.INSTANCE.setCreativeTab(mainTab); } diff --git a/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java b/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java index d957152db5..e42e8e8edc 100644 --- a/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java @@ -7,10 +7,7 @@ import com.github.technus.tectech.thing.block.ReactorSimBlock; import com.github.technus.tectech.thing.casing.GT_Block_CasingsTT; import com.github.technus.tectech.thing.casing.GT_Block_HintTT; import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.thing.item.ConstructableTriggerItem; -import com.github.technus.tectech.thing.item.DebugContainer_EM; -import com.github.technus.tectech.thing.item.DefinitionContainer_EM; -import com.github.technus.tectech.thing.item.ParametrizerMemoryCard; +import com.github.technus.tectech.thing.item.*; import cpw.mods.fml.common.Loader; import openmodularturrets.blocks.turretbases.TurretBaseEM; import openmodularturrets.blocks.turretheads.TurretHeadEM; @@ -43,10 +40,11 @@ public class ThingsLoader implements Runnable { ConstructableTriggerItem.run(); ParametrizerMemoryCard.run(); - TecTech.Logger.info("Useful item registered"); + ElementalDefinitionScanStorage_EM.run(); + TecTech.Logger.info("Useful Items registered"); - DefinitionContainer_EM.run(); - DebugContainer_EM.run(); + ElementalDefinitionContainer_EM.run(); + DebugElementalInstanceContainer_EM.run(); TecTech.Logger.info("Debug Items registered"); } } 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 880ba1c8d4..9238085a35 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 @@ -4,7 +4,7 @@ import com.github.technus.tectech.TecTech; import com.github.technus.tectech.elementalMatter.core.cElementalDefinitionStackMap; import com.github.technus.tectech.elementalMatter.core.containers.cElementalDefinitionStack; import com.github.technus.tectech.elementalMatter.core.interfaces.iElementalDefinition; -import com.github.technus.tectech.thing.item.DefinitionContainer_EM; +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.GT_MetaTileEntity_EM_machine; import gregtech.api.enums.ItemList; @@ -104,8 +104,8 @@ public class TT_recipeAdder extends GT_RecipeAdder { 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(DefinitionContainer_EM.INSTANCE); - DefinitionContainer_EM.setContent(placeholder,new cElementalDefinitionStackMap(new cElementalDefinitionStack(aResearchEM,1))); + ItemStack placeholder=new ItemStack(ElementalDefinitionContainer_EM.INSTANCE); + ElementalDefinitionContainer_EM.setContent(placeholder,new cElementalDefinitionStackMap(new cElementalDefinitionStack(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)); @@ -123,8 +123,8 @@ public class TT_recipeAdder extends GT_RecipeAdder { 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(DefinitionContainer_EM.INSTANCE); - DefinitionContainer_EM.setContent(placeholder,new cElementalDefinitionStackMap(new cElementalDefinitionStack(aResearchEM,1))); + ItemStack placeholder=new ItemStack(ElementalDefinitionContainer_EM.INSTANCE); + ElementalDefinitionContainer_EM.setContent(placeholder,new cElementalDefinitionStackMap(new cElementalDefinitionStack(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)); diff --git a/src/main/java/com/github/technus/tectech/thing/item/DebugContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/DebugContainer_EM.java deleted file mode 100644 index 0bc5487432..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/item/DebugContainer_EM.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.github.technus.tectech.thing.item; - -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.elementalMatter.core.interfaces.iElementalInstanceContainer; -import com.github.technus.tectech.elementalMatter.core.tElementalException; -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -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 java.util.Collections; -import java.util.List; - -import static com.github.technus.tectech.auxiliary.Reference.MODID; -import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; - -/** - * Created by Tec on 15.03.2017. - */ -public class DebugContainer_EM extends Item { - public static DebugContainer_EM INSTANCE; - - private DebugContainer_EM() { - super(); - setMaxStackSize(1); - setUnlocalizedName("em.debugContainer"); - setTextureName(MODID + ":itemDebugContainer"); - } - - @Override - public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, 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 != null && tTileEntity instanceof IGregTechTileEntity) { - IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); - if (metaTE != null && metaTE instanceof iElementalInstanceContainer) { - cElementalInstanceStackMap content = ((iElementalInstanceContainer) metaTE).getContainerHandler(); - if (tNBT.hasKey("content")) { - try { - content.putUnifyAll(cElementalInstanceStackMap.fromNBT(tNBT.getCompoundTag("content"))); - } catch (tElementalException e) { - if (DEBUG_MODE) e.printStackTrace(); - return true; - } - ((iElementalInstanceContainer) metaTE).purgeOverflow(); - tNBT.removeTag("content"); - tNBT.removeTag("info"); - } else if (content.hasStacks()) { - ((iElementalInstanceContainer) metaTE).purgeOverflow(); - tNBT.setTag("info", content.getInfoNBT()); - tNBT.setTag("content", content.toNBT()); - content.clear(); - } - return true; - } - } - } - return aPlayer instanceof EntityPlayerMP; - } - - @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("info")) { - aList.add("Contains:"); - Collections.addAll(aList, cElementalInstanceStackMap.infoFromNBT(tNBT.getCompoundTag("info"))); - } else { - aList.add("Container for elemental matter"); - aList.add(EnumChatFormatting.BLUE + "Right click on elemental hatches"); - } - } catch (Exception e) { - aList.add("---Unexpected Termination---"); - } - } - - public static void run() { - INSTANCE = new DebugContainer_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); - } -} 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 new file mode 100644 index 0000000000..89362c9469 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java @@ -0,0 +1,101 @@ +package com.github.technus.tectech.thing.item; + +import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.Util; +import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.elementalMatter.core.interfaces.iElementalInstanceContainer; +import com.github.technus.tectech.elementalMatter.core.tElementalException; +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +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 java.util.Collections; +import java.util.List; + +import static com.github.technus.tectech.auxiliary.Reference.MODID; +import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; + +/** + * Created by Tec on 15.03.2017. + */ +public class DebugElementalInstanceContainer_EM extends Item { + public static DebugElementalInstanceContainer_EM INSTANCE; + + private DebugElementalInstanceContainer_EM() { + super(); + setMaxStackSize(1); + setUnlocalizedName("em.debugContainer"); + setTextureName(MODID + ":itemDebugContainer"); + } + + @Override + public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, 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 != null && tTileEntity instanceof IGregTechTileEntity) { + IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); + if (metaTE != null && metaTE instanceof iElementalInstanceContainer) { + cElementalInstanceStackMap content = ((iElementalInstanceContainer) metaTE).getContainerHandler(); + if (tNBT.hasKey("content")) { + try { + content.putUnifyAll(cElementalInstanceStackMap.fromNBT(tNBT.getCompoundTag("content"))); + } catch (tElementalException e) { + if (DEBUG_MODE) e.printStackTrace(); + return true; + } + ((iElementalInstanceContainer) metaTE).purgeOverflow(); + tNBT.removeTag("content"); + tNBT.removeTag("info"); + } else if (content.hasStacks()) { + ((iElementalInstanceContainer) metaTE).purgeOverflow(); + tNBT.setTag("info", content.getInfoNBT()); + tNBT.setTag("content", content.toNBT()); + content.clear(); + } + return true; + } + } + } + return aPlayer instanceof EntityPlayerMP; + } + + @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("info")) { + aList.add("Contains:"); + Collections.addAll(aList, Util.infoFromNBT(tNBT.getCompoundTag("info"))); + } else { + aList.add("Container for elemental matter"); + aList.add(EnumChatFormatting.BLUE + "Right click on elemental hatches"); + } + } catch (Exception e) { + aList.add("---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); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/item/DefinitionContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/DefinitionContainer_EM.java deleted file mode 100644 index 942e6b97d7..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/item/DefinitionContainer_EM.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.github.technus.tectech.thing.item; - -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.elementalMatter.core.cElementalDefinitionStackMap; -import com.github.technus.tectech.elementalMatter.core.tElementalException; -import cpw.mods.fml.common.registry.GameRegistry; -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 java.util.Collections; -import java.util.List; - -import static com.github.technus.tectech.auxiliary.Reference.MODID; -import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; - -/** - * Created by Tec on 15.03.2017. - */ -public class DefinitionContainer_EM extends Item { - public static DefinitionContainer_EM INSTANCE; - - private DefinitionContainer_EM() { - super(); - setMaxStackSize(1); - setUnlocalizedName("em.definitionContainer"); - setTextureName(MODID + ":itemDefinitionContainer"); - } - - //return previous thing - public static cElementalDefinitionStackMap setContent(ItemStack containerItem, cElementalDefinitionStackMap definitions){ - if(containerItem.getItem() instanceof DefinitionContainer_EM) { - NBTTagCompound tNBT = containerItem.stackTagCompound; - if (tNBT == null) tNBT=containerItem.stackTagCompound=new NBTTagCompound(); - - cElementalDefinitionStackMap oldMap=null; - if (tNBT.hasKey("content")) { - try { - oldMap=cElementalDefinitionStackMap.fromNBT(tNBT.getCompoundTag("content")); - } catch (tElementalException e) { - if (DEBUG_MODE) e.printStackTrace(); - } - } - tNBT.setTag("info", definitions.getInfoNBT()); - tNBT.setTag("content", definitions.toNBT()); - return oldMap; - } - return null; - } - - public static cElementalDefinitionStackMap getContent(ItemStack containerItem){ - if(containerItem.getItem() instanceof DefinitionContainer_EM){ - NBTTagCompound tNBT = containerItem.stackTagCompound; - - if (tNBT == null || !tNBT.hasKey("content")) return null; - try { - return cElementalDefinitionStackMap.fromNBT(tNBT.getCompoundTag("content")); - } catch (tElementalException e) { - if (DEBUG_MODE) e.printStackTrace(); - } - } - return null; - } - - public static cElementalDefinitionStackMap clearContent(ItemStack containerItem){ - if(containerItem.getItem() instanceof DefinitionContainer_EM){ - NBTTagCompound tNBT = containerItem.stackTagCompound; - if (tNBT == null) return null; - - cElementalDefinitionStackMap oldMap=null; - if (tNBT.hasKey("content")) { - try { - oldMap=cElementalDefinitionStackMap.fromNBT(tNBT.getCompoundTag("content")); - } catch (tElementalException e) { - if (DEBUG_MODE) e.printStackTrace(); - } - } - tNBT.removeTag("info"); - tNBT.removeTag("content"); - 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("info")) { - aList.add("Should Contain:"); - Collections.addAll(aList, cElementalDefinitionStackMap.infoFromNBT(tNBT.getCompoundTag("info"))); - } else { - aList.add("Recipe Hint"); - } - } catch (Exception e) { - aList.add("---Unexpected Termination---"); - } - } - - public static void run() { - INSTANCE = new DefinitionContainer_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); - } -} 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 new file mode 100644 index 0000000000..931a0a94cc --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java @@ -0,0 +1,115 @@ +package com.github.technus.tectech.thing.item; + +import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.Util; +import com.github.technus.tectech.elementalMatter.core.cElementalDefinitionStackMap; +import com.github.technus.tectech.elementalMatter.core.tElementalException; +import cpw.mods.fml.common.registry.GameRegistry; +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 java.util.Collections; +import java.util.List; + +import static com.github.technus.tectech.auxiliary.Reference.MODID; +import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; + +/** + * Created by Tec on 15.03.2017. + */ +public class ElementalDefinitionContainer_EM extends Item { + public static ElementalDefinitionContainer_EM INSTANCE; + + private ElementalDefinitionContainer_EM() { + super(); + setMaxStackSize(1); + setUnlocalizedName("em.definitionContainer"); + setTextureName(MODID + ":itemDefinitionContainer"); + } + + //return previous thing + public static cElementalDefinitionStackMap setContent(ItemStack containerItem, cElementalDefinitionStackMap definitions){ + if(containerItem.getItem() instanceof ElementalDefinitionContainer_EM) { + NBTTagCompound tNBT = containerItem.stackTagCompound; + if (tNBT == null) tNBT=containerItem.stackTagCompound=new NBTTagCompound(); + + cElementalDefinitionStackMap oldMap=null; + if (tNBT.hasKey("content")) { + try { + oldMap=cElementalDefinitionStackMap.fromNBT(tNBT.getCompoundTag("content")); + } catch (tElementalException e) { + if (DEBUG_MODE) e.printStackTrace(); + } + } + tNBT.setTag("info", definitions.getInfoNBT()); + tNBT.setTag("content", definitions.toNBT()); + return oldMap; + } + return null; + } + + public static cElementalDefinitionStackMap getContent(ItemStack containerItem){ + if(containerItem.getItem() instanceof ElementalDefinitionContainer_EM){ + NBTTagCompound tNBT = containerItem.stackTagCompound; + + if (tNBT == null || !tNBT.hasKey("content")) return null; + try { + return cElementalDefinitionStackMap.fromNBT(tNBT.getCompoundTag("content")); + } catch (tElementalException e) { + if (DEBUG_MODE) e.printStackTrace(); + } + } + return null; + } + + public static cElementalDefinitionStackMap clearContent(ItemStack containerItem){ + if(containerItem.getItem() instanceof ElementalDefinitionContainer_EM){ + NBTTagCompound tNBT = containerItem.stackTagCompound; + if (tNBT == null) return null; + + cElementalDefinitionStackMap oldMap=null; + if (tNBT.hasKey("content")) { + try { + oldMap=cElementalDefinitionStackMap.fromNBT(tNBT.getCompoundTag("content")); + } catch (tElementalException e) { + if (DEBUG_MODE) e.printStackTrace(); + } + } + tNBT.removeTag("info"); + tNBT.removeTag("content"); + 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("info")) { + aList.add("Should Contain:"); + Collections.addAll(aList, Util.infoFromNBT(tNBT.getCompoundTag("info"))); + } else { + aList.add("Recipe Hint"); + } + } catch (Exception e) { + aList.add("---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); + } +} 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 new file mode 100644 index 0000000000..2991330564 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java @@ -0,0 +1,96 @@ +package com.github.technus.tectech.thing.item; + +import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.Util; +import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +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.IIcon; + +import java.util.Collections; +import java.util.List; + +import static com.github.technus.tectech.auxiliary.Reference.MODID; +import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; + +/** + * Created by Tec on 15.03.2017. + */ +public class ElementalDefinitionScanStorage_EM extends Item { + public static ElementalDefinitionScanStorage_EM INSTANCE; + public static IIcon offline, online; + + private ElementalDefinitionScanStorage_EM() { + super(); + setMaxStackSize(1); + setUnlocalizedName("em.definitionScanStorage"); + setTextureName(MODID + ":itemDefinitionScanStorage"); + } + + //return previous thing + public static void setContent(ItemStack containerItem, cElementalInstanceStackMap definitions, int[] detailsOnDepthLevels){ + if(containerItem.getItem() instanceof ElementalDefinitionScanStorage_EM) { + if (containerItem.stackTagCompound == null) containerItem.stackTagCompound=new NBTTagCompound(); + containerItem.stackTagCompound.setTag("elementalInfo", definitions.getScanInfoNBT(detailsOnDepthLevels)); + } + } + + public static void clearContent(ItemStack containerItem){ + if(containerItem.getItem() instanceof ElementalDefinitionScanStorage_EM){ + if (containerItem.stackTagCompound == null) return; + containerItem.stackTagCompound.removeTag("elementalInfo"); + return; + } + return; + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { + aList.add(CommonValues.TEC_MARK_EM); + try { + if (aStack.stackTagCompound != null && aStack.stackTagCompound.hasKey("elementalInfo")) { + aList.add("Scan result:"); + if(DEBUG_MODE) + Collections.addAll(aList, Util.infoFromNBT(aStack.stackTagCompound.getCompoundTag("elementalInfo"))); + } else { + aList.add("Storage for matter scan data"); + } + } catch (Exception e) { + aList.add("---Unexpected Termination---"); + } + } + + public static void run() { + INSTANCE = new ElementalDefinitionScanStorage_EM(); + GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName()); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconRegister) { + offline =iconRegister.registerIcon(MODID + ":itemDefinitionScanStorageOff"); + online =this.itemIcon = iconRegister.registerIcon(this.getIconString()); + } + + @Override + public IIcon getIconIndex(ItemStack itemStack) { + NBTTagCompound tagCompound=itemStack.stackTagCompound; + if(tagCompound!=null && tagCompound.hasKey("info")) + return online; + return offline; + } + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + ItemStack that = new ItemStack(this, 1); + that.setTagCompound(new NBTTagCompound()); + list.add(that); + } +} 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 index d43765f7f2..19170a91f9 100644 --- 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 @@ -36,6 +36,13 @@ import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileE * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + public static final int SCAN_DO_NOTHING=0, + SCAN_GET_MASS=1, SCAN_GET_CHARGE=2, SCAN_GET_CLASS_TYPE=4, SCAN_GET_NOMENCLATURE=8, + SCAN_GET_TIMESPAN_INFO=16, SCAN_GET_DECAY_INFO=32, + SCAN_GET_AMOUNT=256, SCAN_GET_COLOR=512, SCAN_GET_ENERGY_LEVEL=1024, SCAN_GET_AGE=2048, SCAN_GET_TIMESPAN_MULT =4096, + SCAN_GET_ENERGY_STATES=32768, SCAN_GET_ENERGY_STATES_DECAYS=65536, + SCAN_GET_DEPTH_LEVEL=-2147483648; + private TT_recipe.TT_EMRecipe.TT_EMRecipe eRecipe; private cElementalDefinitionStack objectResearched; private String machineType; diff --git a/src/main/java/openmodularturrets/tileentity/turret/TileTurretHeadEM.java b/src/main/java/openmodularturrets/tileentity/turret/TileTurretHeadEM.java index fc2e5db293..343a1e5ebd 100644 --- a/src/main/java/openmodularturrets/tileentity/turret/TileTurretHeadEM.java +++ b/src/main/java/openmodularturrets/tileentity/turret/TileTurretHeadEM.java @@ -1,7 +1,7 @@ package openmodularturrets.tileentity.turret; import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.thing.item.DebugContainer_EM; +import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; import net.minecraft.entity.Entity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -54,7 +54,7 @@ public class TileTurretHeadEM extends TurretHead{ } public Item getAmmo() { - return DebugContainer_EM.INSTANCE;//Placeholder item that cannot be achieved, yet still usable for debug + return DebugElementalInstanceContainer_EM.INSTANCE;//Placeholder item that cannot be achieved, yet still usable for debug } public final TurretProjectile createProjectile(World world, Entity target, ItemStack ammo) { diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index 5d041a12e9..20160069e4 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -3,6 +3,7 @@ tile.quantumGlass.name=Quantum Glass tile.quantumStuff.name=Quantum Stuff item.em.debugContainer.name=Debug EM Container item.em.definitionContainer.name=EM Recipe Hint +item.em.definitionScanStorage.name=EM Scan Storage item.em.debugBuilder.name=Multiblock Machine Blueprint item.em.parametrizerMemoryCard.name=Parametrizer Memory Card diff --git a/src/main/resources/assets/tectech/textures/items/itemDefinitionScanStorage.png b/src/main/resources/assets/tectech/textures/items/itemDefinitionScanStorage.png new file mode 100644 index 0000000000..73c5274ef9 Binary files /dev/null and b/src/main/resources/assets/tectech/textures/items/itemDefinitionScanStorage.png differ diff --git a/src/main/resources/assets/tectech/textures/items/itemDefinitionScanStorage.png.mcmeta b/src/main/resources/assets/tectech/textures/items/itemDefinitionScanStorage.png.mcmeta new file mode 100644 index 0000000000..24f863c95e --- /dev/null +++ b/src/main/resources/assets/tectech/textures/items/itemDefinitionScanStorage.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":3 + } +} \ No newline at end of file diff --git a/src/main/resources/assets/tectech/textures/items/itemDefinitionScanStorageOff.png b/src/main/resources/assets/tectech/textures/items/itemDefinitionScanStorageOff.png new file mode 100644 index 0000000000..006ae1e62f Binary files /dev/null and b/src/main/resources/assets/tectech/textures/items/itemDefinitionScanStorageOff.png differ diff --git a/src/main/resources/assets/tectech/textures/items/itemDefinitionScanStorageOff.png.mcmeta b/src/main/resources/assets/tectech/textures/items/itemDefinitionScanStorageOff.png.mcmeta new file mode 100644 index 0000000000..24f863c95e --- /dev/null +++ b/src/main/resources/assets/tectech/textures/items/itemDefinitionScanStorageOff.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":3 + } +} \ No newline at end of file -- cgit