diff options
Diffstat (limited to 'src')
120 files changed, 7775 insertions, 0 deletions
| diff --git a/src/main/java/com/github/technus/tectech/CustomItemList.java b/src/main/java/com/github/technus/tectech/CustomItemList.java new file mode 100644 index 0000000000..22e481be5b --- /dev/null +++ b/src/main/java/com/github/technus/tectech/CustomItemList.java @@ -0,0 +1,151 @@ +package com.github.technus.tectech; + +import gregtech.api.interfaces.IItemContainer; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +import static gregtech.api.enums.GT_Values.W; + +public enum CustomItemList implements IItemContainer +{ +	EMpipe, +	eM_dynamomulti4_UV,eM_dynamomulti16_UV,eM_dynamomulti64_UV, +	eM_dynamomulti4_UHV,eM_dynamomulti16_UHV,eM_dynamomulti64_UHV, +	eM_dynamomulti4_UEV,eM_dynamomulti16_UEV,eM_dynamomulti64_UEV, +	eM_dynamomulti4_UIV,eM_dynamomulti16_UIV,eM_dynamomulti64_UIV, +	eM_dynamomulti4_UMV,eM_dynamomulti16_UMV,eM_dynamomulti64_UMV, +	eM_dynamomulti4_UXV,eM_dynamomulti16_UXV,eM_dynamomulti64_UXV, +	eM_energymulti4_UV,eM_energymulti16_UV,eM_energymulti64_UV, +	eM_energymulti4_UHV,eM_energymulti16_UHV,eM_energymulti64_UHV, +	eM_energymulti4_UEV,eM_energymulti16_UEV,eM_energymulti64_UEV, +	eM_energymulti4_UIV,eM_energymulti16_UIV,eM_energymulti64_UIV, +	eM_energymulti4_UMV,eM_energymulti16_UMV,eM_energymulti64_UMV, +	eM_energymulti4_UXV,eM_energymulti16_UXV,eM_energymulti64_UXV, +	eM_in_UV,eM_in_UHV,eM_in_UEV,eM_in_UIV,eM_in_UMV,eM_in_UXV, +	eM_out_UV,eM_out_UHV,eM_out_UEV,eM_out_UIV,eM_out_UMV,eM_out_UXV, +	eM_muffler_UV,eM_muffler_UHV,eM_muffler_UEV,eM_muffler_UIV,eM_muffler_UMV,eM_muffler_UXV, +	Parametrizer_Hatch,Uncertainty_Hatch,UncertaintyX_Hatch,eM_Casing,eM_Field,eM_Field_Casing,eM_Coil,eM_Tele,eM_TimeSpaceWarp,debugBlock, +	Machine_Multi_BHG,Machine_Multi_EM,Machine_Multi_MatterToEM,Machine_Multi_EMToMatter,Machine_Multi_Collider,Machine_Multi_Wormhole,Machine_Multi_EMCrafter,Machine_Multi_EMjunction; + + +	private ItemStack mStack = null; +	private boolean mHasNotBeenSet = true; + +	//public static Fluid sOilExtraHeavy, sOilHeavy, sOilMedium, sOilLight, sNaturalGas; + +	@Override +	public IItemContainer set(Item aItem) { +		mHasNotBeenSet = false; +		if (aItem == null) return this; +		ItemStack aStack = new ItemStack(aItem, 1, 0); +		mStack = GT_Utility.copyAmount(1, aStack); +		return this; +	} + +	@Override +	public IItemContainer set(ItemStack aStack) { +		mHasNotBeenSet = false; +		mStack = GT_Utility.copyAmount(1, aStack); +		return this; +	} + +	@Override +	public Item getItem() { +		if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); +		if (GT_Utility.isStackInvalid(mStack)) return null; +		return mStack.getItem(); +	} + +	@Override +	public Block getBlock() { +		if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); +		return GT_Utility.getBlockFromStack(getItem()); +	} + +	@Override +	public final boolean hasBeenSet() { +		return !mHasNotBeenSet; +	} + +	@Override +	public boolean isStackEqual(Object aStack) { +		return isStackEqual(aStack, false, false); +	} + +	@Override +	public boolean isStackEqual(Object aStack, boolean aWildcard, boolean aIgnoreNBT) { +		if (GT_Utility.isStackInvalid(aStack)) return false; +		return GT_Utility.areUnificationsEqual((ItemStack) aStack, aWildcard ? getWildcard(1) : get(1), aIgnoreNBT); +	} + +	@Override +	public ItemStack get(long aAmount, Object... aReplacements) { +		if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); +		if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements); +		return GT_Utility.copyAmount(aAmount, GT_OreDictUnificator.get(mStack)); +	} + +	@Override +	public ItemStack getWildcard(long aAmount, Object... aReplacements) { +		if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); +		if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements); +		return GT_Utility.copyAmountAndMetaData(aAmount, W, GT_OreDictUnificator.get(mStack)); +	} + +	@Override +	public ItemStack getUndamaged(long aAmount, Object... aReplacements) { +		if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); +		if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements); +		return GT_Utility.copyAmountAndMetaData(aAmount, 0, GT_OreDictUnificator.get(mStack)); +	} + +	@Override +	public ItemStack getAlmostBroken(long aAmount, Object... aReplacements) { +		if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); +		if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements); +		return GT_Utility.copyAmountAndMetaData(aAmount, mStack.getMaxDamage() - 1, GT_OreDictUnificator.get(mStack)); +	} + +	@Override +	public ItemStack getWithName(long aAmount, String aDisplayName, Object... aReplacements) { +		ItemStack rStack = get(1, aReplacements); +		if (GT_Utility.isStackInvalid(rStack)) return null; +		rStack.setStackDisplayName(aDisplayName); +		return GT_Utility.copyAmount(aAmount, rStack); +	} + +	@Override +	public ItemStack getWithCharge(long aAmount, int aEnergy, Object... aReplacements) { +		ItemStack rStack = get(1, aReplacements); +		if (GT_Utility.isStackInvalid(rStack)) return null; +		GT_ModHandler.chargeElectricItem(rStack, aEnergy, Integer.MAX_VALUE, true, false); +		return GT_Utility.copyAmount(aAmount, rStack); +	} + +	@Override +	public ItemStack getWithDamage(long aAmount, long aMetaValue, Object... aReplacements) { +		if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); +		if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements); +		return GT_Utility.copyAmountAndMetaData(aAmount, aMetaValue, GT_OreDictUnificator.get(mStack)); +	} + +	@Override +	public IItemContainer registerOre(Object... aOreNames) { +		if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); +		for (Object tOreName : aOreNames) GT_OreDictUnificator.registerOre(tOreName, get(1)); +		return this; +	} + +	@Override +	public IItemContainer registerWildcardAsOre(Object... aOreNames) { +		if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); +		for (Object tOreName : aOreNames) GT_OreDictUnificator.registerOre(tOreName, getWildcard(1)); +		return this; +	} + + +}
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/GT_CustomLoader.java b/src/main/java/com/github/technus/tectech/GT_CustomLoader.java new file mode 100644 index 0000000000..82d97663c0 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/GT_CustomLoader.java @@ -0,0 +1,22 @@ +package com.github.technus.tectech; + +import com.github.technus.tectech.blocks.QuantumGlass; +import com.github.technus.tectech.casing.GT_Loader_CasingsTT; +import cpw.mods.fml.common.registry.GameRegistry; + +public class GT_CustomLoader { + + +	public GT_CustomLoader() { +		ElementalCasing = new GT_Loader_CasingsTT(); +		ElementalLoader = new GT_Loader_Elemental(); +	} + +	private GT_Loader_Elemental ElementalLoader = null; +	private GT_Loader_CasingsTT ElementalCasing = null; + +	public void run() { +		ElementalCasing.run(); +		ElementalLoader.run(); +	} +} diff --git a/src/main/java/com/github/technus/tectech/GT_Loader_Elemental.java b/src/main/java/com/github/technus/tectech/GT_Loader_Elemental.java new file mode 100644 index 0000000000..73fd076604 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/GT_Loader_Elemental.java @@ -0,0 +1,222 @@ +package com.github.technus.tectech; + +import com.github.technus.tectech.elementalMatter.classes.cElementalPrimitive; +import com.github.technus.tectech.elementalMatter.definitions.*; +import com.github.technus.tectech.elementalMatter.machine.*; + +/** + * Created by danie_000 on 16.11.2016. + */ +public class GT_Loader_Elemental implements Runnable { +    public void run() { + +        // =================================================================================================== +        // def init +        // =================================================================================================== + +        cElementalPrimitive.run(); + +        cPrimitiveDefinition.run(); + +        eQuarkDefinition.run(); +        eLeptonDefinition.run(); +        eNeutrinoDefinition.run(); +        eBosonDefinition.run(); + +        dHadronDefinition.run(); + +        dAtomDefinition.run(); + +        // =================================================================================================== +        // Recipe init +        // =================================================================================================== + +        GT_MetaTileEntity_EMquantifier.recipeInit(); + +        // =================================================================================================== +        // eM IN +        // =================================================================================================== + +        CustomItemList.eM_in_UV.set(new GT_MetaTileEntity_Hatch_InputElemental( +                12070, "hatch.emin.tier.08", "UV Elemental Input Hatch",8).getStackForm(1L)); + +        CustomItemList.eM_in_UHV.set(new GT_MetaTileEntity_Hatch_InputElemental( +                12071, "hatch.emin.tier.09", "UHV Elemental Input Hatch",9).getStackForm(1L)); + +        CustomItemList.eM_in_UEV.set(new GT_MetaTileEntity_Hatch_InputElemental( +                12072, "hatch.emin.tier.10", "UEV Elemental Input Hatch",10).getStackForm(1L)); + +        CustomItemList.eM_in_UIV.set(new GT_MetaTileEntity_Hatch_InputElemental( +                12073, "hatch.emin.tier.11", "UIV Elemental Input Hatch",11).getStackForm(1L)); + +        CustomItemList.eM_in_UMV.set(new GT_MetaTileEntity_Hatch_InputElemental( +                12074, "hatch.emin.tier.12", "UMV Elemental Input Hatch",12).getStackForm(1L)); + +        CustomItemList.eM_in_UXV.set(new GT_MetaTileEntity_Hatch_InputElemental( +                12075, "hatch.emin.tier.13", "UXV Elemental Input Hatch",13).getStackForm(1L)); + +        // =================================================================================================== +        // eM OUT +        // =================================================================================================== + +        CustomItemList.eM_out_UV.set(new GT_MetaTileEntity_Hatch_OutputElemental( +                12080, "hatch.emout.tier.08", "UV Elemental Output Hatch",8).getStackForm(1L)); + +        CustomItemList.eM_out_UHV.set(new GT_MetaTileEntity_Hatch_OutputElemental( +                12081, "hatch.emout.tier.09", "UHV Elemental Output Hatch",9).getStackForm(1L)); + +        CustomItemList.eM_out_UEV.set(new GT_MetaTileEntity_Hatch_OutputElemental( +                12082, "hatch.emout.tier.10", "UEV Elemental Output Hatch",10).getStackForm(1L)); + +        CustomItemList.eM_out_UIV.set(new GT_MetaTileEntity_Hatch_OutputElemental( +                12083, "hatch.emout.tier.11", "UIV Elemental Output Hatch",11).getStackForm(1L)); + +        CustomItemList.eM_out_UMV.set(new GT_MetaTileEntity_Hatch_OutputElemental( +                12084, "hatch.emout.tier.12", "UMV Elemental Output Hatch",12).getStackForm(1L)); + +        CustomItemList.eM_out_UXV.set(new GT_MetaTileEntity_Hatch_OutputElemental( +                12085, "hatch.emout.tier.13", "UXV Elemental Output Hatch",13).getStackForm(1L)); + +        // =================================================================================================== +        // eM Waste OUT +        // =================================================================================================== + +        CustomItemList.eM_muffler_UV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( +                12090, "hatch.emmuffler.tier.08", "UV Overflow Output Hatch",8,1e10f).getStackForm(1L)); + +        CustomItemList.eM_muffler_UHV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( +                12091, "hatch.emmuffler.tier.09", "UHV Overflow Output Hatch",9,5e10f).getStackForm(1L)); + +        CustomItemList.eM_muffler_UEV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( +                12092, "hatch.emmuffler.tier.10", "UEV Overflow Output Hatch",10,25e10f).getStackForm(1L)); + +        CustomItemList.eM_muffler_UIV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( +                12093, "hatch.emmuffler.tier.11", "UIV Overflow Output Hatch",11,125e10f).getStackForm(1L)); + +        CustomItemList.eM_muffler_UMV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( +                12094, "hatch.emmuffler.tier.12", "UMV Overflow Output Hatch",12,125e11f).getStackForm(1L)); + +        CustomItemList.eM_muffler_UXV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( +                12095, "hatch.emmuffler.tier.13", "UXV Overflow Output Hatch",13,125e12f).getStackForm(1L)); + +        // =================================================================================================== +        // Multi AMP Power INPUTS +        // =================================================================================================== + +        CustomItemList.eM_energymulti4_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( +                12100, "hatch.energymulti04.tier.08", "UV 4A Energy Hatch",8,4).getStackForm(1L)); +        CustomItemList.eM_energymulti16_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( +                12110, "hatch.energymulti16.tier.08", "UV 16A Energy Hatch",8,16).getStackForm(1L)); +        CustomItemList.eM_energymulti64_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( +                12120, "hatch.energymulti64.tier.08", "UV 64A Energy Hatch",8,64).getStackForm(1L)); + +        CustomItemList.eM_energymulti4_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( +                12101, "hatch.energymulti04.tier.09", "UHV 4A Energy Hatch",9,4).getStackForm(1L)); +        CustomItemList.eM_energymulti16_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( +                12111, "hatch.energymulti16.tier.09", "UHV 16A Energy Hatch",9,16).getStackForm(1L)); +        CustomItemList.eM_energymulti64_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( +                12121, "hatch.energymulti64.tier.09", "UHV 64A Energy Hatch",9,64).getStackForm(1L)); + +        CustomItemList.eM_energymulti4_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( +                12102, "hatch.energymulti04.tier.10", "UEV 4A Energy Hatch",10,4).getStackForm(1L)); +        CustomItemList.eM_energymulti16_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( +                12112, "hatch.energymulti16.tier.10", "UEV 16A Energy Hatch",10,16).getStackForm(1L)); +        CustomItemList.eM_energymulti64_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( +                12122, "hatch.energymulti64.tier.10", "UEV 64A Energy Hatch",10,64).getStackForm(1L)); + +        CustomItemList.eM_energymulti4_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( +                12103, "hatch.energymulti04.tier.11", "UIV 4A Energy Hatch",11,4).getStackForm(1L)); +        CustomItemList.eM_energymulti16_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( +                12113, "hatch.energymulti16.tier.11", "UIV 16A Energy Hatch",11,16).getStackForm(1L)); +        CustomItemList.eM_energymulti64_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( +                12123, "hatch.energymulti64.tier.11", "UIV 64A Energy Hatch",11,64).getStackForm(1L)); + +        CustomItemList.eM_energymulti4_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( +                12104, "hatch.energymulti04.tier.12", "UMV 4A Energy Hatch",12,4).getStackForm(1L)); +        CustomItemList.eM_energymulti16_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( +                12114, "hatch.energymulti16.tier.12", "UMV 16A Energy Hatch",12,16).getStackForm(1L)); +        CustomItemList.eM_energymulti64_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( +                12124, "hatch.energymulti64.tier.12", "UMV 64A Energy Hatch",12,64).getStackForm(1L)); + +        CustomItemList.eM_energymulti4_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( +                12105, "hatch.energymulti04.tier.13", "UXV 4A Energy Hatch",13,4).getStackForm(1L)); +        CustomItemList.eM_energymulti16_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( +                12115, "hatch.energymulti16.tier.13", "UXV 16A Energy Hatch",13,16).getStackForm(1L)); +        CustomItemList.eM_energymulti64_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( +                12125, "hatch.energymulti64.tier.13", "UXV 64A Energy Hatch",13,64).getStackForm(1L)); + + +        // =================================================================================================== +        // Multi AMP Power OUTPUTS +        // =================================================================================================== + +        CustomItemList.eM_dynamomulti4_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( +                12130, "hatch.dynamomulti04.tier.08", "UV 4A Dynamo Hatch",8,4).getStackForm(1L)); +        CustomItemList.eM_dynamomulti16_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( +                12140, "hatch.dynamomulti16.tier.08", "UV 16A Dynamo Hatch",8,16).getStackForm(1L)); +        CustomItemList.eM_dynamomulti64_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( +                12150, "hatch.dynamomulti64.tier.08", "UV 64A Dynamo Hatch",8,64).getStackForm(1L)); + +        CustomItemList.eM_dynamomulti4_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( +                12131, "hatch.dynamomulti04.tier.09", "UHV 4A Dynamo Hatch",9,4).getStackForm(1L)); +        CustomItemList.eM_dynamomulti16_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( +                12141, "hatch.dynamomulti16.tier.09", "UHV 16A Dynamo Hatch",9,16).getStackForm(1L)); +        CustomItemList.eM_dynamomulti64_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( +                12151, "hatch.dynamomulti64.tier.09", "UHV 64A Dynamo Hatch",9,64).getStackForm(1L)); + +        CustomItemList.eM_dynamomulti4_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( +                12132, "hatch.dynamomulti04.tier.10", "UEV 4A Dynamo Hatch",10,4).getStackForm(1L)); +        CustomItemList.eM_dynamomulti16_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( +                12142, "hatch.dynamomulti16.tier.10", "UEV 16A Dynamo Hatch",10,16).getStackForm(1L)); +        CustomItemList.eM_dynamomulti64_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( +                12152, "hatch.dynamomulti64.tier.10", "UEV 64A Dynamo Hatch",10,64).getStackForm(1L)); + +        CustomItemList.eM_dynamomulti4_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( +                12133, "hatch.dynamomulti04.tier.11", "UIV 4A Dynamo Hatch",11,4).getStackForm(1L)); +        CustomItemList.eM_dynamomulti16_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( +                12143, "hatch.dynamomulti16.tier.11", "UIV 16A Dynamo Hatch",11,16).getStackForm(1L)); +        CustomItemList.eM_dynamomulti64_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( +                12153, "hatch.dynamomulti64.tier.11", "UIV 64A Dynamo Hatch",11,64).getStackForm(1L)); + +        CustomItemList.eM_dynamomulti4_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( +                12134, "hatch.dynamomulti04.tier.12", "UMV 4A Dynamo Hatch",12,4).getStackForm(1L)); +        CustomItemList.eM_dynamomulti16_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( +                12144, "hatch.dynamomulti16.tier.12", "UMV 16A Dynamo Hatch",12,16).getStackForm(1L)); +        CustomItemList.eM_dynamomulti64_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( +                12154, "hatch.dynamomulti64.tier.12", "UMV 64A Dynamo Hatch",12,64).getStackForm(1L)); + +        CustomItemList.eM_dynamomulti4_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( +                12135, "hatch.dynamomulti04.tier.13", "UXV 4A Dynamo Hatch",13,4).getStackForm(1L)); +        CustomItemList.eM_dynamomulti16_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( +                12145, "hatch.dynamomulti16.tier.13", "UXV 16A Dynamo Hatch",13,16).getStackForm(1L)); +        CustomItemList.eM_dynamomulti64_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( +                12155, "hatch.dynamomulti64.tier.13", "UXV 64A Dynamo Hatch",13,64).getStackForm(1L)); + +        // =================================================================================================== +        // MULTIBLOCKS EM +        // =================================================================================================== + +        CustomItemList.Machine_Multi_MatterToEM.set(new GT_MetaTileEntity_EMquantifier(12160,"multimachine.mattertoem","Matter Quantifier").getStackForm(1L)); +        CustomItemList.Machine_Multi_EMToMatter.set(new GT_MetaTileEntity_EMdequantifier(12161,"multimachine.emtomatter","Matter De-quantifier").getStackForm(1L)); +        CustomItemList.Machine_Multi_EMjunction.set(new GT_MetaTileEntity_EMjunction(12162,"multimachine.emjunction","Matter junction").getStackForm(1L)); +        CustomItemList.Machine_Multi_EM.set(new GT_MetaTileEntity_EMmachine(12163,"multimachine.emprocessing","Quantum Processing Machine").getStackForm(1L)); +        CustomItemList.Machine_Multi_EMCrafter.set(new GT_MetaTileEntity_EMcrafter(12164,"multimachine.emcrafter","Matter Assembler").getStackForm(1L)); +        CustomItemList.Machine_Multi_Collider.set(new GT_MetaTileEntity_EMcollider(12165,"multimachine.emcollider","Matter Collider").getStackForm(1L)); +        CustomItemList.Machine_Multi_BHG.set(new GT_MetaTileEntity_EMbhg(12166,"multimachine.blackholegenerator","Black Hole Generator").getStackForm(1L)); +        CustomItemList.Machine_Multi_Wormhole.set(new GT_MetaTileEntity_EMwormhole(12167,"multimachine.emwormhole","Wormhole").getStackForm(1L)); + +        // =================================================================================================== +        // Hatches EM +        // =================================================================================================== +        CustomItemList.Parametrizer_Hatch.set(new GT_MetaTileEntity_Hatch_Param(12170,"hatch.param.tier.06","Parametrizer for machines",6).getStackForm(1L)); +        CustomItemList.Uncertainty_Hatch.set(new GT_MetaTileEntity_Hatch_Uncertainty(12171,"hatch.emcertain.tier.06","Uncertainty resolver",6).getStackForm(1L)); +        CustomItemList.UncertaintyX_Hatch.set(new GT_MetaTileEntity_Hatch_Uncertainty(12172,"hatch.emcertain.tier.10","Uncertainty resolver X",10).getStackForm(1L)); + +        // =================================================================================================== +        // EM pipe +        // =================================================================================================== +        CustomItemList.EMpipe.set(new GT_MetaTileEntity_EMpipe(12179,"pipe.elementalmatter","Quantum tunnel").getStackForm(1L)); + +        //System.out.println("ELEMENTAL INIT DONE"); +    } +} diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java new file mode 100644 index 0000000000..22e1e440c0 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -0,0 +1,82 @@ +package com.github.technus.tectech; + +import com.github.technus.tectech.auxiliary.Reference; +import com.github.technus.tectech.auxiliary.TecTechConfig; +import com.github.technus.tectech.blocks.QuantumGlass; +import com.github.technus.tectech.blocks.QuantumGlassRender; +import com.github.technus.tectech.proxy.CommonProxy; +import cpw.mods.fml.common.Mod; +import cpw.mods.fml.common.Mod.EventHandler; +import cpw.mods.fml.common.Mod.Instance; +import cpw.mods.fml.common.SidedProxy; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.event.FMLServerStartingEvent; +import cpw.mods.fml.common.registry.GameRegistry; +import eu.usrv.yamcore.auxiliary.IngameErrorLog; +import eu.usrv.yamcore.auxiliary.LogHelper; + +import java.util.Random; + +@Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION, dependencies = "required-after:Forge@[10.13.4.1614,);" +		+ "required-after:YAMCore@[0.5.73,);") +public class TecTech { + +	@SidedProxy(clientSide = Reference.CLIENTSIDE, serverSide = Reference.SERVERSIDE) +	public static CommonProxy proxy; + +	@Instance(Reference.MODID) +	public static TecTech instance; + +	//public static CreativeTabsManager TabManager = null; +	public static IngameErrorLog Module_AdminErrorLogs = null; +	public static GT_CustomLoader GTCustomLoader = null; +	public static TecTechConfig ModConfig; +	public static Random Rnd = null; +	public static LogHelper Logger = new LogHelper(Reference.MODID); + +	public static void AddLoginError(String pMessage) { +		if (Module_AdminErrorLogs != null) +			Module_AdminErrorLogs.AddErrorLogOnAdminJoin(pMessage); +	} + +	@EventHandler +	public void PreLoad(FMLPreInitializationEvent PreEvent) { +		Logger.setDebugOutput(true); + +		Rnd = new Random(System.currentTimeMillis()); + +		ModConfig = new TecTechConfig(PreEvent.getModConfigurationDirectory(), Reference.COLLECTIONNAME, +				Reference.MODID); +		if (!ModConfig.LoadConfig()) +			Logger.error( +					String.format("%s could not load its config file. Things are going to be weird!", Reference.MODID)); + +		if (ModConfig.ModAdminErrorLogs_Enabled) { +			Logger.debug("Module_AdminErrorLogs is enabled"); +			Module_AdminErrorLogs = new IngameErrorLog(); +		} +	} + +	@EventHandler +	public void load(FMLInitializationEvent event) { +		GameRegistry.registerBlock(QuantumGlass.INSTANCE,QuantumGlass.INSTANCE.getUnlocalizedName()); +	} + +	@EventHandler +	public void PostLoad(FMLPostInitializationEvent PostEvent) { +		GTCustomLoader = new GT_CustomLoader(); +		GTCustomLoader.run(); +	} + +	/** +	 * Do some stuff once the server starts +	 *  +	 * @param pEvent +	 */ +	@EventHandler +	public void serverLoad(FMLServerStartingEvent pEvent) { +	} + +} diff --git a/src/main/java/com/github/technus/tectech/auxiliary/Reference.java b/src/main/java/com/github/technus/tectech/auxiliary/Reference.java new file mode 100644 index 0000000000..85f57f2c24 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/auxiliary/Reference.java @@ -0,0 +1,11 @@ + +package com.github.technus.tectech.auxiliary; + +public class Reference { +	public static final String MODID = "tectech"; +	public static final String NAME = "TecTech - Tec Technology!"; +	public static final String VERSION = "GRADLETOKEN_VERSION"; +	public static final String COLLECTIONNAME = "TecTech"; +	public static final String CLIENTSIDE = "com.github.technus.tectech.proxy.ClientProxy"; +	public static final String SERVERSIDE = "com.github.technus.tectech.proxy.CommonProxy"; +} diff --git a/src/main/java/com/github/technus/tectech/auxiliary/TecTechConfig.java b/src/main/java/com/github/technus/tectech/auxiliary/TecTechConfig.java new file mode 100644 index 0000000000..0eb8a90d8f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/auxiliary/TecTechConfig.java @@ -0,0 +1,30 @@ +package com.github.technus.tectech.auxiliary; + +import eu.usrv.yamcore.config.ConfigManager; + +import java.io.File; + +public class TecTechConfig extends ConfigManager { +	public TecTechConfig(File pConfigBaseDirectory, String pModCollectionDirectory, String pModID) { +		super(pConfigBaseDirectory, pModCollectionDirectory, pModID); + +	} + +	public boolean ModAdminErrorLogs_Enabled; + +	@Override +	protected void PreInit() { +		ModAdminErrorLogs_Enabled = false; +	} + +	@Override +	protected void Init() { +		ModAdminErrorLogs_Enabled = _mainConfig.getBoolean("AdminErrorLog", "Modules", ModAdminErrorLogs_Enabled, +				"If set to true, every op/admin will receive all errors occoured during the startup phase as ingame message on join"); +	} + +	@Override +	protected void PostInit() { + +	} +}
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/blocks/QuantumGlass.java b/src/main/java/com/github/technus/tectech/blocks/QuantumGlass.java new file mode 100644 index 0000000000..e126cfb892 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/blocks/QuantumGlass.java @@ -0,0 +1,86 @@ +package com.github.technus.tectech.blocks; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import eu.usrv.yamcore.blocks.BlockBase; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; + +import static com.github.technus.tectech.auxiliary.Reference.MODID; + +/** + * Created by danie_000 on 17.12.2016. + */ +public final class QuantumGlass extends BlockBase{ +    public static IIcon stuff; +    public static QuantumGlass INSTANCE=new QuantumGlass(); + +    public QuantumGlass(){ +        super(Material.iron); +        this.setBlockBounds(0,0,0,1,1,1); +        setBlockName("QuantumGlass"); +        setHarvestLevel("wrench",3); +        setHardness(50); +        setResistance(30); +        setLightOpacity(0); +        setStepSound(Block.soundTypeMetal); +        setBlockTextureName(MODID+":blockQuantumGlass"); +    } + +    @Override +    public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) { +        return true; +    } + +    @Override +    public boolean isOpaqueCube() { +        return false; +    } + +    @Override +    public boolean getCanBlockGrass() { +        return false; +    } + +    //@Override +    //public boolean canRenderInPass(int pass) { +    //    return true; +    //} + +    @Override +    public boolean canBeReplacedByLeaves(IBlockAccess world, int x, int y, int z) { +        return false; +    } + +    @SideOnly(Side.CLIENT) +    public int getRenderBlockPass() +    { +        return 1; +    } + +    public boolean renderAsNormalBlock() +    { +        return false; +    } + +    @SideOnly(Side.CLIENT) +    public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) +    { +        Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_); +        return block != this;// && super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_); +    } + +    @Override +    public int getRenderType() { +        return QuantumGlassRender.renderID; +    } + +    @Override +    public void registerBlockIcons(IIconRegister p_149651_1_) { +        super.registerBlockIcons(p_149651_1_); +        stuff=this.blockIcon; +    } +} diff --git a/src/main/java/com/github/technus/tectech/blocks/QuantumGlassRender.java b/src/main/java/com/github/technus/tectech/blocks/QuantumGlassRender.java new file mode 100644 index 0000000000..58cfbdd744 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/blocks/QuantumGlassRender.java @@ -0,0 +1,121 @@ +package com.github.technus.tectech.blocks; + +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +/** + * Created by danie_000 on 19.12.2016. + */ +public final class QuantumGlassRender implements ISimpleBlockRenderingHandler { +    public static int renderID; + +    public QuantumGlassRender() {} + +    @Override +    public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { +        GL11.glTranslatef(-0.5F, -0.5F, -0.5F); +        Tessellator tessellator = Tessellator.instance; + +        //Get icons from custom register (useful for renderers and fluids) +        IIcon side = QuantumGlass.stuff; +        GL11.glDisable(GL11.GL_CULL_FACE); +        tessellator.startDrawingQuads(); +        tessellator.setNormal(0.0F, -1.0F, 0.0F); +        renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, side); +        tessellator.draw(); +        tessellator.startDrawingQuads(); +        tessellator.setNormal(0.0F, 1.0F, 0.0F); +        renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, side); +        tessellator.draw(); +        tessellator.startDrawingQuads(); +        tessellator.setNormal(0.0F, 0.0F, -1.0F); +        renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, side); +        tessellator.draw(); +        tessellator.startDrawingQuads(); +        tessellator.setNormal(0.0F, 0.0F, 1.0F); +        renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, side); +        tessellator.draw(); +        tessellator.startDrawingQuads(); +        tessellator.setNormal(-1.0F, 0.0F, 0.0F); +        renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, side); +        tessellator.draw(); +        tessellator.startDrawingQuads(); +        tessellator.setNormal(1.0F, 0.0F, 0.0F); +        renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, side); +        tessellator.draw(); +        GL11.glTranslatef(0.5F, 0.5F, 0.5F); +        GL11.glEnable(GL11.GL_CULL_FACE); +    } + +    @Override +    public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, +                                    Block block, int modelId, +                                    RenderBlocks renderer) { + +        renderer.renderStandardBlock(block, x, y, z); +        Tessellator tes = Tessellator.instance; +        tes.setNormal(0F,1F,0F); +        tes.setBrightness(15728880); +        tes.setColorOpaque_F(0F, 1F, 1F); +        IIcon side = QuantumGlass.stuff; + +        //South +        if(world.getBlock(x,y,z+1).getClass() != QuantumGlass.class) { +            tes.addVertexWithUV(x, y, z + 0.999, side.getMinU(), side.getMaxV()); //0.999 instead of 1 for fighting (textures overlapping) +            tes.addVertexWithUV(x, y + 1, z + 0.999, side.getMinU(), side.getMinV()); +            tes.addVertexWithUV(x + 1, y + 1, z + 0.999, side.getMaxU(), side.getMinV()); +            tes.addVertexWithUV(x + 1, y, z + 0.999, side.getMaxU(), side.getMaxV()); +        } +        //East +        if(world.getBlock(x+1,y,z).getClass() != QuantumGlass.class) { +            tes.addVertexWithUV(x + 0.999, y, z + 1, side.getMinU(), side.getMaxV()); +            tes.addVertexWithUV(x + 0.999, y + 1, z + 1, side.getMinU(), side.getMinV()); +            tes.addVertexWithUV(x + 0.999, y + 1, z, side.getMaxU(), side.getMinV()); +            tes.addVertexWithUV(x + 0.999, y, z, side.getMaxU(), side.getMaxV()); +        } +        //North +        if(world.getBlock(x,y,z-1).getClass() != QuantumGlass.class) { +            tes.addVertexWithUV(x + 1, y, z + 0.001, side.getMinU(), side.getMaxV()); +            tes.addVertexWithUV(x + 1, y + 1, z + 0.001, side.getMinU(), side.getMinV()); +            tes.addVertexWithUV(x, y + 1, z + 0.001, side.getMaxU(), side.getMinV()); +            tes.addVertexWithUV(x, y, z + 0.001, side.getMaxU(), side.getMaxV()); +        } +        //West +        if(world.getBlock(x-1,y,z).getClass() != QuantumGlass.class) { +            tes.addVertexWithUV(x + 0.001, y, z, side.getMinU(), side.getMaxV()); +            tes.addVertexWithUV(x + 0.001, y + 1, z, side.getMinU(), side.getMinV()); +            tes.addVertexWithUV(x + 0.001, y + 1, z + 1, side.getMaxU(), side.getMinV()); +            tes.addVertexWithUV(x + 0.001, y, z + 1, side.getMaxU(), side.getMaxV()); +        } +        //Top +        if(world.getBlock(x,y+1,z).getClass() != QuantumGlass.class) { +            tes.addVertexWithUV(x, y + 0.999, z + 1, side.getMinU(), side.getMaxV()); +            tes.addVertexWithUV(x, y + 0.999, z, side.getMinU(), side.getMinV()); +            tes.addVertexWithUV(x + 1, y + 0.999, z, side.getMaxU(), side.getMinV()); +            tes.addVertexWithUV(x + 1, y + 0.999, z + 1, side.getMaxU(), side.getMaxV()); +        } +        //Bottom +        if(world.getBlock(x,y-1,z).getClass() != QuantumGlass.class) { +            tes.addVertexWithUV(x, y + 0.001, z, side.getMinU(), side.getMaxV()); +            tes.addVertexWithUV(x, y + 0.001, z + 1, side.getMinU(), side.getMinV()); +            tes.addVertexWithUV(x + 1, y + 0.001, z + 1, side.getMaxU(), side.getMinV()); +            tes.addVertexWithUV(x + 1, y + 0.001, z, side.getMaxU(), side.getMaxV()); +        } +        return true; +    } + +    @Override +    public boolean shouldRender3DInInventory(int modelId) { +        return true; +    } + +    @Override +    public int getRenderId() { +        return QuantumGlassRender.renderID; +    } +} diff --git a/src/main/java/com/github/technus/tectech/casing/GT_Block_CasingsTT.java b/src/main/java/com/github/technus/tectech/casing/GT_Block_CasingsTT.java new file mode 100644 index 0000000000..d15a0aa8d7 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/casing/GT_Block_CasingsTT.java @@ -0,0 +1,103 @@ +package com.github.technus.tectech.casing; + +import com.github.technus.tectech.CustomItemList; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.Textures; +import gregtech.api.objects.GT_CopiedBlockTexture; +import gregtech.api.util.GT_LanguageManager; +import gregtech.common.blocks.GT_Block_Casings_Abstract; +import gregtech.common.blocks.GT_Material_Casings; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; + +/** + * Created by danie_000 on 03.10.2016. + */ +public class GT_Block_CasingsTT +        extends GT_Block_Casings_Abstract { + +    private static IIcon eM3,eM4,eM5,eM6,eM7,eM8,eM9; +    private static IIcon debug[]=new IIcon[6]; + +    public GT_Block_CasingsTT() { + +        super(GT_Item_CasingsTT.class, "gt.blockcasingsTT", GT_Material_Casings.INSTANCE); +        for (byte i = 0; i < 16; i = (byte) (i + 1)) { +            Textures.BlockIcons.CASING_BLOCKS[(i + 96)] = new GT_CopiedBlockTexture(this, 6, i); +            /*IMPORTANT for block recoloring*/ +        } +        GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "Molecular Containment Casing");//adding +        GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".4.name", "Containment Field Generator");//adding +        GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".5.name", "Containment Field Generator Casing");//adding +        GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "Molecular Containment Coil");//adding +        GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".7.name", "Teleportation Casing");//adding +        GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Spacetime Altering Casing");//adding + +        GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "Debug Sides");//adding + + +        CustomItemList.eM_Casing.set(new ItemStack(this, 1, 3));//adding +        CustomItemList.eM_Field.set(new ItemStack(this, 1, 4));//adding +        CustomItemList.eM_Field_Casing.set(new ItemStack(this, 1, 5));//adding +        CustomItemList.eM_Coil.set(new ItemStack(this, 1, 6));//adding +        CustomItemList.eM_Tele.set(new ItemStack(this, 1, 7));//adding +        CustomItemList.eM_TimeSpaceWarp.set(new ItemStack(this, 1, 8)); + +        CustomItemList.debugBlock.set(new ItemStack(this, 1, 9)); +    } + +    @Override +    public void registerBlockIcons(IIconRegister aIconRegister) { +        //super.registerBlockIcons(aIconRegister); +        eM3=aIconRegister.registerIcon("gregtech:iconsets/EM_CASING"); +        eM4=aIconRegister.registerIcon("gregtech:iconsets/EM_FIELD"); +        eM5=aIconRegister.registerIcon("gregtech:iconsets/EM_FIELD_CASING"); +        eM6=aIconRegister.registerIcon("gregtech:iconsets/EM_COIL"); +        eM7=aIconRegister.registerIcon("gregtech:iconsets/EM_COIL_NONSIDE"); +        eM8=aIconRegister.registerIcon("gregtech:iconsets/EM_TELE"); +        eM8=aIconRegister.registerIcon("gregtech:iconsets/EM_TELE"); +        eM9=aIconRegister.registerIcon("gregtech:iconsets/EM_TIMESPACE"); + +        debug[0]=aIconRegister.registerIcon("gregtech:iconsets/DEBUG_0"); +        debug[1]=aIconRegister.registerIcon("gregtech:iconsets/DEBUG_1"); +        debug[2]=aIconRegister.registerIcon("gregtech:iconsets/DEBUG_2"); +        debug[3]=aIconRegister.registerIcon("gregtech:iconsets/DEBUG_3"); +        debug[4]=aIconRegister.registerIcon("gregtech:iconsets/DEBUG_4"); +        debug[5]=aIconRegister.registerIcon("gregtech:iconsets/DEBUG_5"); +    } + +    public IIcon getIcon(int aSide, int aMeta) { +        switch (aMeta) { +            case 3: +                return eM3; +            case 4: +                return eM4; +            case 5: +                return eM5; +            case 6: +                if(aSide<2)return eM7; +                return eM6; +            case 7: +                return eM8; +            case 8: +                return eM9; +            case 9: +                return debug[aSide]; +            default: +                return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); +        } +    } + +    @SideOnly(Side.CLIENT) +    public IIcon getIcon(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int aSide) { +        int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); +        return getIcon(aSide,tMeta); +    } + +    public int colorMultiplier(IBlockAccess aWorld, int aX, int aY, int aZ) { +        return super.colorMultiplier(aWorld, aX, aY, aZ); +    } +} diff --git a/src/main/java/com/github/technus/tectech/casing/GT_Container_CasingsTT.java b/src/main/java/com/github/technus/tectech/casing/GT_Container_CasingsTT.java new file mode 100644 index 0000000000..ddda51ea33 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/casing/GT_Container_CasingsTT.java @@ -0,0 +1,10 @@ +package com.github.technus.tectech.casing; + +import net.minecraft.block.Block; + +/** + * Created by danie_000 on 03.10.2016. + */ +public class GT_Container_CasingsTT{ +    public static Block sBlockCasingsTT; +} diff --git a/src/main/java/com/github/technus/tectech/casing/GT_Item_CasingsTT.java b/src/main/java/com/github/technus/tectech/casing/GT_Item_CasingsTT.java new file mode 100644 index 0000000000..0560b28896 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/casing/GT_Item_CasingsTT.java @@ -0,0 +1,14 @@ +package com.github.technus.tectech.casing; + +import gregtech.common.blocks.GT_Item_Casings_Abstract; +import net.minecraft.block.Block; + +/** + * Created by danie_000 on 03.10.2016. + */ +public class GT_Item_CasingsTT +        extends GT_Item_Casings_Abstract { +    public GT_Item_CasingsTT(Block par1) { +        super(par1); +    } +} diff --git a/src/main/java/com/github/technus/tectech/casing/GT_Loader_CasingsTT.java b/src/main/java/com/github/technus/tectech/casing/GT_Loader_CasingsTT.java new file mode 100644 index 0000000000..3094d5e8b3 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/casing/GT_Loader_CasingsTT.java @@ -0,0 +1,10 @@ +package com.github.technus.tectech.casing; + +/** + * Created by danie_000 on 03.10.2016. + */ +public class GT_Loader_CasingsTT implements Runnable { +    public void run(){ +        GT_Container_CasingsTT.sBlockCasingsTT = new GT_Block_CasingsTT(); +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/README b/src/main/java/com/github/technus/tectech/elementalMatter/README new file mode 100644 index 0000000000..f34168aa50 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/README @@ -0,0 +1,45 @@ +TO CHANGE DEFINITION YOU MUST INSTANTIATE IT ONCE MORE (from scratch, failing to do that will end up in the heavy bugs)! + + Example complex definition: + + Bottom + + PrimitiveDef + | + DefStack + ||||| + DefStackTree + | + ..... ETC up to the point when you can no longer make NBT to save it (128 levels - already used ones) + Def - definition of the parent stack + | + DefStack - stacks that build the parent definition + |||||multiple to 1 + DefStackTree - internal storage for components of parent def + | + Def - definition of the parent stack + | + DefStack - stacks that build the parent definition + |||||multiple to 1 + DefStackTree - internal storage for components of parent def + | + Definition - top hierarchy definition + | 1 to 1 + DefinitionStack - for recipe comparisons + OR + InstanceStack - real things + + TOP + +Trees: + + DefinitionStack - def stack + |||||multiple to 1 + DefinitionStackTree - def container - for recipe comparisons + + + InstanceStack - inst stack + |||||multiple to 1 + InstanceStackTree - inst container - real things go here + +//TODO CHECK USE CASES OF VALUES and KEYS method!
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/Behaviour_elementalMatterContainer.java b/src/main/java/com/github/technus/tectech/elementalMatter/classes/Behaviour_elementalMatterContainer.java new file mode 100644 index 0000000000..dcef8a8d7a --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/classes/Behaviour_elementalMatterContainer.java @@ -0,0 +1,76 @@ +package com.github.technus.tectech.elementalMatter.classes; + + +import com.github.technus.tectech.elementalMatter.commonValues; +import com.github.technus.tectech.elementalMatter.interfaces.iElementalInstanceContainer; +import gregtech.api.interfaces.IItemBehaviour; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.items.GT_MetaBase_Item; +import gregtech.api.util.GT_LanguageManager; +import gregtech.common.items.behaviors.Behaviour_None; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +import java.util.Collections; +import java.util.List; + +import static com.github.technus.tectech.elementalMatter.commonValues.DEBUGMODE; + +/** + * Created by danie_000 on 11.12.2016. + * used in custom GT build! debug purposes + */ +public final class Behaviour_elementalMatterContainer extends Behaviour_None { +    public static final IItemBehaviour<GT_MetaBase_Item> INSTANCE = new Behaviour_elementalMatterContainer(); +    private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.emc", "Container for elemental matter"); + +    public boolean onItemUseFirst(GT_MetaBase_Item aItem, 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) { +                    cElementalInstanceStackTree content=((iElementalInstanceContainer) metaTE).getContainerHandler(); +                    if (tNBT.hasKey("content")) { +                        try { +                            content.putUnifyAll(cElementalInstanceStackTree.fromNBT(tNBT.getCompoundTag("content"))); +                        }catch (tElementalException e){ +                            if(DEBUGMODE)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; +    } + +    public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) { +        aList.add(commonValues.tecMark); +        aList.add(mTooltip); +        try { +            NBTTagCompound tNBT = aStack.getTagCompound(); +            if(tNBT.hasKey("info")) { +                aList.add("Contains:"); +                Collections.addAll(aList, cElementalInstanceStackTree.infoFromNBT(tNBT.getCompoundTag("info"))); +            } +        }catch(Exception e){aList.add("---Unexpected Termination---");} +        return aList; +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDecay.java b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDecay.java new file mode 100644 index 0000000000..1098ac3a1f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDecay.java @@ -0,0 +1,65 @@ +package com.github.technus.tectech.elementalMatter.classes; + +import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class cElementalDecay { +    public static final cElementalDecay[] noDecay=(cElementalDecay[]) null; +                                                //DECAY IMPOSSIBLE!!! +                                                //Do not use regular NULL java will not make it work with varargs!!! +                                                //Or cast null into ARRAY type but this static is more convenient!!! +    public static final cElementalDecay[] noProduct=new cElementalDecay[0]; +                                                //this in turn can be used to tell that the thing should just vanish +    public final cElementalDefinitionStackTree outputStacks; +    public final float probability; + +    public cElementalDecay(iElementalDefinition... outSafe) { +        this(2F, outSafe); +    } + +    public cElementalDecay(float probability, iElementalDefinition... outSafe) { +        cElementalDefinitionStack[] outArr = new cElementalDefinitionStack[outSafe.length]; +        for (int i = 0; i < outArr.length; i++) { +            outArr[i] = new cElementalDefinitionStack(outSafe[i], 1); +        } +        this.outputStacks = new cElementalDefinitionStackTree(outArr); +        this.probability = probability; +    } + +    public cElementalDecay(cElementalDefinitionStack... outSafe) { +        this(2F, outSafe); +    } + +    public cElementalDecay(float probability, cElementalDefinitionStack... out) { +        this.outputStacks = new cElementalDefinitionStackTree(out); +        this.probability = probability; +    } + +    public cElementalDecay(cElementalDefinitionStackTree tree){ +        this(2F, tree); +    } + +    public cElementalDecay(float probability,cElementalDefinitionStackTree tree){ +        this.outputStacks=tree; +        this.probability=probability; +    } + +    public cElementalInstanceStackTree getResults(float lifeMult, int age, int energy, int amountDecaying) { +        cElementalInstanceStackTree decayResult = new cElementalInstanceStackTree(); +        if(outputStacks == null) return decayResult;//This is to prevent null pointer exceptions. +                //Deny decay code is in instance! +        int qtty = 0; +        for (cElementalDefinitionStack stack : outputStacks.values()) qtty += stack.amount; +        if(qtty<=0) return decayResult; +        //energy /= qtty; +        //lifeMult /= (float) qtty; +        for (cElementalDefinitionStack stack : outputStacks.values()) { +            decayResult.putUnify(new cElementalInstanceStack(stack.definition, +                    amountDecaying * stack.amount, +                    lifeMult, age, energy/Math.max(1,stack.amount)));//get instances from stack +        } +        return decayResult; +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinition.java new file mode 100644 index 0000000000..807d6991ae --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinition.java @@ -0,0 +1,79 @@ +package com.github.technus.tectech.elementalMatter.classes; + +import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; +import com.github.technus.tectech.elementalMatter.interfaces.iHasElementalDefinition; +import net.minecraft.nbt.NBTTagCompound; + +import java.lang.reflect.Method; +import java.util.TreeMap; + +import static com.github.technus.tectech.elementalMatter.commonValues.DEBUGMODE; +import static com.github.technus.tectech.elementalMatter.definitions.cPrimitiveDefinition.debug__; + +/** + * Created by danie_000 on 23.01.2017. + */ +public abstract class cElementalDefinition implements iElementalDefinition { +    //add text based creators for recipe formula input? +    private static final TreeMap<Byte,Method> nbtCreationBind=new TreeMap<>();//creator methods in subclasses + +    protected static Method addCreatorFromNBT(byte b,Method m){ +        return nbtCreationBind.put(b,m); +    } + +    //Nothing array +    public static final iElementalDefinition[] nothing = new cElementalPrimitive[0]; + +    public static iElementalDefinition fromNBT(NBTTagCompound nbt){ +        try { +            return (iElementalDefinition) nbtCreationBind.get(nbt.getByte("t")).invoke(null, nbt); +        }catch(Exception e){ +            if(DEBUGMODE)e.printStackTrace(); +            return debug__; +        } +    } + +    @Override +    public final boolean equals(Object obj) { +        if(obj instanceof iElementalDefinition) +            return compareTo((iElementalDefinition) obj)==0; +        if(obj instanceof iHasElementalDefinition) +            return compareTo(((iHasElementalDefinition) obj).getDefinition())==0; +        return false; +    } + +    @Override +    public int compareTo(iElementalDefinition o) { +        if(getClassType()==o.getClassType()){ +            //only of the internal def stacks!!! +            //that allows neat check if the same thing and +            //top hierarchy amount can be used to store amount info +            return compareDefinitionStacksWithAmount(getSubParticles().values(),o.getSubParticles().values()); +        } +        return compareClasses(o); +    } + +    public final int compareClasses(iElementalDefinition obj){ +        return ((int)getClassType())-obj.getClassType(); +    } + +    //use only for nested operations! +    private static int compareDefinitionStacksWithAmount(cElementalDefinitionStack[] tc, cElementalDefinitionStack[] sc){ +        if(tc == null) +            if(sc == null) return 0; +            else return -1; +        if(sc == null) return 1; + +        if (tc.length > sc.length) return 1; +        if (tc.length < sc.length) return -1; + +        for (int i = 0; i < tc.length; i++) { +            int cn = tc[i].definition.compareTo(sc[i].definition); +            if (cn != 0) return cn; + +            if (tc[i].amount > sc[i].amount) return  1; +            if (tc[i].amount < sc[i].amount) return -1; +        } +        return 0; +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinitionStack.java b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinitionStack.java new file mode 100644 index 0000000000..679c1a9c43 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinitionStack.java @@ -0,0 +1,74 @@ +package com.github.technus.tectech.elementalMatter.classes; + +import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; +import com.github.technus.tectech.elementalMatter.interfaces.iHasElementalDefinition; +import net.minecraft.nbt.NBTTagCompound; + +import static com.github.technus.tectech.elementalMatter.definitions.cPrimitiveDefinition.null__; + +/** + * Created by danie_000 on 20.11.2016. + */ +public final class cElementalDefinitionStack implements iHasElementalDefinition { +    public final iElementalDefinition definition; +    public final int amount; + +    public cElementalDefinitionStack(iElementalDefinition def, int amount) { +        this.definition = def==null?null__:def; +        this.amount = amount; +    } + +    @Override +    public iElementalDefinition getDefinition() { +        return definition; +    } + +    @Override +    public int getAmount() { +        return amount; +    } + +    public int getCharge() { +        return definition.getCharge() * amount; +    } + +    public float getMass() { +        return definition.getMass() * amount; +    } + +    @Override +    public int compareTo(iHasElementalDefinition o) { +        return definition.compareTo(o.getDefinition()); +    } + +    @Override +    public boolean equals(Object obj) { +        if(obj instanceof iElementalDefinition) +            return definition.compareTo((iElementalDefinition) obj)==0; +        if(obj instanceof iHasElementalDefinition) +            return definition.compareTo(((iHasElementalDefinition) obj).getDefinition())==0; +        return false; +    } + +    public NBTTagCompound toNBT() { +        NBTTagCompound nbt=new NBTTagCompound(); +        nbt.setTag("d",definition.toNBT()); +        nbt.setInteger("q",amount); +        return nbt; +    } + +    public static cElementalDefinitionStack fromNBT(NBTTagCompound nbt){ +        return new cElementalDefinitionStack( +                cElementalDefinition.fromNBT(nbt.getCompoundTag("d")), +                nbt.getInteger("q")); +    } + +    public cElementalDefinitionStack unifyIntoNew(cElementalDefinitionStack... other){ +        if(other==null)return this; +        int i=amount; +        for(cElementalDefinitionStack stack:other) +            if(stack!=null) +                i+=stack.amount; +        return new cElementalDefinitionStack(definition,i); +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinitionStackTree.java b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinitionStackTree.java new file mode 100644 index 0000000000..347c46b1a4 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinitionStackTree.java @@ -0,0 +1,304 @@ +package com.github.technus.tectech.elementalMatter.classes; + +import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; +import com.github.technus.tectech.elementalMatter.interfaces.iHasElementalDefinition; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; + +import java.util.Map; +import java.util.TreeMap; + +import static com.github.technus.tectech.elementalMatter.definitions.cPrimitiveDefinition.debug__; + +/** + * Created by danie_000 on 22.01.2017. + */ +public final class cElementalDefinitionStackTree implements Comparable<cElementalDefinitionStackTree> { +    private TreeMap<iElementalDefinition,cElementalDefinitionStack> tree=new TreeMap<>(); +//Constructors +    public cElementalDefinitionStackTree(){} + +    @Deprecated +    public cElementalDefinitionStackTree(iElementalDefinition... in){ +        if(in==null)return; +        for(iElementalDefinition definition:in) +            tree.put(definition, new cElementalDefinitionStack(definition,1)); +    } + +    public cElementalDefinitionStackTree(cElementalDefinitionStack... in){ +        if(in==null)return; +        for(cElementalDefinitionStack stack:in) +            tree.put(stack.definition, stack); +    } + +    private cElementalDefinitionStackTree(TreeMap<iElementalDefinition,cElementalDefinitionStack> in){ +        if(in==null)return; +        tree=in; +    } + +    public cElementalDefinitionStackTree(cElementalDefinitionStackTree in){ +        this(in.tree); +    } + +    @Override +    protected Object clone() throws CloneNotSupportedException { +        return new cElementalDefinitionStackTree(tree); +    } + +    @Override +    public int compareTo(cElementalDefinitionStackTree o) { +        if(tree.size()!=o.tree.size())return tree.size()-o.tree.size(); +        cElementalDefinitionStack[] ofThis=values(),ofThat=o.values(); +        for(int i=0;i<ofThat.length;i++){ +            int result=ofThis[i].compareTo(ofThat[i]); +            if(result!=0) return result; +        } +        return 0; +    } + +    //Removers +    public void clear(){ +        tree.clear(); +    } + +    public cElementalDefinitionStack remove(iElementalDefinition def){ +        return tree.remove(def); +    } + +    @Deprecated +    public cElementalDefinitionStack remove(iHasElementalDefinition has){ +        return tree.remove(has.getDefinition()); +    } + +    public void removeAll(iElementalDefinition... definitions){ +        for(iElementalDefinition def:definitions) +            tree.remove(def); +    } + +    @Deprecated +    private void removeAll(iHasElementalDefinition... hasElementals){ +        for(iHasElementalDefinition has:hasElementals) +            tree.remove(has.getDefinition()); +    } + +//Remove amounts +    public boolean removeAmount(boolean testOnly, cElementalInstanceStack instance){ +        final cElementalDefinitionStack target=tree.get(instance.definition); +        if(target==null) +            return false; +        if(testOnly) +            return target.amount>=instance.amount; +        else{ +            final int diff=target.amount-instance.amount; +            if(diff>0) { +                tree.put(target.definition,new cElementalDefinitionStack(target.definition,diff)); +                return true; +            }else if(diff==0){ +                tree.remove(instance.definition); +                return true; +            } +        } +        return false; +    } + +    public boolean removeAmount(boolean testOnly, cElementalDefinitionStack stack){ +        final cElementalDefinitionStack target=tree.get(stack.definition); +        if(target==null) +            return false; +        if(testOnly) +            return target.amount>=stack.amount; +        else{ +            final int diff=target.amount-stack.amount; +            if(diff>0) { +                tree.put(target.definition,new cElementalDefinitionStack(target.definition,diff)); +                return true; +            }else if(diff==0){ +                tree.remove(stack.definition); +                return true; +            } +        } +        return false; +    } + +    @Deprecated +    public boolean removeAmount(boolean testOnly, iElementalDefinition def){ +        return removeAmount(testOnly,new cElementalDefinitionStack(def,1)); +    } + +    public boolean removeAllAmounts(boolean testOnly, cElementalInstanceStack... instances) { +        boolean test=true; +        for(cElementalInstanceStack stack:instances) +            test&=removeAmount(true,stack); +        if(testOnly || !test)return test; +        for(cElementalInstanceStack stack:instances) +            removeAmount(false,stack); +        return true; +    } + +    public boolean removeAllAmounts(boolean testOnly, cElementalDefinitionStack... stacks){ +        boolean test=true; +        for(cElementalDefinitionStack stack:stacks) +            test&=removeAmount(true,stack); +        if(testOnly || !test)return test; +        for(cElementalDefinitionStack stack:stacks) +            removeAmount(false,stack); +        return true; +    } + +    @Deprecated +    public boolean removeAllAmounts(boolean testOnly, iElementalDefinition...  definitions){ +        final cElementalDefinitionStack[] stacks=new cElementalDefinitionStack[definitions.length]; +        for (int i=0;i<stacks.length;i++) +            stacks[i]=new cElementalDefinitionStack(definitions[i],1); +        return removeAllAmounts(testOnly,stacks); +    } + +    public boolean removeAllAmounts(boolean testOnly, cElementalDefinitionStackTree container){ +        return removeAllAmounts(testOnly,container.values()); +    } + +    public boolean removeAllAmounts(boolean testOnly, cElementalInstanceStackTree container){ +        return removeAllAmounts(testOnly,container.values()); +    } + +//Put replace +    public cElementalDefinitionStack putReplace(cElementalDefinitionStack defStackUnsafe){ +        return tree.put(defStackUnsafe.definition,defStackUnsafe); +    } + +    public void putReplaceAll(cElementalDefinitionStack... defStacks){ +        for(cElementalDefinitionStack defStack:defStacks) +            this.tree.put(defStack.definition,defStack); +    } + +    private void putReplaceAll(Map<iElementalDefinition,cElementalDefinitionStack> inTreeUnsafe){ +        this.tree.putAll(inTreeUnsafe); +    } + +    public void putReplaceAll(cElementalDefinitionStackTree inContainerUnsafe){ +        putReplaceAll(inContainerUnsafe.tree); +    } + +//Put unify +    public cElementalDefinitionStack putUnify(cElementalDefinitionStack def){ +        return tree.put(def.definition,def.unifyIntoNew(tree.get(def.definition))); +    } + +    @Deprecated +    public cElementalDefinitionStack putUnify(iElementalDefinition def){ +        return putUnify(new cElementalDefinitionStack(def,1)); +    } + +    public void putUnifyAll(cElementalDefinitionStack... defs){ +        for(cElementalDefinitionStack def:defs) +            putUnify(def); +    } + +    @Deprecated +    public void  putUnifyAll(iElementalDefinition... defs){ +        for(iElementalDefinition def:defs) +            putUnify(def); +    } + +    private void putUnifyAll(Map<iElementalDefinition,cElementalDefinitionStack> inTreeUnsafe){ +        for (cElementalDefinitionStack in:inTreeUnsafe.values()) +            putUnify(in); +    } + +    public void putUnifyAll(cElementalDefinitionStackTree containerUnsafe){ +        putUnifyAll(containerUnsafe.tree); +    } +//Getters +    public cElementalDefinitionStack getDefinitionStack(iElementalDefinition def){ +        return tree.get(def); +    } + +    public String[] getElementalInfo() { +        final String[] info=new String[tree.size()*3]; +        int i=0; +        for(cElementalDefinitionStack defStack:tree.values()){ +            info[i  ]=EnumChatFormatting.BLUE + defStack.definition.getName(); +            info[i+1]=EnumChatFormatting.AQUA + defStack.definition.getSymbol(); +            info[i+2]="Amount "+EnumChatFormatting.GREEN + defStack.amount; +            i+=3; +        } +        return info; +    } + +    public cElementalDefinitionStack[] values(){ +        return tree.values().toArray(new cElementalDefinitionStack[0]); +    } + +    public iElementalDefinition[] keys(){ +        return tree.keySet().toArray(new iElementalDefinition[0]); +    } + +//Tests +    public boolean containsDefinition(iElementalDefinition def){ +        return tree.containsKey(def); +    } + +    public boolean containsDefinitionStack(cElementalDefinitionStack inst){ +        return tree.containsValue(inst); +    } + +    public int size(){ +        return tree.size(); +    } + +    public boolean hasStacks(){ +        return tree.size()>0; +    } + +//NBT +    public NBTTagCompound getInfoNBT(){ +        final NBTTagCompound nbt=new NBTTagCompound(); +        final String[] info=getElementalInfo(); +        nbt.setInteger("i",info.length); +        for(int i=0;i<info.length;i++) +            nbt.setString(Integer.toString(i),info[i]); +        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 NBTTagCompound toNBT() { +        final NBTTagCompound nbt=new NBTTagCompound(); +        nbt.setInteger("i",tree.size()); +        int i=0; +        for(cElementalDefinitionStack defStack: tree.values()) +            nbt.setTag(Integer.toString(i++),defStack.toNBT()); +        return nbt; +    } + +    public static cElementalDefinitionStackTree fromNBT(NBTTagCompound nbt) throws tElementalException{ +        final cElementalDefinitionStack[] defStacks=new cElementalDefinitionStack[nbt.getInteger("i")]; +        for(int i=0;i<defStacks.length;i++) { +            defStacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); +            if(defStacks[i].definition.equals(debug__)) +                throw new tElementalException("Something went Wrong"); +        } +        return new cElementalDefinitionStackTree(defStacks); +    } + +//stackUp +    @Deprecated +    public static cElementalDefinitionStackTree stackUpTree(iElementalDefinition... in){ +        final cElementalDefinitionStackTree inTree=new cElementalDefinitionStackTree(); +        for(iElementalDefinition def:in){ +            inTree.putUnify(new cElementalDefinitionStack(def,1)); +        } +        return inTree; +    } + +    public static cElementalDefinitionStackTree stackUpTree(cElementalDefinitionStack... in){ +        final cElementalDefinitionStackTree inTree=new cElementalDefinitionStackTree(); +        inTree.putUnifyAll(in); +        return inTree; +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStack.java b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStack.java new file mode 100644 index 0000000000..bcaae7ca03 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStack.java @@ -0,0 +1,245 @@ +package com.github.technus.tectech.elementalMatter.classes; + +import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; +import com.github.technus.tectech.elementalMatter.interfaces.iHasElementalDefinition; +import gregtech.api.objects.XSTR; +import net.minecraft.nbt.NBTTagCompound; + +import static com.github.technus.tectech.elementalMatter.definitions.cPrimitiveDefinition.null__; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class cElementalInstanceStack implements iHasElementalDefinition { +    private static final XSTR xstr = new XSTR(); + +    public final iElementalDefinition definition; +    //energy - if positive then particle should try to decay +    public int energy; +    //byte color; 0=R 1=G 2=B 0=C 1=M 2=Y, else ignored +    private byte color; +    public int age; +    public int amount; +    private float lifeTime; +    private float lifeTimeMult; + +    public cElementalInstanceStack(cElementalDefinitionStack stackSafe) { +        this(stackSafe.definition, stackSafe.amount, 1F, 0, 0); +    } + +    public cElementalInstanceStack(cElementalDefinitionStack stackSafe, float lifeTimeMult, int age, int energy) { +        this(stackSafe.definition,stackSafe.amount,lifeTimeMult,age,energy); +    } + +    public cElementalInstanceStack(iElementalDefinition defSafe, int amount) { +        this(defSafe, amount, 1F, 0, 0); +    } + +    public cElementalInstanceStack(iElementalDefinition defSafe, int amount, float lifeTimeMult, int age, int energy) { +        this.definition = defSafe==null?null__:defSafe; +        byte color = definition.getColor(); +        if (color < (byte) 0) {//transforms colorable??? into proper color +            this.color = color; +        } else { +            this.color = (byte) (xstr.nextInt(3)); +        } +        this.lifeTimeMult = lifeTimeMult; +        this.lifeTime = definition.getRawLifeTime() * this.lifeTimeMult; +        this.age = age; +        this.energy = energy; +        this.amount=amount; +    } + +    @Override +    public int getAmount() { +        return amount; +    } + +    public int getCharge() { +        return definition.getCharge() * amount; +    } + +    public float getMass() { +        return definition.getMass() * amount; +    } + +    public cElementalDefinitionStack getDefinitionStack() { +        return new cElementalDefinitionStack(definition,amount); +    } + +    @Override +    public iElementalDefinition getDefinition() { +        return definition; +    } + +    public byte getColor() { +        return color; +    } + +    public byte setColor(byte color) { +        if (this.color < (byte) 0) return this.color; +        this.color = color; +        return this.color; +    } + +    public byte nextColor() { +        if (this.color < (byte) 0) return this.color; +        this.color = (byte) (xstr.nextInt(3)); +        return this.color; +    } + +    public float getLifeTime() { +        return lifeTime; +    } + +    public float multLifeTime(float mult) { +        this.lifeTimeMult = mult; +        this.lifeTime = definition.getRawLifeTime() * mult; +        return this.lifeTime; +    } + +    public float getLifeTimeMult() { +        return lifeTimeMult; +    } + +    public cElementalInstanceStackTree decay() { +        return decay(1F, age, 0); +    } + +    public cElementalInstanceStackTree decay(Float lifeTimeMult, int age, int postEnergize) { +        if (this.energy > 0) { +            this.energy--; +            return decayCompute(definition.getEnergeticDecayInstant(), lifeTimeMult, age, postEnergize + this.energy); +        } else if (definition.getRawLifeTime() < 0) { +            return null;//return null, decay cannot be achieved +        } else if (1F > this.lifeTime) { +            return decayCompute(definition.getNaturalDecayInstant(), lifeTimeMult, age, postEnergize + this.energy); +        } else if (((float) this.age) > this.lifeTime) { +            return decayCompute(definition.getDecayArray(), lifeTimeMult, age, postEnergize + this.energy); +        } +        return null;//return null since decay cannot be achieved +    } + +    private cElementalInstanceStackTree decayCompute(cElementalDecay[] decays, float lifeTimeMult, int age, int energy) { +        if (decays == null) return null;//Can not decay so it wont +        else if (decays.length == 0) return new cElementalInstanceStackTree();//provide non null 0 length array for annihilation +        else if (decays.length == 1) {//only one type of decay :D, doesn't need dead end +            return decays[0].getResults(lifeTimeMult, age, energy, this.amount); +        } else { +            cElementalInstanceStackTree output = new cElementalInstanceStackTree(); +            final int differentDecays = decays.length; +            int[] qttyOfDecay = new int[differentDecays]; +            int amountRemaining = this.amount, amount = this.amount; +            float remainingProbability = 1F; + +            for (int i = 0; i < differentDecays; i++) { +                if (decays[i].probability > 1F) { +                    int thisDecayAmount = (int) (Math.floor(remainingProbability * (float) amount)); +                    if (thisDecayAmount == 0) { +                        //remainingProbability=something; +                        break; +                    } else if (thisDecayAmount <= amountRemaining) { +                        amountRemaining -= thisDecayAmount; +                        qttyOfDecay[i] += thisDecayAmount; +                        break; +                    } +                    //in case too much was made +                    qttyOfDecay[i] += amountRemaining; +                    amountRemaining = 0; +                    //remainingProbability=0; +                    break; +                } +                int thisDecayAmount = (int) (Math.floor(decays[i].probability * (float) amount)); +                if (thisDecayAmount <= amountRemaining && thisDecayAmount > 0) {//some was made +                    remainingProbability -= (decays[i].probability); +                    amountRemaining -= thisDecayAmount; +                    qttyOfDecay[i] += thisDecayAmount; +                } else if (thisDecayAmount > amountRemaining) {//too much was made +                    qttyOfDecay[i] += amountRemaining; +                    amountRemaining = 0; +                    //remainingProbability=0; +                    break; +                }//if 0 +            } + +            for (int i = 0; i < amountRemaining; i++) { +                double rand = (double) (xstr.nextFloat()); +                for (int j = 0; j < differentDecays; j++) {//looking for the thing it decayed into +                    rand -= (double) (decays[j].probability); +                    if (rand <= 0D) { +                        qttyOfDecay[j]++; +                        break; +                    } +                } +            } + +            for (int i = 0; i < differentDecays; i++) { +                if (qttyOfDecay[i] > 0) +                    output.putUnifyAll(decays[i].getResults(lifeTimeMult, age, energy, qttyOfDecay[i])); +            } +            return output; +        } +    } + +    public cElementalInstanceStack getCopy() { +        cElementalInstanceStack cI = new cElementalInstanceStack(definition,amount, lifeTimeMult, age, energy); +        cI.setColor(color); +        return cI; +    } + +    @Override +    public int compareTo(iHasElementalDefinition o) {//use for unification +        return definition.compareTo(o.getDefinition()); +    } + +    @Override +    public boolean equals(Object obj) { +        if(obj instanceof iElementalDefinition) +            return definition.compareTo((iElementalDefinition) obj)==0; +        if(obj instanceof iHasElementalDefinition) +            return definition.compareTo(((iHasElementalDefinition) obj).getDefinition())==0; +        return false; +    } + +    public cElementalInstanceStack unifyIntoThis(cElementalInstanceStack... instances){ +        if(instances==null)return this; +        //returns with the definition from the first object passed +        int energy=this.energy*this.amount; +        float lifeTimeMul=this.lifeTimeMult; + +        for(cElementalInstanceStack instance:instances){ +            if(instance!=null && this.compareTo(instance)==0) { +                this.amount += instance.amount; +                energy += instance.energy * instance.amount; +                lifeTimeMul = Math.min(lifeTimeMul, instance.lifeTimeMult); +                this.age = Math.max(this.age, instance.age); +            } +        } + +        if(amount!=0)energy/=Math.abs(amount); + +        this.energy=energy; +        this.multLifeTime(lifeTimeMul); +        return this; +    } + +    public NBTTagCompound toNBT() { +        NBTTagCompound nbt=new NBTTagCompound(); +        nbt.setTag("d", definition.toNBT()); +        nbt.setInteger("q",amount); +        nbt.setInteger("e",energy); +        nbt.setByte("c",color); +        nbt.setInteger("a",age); +        nbt.setFloat("m",lifeTimeMult); +        return nbt; +    } + +    public static cElementalInstanceStack fromNBT(NBTTagCompound nbt){ +        NBTTagCompound definition=nbt.getCompoundTag("d"); +        cElementalInstanceStack instance= new cElementalInstanceStack( +                cElementalDefinition.fromNBT(definition), +                nbt.getInteger("q"),nbt.getFloat("m"),nbt.getInteger("a"),nbt.getInteger("e")); +        instance.setColor(nbt.getByte("c")); +        return instance; +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStackTree.java b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStackTree.java new file mode 100644 index 0000000000..089e656a0d --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStackTree.java @@ -0,0 +1,345 @@ +package com.github.technus.tectech.elementalMatter.classes; + +import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; +import com.github.technus.tectech.elementalMatter.interfaces.iHasElementalDefinition; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; + +import java.util.Map; +import java.util.TreeMap; + +import static com.github.technus.tectech.elementalMatter.definitions.cPrimitiveDefinition.debug__; + +/** + * Created by danie_000 on 22.01.2017. + */ +public final class cElementalInstanceStackTree implements Comparable<cElementalInstanceStackTree> { +    private TreeMap<iElementalDefinition,cElementalInstanceStack> tree=new TreeMap<>(); +//Constructors +    public cElementalInstanceStackTree(){} + +    public cElementalInstanceStackTree(cElementalInstanceStack... inSafe){ +        this(true, inSafe); +    } + +    public cElementalInstanceStackTree(boolean copy, cElementalInstanceStack... in){ +        if(in==null)return; +        if(copy){ +            for(cElementalInstanceStack instance:in) { +                tree.put(instance.definition, instance.getCopy()); +            } +        }else{ +            for(cElementalInstanceStack instance:in) { +                tree.put(instance.definition, instance); +            } +        } +    } + +    private cElementalInstanceStackTree(TreeMap<iElementalDefinition,cElementalInstanceStack> inSafe){ +        this(true,inSafe); +    } + +    private cElementalInstanceStackTree(boolean copy, TreeMap<iElementalDefinition,cElementalInstanceStack> in){ +        if(in==null)return; +        if(copy){ +            for(cElementalInstanceStack instance:in.values()){ +                tree.put(instance.definition,instance.getCopy()); +            } +        }else{ +            tree=in; +        } +    } + +    public cElementalInstanceStackTree(cElementalInstanceStackTree inSafe){ +        this(true,inSafe.tree); +    } + +    public cElementalInstanceStackTree(boolean copy, cElementalInstanceStackTree in){ +        this(copy,in.tree); +    } + +    @Override +    protected Object clone() throws CloneNotSupportedException { +        return new cElementalInstanceStackTree(tree); +    } + +    @Override +    public int compareTo(cElementalInstanceStackTree o) { +        if(tree.size()!=o.tree.size())return tree.size()-o.tree.size(); +        cElementalInstanceStack[] ofThis=values(),ofThat=o.values(); +        for(int i=0;i<ofThat.length;i++){ +            int result=ofThis[i].compareTo(ofThat[i]); +            if(result!=0) return result; +        } +        return 0; +    } + +//Removers +    public void clear(){ +        tree.clear(); +    } + +    public cElementalInstanceStack remove(iElementalDefinition def){ +        return tree.remove(def); +    } + +    @Deprecated +    public cElementalInstanceStack remove(iHasElementalDefinition has){ +        return tree.remove(has.getDefinition()); +    } + +    public void removeAll(iElementalDefinition... definitions){ +        for(iElementalDefinition def:definitions) +            tree.remove(def); +    } + +    @Deprecated +    private void removeAll(iHasElementalDefinition... hasElementals){ +        for(iHasElementalDefinition has:hasElementals) +            tree.remove(has.getDefinition()); +    } + +//Remove amounts +    public boolean removeAmount(boolean testOnly, cElementalInstanceStack instance){ +        final cElementalInstanceStack target=tree.get(instance.definition); +        if(target==null) +            return false; +        if(testOnly) +            return target.amount>=instance.amount; +        else{ +            final int diff=target.amount-instance.amount; +            if(diff>0) { +                target.amount=diff; +                return true; +            }else if(diff==0){ +                tree.remove(instance.definition); +                return true; +            } +        } +        return false; +    } + +    public boolean removeAmount(boolean testOnly, cElementalDefinitionStack stack){ +        final cElementalInstanceStack target=tree.get(stack.definition); +        if(target==null) +            return false; +        if(testOnly) +            return target.amount>=stack.amount; +        else{ +            final int diff=target.amount-stack.amount; +            if(diff>0) { +                target.amount=diff; +                return true; +            }else if(diff==0){ +                tree.remove(stack.definition); +                return true; +            } +        } +        return false; +    } + +    @Deprecated +    public boolean removeAmount(boolean testOnly, iElementalDefinition def){ +        return removeAmount(testOnly,new cElementalDefinitionStack(def,1)); +    } + +    public boolean removeAllAmounts(boolean testOnly, cElementalInstanceStack... instances) { +        boolean test=true; +        for(cElementalInstanceStack stack:instances) +            test&=removeAmount(true,stack); +        if(testOnly || !test)return test; +        for(cElementalInstanceStack stack:instances) +            removeAmount(false,stack); +        return true; +    } + +    public boolean removeAllAmounts(boolean testOnly, cElementalDefinitionStack... stacks){ +        boolean test=true; +        for(cElementalDefinitionStack stack:stacks) +            test&=removeAmount(true,stack); +        if(testOnly || !test)return test; +        for(cElementalDefinitionStack stack:stacks) +            removeAmount(false,stack); +        return true; +    } + +    @Deprecated +    public boolean removeAllAmounts(boolean testOnly, iElementalDefinition...  definitions){ +        final cElementalDefinitionStack[] stacks=new cElementalDefinitionStack[definitions.length]; +        for (int i=0;i<stacks.length;i++) +            stacks[i]=new cElementalDefinitionStack(definitions[i],1); +        return removeAllAmounts(testOnly,stacks); +    } + +    public boolean removeAllAmounts(boolean testOnly, cElementalDefinitionStackTree container){ +        return removeAllAmounts(testOnly,container.values()); +    } + +    public boolean removeAllAmounts(boolean testOnly, cElementalInstanceStackTree container){ +        return removeAllAmounts(testOnly,container.values()); +    } + +//Remove overflow +    public float removeOverflow(int stacksCount,int stackCapacity){ +        float massRemoved=0; + +        if(tree.size()>stacksCount) { +            iElementalDefinition[] keys= this.keys(); +            for(int i=stacksCount;i<keys.length;i++){ +                massRemoved+=tree.get(keys[i]).getDefinitionStack().getMass(); +                tree.remove(keys[i]); +            } +        } + +        for(cElementalInstanceStack instance:this.values()) +            if(instance.amount>stackCapacity) { +                massRemoved+=instance.definition.getMass()*(instance.amount-stackCapacity); +                instance.amount=stackCapacity; +            } +        return massRemoved; +    } + +//Put replace +    public cElementalInstanceStack putReplace(cElementalInstanceStack instanceUnsafe){ +        return tree.put(instanceUnsafe.definition,instanceUnsafe); +    } + +    public void putReplaceAll(cElementalInstanceStack... instances){ +        for(cElementalInstanceStack instance:instances) +            this.tree.put(instance.definition,instance); +    } + +    private void putReplaceAll(Map<iElementalDefinition,cElementalInstanceStack> inTreeUnsafe){ +        this.tree.putAll(inTreeUnsafe); +    } + +    public void putReplaceAll(cElementalInstanceStackTree inContainerUnsafe){ +        putReplaceAll(inContainerUnsafe.tree); +    } + +//Put unify +    public cElementalInstanceStack putUnify(cElementalInstanceStack instance){ +        return tree.put(instance.definition,instance.unifyIntoThis(tree.get(instance.definition))); +    } + +    public void putUnifyAll(cElementalInstanceStack... instances){ +        for(cElementalInstanceStack instance:instances) +            putUnify(instance); +    } + +    private void putUnifyAll(Map<iElementalDefinition,cElementalInstanceStack> inTreeUnsafe){ +        for (cElementalInstanceStack in:inTreeUnsafe.values()) +            putUnify(in); +    } + +    public void putUnifyAll(cElementalInstanceStackTree containerUnsafe){ +        putUnifyAll(containerUnsafe.tree); +    } + +//Getters +    public cElementalInstanceStack getInstance(iElementalDefinition def){ +        return tree.get(def); +    } + +    public String[] getElementalInfo() { +        final String[] info=new String[tree.size()*3]; +        int i=0; +        for(cElementalInstanceStack instance:tree.values()){ +            info[i  ]=EnumChatFormatting.BLUE + instance.definition.getName(); +            info[i+1]=EnumChatFormatting.AQUA + instance.definition.getSymbol(); +            info[i+2]="Amount "+EnumChatFormatting.GREEN + instance.amount; +            i+=3; +        } +        return info; +    } + +    public cElementalInstanceStack[] values(){ +        return tree.values().toArray(new cElementalInstanceStack[0]); +    } + +    public iElementalDefinition[] keys(){ +        return tree.keySet().toArray(new iElementalDefinition[0]); +    } + +    public float getMass(){ +        float mass=0; +        for(cElementalInstanceStack stack:tree.values()){ +            mass+=stack.getMass(); +        } +        return mass; +    } +//Tests +    public boolean containsDefinition(iElementalDefinition def){ +        return tree.containsKey(def); +    } + +    public boolean containsInstance(cElementalInstanceStack inst){ +        return tree.containsValue(inst); +    } + +    public int size(){ +        return tree.size(); +    } + +    public boolean hasStacks(){ +        return tree.size()>0; +    } + +//Tick Content +    public void tickContent(float lifeTimeMult, int postEnergize){ +        for(cElementalInstanceStack instance:this.values()){ +            cElementalInstanceStackTree newThings=instance.decay(lifeTimeMult,++instance.age,postEnergize); +            if(newThings==null){ +                instance.nextColor(); +            }else{ +                tree.remove(instance.definition); +                for(cElementalInstanceStack newInstance:newThings.values()) +                    putUnify(newInstance); +            } +        } + +    } + +//NBT +    public NBTTagCompound getInfoNBT(){ +        final NBTTagCompound nbt=new NBTTagCompound(); +        final String[] info=getElementalInfo(); +        nbt.setInteger("i",info.length); +        for(int i=0;i<info.length;i++) +            nbt.setString(Integer.toString(i),info[i]); +        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 NBTTagCompound toNBT() { +        final NBTTagCompound nbt=new NBTTagCompound(); +        nbt.setInteger("i",tree.size()); +        int i=0; +        for(cElementalInstanceStack instance: tree.values()) +            nbt.setTag(Integer.toString(i++),instance.toNBT()); +        return nbt; +    } + +    public static cElementalInstanceStackTree fromNBT(NBTTagCompound nbt) throws tElementalException{ +        final cElementalInstanceStack[] instances=new cElementalInstanceStack[nbt.getInteger("i")]; +        for(int i=0;i<instances.length;i++){ +            instances[i]= cElementalInstanceStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); +            if(instances[i].definition.equals(debug__)) +                throw new tElementalException("Something went Wrong"); +        } +        return new cElementalInstanceStackTree(false, instances); +    } + +//stackUp +    public static cElementalInstanceStack[] stackUp(cElementalInstanceStack... in){ +        final cElementalInstanceStackTree inTree=new cElementalInstanceStackTree(); +        inTree.putUnifyAll(in); +        return inTree.values(); +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalPrimitive.java b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalPrimitive.java new file mode 100644 index 0000000000..89efa0cc71 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalPrimitive.java @@ -0,0 +1,173 @@ +package com.github.technus.tectech.elementalMatter.classes; + +import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; +import net.minecraft.client.Minecraft; +import net.minecraft.crash.CrashReport; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.FluidStack; + +import java.util.TreeMap; + +import static com.github.technus.tectech.elementalMatter.commonValues.DEBUGMODE; + +/** + * Created by danie_000 on 22.10.2016. + * EXTEND THIS TO ADD NEW PRIMITIVES, WATCH OUT FOR ID'S!!!  (-1 to 32 can be assumed as used) + */ +public abstract class cElementalPrimitive extends cElementalDefinition { +    private static final byte nbtType=(byte) 'p'; + +    public static final TreeMap<Integer, iElementalDefinition> bindsBO = new TreeMap<>(); + + +    public final String name; +    public final String symbol; +    //float-mass in eV/c^2 +    public final float mass; +    //int -electric charge in 1/3rds of electron charge for optimization +    public final byte charge; +    //-1 if is not colorable +    public final byte color; +    //-1/-2/-3 anti matter generations, +1/+2/+3 matter generations, 0 self anti +    public final byte type; +    private cElementalPrimitive anti; +    private cElementalDecay[] elementalDecays; +    private byte naturalDecayInstant; +    private byte energeticDecayInstant; +    private float rawLifeTime; + +    public final int ID; + +    //no _ at end - normal particle +    //   _ at end - anti particle +    //  __ at end - self is antiparticle + +    protected cElementalPrimitive(String name, String symbol, int type, float mass, int charge, int color, int ID) { +        this.name = name; +        this.symbol = symbol; +        this.type = (byte) type; +        this.mass = mass; +        this.charge = (byte) charge; +        this.color = (byte) color; +        this.ID = ID; +        if(bindsBO.put(ID, this)!=null) Minecraft.getMinecraft().crashed(new CrashReport("Primitive definition",new tElementalException("Duplicate ID"))); +    } + +    // +    protected void init(cElementalPrimitive antiParticle, float rawLifeTime, int naturalInstant, int energeticInstant, cElementalDecay... elementalDecaysArray) { +        this.anti = antiParticle; +        this.rawLifeTime = rawLifeTime; +        this.naturalDecayInstant = (byte) naturalInstant; +        this.energeticDecayInstant = (byte) energeticInstant; +        this.elementalDecays = elementalDecaysArray; +    } + +    @Override +    public String getName() { +        return "Undefined: " + name; +    } + +    @Override +    public String getSymbol() { +        return symbol; +    } + +    @Override +    public iElementalDefinition getAnti() { +        return anti;//no need for copy +    } + +    @Override +    public int getCharge() { +        return charge; +    } + +    @Override +    public byte getColor() { +        return color; +    } + +    @Override +    public float getMass() { +        return mass; +    } + +    @Override +    public cElementalDecay[] getNaturalDecayInstant() { +        if (naturalDecayInstant < 0) return elementalDecays; +        return new cElementalDecay[]{elementalDecays[naturalDecayInstant]}; +    } + +    @Override +    public cElementalDecay[] getEnergeticDecayInstant() { +        if (energeticDecayInstant < 0) return elementalDecays; +        return new cElementalDecay[]{elementalDecays[energeticDecayInstant]}; +    } + +    @Override +    public cElementalDecay[] getDecayArray() { +        return elementalDecays; +    } + +    @Override +    public float getRawLifeTime() { +        return rawLifeTime; +    } + +    @Override +    public final cElementalDefinitionStackTree getSubParticles() { +        return null; +    } + +    @Override +    public FluidStack materializesIntoFluid() { +        return null; +    } + +    @Override +    public ItemStack materializesIntoItem() { +        return null; +    } + +    @Override +    public byte getType() { +        return type; +    } + +    @Override +    public final NBTTagCompound toNBT() { +        NBTTagCompound nbt=new NBTTagCompound(); +        nbt.setByte("t",nbtType); +        nbt.setInteger("c",ID); +        return nbt; +    } + +    public static iElementalDefinition fromNBT(NBTTagCompound content) { +        return bindsBO.get(content.getInteger("c")); +    } + +    @Override +    public final byte getClassType() { +        return -128; +    } + +    @Override +    public final int compareTo(iElementalDefinition o) { +        if(getClassType()==o.getClassType()){ +            int oID=((cElementalPrimitive)o).ID; +            if (ID > oID) return 1; +            if (ID < oID) return -1; +            return 0; +        } +        return compareClasses(o); +    } + +    public static void run() { +        try { +            cElementalDefinition.addCreatorFromNBT(nbtType, cElementalPrimitive.class.getMethod("fromNBT", NBTTagCompound.class)); +        } catch (Exception e) { +            if(DEBUGMODE)e.printStackTrace(); +        } +    } +}
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/rElementalRecipe.java b/src/main/java/com/github/technus/tectech/elementalMatter/classes/rElementalRecipe.java new file mode 100644 index 0000000000..f7df77fb78 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/classes/rElementalRecipe.java @@ -0,0 +1,35 @@ +package com.github.technus.tectech.elementalMatter.classes; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +/** + * Created by Tec on 02.03.2017. + */ +public class rElementalRecipe implements Comparable<rElementalRecipe> { +    public final cElementalDefinitionStackTree inEM; +    public final cElementalDefinitionStackTree outEM; +    public final ItemStack[] outItems; +    public final FluidStack[] outFluids; +    public Object[] extension=null; + +    public rElementalRecipe( +            cElementalDefinitionStackTree inEMnotNull, +            cElementalDefinitionStackTree outEM, +            ItemStack[] outItems, +            FluidStack[] outFluids){ +        this.inEM=inEMnotNull; +        this.outEM=outEM; +        this.outItems=outItems; +        this.outFluids=outFluids; +    } + +    public void extend(Object... data){ +        extension=data; +    } + +    @Override +    public int compareTo(rElementalRecipe o) { +        return inEM.compareTo(o.inEM); +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/rElementalRecipeTree.java b/src/main/java/com/github/technus/tectech/elementalMatter/classes/rElementalRecipeTree.java new file mode 100644 index 0000000000..154f390138 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/classes/rElementalRecipeTree.java @@ -0,0 +1,62 @@ +package com.github.technus.tectech.elementalMatter.classes; + +import java.util.TreeMap; + +/** + * Created by Tec on 02.03.2017. + */ +public class rElementalRecipeTree { +    private TreeMap<cElementalDefinitionStackTree,rElementalRecipe> recipes=new TreeMap<>(); + +    public rElementalRecipeTree(rElementalRecipe... contents){ +        for(rElementalRecipe recipe:contents) +            recipes.put(recipe.inEM,recipe); +    } + +    public rElementalRecipe put(rElementalRecipe in){ +        return recipes.put(in.inEM,in); +    } + +    public void putAll(rElementalRecipe... contents){ +        for(rElementalRecipe recipe:contents) +            recipes.put(recipe.inEM,recipe); +    } + +    public rElementalRecipe findExact(cElementalDefinitionStackTree in){ +        return recipes.get(in); +    } + +    public rElementalRecipe findTopMatch(cElementalDefinitionStackTree in){ +        for (cElementalDefinitionStackTree requirement:recipes.descendingKeySet()){ +            if(in.removeAllAmounts(true,requirement)) +                return recipes.get(requirement); +        } +        return null; +    } + +    public rElementalRecipe findTopMatch(cElementalInstanceStackTree in, boolean testOnly){ +        for (cElementalDefinitionStackTree requirement:recipes.descendingKeySet()){ +            if(in.removeAllAmounts(testOnly,requirement)) +                return recipes.get(requirement); +        } +        return null; +    } + +    public rElementalRecipe findBottomMatch(cElementalDefinitionStackTree in){ +        for (cElementalDefinitionStackTree requirement:recipes.keySet()){ +            if(in.removeAllAmounts(true,requirement)){ +                return recipes.get(requirement); +            } +        } +        return null; +    } + +    public rElementalRecipe findBottomMatch(cElementalInstanceStackTree in, boolean testOnly){ +        for (cElementalDefinitionStackTree requirement:recipes.keySet()){ +            if(in.removeAllAmounts(testOnly,requirement)){ +                return recipes.get(requirement); +            } +        } +        return null; +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/tElementalException.java b/src/main/java/com/github/technus/tectech/elementalMatter/classes/tElementalException.java new file mode 100644 index 0000000000..0218d82a03 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/classes/tElementalException.java @@ -0,0 +1,10 @@ +package com.github.technus.tectech.elementalMatter.classes; + +/** + * Created by danie_000 on 19.11.2016. + */ +public final class tElementalException extends Exception { +    public tElementalException(String message) { +        super(message); +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/commonValues.java b/src/main/java/com/github/technus/tectech/elementalMatter/commonValues.java new file mode 100644 index 0000000000..124071ff38 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/commonValues.java @@ -0,0 +1,25 @@ +package com.github.technus.tectech.elementalMatter; + +import net.minecraft.util.EnumChatFormatting; + +/** + * Created by danie_000 on 11.01.2017. + */ +public final class commonValues { +	public final static String tecMark = EnumChatFormatting.BLUE + "Tec" + EnumChatFormatting.DARK_BLUE + "Tech" +			+ EnumChatFormatting.BLUE + ": Elemental Matter"; +	public final static byte decayAt = 0;// hatches compute dacays +	public final static byte multiPurge1At = 2;// multiblocks clean their +												// hatches 1 +	public final static byte moveAt = 4;// move stuff around +	public final static byte recipeAt = 6;// move stuff around +	public final static byte multiPurge2At = 8;// multiblocks clean their +												// hatches 2 +	public final static byte overflowAt = 10;// then hatches clean themselves +	// - in case some hatches are not in multiblock structure +	public final static byte multiCheckAt = 12;// multiblock checks it's state +	public final static byte disperseAt = 14;// overflow hatches perform +												// disperse + +	public final static boolean DEBUGMODE = true; +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/cPrimitiveDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/cPrimitiveDefinition.java new file mode 100644 index 0000000000..5c05e6d54a --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/cPrimitiveDefinition.java @@ -0,0 +1,41 @@ +package com.github.technus.tectech.elementalMatter.definitions; + +import com.github.technus.tectech.elementalMatter.classes.cElementalPrimitive; +import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; +import net.minecraft.nbt.NBTTagCompound; + +import static com.github.technus.tectech.elementalMatter.classes.cElementalDecay.noDecay; +import static com.github.technus.tectech.elementalMatter.classes.cElementalDecay.noProduct; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class cPrimitiveDefinition extends cElementalPrimitive { +    public static final cPrimitiveDefinition debug__ = new cPrimitiveDefinition("Fallback of a bug","!",0,0f,0,Integer.MIN_VALUE,Integer.MIN_VALUE); +    public static final cPrimitiveDefinition null__ = new cPrimitiveDefinition("This is a bug",".", 0, 0F, 0, -3,Integer.MAX_VALUE); +        //Never create null__ particle - if u need fallback use debug__ +    public static final cPrimitiveDefinition space__ = new cPrimitiveDefinition("Space", "_", 0, 0F, 0, -4,0); +    public static final cPrimitiveDefinition magic = new cPrimitiveDefinition("Magic", "Ma", 4, -1F, 0, 0,1); +    public static final cPrimitiveDefinition magic_ = new cPrimitiveDefinition("Antimagic", "~Ma", -4, -1F, 0, 0,2); + +    protected cPrimitiveDefinition(String name, String symbol, int type, float mass, int charge, int color, int ID) { +        super(name,symbol,type,mass,charge,color,ID); +    } + +    public static iElementalDefinition fromNBT(NBTTagCompound content) { +        return bindsBO.get(content.getInteger("c")); +    } + +    public static void run() { +        debug__.init(null__,  -1F, -1, -1, noDecay); +        null__.init(null__,  -1F, -1, -1, noProduct); +        space__.init(space__, -1F, -1, -1, noProduct); +        magic.init(magic_, -1F, -1, -1, noDecay); +        magic_.init(magic, -1F, -1, -1, noDecay); +    } + +    @Override +    public String getName() { +        return "Primitive: " + name; +    } +}
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/dAtomDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/dAtomDefinition.java new file mode 100644 index 0000000000..a07509adf5 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/dAtomDefinition.java @@ -0,0 +1,501 @@ +package com.github.technus.tectech.elementalMatter.definitions; + +import com.github.technus.tectech.elementalMatter.classes.*; +import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; +import gregtech.api.objects.XSTR; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.FluidStack; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.TreeSet; + +import static com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStackTree.stackUpTree; +import static com.github.technus.tectech.elementalMatter.commonValues.DEBUGMODE; +import static com.github.technus.tectech.elementalMatter.definitions.eBosonDefinition.boson_Y__; +import static com.github.technus.tectech.elementalMatter.definitions.eBosonDefinition.deadEnd; + +/** + * Created by danie_000 on 18.11.2016. + */ +public final class dAtomDefinition extends cElementalDefinition { +    private static final byte nbtType=(byte)'a'; +    private static final XSTR xstr = new XSTR(); +    private static final HashMap<Integer,TreeSet<Integer>> stableIsotopes=new HashMap<>(); +    private static cElementalDefinitionStack alfa; + +    //float-mass in eV/c^2 +    public final float mass; +    //public final int charge; +    public final int charge; +    //int -electric charge in 1/3rds of electron charge for optimization +    public final int chargeLeptons; +    public final float rawLifeTime; +    //generation max present inside - minus if contains any anti quark +    public final byte type; + +    public final byte decayMode;//t neutron to proton+,0,f proton to neutron +    public final boolean stable; + +    //private final FluidStack fluidThing; +    //private final ItemStack itemThing; +    public final int isotope; +    public final int element; +    private cElementalDefinitionStackTree elementalStacks; + +    //stable is rawLifeTime>=10^9 + +    //private final FluidStack fluidThing; +    //private final ItemStack itemThing; + +    @Deprecated +    public dAtomDefinition(iElementalDefinition... things) throws tElementalException { +        this(true, stackUpTree(things)); +    } + +    @Deprecated +    private dAtomDefinition(boolean check, iElementalDefinition... things) throws tElementalException { +        this(check, stackUpTree(things)); +    } + +    public dAtomDefinition(cElementalDefinitionStack... things) throws tElementalException { +        this(true, stackUpTree(things)); +    } + +    private dAtomDefinition(boolean check, cElementalDefinitionStack... things) throws tElementalException { +        this(check, stackUpTree(things)); +    } + +    public dAtomDefinition(cElementalDefinitionStackTree things) throws tElementalException { +        this(true, things); +    } + +    private dAtomDefinition(boolean check, cElementalDefinitionStackTree things) throws tElementalException { +        if (check && !canTheyBeTogether(things)) throw new tElementalException("Atom Definition error"); +        this.elementalStacks = things; + +        float mass = 0; +        int cLeptons = 0; +        int cNucleus = 0; +        int isotope = 0, element = 0; +        int type = 0; +        boolean containsAnti = false; +        for (cElementalDefinitionStack stack : elementalStacks.values()) { +            iElementalDefinition def = stack.definition; +            int amount = stack.amount; +            mass += amount * def.getMass(); +            if (def.getType() < 0) containsAnti = true; +            type = Math.max(type, Math.abs(def.getType())); + +            if (def instanceof eLeptonDefinition) { +                cLeptons += amount * def.getCharge(); +            } else { +                cNucleus += amount * def.getCharge(); +                if (def.getCharge() == 3) element += amount; +                else if (def.getCharge() == -3) element -= amount; +                else if (def.getCharge() == 0) { +                    isotope += amount; +                } +            } +        } +        this.type = containsAnti ? (byte) -type : (byte) type; +        this.mass = mass; +        this.chargeLeptons = cLeptons; +        this.charge = cNucleus + cLeptons; +        this.isotope = isotope; +        this.element = element; + +        element = Math.abs(element); + +        xstr.setSeed((long) (element+1)*(isotope+100)); + +        //stability curve +        int StableIsotope = stableIzoCurve(element); +        int izoDiff =isotope-StableIsotope; +        int izoDiffAbs = Math.abs(izoDiff); + +        this.rawLifeTime= calculateLifeTime(izoDiff,izoDiffAbs,element,isotope,containsAnti); +        if(izoDiff==0) +            this.decayMode=0; +        else +            this.decayMode=izoDiff>0?(byte)Math.min(2,1+izoDiffAbs/4):(byte)-Math.min(2,1+izoDiffAbs/4); +        this.stable=isStable(this.rawLifeTime); +    } + +    private static boolean isStable(float lifeTime){ +        return lifeTime>1.5e25f; +    } + +    private static int stableIzoCurve(int element){ +        return (int) Math.round(-1.19561E-06 * Math.pow(element, 4D) + +                1.60885E-04 * Math.pow(element, 3D) + +                3.76604E-04 * Math.pow(element, 2D) + +                1.08418E+00 * (double) element); +    } + +    private static float calculateLifeTime(int izoDiff, int izoDiffAbs, int element, int isotope, boolean containsAnti){ +        float rawLifeTime; + +        if (element<=83 && isotope<127 && (izoDiffAbs == 0 || +                (element == 1 && isotope == 0) || +                (element == 2 && isotope == 1) || +                (izoDiffAbs == 1 && element > 2 && element % 2 == 1) || +                (izoDiffAbs == 3 && element > 30 && element % 2 == 0) || +                (izoDiffAbs == 5 && element > 30 && element % 2 == 0) || +                (izoDiffAbs == 2 && element > 20 && element % 2 == 1))) { +            rawLifeTime = containsAnti ? 2.381e4f*(1f+xstr.nextFloat()*9f) : (1f+xstr.nextFloat()*9f) * 1.5347e25F; +        } else { +            //Y = (X-A)/(B-A) * (D-C) + C +            float unstabilityEXP=0; +            if(element==0){ +                return 1e-35f; +            }else if(element==1){ +                unstabilityEXP=1.743f-(Math.abs(izoDiff-1)*9.743f); +            }else if(element==2){ +                switch(isotope){ +                    case 4: +                        unstabilityEXP=1.61f;break; +                    case 5: +                        unstabilityEXP=-7.523F;break; +                    case 6: +                        unstabilityEXP=-1.51f;break; +                    default: +                        unstabilityEXP=-(izoDiffAbs*6.165F);break; +                } +            }else if(element<=83 || (isotope<=127 && element<=120)){ +                float elementPow4=(float)Math.pow(element,4f); + +                unstabilityEXP=Math.min(element/2.4f,6+((element+1)%2)*3e6F/elementPow4)+(((float)-izoDiff*elementPow4)/1e8F)-(Math.abs(izoDiff-1+element/60F)*(3f-(element/12.5f)+((element*element)/1500f))); +            }else if(element<180){ +                unstabilityEXP=Math.min((element-85)*2,16+((isotope+1)%2)*2.5F-(element-85)/3F)-(Math.abs(izoDiff)*(3f-(element/13f)+((element*element)/1600f))); +            }else return -1; +            if((isotope==127 || isotope==128) && (element<120 && element>83)) unstabilityEXP-=1.8f; +            if(element>83 && element<93 && isotope%2==0 && izoDiff==3) unstabilityEXP+=6; +            if(element>93 && element<103 && isotope%2==0 && izoDiff==4) unstabilityEXP+=6; +            rawLifeTime = (containsAnti ? 1e-8f : 1f)*(float)(Math.pow(10F,unstabilityEXP))*(1f+xstr.nextFloat()*9f); +        } + +        if(rawLifeTime<8e-15)return 1e-35f; +        if(rawLifeTime>8e28)return 8e30f; +        return rawLifeTime; +    } + +    private static boolean canTheyBeTogether(cElementalDefinitionStackTree stacks) { +        boolean nuclei = false; +        for (cElementalDefinitionStack stack : stacks.values()) +            if (stack.definition instanceof dHadronDefinition) { +                if (((dHadronDefinition) stack.definition).amount != 3) return false; +                nuclei = true; +            } else if (!(stack.definition instanceof eLeptonDefinition)) return false; +        return nuclei; +    } + +    public boolean checkThis() { +        return canTheyBeTogether(elementalStacks); +    } + +    @Override +    public int getCharge() { +        return charge; +    } + +    public int getChargeLeptons() { +        return chargeLeptons; +    } + +    public int getChargeHadrons() { +        return charge - chargeLeptons; +    } + +    public int getIonization() { +        return (element * 3) + chargeLeptons; +    } + +    @Override +    public float getMass() { +        return mass; +    } + +    @Override +    public byte getType() { +        return type; +    } + +    @Override +    public float getRawLifeTime() { +        return rawLifeTime; +    } + +    @Override +    public byte getColor() { +        return -10; +    } + +    @Override +    public String getName() { +        final int element=Math.abs(this.element); +        final boolean negative=element<0; +        try{ +            if(type!=1) return (negative?"~? ":"? ") +nomenclature.Name[element]; +            return negative?"~"+ nomenclature.Name[element]:nomenclature.Name[element]; +        }catch(Exception e){ +            if(DEBUGMODE)e.printStackTrace(); +            return (negative?"Element: ~":"Element: ") + element; +        } +    } + +    @Override +    public String getSymbol() { +        final int element=Math.abs(this.element); +        final boolean negative=element<0; +        try{ +            return (negative?"~":"") + nomenclature.Symbol[element]+" N:"+isotope+" I:"+getIonization(); +        }catch(Exception e){ +            if(DEBUGMODE)e.printStackTrace(); +            try { +                int s100 = element / 100, s1 = (element/10) % 10, s10 = (element) % 10; +                return (negative?"~":"") + nomenclature.SymbolIUPAC[10+s100]+nomenclature.SymbolIUPAC[s10]+nomenclature.SymbolIUPAC[s1]+ " N:" + isotope + " I:" + getIonization(); +            }catch (Exception E){ +                if(DEBUGMODE)e.printStackTrace(); +                return (negative?"~":"") + "? N:" + isotope + " I:" + getIonization(); +            } +        } +    } + +    @Override +    public cElementalDefinitionStackTree getSubParticles() { +        return elementalStacks; +    } + +    @Override +    public cElementalDecay[] getDecayArray() { +        if(this.type==1){ +            switch(decayMode){ +                case -2: return PbetaDecay(); +                case -1: return Emmision(dHadronDefinition.hadron_p1); +                case  0: return alphaDecay(); +                case  1: return Emmision(dHadronDefinition.hadron_n1); +                case  2: return MbetaDecay(); +                default: return getNaturalDecayInstant(); +            } +        }else{ +            return getNaturalDecayInstant(); +        } +    } + +    private cElementalDecay[] Emmision(cElementalDefinitionStack emit){ +        final cElementalDefinitionStackTree tree=new cElementalDefinitionStackTree(elementalStacks.values()); +        if(tree.removeAmount(false,emit)){ +            try { +                return new cElementalDecay[]{ +                        new cElementalDecay(0.5f, this), +                        new cElementalDecay(0.5f, new cElementalDefinitionStack(new dAtomDefinition(tree),1),emit), +                        deadEnd +                }; +            }catch (Exception e){ +                if(DEBUGMODE)e.printStackTrace(); +            } +        } +        return getNaturalDecayInstant(); +    } + +    private cElementalDecay[] alphaDecay(){ +        final cElementalDefinitionStackTree tree=new cElementalDefinitionStackTree(elementalStacks.values()); +        if(tree.removeAllAmounts(false,dHadronDefinition.hadron_n2,dHadronDefinition.hadron_p2)){ +            try { +                return new cElementalDecay[]{ +                        new cElementalDecay(0.5f, this), +                        new cElementalDecay(0.5f, new cElementalDefinitionStack(new dAtomDefinition(tree),1),alfa), +                        deadEnd +                }; +            }catch (Exception e){ +                if(DEBUGMODE)e.printStackTrace(); +            } +        } +        return getNaturalDecayInstant(); +    } + +    private cElementalDecay[] MbetaDecay(){ +        final cElementalDefinitionStackTree tree=new cElementalDefinitionStackTree(elementalStacks.values()); +        if(tree.removeAmount(false,dHadronDefinition.hadron_n1)){ +            try { +                tree.putUnify(dHadronDefinition.hadron_p1); +                return new cElementalDecay[]{ +                        new cElementalDecay(0.5f, this), +                        new cElementalDecay(0.5f, new cElementalDefinitionStack(new dAtomDefinition(tree),1),eLeptonDefinition.lepton_e1,eNeutrinoDefinition.lepton_Ve_1), +                        deadEnd +                }; +            }catch (Exception e){ +                if(DEBUGMODE)e.printStackTrace(); +            } +        } +        return getNaturalDecayInstant(); +    } + +    private cElementalDecay[] PbetaDecay(){ +        final cElementalDefinitionStackTree tree=new cElementalDefinitionStackTree(elementalStacks.values()); +        if(tree.removeAmount(false,dHadronDefinition.hadron_p1)){ +            try { +                tree.putUnify(dHadronDefinition.hadron_n1); +                return new cElementalDecay[]{ +                        new cElementalDecay(0.5f, this), +                        new cElementalDecay(0.5f, new cElementalDefinitionStack(new dAtomDefinition(tree),1),eLeptonDefinition.lepton_e_1,eNeutrinoDefinition.lepton_Ve1), +                        deadEnd +                }; +            }catch (Exception e){ +                if(DEBUGMODE)e.printStackTrace(); +            } +        } +        return getNaturalDecayInstant(); +    } + +    @Override +    public cElementalDecay[] getEnergeticDecayInstant() { +        //strip leptons +        boolean doIt=true; +        ArrayList<cElementalDefinitionStack> decaysInto = new ArrayList<cElementalDefinitionStack>(); +        ArrayList<cElementalDefinitionStack> newAtom = new ArrayList<cElementalDefinitionStack>(); +        for (cElementalDefinitionStack elementalStack : elementalStacks.values()) { +            if(elementalStack.definition instanceof eLeptonDefinition && doIt){ +                doIt=false; +                if(elementalStack.amount>1) +                    newAtom.add(new cElementalDefinitionStack(elementalStack.definition,elementalStack.amount-1)); +                decaysInto.add(new cElementalDefinitionStack(elementalStack.definition,1)); +            }else{ +                newAtom.add(elementalStack); +            } +        } +        try { +            decaysInto.add(new cElementalDefinitionStack(new dAtomDefinition(newAtom.toArray(new cElementalDefinitionStack[newAtom.size()])),1)); +            return new cElementalDecay[]{new cElementalDecay(0.95F, decaysInto.toArray(new cElementalDefinitionStack[decaysInto.size()])), eBosonDefinition.deadEnd}; +        }catch(tElementalException e){ +            if(DEBUGMODE)e.printStackTrace(); +            for(cElementalDefinitionStack things:newAtom){ +                decaysInto.add(things); +            } +            return new cElementalDecay[]{new cElementalDecay(0.75F, decaysInto.toArray(new cElementalDefinitionStack[decaysInto.size()])), eBosonDefinition.deadEnd}; +        } +    } + +    @Override +    public cElementalDecay[] getNaturalDecayInstant() { +        //disembody +        ArrayList<cElementalDefinitionStack> decaysInto = new ArrayList<cElementalDefinitionStack>(); +        for (cElementalDefinitionStack elementalStack : elementalStacks.values()) { +            if (elementalStack.definition.getType() == 1 || elementalStack.definition.getType() == -1) { +                //covers both quarks and antiquarks +                decaysInto.add(elementalStack); +            } else { +                //covers both quarks and antiquarks +                decaysInto.add(new cElementalDefinitionStack(boson_Y__, 2)); +            } +        } +        return new cElementalDecay[]{new cElementalDecay(0.75F, decaysInto.toArray(new cElementalDefinitionStack[decaysInto.size()])), eBosonDefinition.deadEnd}; +    } + +    @Override +    public iElementalDefinition getAnti() { +        cElementalDefinitionStack[] elementalStacks=this.elementalStacks.values(); +        cElementalDefinitionStack[] antiElements = new cElementalDefinitionStack[elementalStacks.length]; +        for (int i = 0; i < antiElements.length; i++) { +            antiElements[i] = new cElementalDefinitionStack(elementalStacks[i].definition.getAnti(), elementalStacks[i].amount); +        } +        try { +            return new dAtomDefinition(false, antiElements); +        } catch (tElementalException e) { +            if(DEBUGMODE)e.printStackTrace(); +            return null; +        } +    } + +    @Override +    public FluidStack materializesIntoFluid() { +        return null; +    } + +    @Override +    public ItemStack materializesIntoItem() { +        return null; +    } + +    private final static class nomenclature{ +        static final private String[] Symbol = new String[]{"Nt", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"}; +        static final private String[] Name = new String[]{"Neutronium", "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"}; +        static final private String[] SymbolIUPAC = new String[]{"n","u","b","t","q","p","h","s","o","e","N","U","B","T","Q","P","H","S","O","E"}; +    } + +    @Override +    public NBTTagCompound toNBT() { +        NBTTagCompound nbt=new NBTTagCompound(); +        nbt.setByte("t",nbtType); +        cElementalDefinitionStack[] elementalStacksValues=elementalStacks.values(); +        nbt.setInteger("i",elementalStacksValues.length); +        for (int i=0;i<elementalStacksValues.length;i++) +            nbt.setTag(Integer.toString(i),elementalStacksValues[i].toNBT()); +        return nbt; +    } + +    public static iElementalDefinition fromNBT(NBTTagCompound nbt){ +        cElementalDefinitionStack[] stacks=new cElementalDefinitionStack[nbt.getInteger("i")]; +        for(int i=0;i<stacks.length;i++) +            stacks[i]=cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); +        try { +            return new dAtomDefinition(stacks); +        }catch (tElementalException e){ +            if(DEBUGMODE)e.printStackTrace(); +            return null; +        } +    } + +    public static void run(){ +        try { +            cElementalDefinition.addCreatorFromNBT(nbtType, dAtomDefinition.class.getMethod("fromNBT", NBTTagCompound.class)); +        }catch (Exception e){ +            if(DEBUGMODE)e.printStackTrace(); +        } +        //populate stable isotopes +        for(int element=0;element<180;element++) +            for(int isotope=0;isotope<180;isotope++){ +                xstr.setSeed((long) (element+1)*(isotope+100)); +                //stability curve +                final int StableIsotope = stableIzoCurve(element); +                final int izoDiff =isotope-StableIsotope; +                final int izoDiffAbs = Math.abs(izoDiff); +                final float rawLifeTime= calculateLifeTime(izoDiff,izoDiffAbs,element,isotope,false); +                if(isStable(rawLifeTime)){ +                    TreeSet<Integer> isotopes=stableIsotopes.get(element); +                    if(isotopes==null) +                        stableIsotopes.put(element,isotopes=new TreeSet<>()); +                    isotopes.add(isotope); +                } +            } +        try { +            alfa = new cElementalDefinitionStack( +                    new dAtomDefinition( +                            new cElementalDefinitionStack(dHadronDefinition.hadron_p, 2), +                            new cElementalDefinitionStack(dHadronDefinition.hadron_n, 2)) +                    ,1); +        }catch (Exception e){ +            if(DEBUGMODE)e.printStackTrace(); +        } +    } + +    public static dAtomDefinition getFirstStableIsotope(int element){ +        try { +            int isotope=stableIsotopes.get(element).first(); +            return new dAtomDefinition( +                    new cElementalDefinitionStack(dHadronDefinition.hadron_n,isotope), +                    new cElementalDefinitionStack(dHadronDefinition.hadron_p,element), +                    new cElementalDefinitionStack(eLeptonDefinition.lepton_e,element)); +        }catch (Exception e){ +            if(DEBUGMODE)e.printStackTrace(); +            return null; +        } +    } + +    @Override +    public byte getClassType() { +        return 64; +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/dHadronDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/dHadronDefinition.java new file mode 100644 index 0000000000..2af2acf328 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/dHadronDefinition.java @@ -0,0 +1,324 @@ +package com.github.technus.tectech.elementalMatter.definitions; + +import com.github.technus.tectech.elementalMatter.classes.*; +import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.FluidStack; + +import java.util.ArrayList; + +import static com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStackTree.stackUpTree; +import static com.github.technus.tectech.elementalMatter.commonValues.DEBUGMODE; +import static com.github.technus.tectech.elementalMatter.definitions.eBosonDefinition.boson_Y__; + +/** + * Created by danie_000 on 17.11.2016. + */ +public final class dHadronDefinition extends cElementalDefinition { +    private static final byte nbtType=(byte)'h'; +    //Helpers +    public static dHadronDefinition hadron_p, hadron_n, hadron_p_, hadron_n_; +    public static cElementalDefinitionStack hadron_p1, hadron_n1,hadron_p2, hadron_n2; +    private static float protonMass = 0F; +    private static float neutronMass = 0F; +    //float-mass in eV/c^2 +    public final float mass; +    //int -electric charge in 1/3rds of electron charge for optimization +    public final int charge; +    public final float rawLifeTime; +    public final byte amount; +    //generation max present inside - minus if contains any antiquark +    public final byte type; +    //private final FluidStack fluidThing; +    //private final ItemStack itemThing; +    private cElementalDefinitionStackTree quarkStacks; + +    @Deprecated +    public dHadronDefinition(eQuarkDefinition... quarks) throws tElementalException { +        this(true, stackUpTree(quarks)); +    } + +    @Deprecated +    private dHadronDefinition(boolean check, eQuarkDefinition... quarks) throws tElementalException { +        this(check, stackUpTree(quarks)); +    } + +    public dHadronDefinition(cElementalDefinitionStack... quarks) throws tElementalException { +        this(true, stackUpTree(quarks)); +    } + +    private dHadronDefinition(boolean check,cElementalDefinitionStack... quarks) throws tElementalException { +        this(check, stackUpTree(quarks)); +    } + +    public dHadronDefinition(cElementalDefinitionStackTree quarks) throws tElementalException { +        this(true, quarks); +    } + +    private dHadronDefinition(boolean check, cElementalDefinitionStackTree quarks) throws tElementalException { +        if (check && !canTheyBeTogether(quarks)) throw new tElementalException("Hadron Definition error"); +        this.quarkStacks = quarks; + +        byte amount = 0; +        int charge = 0; +        int type = 0; +        boolean containsAnti = false; +        float mass = 0; +        for (cElementalDefinitionStack quarkStack : quarkStacks.values()) { +            amount += quarkStack.amount; +            mass += quarkStack.getMass(); +            charge += quarkStack.getCharge(); +            type = Math.max(Math.abs(quarkStack.definition.getType()), type); +            if (quarkStack.definition.getType() < 0) containsAnti = true; +        } +        this.amount = amount; +        this.charge = charge; +        this.type = containsAnti ? (byte) (-type) : (byte) type; +        int mult = this.amount * this.amount * (this.amount - 1); +        this.mass = mass * 5.543F * (float) mult;//yes it becomes heavier + +        if (this.mass == protonMass && this.amount == 3) this.rawLifeTime = 1e35F; +        else if (this.mass == neutronMass && this.amount == 3) this.rawLifeTime = 17630F; +        else { +            if (this.amount == 3) { +                this.rawLifeTime = (1.34F / this.mass) * (float) Math.pow(9.81, charge); +            } else if (this.amount == 2) { +                this.rawLifeTime = (1.21F / this.mass) / (float) Math.pow(19.80, charge); +            } else { +                this.rawLifeTime = (1.21F / this.mass) / (float) Math.pow(9.80, charge); +            } +        } +    } + +    //public but u can just try{}catch(){} the constructor it still calls this method +    private static boolean canTheyBeTogether(cElementalDefinitionStackTree stacks) { +        int amount = 0; +        for (cElementalDefinitionStack quarks : stacks.values()) { +            if (!(quarks.definition instanceof eQuarkDefinition)) return false; +            amount += quarks.amount; +        } +        if (amount < 2 || amount > 12) return false; +        return true; +    } + +    //Unused outside yet still available. +    public boolean checkThis() { +        return canTheyBeTogether(quarkStacks); +    } + +    @Override +    public String getName() { +        String name; +        switch (amount) { +            case 2: +                name = "Meson:"; +                break; +            case 3: +                name = "Baryon:"; +                break; +            case 4: +                name = "Tetraquark:"; +                break; +            case 5: +                name = "Pentaquark:"; +                break; +            case 6: +                name = "Hexaquark:"; +                break; +            default: +                name = "Hadron:"; +        } +        for (cElementalDefinitionStack quark : quarkStacks.values()) { +            name += " " + quark.definition.getSymbol()+quark.amount; +        } +        return name; +    } + +    @Override +    public String getSymbol() { +        String symbol = ""; +        for (cElementalDefinitionStack quark : quarkStacks.values()) +            for (int i = 0; i < quark.amount; i++) +                symbol += quark.definition.getSymbol(); +        return symbol; +    } + +    @Override +    public byte getColor() { +        return -7; +    } + +    @Override +    public cElementalDefinitionStackTree getSubParticles() { +        return quarkStacks; +    } + +    @Override +    public cElementalDecay[] getNaturalDecayInstant() { +        ArrayList<cElementalDefinitionStack> decaysInto = new ArrayList<>(); +        for (cElementalDefinitionStack quarkStack : quarkStacks.values()) { +            if (quarkStack.definition.getType() == 1 || quarkStack.definition.getType() == -1) { +                //covers both quarks and antiquarks +                decaysInto.add(quarkStack); +            } else { +                //covers both quarks and antiquarks +                decaysInto.add(new cElementalDefinitionStack(boson_Y__, 2)); +            } +        } +        return new cElementalDecay[]{ +                new cElementalDecay(0.75F, decaysInto.toArray(new cElementalDefinitionStack[decaysInto.size()])), +                eBosonDefinition.deadEnd +        }; +    } + +    @Override +    public cElementalDecay[] getEnergeticDecayInstant() { +        cElementalDefinitionStack[] quarkStacks=this.quarkStacks.values(); +        if (amount == 2 && quarkStacks.length == 2 && quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() && quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) +            return new cElementalDecay[]{eBosonDefinition.deadEnd}; +        return new cElementalDecay[]{new cElementalDecay(0.75F, quarkStacks), eBosonDefinition.deadEnd}; //decay into quarks +    } + +    @Override +    public cElementalDecay[] getDecayArray() { +        cElementalDefinitionStack[] quarkStacks=this.quarkStacks.values(); +        if (amount == 2 && quarkStacks.length == 2 && quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() && quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) +            return new cElementalDecay[]{eBosonDefinition.deadEnd}; +        else if (amount != 3) +            return new cElementalDecay[]{new cElementalDecay(0.95F, quarkStacks), eBosonDefinition.deadEnd}; //decay into quarks +        else { +            ArrayList<eQuarkDefinition> newBaryon = new ArrayList<eQuarkDefinition>(); +            iElementalDefinition[] Particles = new iElementalDefinition[2]; +            for (cElementalDefinitionStack quarks : quarkStacks) { +                for (int i = 0; i < quarks.amount; i++) +                    newBaryon.add((eQuarkDefinition) quarks.definition); +            } +            //remove last +            eQuarkDefinition lastQuark = newBaryon.remove(2); + +            if (Math.abs(lastQuark.getType()) > 1) { +                cElementalDefinitionStack[] decay = lastQuark.getDecayArray()[1].outputStacks.values(); +                newBaryon.add((eQuarkDefinition) decay[0].definition); +                Particles[0] = decay[1].definition; +                Particles[1] = decay[2].definition; +            } else { +                cElementalDefinitionStack[] decay = lastQuark.getDecayArray()[0].outputStacks.values(); +                newBaryon.add((eQuarkDefinition) decay[0].definition); +                Particles[0] = decay[1].definition; +                Particles[1] = decay[2].definition; +            } + +            eQuarkDefinition[] contentOfBaryon = newBaryon.toArray(new eQuarkDefinition[3]); + +            try { +                return new cElementalDecay[]{ +                        new cElementalDecay(0.98F, new dHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1]), +                        new cElementalDecay(0.001F, new dHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1], boson_Y__), +                        eBosonDefinition.deadEnd}; //decay into quarks +            } catch (tElementalException e) { +                if(DEBUGMODE)e.printStackTrace(); +                return new cElementalDecay[]{eBosonDefinition.deadEnd}; +            } +        } +    } + +    @Override +    public float getMass() { +        return mass; +    } + +    @Override +    public int getCharge() { +        return charge; +    } + +    @Override +    public float getRawLifeTime() { +        return rawLifeTime; +    } + +    @Override +    public byte getType() { +        return type; +    } + +    @Override +    public iElementalDefinition getAnti() { +        cElementalDefinitionStackTree anti=new cElementalDefinitionStackTree(); +        for(cElementalDefinitionStack stack:quarkStacks.values()) +            anti.putReplace(new cElementalDefinitionStack(stack.definition.getAnti(),stack.amount)); +        try { +            return new dHadronDefinition(anti); +        }catch (tElementalException e) { +            if(DEBUGMODE)e.printStackTrace(); +            return null; +        } +    } + +    @Override +    public ItemStack materializesIntoItem() { +        return null; +    } + +    @Override +    public FluidStack materializesIntoFluid() { +        return null; +    } + +    @Override +    public NBTTagCompound toNBT() { +        NBTTagCompound nbt=new NBTTagCompound(); +        nbt.setByte("t",nbtType); +        cElementalDefinitionStack[] quarkStacksValues=quarkStacks.values(); +        nbt.setInteger("i",quarkStacksValues.length); +        for (int i=0;i<quarkStacksValues.length;i++) +            nbt.setTag(Integer.toString(i),quarkStacksValues[i].toNBT()); +        return nbt; +    } + +    public static iElementalDefinition fromNBT(NBTTagCompound nbt){ +        cElementalDefinitionStack[] stacks=new cElementalDefinitionStack[nbt.getInteger("i")]; +        for(int i=0;i<stacks.length;i++) +            stacks[i]=cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); +        try { +            return new dHadronDefinition(stacks); +        }catch (tElementalException e){ +            if(DEBUGMODE)e.printStackTrace(); +            return null; +        } +    } + +    public static void run() { +        try { +            hadron_p = new dHadronDefinition(false, eQuarkDefinition.quark_u, eQuarkDefinition.quark_u, eQuarkDefinition.quark_d); +            protonMass = hadron_p.mass; +            //redefine the proton with proper lifetime (the lifetime is based on mass comparison) +            hadron_p = new dHadronDefinition(false, eQuarkDefinition.quark_u, eQuarkDefinition.quark_u, eQuarkDefinition.quark_d); +            hadron_p_ = (dHadronDefinition) (hadron_p.getAnti()); +            hadron_n = new dHadronDefinition(false, eQuarkDefinition.quark_u, eQuarkDefinition.quark_d, eQuarkDefinition.quark_d); +            neutronMass = hadron_n.mass; +            //redefine the neutron with proper lifetime (the lifetime is based on mass comparison) +            hadron_n = new dHadronDefinition(false, eQuarkDefinition.quark_u, eQuarkDefinition.quark_d, eQuarkDefinition.quark_d); +            hadron_n_ = (dHadronDefinition) (hadron_n.getAnti()); +        } catch (tElementalException e) { +            if(DEBUGMODE)e.printStackTrace(); +            protonMass = -1; +            neutronMass = -1; +        } +        hadron_p1=new cElementalDefinitionStack(hadron_p,1); +        hadron_n1=new cElementalDefinitionStack(hadron_n,1); +        hadron_p2=new cElementalDefinitionStack(hadron_p,2); +        hadron_n2=new cElementalDefinitionStack(hadron_n,2); +        try { +            cElementalDefinition.addCreatorFromNBT(nbtType, dHadronDefinition.class.getMethod("fromNBT", NBTTagCompound.class)); +        }catch (Exception e){ +            if(DEBUGMODE)e.printStackTrace(); +        } +    } + +    @Override +    public byte getClassType() { +        return -64; +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/eBosonDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/eBosonDefinition.java new file mode 100644 index 0000000000..648b47d2ad --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/eBosonDefinition.java @@ -0,0 +1,36 @@ +package com.github.technus.tectech.elementalMatter.definitions; + +import com.github.technus.tectech.elementalMatter.classes.cElementalDecay; +import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStack; +import com.github.technus.tectech.elementalMatter.classes.cElementalPrimitive; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class eBosonDefinition extends cElementalPrimitive { +    public static final eBosonDefinition boson_Y__ = new eBosonDefinition("Photon", "\u03b3", 0, 1e-19F, 0, -1,27); +    public static final eBosonDefinition boson_H__ = new eBosonDefinition("Higgs", "\u0397", 0, 126.09e9F, 0, -2,28); +    //deadEnd +    public static final cElementalDecay deadEnd = new cElementalDecay(boson_Y__,boson_Y__); +    public static final cElementalDecay deadEndHalf = new cElementalDecay(boson_Y__); + +    private eBosonDefinition(String name, String symbol,int type, float mass, int charge, int color, int ID) { +        super(name, symbol,type, mass, charge, color,ID); +    } + +    public static void run() { +        boson_Y__.init(null, -1F, 0, 1, +                new cElementalDecay(boson_Y__), +                deadEnd); +        boson_H__.init(null, 1.56e-22F, 0, 0, +                new cElementalDecay(0.96F, new cElementalDefinitionStack(boson_Y__,4)), +                new cElementalDecay(0.02F, eLeptonDefinition.lepton_t, eLeptonDefinition.lepton_t_), +                new cElementalDecay(0.01F, eQuarkDefinition.quark_b, eQuarkDefinition.quark_b_), +                deadEnd); +    } + +    @Override +    public String getName() { +        return "Boson: " + name; +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/eLeptonDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/eLeptonDefinition.java new file mode 100644 index 0000000000..40b0f13ad8 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/eLeptonDefinition.java @@ -0,0 +1,63 @@ +package com.github.technus.tectech.elementalMatter.definitions; + +import com.github.technus.tectech.elementalMatter.classes.cElementalDecay; +import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStack; +import com.github.technus.tectech.elementalMatter.classes.cElementalPrimitive; + +import static com.github.technus.tectech.elementalMatter.definitions.eNeutrinoDefinition.*; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class eLeptonDefinition extends cElementalPrimitive { +    public static final eLeptonDefinition lepton_e = new eLeptonDefinition("Electron", "\u03b2-",1, 0.511e6F, -3, -1,15); +    public static final eLeptonDefinition lepton_m = new eLeptonDefinition("Muon", "\u03bc-",2, 105.658e6F, -3, -1,17); +    public static final eLeptonDefinition lepton_t = new eLeptonDefinition("Tauon", "\u03c4-",3, 1776.83e6F, -3, -1,19); +    public static final eLeptonDefinition lepton_e_ = new eLeptonDefinition("Positron", "\u03b2+",-1, 0.511e6F, 3, -1,16); +    public static final eLeptonDefinition lepton_m_ = new eLeptonDefinition("Antimuon", "\u03bc+",-2,105.658e6F, 3, -1,18); +    public static final eLeptonDefinition lepton_t_ = new eLeptonDefinition("Antitauon", "\u03c4+",-3, 1776.83e6F, 3, -1,20); +    public static final cElementalDefinitionStack lepton_e1=new cElementalDefinitionStack(lepton_e,1); +    public static final cElementalDefinitionStack lepton_e_1=new cElementalDefinitionStack(lepton_e_,1); + + +    private eLeptonDefinition(String name, String symbol,int type, float mass, int charge, int color,int ID) { +        super(name, symbol,type, mass, charge, color,ID); +        //this.itemThing=null; +        //this.fluidThing=null; +    } + +    public static void run() { +        lepton_e.init(lepton_e_, 10000F, 2, 3, +                new cElementalDecay(0.9F, lepton_e), +                new cElementalDecay(0.05F, nothing), +                eBosonDefinition.deadEnd,//makes photons and don't care +                new cElementalDecay(lepton_e, eBosonDefinition.boson_Y__)); +        lepton_m.init(lepton_m_, 1.1e-7F, 0, 1, +                new cElementalDecay(0.9F, lepton_e, lepton_Ve_, lepton_Vm), +                eBosonDefinition.deadEnd);//makes photons and don't care +        lepton_t.init(lepton_t_, 2.906e-13F, 1, 3, +                new cElementalDecay(0.8F, lepton_m, lepton_Vm_, lepton_Vt, eBosonDefinition.boson_Y__), +                new cElementalDecay(0.1F, lepton_e, lepton_Ve_, lepton_Vm), +                new cElementalDecay(0.05F, lepton_m, lepton_Vm_, lepton_Vt, eBosonDefinition.boson_H__), +                eBosonDefinition.deadEnd);//makes photons and don't care + +        lepton_e_.init(lepton_e, 9000F, 2, 3, +                new cElementalDecay(0.9F, lepton_e_), +                new cElementalDecay(0.05F, nothing), +                eBosonDefinition.deadEnd,//makes photons and don't care +                new cElementalDecay(lepton_e_, eBosonDefinition.boson_Y__)); +        lepton_m_.init(lepton_m, 1.1e-7F, 0, 1, +                new cElementalDecay(0.9F, lepton_e_, lepton_Ve, lepton_Vm_), +                eBosonDefinition.deadEnd);//makes photons and don't care +        lepton_t_.init(lepton_t, 2.906e-13F, 1, 3, +                new cElementalDecay(0.8F, lepton_m_, lepton_Vm, lepton_Vt_, eBosonDefinition.boson_Y__), +                new cElementalDecay(0.1F, lepton_e_, lepton_Ve, lepton_Vm_), +                new cElementalDecay(0.05F, lepton_m_, lepton_Vm, lepton_Vt_, eBosonDefinition.boson_H__), +                eBosonDefinition.deadEnd);//makes photons and don't care +    } + +    @Override +    public String getName() { +        return "Lepton: " + name; +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/eNeutrinoDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/eNeutrinoDefinition.java new file mode 100644 index 0000000000..207d6696cf --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/eNeutrinoDefinition.java @@ -0,0 +1,56 @@ +package com.github.technus.tectech.elementalMatter.definitions; + +import com.github.technus.tectech.elementalMatter.classes.cElementalDecay; +import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStack; +import com.github.technus.tectech.elementalMatter.classes.cElementalPrimitive; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class eNeutrinoDefinition extends cElementalPrimitive { +    public static final eNeutrinoDefinition lepton_Ve = new eNeutrinoDefinition("Electron neutrino", "\u03bd\u03b2",1, 2e0F, 0, -1,21); +    public static final eNeutrinoDefinition lepton_Vm = new eNeutrinoDefinition("Muon neutrino", "\u03bd\u03bc",2, 0.15e6F, 0, -1,23); +    public static final eNeutrinoDefinition lepton_Vt = new eNeutrinoDefinition("Tauon neutrino", "\u03bd\u03c4",3, 15e6F, 0, -1,25); +    public static final eNeutrinoDefinition lepton_Ve_ = new eNeutrinoDefinition("Positron neutrino", "~\u03bd\u03b2",-1, 2e0F, 0, -1,22); +    public static final eNeutrinoDefinition lepton_Vm_ = new eNeutrinoDefinition("Antimuon neutrino", "~\u03bd\u03bc",-2, 0.15e6F, 0, -1,24); +    public static final eNeutrinoDefinition lepton_Vt_ = new eNeutrinoDefinition("Antitauon neutrino", "~\u03bd\u03c4",-3, 15e6F, 0, -1,26); +    public static final cElementalDefinitionStack lepton_Ve1=new cElementalDefinitionStack(lepton_Ve,1); +    public static final cElementalDefinitionStack lepton_Ve_1=new cElementalDefinitionStack(lepton_Ve_,1); + +    private eNeutrinoDefinition(String name, String symbol,int type, float mass, int charge, int color, int ID) { +        super(name, symbol,type, mass, charge, color,ID); +    } + +    public static void run() { +        lepton_Ve.init(lepton_Ve_, 1F, 1, 0, +                new cElementalDecay(0.95F, nothing), +                new cElementalDecay(0.1F, lepton_Ve), +                eBosonDefinition.deadEndHalf); +        lepton_Vm.init(lepton_Vm_, 1F, 1, 0, +                new cElementalDecay(0.9F, nothing), +                new cElementalDecay(0.1F, lepton_Vm), +                eBosonDefinition.deadEndHalf); +        lepton_Vt.init(lepton_Vt_, 1F, 1, 0, +                new cElementalDecay(0.85F, nothing), +                new cElementalDecay(0.1F, lepton_Vt), +                eBosonDefinition.deadEndHalf); + +        lepton_Ve_.init(lepton_Ve, 1F, 1, 0, +                new cElementalDecay(0.95F, nothing), +                new cElementalDecay(0.1F, lepton_Ve_), +                eBosonDefinition.deadEndHalf); +        lepton_Vm_.init(lepton_Vm, 1F, 1, 0, +                new cElementalDecay(0.9F, nothing), +                new cElementalDecay(0.1F, lepton_Vm_), +                eBosonDefinition.deadEndHalf); +        lepton_Vt_.init(lepton_Vt, 1F, 1, 0, +                new cElementalDecay(0.85F, nothing), +                new cElementalDecay(0.1F, lepton_Vt_), +                eBosonDefinition.deadEndHalf); +    } + +    @Override +    public String getName() { +        return "Lepton: " + name; +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/eQuarkDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/eQuarkDefinition.java new file mode 100644 index 0000000000..275ebcef64 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/eQuarkDefinition.java @@ -0,0 +1,97 @@ +package com.github.technus.tectech.elementalMatter.definitions; + +import com.github.technus.tectech.elementalMatter.classes.cElementalDecay; +import com.github.technus.tectech.elementalMatter.classes.cElementalPrimitive; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class eQuarkDefinition extends cElementalPrimitive { +    public static final eQuarkDefinition quark_u = new eQuarkDefinition("Up", "u",1, 2.3e6F, 2, 0,3); +    public static final eQuarkDefinition quark_c = new eQuarkDefinition("Charm", "c",2, 1.29e9F, 2, 0,9); +    public static final eQuarkDefinition quark_t = new eQuarkDefinition("Top", "t",3, 172.44e9F, 2, 0,13); +    public static final eQuarkDefinition quark_d = new eQuarkDefinition("Down", "d",1, 4.8e6F, -1, 0,5); +    public static final eQuarkDefinition quark_s = new eQuarkDefinition("Strange", "s",2, 95e6F, -1, 0,7); +    public static final eQuarkDefinition quark_b = new eQuarkDefinition("Bottom", "b",3, 4.65e9F, -1, 0,11); +    public static final eQuarkDefinition quark_u_ = new eQuarkDefinition("AntiUp", "~u",-1, 2.3e6F, -2, 0,4); +    public static final eQuarkDefinition quark_c_ = new eQuarkDefinition("AntiCharm", "~c",-2, 1.29e9F, -2, 0,10); +    public static final eQuarkDefinition quark_t_ = new eQuarkDefinition("AntiTop", "~t",-3, 172.44e9F, -2, 0,14); +    public static final eQuarkDefinition quark_d_ = new eQuarkDefinition("AntiDown", "~d",-1, 4.8e6F, 1, 0,6); +    public static final eQuarkDefinition quark_s_ = new eQuarkDefinition("AntiStrange", "~s",-2, 95e6F, 1, 0,8); +    public static final eQuarkDefinition quark_b_ = new eQuarkDefinition("AntiBottom", "~b",-3, 4.65e9F, 1, 0,12); + +    private eQuarkDefinition(String name, String symbol,int type, float mass, int charge, int color,int ID) { +        super(name, symbol,type, mass, charge, color,ID); +    } + +    public static void run() { +        quark_u.init(quark_u_, 90F, 3, -1, +                new cElementalDecay(0.9F, quark_d, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), +                new cElementalDecay(0.050778116F, quark_s/*,lepton_m_,lepton_Vm*/), +                new cElementalDecay(1.23201e-5F, quark_b/*,lepton_t_,lepton_Vt*/), +                eBosonDefinition.deadEnd);//makes photons and don't care +        quark_c.init(quark_c_, 0.5e-13F, 1, -1, +                new cElementalDecay(0.9F, quark_s, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), +                new cElementalDecay(0.05071504F, quark_d, eLeptonDefinition.lepton_m_, eNeutrinoDefinition.lepton_Vm), +                new cElementalDecay(0.00169744F, quark_b/*,lepton_t_,lepton_Vt*/), +                eBosonDefinition.deadEnd);//makes photons and don't care +        quark_t.init(quark_t_, 2.5e-26F, 2, -1, +                new cElementalDecay(0.9F, quark_b, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), +                new cElementalDecay(0.00163216F, quark_s, eLeptonDefinition.lepton_m_, eNeutrinoDefinition.lepton_Vm), +                new cElementalDecay(7.51689e-5F, quark_d, eLeptonDefinition.lepton_t_, eNeutrinoDefinition.lepton_Vt), +                eBosonDefinition.deadEnd);//makes photons and don't care + +        quark_d.init(quark_d_, 46F, 3, -1, +                new cElementalDecay(0.9F, quark_u, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), +                new cElementalDecay(0.05071504F, quark_c/*,lepton_m,lepton_Vm_*/), +                new cElementalDecay(7.51689e-5F, quark_t/*,lepton_t,lepton_Vt_*/), +                eBosonDefinition.deadEnd);//makes photons and don't care +        quark_s.init(quark_s_, 0.6e-9F, 1, -1, +                new cElementalDecay(0.9F, quark_c, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), +                new cElementalDecay(0.050778116F, quark_u, eLeptonDefinition.lepton_m, eNeutrinoDefinition.lepton_Vm_), +                new cElementalDecay(0.00163216F, quark_t/*,lepton_t,lepton_Vt_*/), +                eBosonDefinition.deadEnd);//makes photons and don't care +        quark_b.init(quark_b_, 0.7e-13F, 2, -1, +                new cElementalDecay(0.9F, quark_t, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), +                new cElementalDecay(0.00169744F, quark_c, eLeptonDefinition.lepton_m, eNeutrinoDefinition.lepton_Vm_), +                new cElementalDecay(1.23201e-5F, quark_u, eLeptonDefinition.lepton_t, eNeutrinoDefinition.lepton_Vt_), +                eBosonDefinition.deadEnd);//makes photons and don't care + +        quark_u_.init(quark_u, 88, 3, -1, +                new cElementalDecay(0.9F, quark_d_, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), +                new cElementalDecay(0.050778116F, quark_s_/*,lepton_m,lepton_Vm_*/), +                new cElementalDecay(1.23201e-5F, quark_b_/*,lepton_t,lepton_Vt_*/), +                eBosonDefinition.deadEnd);//makes photons and don't care +        quark_c_.init(quark_c, 0.5e-13F, 1, -1, +                new cElementalDecay(0.9F, quark_s_, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), +                new cElementalDecay(0.05071504F, quark_d_, eLeptonDefinition.lepton_m, eNeutrinoDefinition.lepton_Vm_), +                new cElementalDecay(0.00169744F, quark_b_/*,lepton_t,lepton_Vt_*/), +                eBosonDefinition.deadEnd);//makes photons and don't care +        quark_t_.init(quark_t, 2.5e-26F, 2, -1, +                new cElementalDecay(0.9F, quark_b_, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), +                new cElementalDecay(0.00163216F, quark_s_, eLeptonDefinition.lepton_m, eNeutrinoDefinition.lepton_Vm_), +                new cElementalDecay(7.51689e-5F, quark_d_, eLeptonDefinition.lepton_t, eNeutrinoDefinition.lepton_Vt_), +                eBosonDefinition.deadEnd);//makes photons and don't care + +        quark_d_.init(quark_d, 44F, 3, -1, +                new cElementalDecay(0.9F, quark_u_, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), +                new cElementalDecay(0.05071504F, quark_c_/*,lepton_m_,lepton_Vm*/), +                new cElementalDecay(7.51689e-5F, quark_t_/*,lepton_t_,lepton_Vt*/), +                eBosonDefinition.deadEnd);//makes photons and don't care +        quark_s_.init(quark_s, 0.6e-9F, 1, -1, +                new cElementalDecay(0.9F, quark_c_, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), +                new cElementalDecay(0.050778116F, quark_u_, eLeptonDefinition.lepton_m_, eNeutrinoDefinition.lepton_Vm), +                new cElementalDecay(0.00163216F, quark_t_/*,lepton_t_,lepton_Vt*/), +                eBosonDefinition.deadEnd);//makes photons and don't care +        quark_b_.init(quark_b, 0.7e-13F, 2, -1, +                new cElementalDecay(0.9F, quark_t_, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), +                new cElementalDecay(0.00169744F, quark_c_, eLeptonDefinition.lepton_m_, eNeutrinoDefinition.lepton_Vm), +                new cElementalDecay(1.23201e-5F, quark_u_, eLeptonDefinition.lepton_t_, eNeutrinoDefinition.lepton_Vt), +                eBosonDefinition.deadEnd);//makes photons and don't care +    } + +    @Override +    public String getName() { +        return "Quark: " + name; +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/gui/GT_Container_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/elementalMatter/gui/GT_Container_MultiMachineEM.java new file mode 100644 index 0000000000..ef6b073aee --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/gui/GT_Container_MultiMachineEM.java @@ -0,0 +1,96 @@ +package com.github.technus.tectech.elementalMatter.gui; + +import com.github.technus.tectech.elementalMatter.machine.GT_MetaTileEntity_MultiblockBase_Elemental; +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.gui.GT_Slot_Holo; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { +    public byte[] eParamsInStatus=new byte[20];//unused 0,G ok 1, B too low 2, R too high 3, Y blink dangerous 4,5 +    public byte[] eParamsOutStatus=new byte[20]; +    public byte eCertainMode=5,eCertainStatus=127; +    public boolean ePowerPass=false,eSafeVoid=false; + +    public GT_Container_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { +        super(aInventoryPlayer, aTileEntity); +    } + +    public GT_Container_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean bindInventory) { +        super(aInventoryPlayer, aTileEntity, bindInventory); +    } + +    @Override +    public void addSlots(InventoryPlayer aInventoryPlayer) { +        addSlotToContainer(new Slot(mTileEntity, 1, 152, -21)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 0, false, false, 1)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 21, false, false, 1)); +    } + +    @Override +    public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { +        if (aSlotIndex < 0) +            return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); +        Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); +        if ((tSlot != null) && (this.mTileEntity.getMetaTileEntity() != null)) { +            GT_MetaTileEntity_MultiblockBase_Elemental base=(GT_MetaTileEntity_MultiblockBase_Elemental)this.mTileEntity.getMetaTileEntity(); +            switch (aSlotIndex){ +                case 1:base.ePowerPass^=true;break; +                case 2:base.eSafeVoid^=true;break; +            } +        } +        return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); +    } + +    @Override +    public void detectAndSendChanges() { +        super.detectAndSendChanges(); +        if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null) || (this.eParamsInStatus ==null)) +            return;//INTELLIJ IS TALKING BULLSHIT HERE IT CAN BE NULL!!! +        this.eParamsInStatus = ((GT_MetaTileEntity_MultiblockBase_Elemental) this.mTileEntity.getMetaTileEntity()).eParamsInStatus; +        this.eParamsOutStatus = ((GT_MetaTileEntity_MultiblockBase_Elemental) this.mTileEntity.getMetaTileEntity()).eParamsOutStatus; +        this.eCertainMode = ((GT_MetaTileEntity_MultiblockBase_Elemental) this.mTileEntity.getMetaTileEntity()).eCertainMode; +        this.eCertainStatus = ((GT_MetaTileEntity_MultiblockBase_Elemental) this.mTileEntity.getMetaTileEntity()).eCertainStatus; +        this.ePowerPass = ((GT_MetaTileEntity_MultiblockBase_Elemental) this.mTileEntity.getMetaTileEntity()).ePowerPass; +        this.eSafeVoid = ((GT_MetaTileEntity_MultiblockBase_Elemental) this.mTileEntity.getMetaTileEntity()).eSafeVoid; + +        for (Object crafter : this.crafters) { +            ICrafting var1 = (ICrafting) crafter; +            int i = 100; +            for (int j = 0; j < eParamsInStatus.length; j++) +                var1.sendProgressBarUpdate(this, i++, eParamsInStatus[j] | (eParamsOutStatus[j] << 8)); +            var1.sendProgressBarUpdate(this, 120, eCertainMode | (eCertainStatus << 8)); +            var1.sendProgressBarUpdate(this, 121, (ePowerPass ? 1 : 0) + (eSafeVoid ? 2 : 0)); +        } +    } + +    @Override +    public void updateProgressBar(int par1, int par2) { +        super.updateProgressBar(par1, par2); +        if(this.eParamsInStatus ==null)return; +        if(par1>=100 && par1< 120){ +            this.eParamsInStatus[par1-100]=(byte)(par2&0xff); +            this.eParamsOutStatus[par1-100]=(byte)(par2>>>8); +        }else if(par1==120){ +            this.eCertainMode=(byte)(par2&0xff); +            this.eCertainStatus=(byte)(par2>>>8); +        }else if(par1==121){ +            this.ePowerPass=(par2&1)==1; +            this.eSafeVoid=(par2&2)==2; +        } +    } + +    @Override +    public int getSlotCount() { +        return 1; +    } + +    @Override +    public int getShiftClickSlotCount() { +        return 1; +    } +}
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/gui/GT_Container_Param.java b/src/main/java/com/github/technus/tectech/elementalMatter/gui/GT_Container_Param.java new file mode 100644 index 0000000000..29b37587f1 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/gui/GT_Container_Param.java @@ -0,0 +1,205 @@ +package com.github.technus.tectech.elementalMatter.gui; + +import com.github.technus.tectech.elementalMatter.machine.GT_MetaTileEntity_Hatch_Param; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.gui.GT_Slot_Holo; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +import java.util.Iterator; + +public final class GT_Container_Param extends GT_ContainerMetaTile_Machine { +    public int exponent = 0; +    public int value2 = 0; +    public int value1 = 0; +    public int param = 0; +    public float value2f = 0; +    public float value1f = 0; +    public float input1f=0; private int input1Bits=0; +    public float input2f=0; private int input2Bits=0; +    public GT_Container_Param(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { +        super(aInventoryPlayer, aTileEntity); +    } + +    @Override +    public void addSlots(InventoryPlayer aInventoryPlayer) { +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 5, false, false, 1)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 23, false, false, 1)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 41, false, false, 1)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 59, false, false, 1)); + +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 5, false, false, 1)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 23, false, false, 1)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 41, false, false, 1)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 59, false, false, 1)); + +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 5, false, false, 1)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 23, false, false, 1)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 41, false, false, 1)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 59, false, false, 1)); + +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 5, false, false, 1)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 23, false, false, 1)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 41, false, false, 1)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 59, false, false, 1)); +    } + +    @Override +    public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { +        if (aSlotIndex < 0) { +            return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); +        } +        Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); +        boolean doStuff=true; +        if ((tSlot != null) && (this.mTileEntity.getMetaTileEntity() != null)) { +            GT_MetaTileEntity_Hatch_Param paramH=(GT_MetaTileEntity_Hatch_Param)this.mTileEntity.getMetaTileEntity(); +            switch (aSlotIndex) { +                case 0: +                    paramH.param -= (aShifthold == 1 ? 512 : 64); +                    break; +                case 1: +                    paramH.value1 -= (aShifthold == 1 ? 512 : 64); +                    break; +                case 2: +                    paramH.value2 -= (aShifthold == 1 ? 512 : 64); +                    break; +                case 3: +                    paramH.exponent -= (aShifthold == 1 ? 16 : 8); +                    break; +                case 4: +                    paramH.param -= (aShifthold == 1 ? 16 : 1); +                    break; +                case 5: +                    paramH.value1 -= (aShifthold == 1 ? 16 : 1); +                    break; +                case 6: +                    paramH.value2 -= (aShifthold == 1 ? 16 : 1); +                    break; +                case 7: +                    paramH.exponent -= (aShifthold == 1 ? 4 : 1); +                    break; +                case 8: +                    paramH.param += (aShifthold == 1 ? 512 : 64); +                    break; +                case 9: +                    paramH.value1 += (aShifthold == 1 ? 512 : 64); +                    break; +                case 10: +                    paramH.value2 += (aShifthold == 1 ? 512 : 64); +                    break; +                case 11: +                    paramH.exponent += (aShifthold == 1 ? 16 : 8); +                    break; +                case 12: +                    paramH.param += (aShifthold == 1 ? 16 : 1); +                    break; +                case 13: +                    paramH.value1 += (aShifthold == 1 ? 16 : 1); +                    break; +                case 14: +                    paramH.value2 += (aShifthold == 1 ? 16 : 1); +                    break; +                case 15: +                    paramH.exponent += (aShifthold == 1 ? 4 : 1); +                    break; +                default: +                    doStuff=false; +            } +            if(doStuff) { +                if(paramH.param> 9) paramH.param= 9; +                if(paramH.param<-1) paramH.param=-1; +                paramH.value1f = (float)(paramH.value1 * Math.pow(2, paramH.exponent)); +                paramH.value2f = (float)(paramH.value2 * Math.pow(2, paramH.exponent)); +            } +        } +        return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); +    } + +    @Override +    public void detectAndSendChanges() { +        super.detectAndSendChanges(); +        if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null)) { +            return; +        } +        this.param = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).param; +        this.value1 = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).value1; +        this.value2 = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).value2; +        this.exponent = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).exponent; +        this.input1Bits= Float.floatToIntBits(((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).input1f); +        this.input2Bits= Float.floatToIntBits(((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).input2f); + +        Iterator var2 = this.crafters.iterator(); +        while (var2.hasNext()) { +            ICrafting var1 = (ICrafting) var2.next(); +            var1.sendProgressBarUpdate(this, 100, this.param    & 0xFFFF); +            var1.sendProgressBarUpdate(this, 101, this.param    >>> 16); +            var1.sendProgressBarUpdate(this, 102, this.value1   & 0xFFFF); +            var1.sendProgressBarUpdate(this, 103, this.value1   >>> 16); +            var1.sendProgressBarUpdate(this, 104, this.value2   & 0xFFFF); +            var1.sendProgressBarUpdate(this, 105, this.value2   >>> 16); +            var1.sendProgressBarUpdate(this, 106, this.exponent & 0xFFFF); +            var1.sendProgressBarUpdate(this, 107, this.exponent >>> 16); +            var1.sendProgressBarUpdate(this, 108, this.input1Bits & 0xFFFF); +            var1.sendProgressBarUpdate(this, 109, this.input1Bits >>> 16); +            var1.sendProgressBarUpdate(this, 110, this.input2Bits & 0xFFFF); +            var1.sendProgressBarUpdate(this, 111, this.input2Bits >>> 16); +        } +    } + +    @SideOnly(Side.CLIENT) +    public void updateProgressBar(int par1, int par2) { +        super.updateProgressBar(par1, par2); +        switch (par1) { +            case 100: +                this.param = (this.param & 0xFFFF0000 | par2); +                return; +            case 101: +                this.param = (this.param & 0xFFFF | par2 << 16); +                return; +            case 102: +                this.value1 = (this.value1 & 0xFFFF0000 | par2); +                break; +            case 103: +                this.value1 = (this.value1 & 0xFFFF | par2 << 16); +                break; +            case 104: +                this.value2 = (this.value2 & 0xFFFF0000 | par2); +                break; +            case 105: +                this.value2 = (this.value2 & 0xFFFF | par2 << 16); +                break; +            case 106: +                this.exponent = (this.exponent & 0xFFFF0000 | par2); +                break; +            case 107: +                this.exponent = (this.exponent & 0xFFFF | par2 << 16); +                break; +            case 108: +                this.input1Bits = (this.input1Bits & 0xFFFF0000 | par2); +                this.input1f=Float.intBitsToFloat(input1Bits); +                return; +            case 109: +                this.input1Bits = (this.input1Bits & 0xFFFF | par2 << 16); +                this.input1f=Float.intBitsToFloat(input1Bits); +                return; +            case 110: +                this.input2Bits = (this.input2Bits & 0xFFFF0000 | par2); +                this.input2f=Float.intBitsToFloat(input2Bits); +                return; +            case 111: +                this.input2Bits = (this.input2Bits & 0xFFFF | par2 << 16); +                this.input2f=Float.intBitsToFloat(input2Bits); +                return; +            default: +                return; +        } +        this.value1f = (float)(this.value1 * Math.pow(2, this.exponent)); +        this.value2f = (float)(this.value2 * Math.pow(2, this.exponent)); +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/gui/GT_Container_Uncertainty.java b/src/main/java/com/github/technus/tectech/elementalMatter/gui/GT_Container_Uncertainty.java new file mode 100644 index 0000000000..7d1c4e60cb --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/gui/GT_Container_Uncertainty.java @@ -0,0 +1,121 @@ +package com.github.technus.tectech.elementalMatter.gui; + +import com.github.technus.tectech.elementalMatter.machine.GT_MetaTileEntity_Hatch_Uncertainty; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.gui.GT_Slot_Holo; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +import java.util.Iterator; + +public final class GT_Container_Uncertainty extends GT_ContainerMetaTile_Machine { +    public short[] matrix=new short[]{500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500}; +    public byte selection=-1,mode=0,status=-128; + +    public GT_Container_Uncertainty(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { +        super(aInventoryPlayer, aTileEntity); +    } + +    @Override +    public void addSlots(InventoryPlayer aInventoryPlayer) { +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 5, false, false, 1)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 23, false, false, 1)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 41, false, false, 1)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 59, false, false, 1)); + +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 5, false, false, 1)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 23, false, false, 1)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 41, false, false, 1)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 59, false, false, 1)); + +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 5, false, false, 1)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 23, false, false, 1)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 41, false, false, 1)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 59, false, false, 1)); + +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 5, false, false, 1)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 23, false, false, 1)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 41, false, false, 1)); +        addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 59, false, false, 1)); +    } + +    @Override +    public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { +        if (aSlotIndex < 0) { +            return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); +        } +        Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); +        if ((tSlot != null) && (this.mTileEntity.getMetaTileEntity() != null)) { +            GT_MetaTileEntity_Hatch_Uncertainty catH=(GT_MetaTileEntity_Hatch_Uncertainty)this.mTileEntity.getMetaTileEntity(); +            if(aSlotIndex<16 && catH.matrix!=null) { +                if (catH.selection == -1) { +                    catH.selection = (byte) (aSlotIndex); +                } else { +                    short temp=catH.matrix[catH.selection]; +                    catH.matrix[catH.selection]=catH.matrix[aSlotIndex]; +                    catH.matrix[aSlotIndex]=temp; +                    catH.selection= -1; +                } + +            } +        } +        return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); +    } + +    @Override +    public void detectAndSendChanges() { +        super.detectAndSendChanges(); +        if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null)) { +            return; +        } + +        ((GT_MetaTileEntity_Hatch_Uncertainty) this.mTileEntity.getMetaTileEntity()).compute(); + +        if (this.matrix != null) +            for (int i = 0; i < 16; i++) +                this.matrix[i] = ((GT_MetaTileEntity_Hatch_Uncertainty) this.mTileEntity.getMetaTileEntity()).matrix[i]; + +        this.selection = ((GT_MetaTileEntity_Hatch_Uncertainty) this.mTileEntity.getMetaTileEntity()).selection; +        this.mode = ((GT_MetaTileEntity_Hatch_Uncertainty) this.mTileEntity.getMetaTileEntity()).mode; +        this.status = ((GT_MetaTileEntity_Hatch_Uncertainty) this.mTileEntity.getMetaTileEntity()).status; + +        Iterator var2 = this.crafters.iterator(); +        while (var2.hasNext()) { +            ICrafting var1 = (ICrafting) var2.next(); +            var1.sendProgressBarUpdate(this, 100, this.selection); +            var1.sendProgressBarUpdate(this, 101, this.mode); +            var1.sendProgressBarUpdate(this, 102, this.status); + +            if (this.matrix != null) +                for (int i = 0; i < 16; i++) +                    var1.sendProgressBarUpdate(this, 103 + i, this.matrix[i]); +        } +    } + +    @SideOnly(Side.CLIENT) +    public void updateProgressBar(int par1, int par2) { +        super.updateProgressBar(par1, par2); +        switch (par1) { +            case 100: +                this.selection = (byte) par2; +                break; +            case 101: +                this.mode = (byte) par2; +                break; +            case 102: +                this.status = (byte) par2; +                break; +            default: +                if(matrix!=null && par1>=103 && par1<119) { +                    this.matrix[par1-103]=(short) par2; +                    break; +                } +        } +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/gui/GT_GUIContainer_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/elementalMatter/gui/GT_GUIContainer_MultiMachineEM.java new file mode 100644 index 0000000000..59e962a1eb --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/gui/GT_GUIContainer_MultiMachineEM.java @@ -0,0 +1,181 @@ +package com.github.technus.tectech.elementalMatter.gui; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.XSTR; +import net.minecraft.entity.player.InventoryPlayer; +import org.lwjgl.opengl.GL11; + +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; + +/** + * Created by Tec on 21.02.2017. + */ + +public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Machine { +    private static final XSTR ran=new XSTR(); +    String mName = ""; + +    public GT_GUIContainer_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) { +        super(new GT_Container_MultiMachineEM(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); +        mName = aName; +    } + +    @Override +    protected void drawGuiContainerForegroundLayer(int par1, int par2) { +        fontRendererObj.drawString(mName, 10, -18, 16448255); + +        if (mContainer != null) { +            if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 1) != 0) +                fontRendererObj.drawString("Pipe is loose.", 10, -10, 16448255); +            if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 2) != 0) +                fontRendererObj.drawString("Screws are missing.", 10, -2, 16448255); +            if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 4) != 0) +                fontRendererObj.drawString("Something is stuck.", 10, 6, 16448255); +            if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 8) != 0) +                fontRendererObj.drawString("Platings are dented.", 10, 14, 16448255); +            if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 16) != 0) +                fontRendererObj.drawString("Circuitry burned out.", 10, 22, 16448255); +            if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 32) != 0) +                fontRendererObj.drawString("That doesn't belong there.", 10, 30, 16448255); +            if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 64) != 0) +                fontRendererObj.drawString("Incomplete Structure.", 10, 38, 16448255); +            if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 128) != 0) +                fontRendererObj.drawString("Too Uncertain.", 10, 46, 16448255); +            if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 256) != 0) +                fontRendererObj.drawString("Invalid Parameters.", 10, 54, 16448255); + +            if (((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode == 0) { +                if (((GT_Container_MultiMachineEM) mContainer).mActive == 0) { +                    fontRendererObj.drawString("Hit with Soft Hammer", 10, -10, 16448255); +                    fontRendererObj.drawString("to (re-)start the Machine", 10, -2, 16448255); +                    fontRendererObj.drawString("if it doesn't start.", 10, 6, 16448255); +                } else { +                    fontRendererObj.drawString("Running perfectly.", 10, -10, 16448255); +                } +            } +        } +    } + +    @Override +    protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { +        super.drawGuiContainerBackgroundLayer(par1, par2, par3); +        int x = (width - xSize) / 2; +        int y = (height - ySize) / 2; +        y-=26; +        drawTexturedModalRect(x, y, 0, 0, xSize, ySize+26); +        if (this.mContainer != null && ((GT_Container_MultiMachineEM) this.mContainer).eParamsInStatus!=null) { +            GL11.glColor4f(1f, 1f, 1f, 1f); + +            if(((GT_Container_MultiMachineEM) mContainer).ePowerPass) +                drawTexturedModalRect(x + 151, y + 25, 183, 25, 18, 18); + +            if(((GT_Container_MultiMachineEM) mContainer).eSafeVoid) +                drawTexturedModalRect(x + 151, y + 46, 183, 46, 18, 18); + +            x+=11;y+=96; +            for(int i=0;i<20;){ +                byte j=(byte)(i>>>1); +                LEDdrawP(x,y,i  ,0,((GT_Container_MultiMachineEM) this.mContainer).eParamsInStatus[j]); +                LEDdrawP(x,y,i++,1,((GT_Container_MultiMachineEM) this.mContainer).eParamsOutStatus[j]); +                LEDdrawP(x,y,i  ,0,((GT_Container_MultiMachineEM) this.mContainer).eParamsInStatus[j+10]); +                LEDdrawP(x,y,i++,1,((GT_Container_MultiMachineEM) this.mContainer).eParamsOutStatus[j+10]); +            } + +            final short rU=183,Vs=77; +            x+=140;y-=19; +            final byte state=((GT_Container_MultiMachineEM) this.mContainer).eCertainStatus; +            switch(((GT_Container_MultiMachineEM) this.mContainer).eCertainMode){ +                case 1://ooo oxo ooo +                    drawTexturedModalRect(x + 6, y + 6, +                            rU + (state==0?38:6), +                            Vs + 6, 6, 6); +                    break; +                case 2://ooo xox ooo +                    drawTexturedModalRect(x, y + 6, +                            rU + ((state&1)==0?32:0), +                            Vs + 6, 6, 6); +                    drawTexturedModalRect(x+12, y + 6, +                            rU + ((state&2)==0?44:12), +                            Vs + 6, 6, 6); +                    break; +                case 3://oxo xox oxo +                    drawTexturedModalRect(x+6, y, +                            rU + ((state&1)==0?38:6), +                            Vs, 6, 6); +                    drawTexturedModalRect(x, y + 6, +                            rU + ((state&2)==0?32:0), +                            Vs + 6, 6, 6); +                    drawTexturedModalRect(x+12, y + 6, +                            rU + ((state&4)==0?44:12), +                            Vs + 6, 6, 6); +                    drawTexturedModalRect(x+6, y + 12, +                            rU + ((state&8)==0?38:6), +                            Vs + 12, 6, 6); +                    break; +                case 4://xox ooo xox +                    drawTexturedModalRect(x, y, +                            rU + ((state&1)==0?32:0), +                            Vs, 6, 6); +                    drawTexturedModalRect(x+12, y, +                            rU + ((state&2)==0?44:12), +                            Vs, 6, 6); +                    drawTexturedModalRect(x, y+12, +                            rU + ((state&4)==0?32:0), +                            Vs+12, 6, 6); +                    drawTexturedModalRect(x+12, y + 12, +                            rU + ((state&8)==0?44:12), +                            Vs + 12, 6, 6); +                    break; +                case 5://xox ooo xox +                    drawTexturedModalRect(x, y, +                            rU + ((state&1)==0?32:0), +                            Vs, 6, 6); +                    drawTexturedModalRect(x+12, y, +                            rU + ((state&2)==0?44:12), +                            Vs, 6, 6); +                    drawTexturedModalRect(x + 6, y + 6, +                            rU + ((state&4)==0?38:6), +                            Vs + 6, 6, 6); +                    drawTexturedModalRect(x, y+12, +                            rU + ((state&8)==0?32:0), +                            Vs+12, 6, 6); +                    drawTexturedModalRect(x+12, y + 12, +                            rU + ((state&16)==0?44:12), +                            Vs + 12, 6, 6); +                    break; +            } +        } +    } + +    private void LEDdrawP(int x,int y,int i,int j,byte status){ +        final int v=192,su=8,sv=6,u=11; +        switch(status){ +            case 1://ok +                drawTexturedModalRect(x+su*i,y+sv*j,u+su*i,v+sv*(4+j),su,sv); +            break; +            case 2://too low blink +                if(ran.nextInt(2)==0){ +                    drawTexturedModalRect(x+su*i,y+sv*j,u+su*i,v+sv*j,su,sv); +                    break; +                } +            case 3:// too low +                drawTexturedModalRect(x+su*i,y+sv*j,u+su*i,v+sv*(2+j),su,sv); +            break; +            case 4://too high blink +                if(ran.nextInt(2)==0) { +                    drawTexturedModalRect(x+su*i,y+sv*j,u+su*i,v+sv*(8+j),su,sv); +                    break; +                } +            case 5:// too high +                drawTexturedModalRect(x+su*i,y+sv*j,u+su*i,v+sv*(6+j),su,sv); +            break; +            case 6: +                if(ran.nextInt(2)==0) +                    drawTexturedModalRect(x+su*i,y+sv*j,u+su*i,v+sv*j,su,sv); +                else +                    drawTexturedModalRect(x+su*i,y+sv*j,u+su*i,v+sv*(8+j),su,sv); + +        } +    } +}
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/gui/GT_GUIContainer_Param.java b/src/main/java/com/github/technus/tectech/elementalMatter/gui/GT_GUIContainer_Param.java new file mode 100644 index 0000000000..988088cb83 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/gui/GT_GUIContainer_Param.java @@ -0,0 +1,37 @@ +package com.github.technus.tectech.elementalMatter.gui; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.InventoryPlayer; + +import static com.github.technus.tectech.TecTech.proxy; +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; + +public final class GT_GUIContainer_Param extends GT_GUIContainerMetaTile_Machine { +    public GT_GUIContainer_Param(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { +        super(new GT_Container_Param(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "Parametrizer.png"); +    } + +    protected void drawGuiContainerForegroundLayer(int par1, int par2) { +        if (this.mContainer != null) { +            proxy.renderUnicodeString("Parametrizer: " + ((GT_Container_Param) this.mContainer).param, 46, 7,167, 0xffffff); +            proxy.renderUnicodeString("\u2460\u2b07" + String.format(java.util.Locale.ENGLISH,"%+.5E",((GT_Container_Param) this.mContainer).input1f), 46, 16,167, 0x22ddff); +            proxy.renderUnicodeString("\u2461\u2b07" + String.format(java.util.Locale.ENGLISH,"%+.5E",((GT_Container_Param) this.mContainer).input2f), 46, 24,167, 0x00ffff); +            proxy.renderUnicodeString("\u2460\u2b06" + String.format(java.util.Locale.ENGLISH,"%+.5E",((GT_Container_Param) this.mContainer).value1f), 46, 33,167, 0x00bbff); +            proxy.renderUnicodeString("\u2461\u2b06" + String.format(java.util.Locale.ENGLISH,"%+.5E",((GT_Container_Param) this.mContainer).value2f), 46, 41,167, 0x0077ff); +            proxy.renderUnicodeString("M\u2460: " + ((GT_Container_Param) this.mContainer).value1, 46, 50,167,0x00bbff); +            proxy.renderUnicodeString("M\u2461: " + ((GT_Container_Param) this.mContainer).value2, 46, 58,167,0x0077ff); +            proxy.renderUnicodeString("E\u2460\u2461: " + ((GT_Container_Param) this.mContainer).exponent, 46, 66,167,0x0033ff); +        }else{ +            proxy.renderUnicodeString("Parametrizer", 46, 7,167, 0xffffff); +        } +        //167 +    } + +    protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { +        super.drawGuiContainerBackgroundLayer(par1, par2, par3); +        int x = (this.width - this.xSize) / 2; +        int y = (this.height - this.ySize) / 2; +        drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/gui/GT_GUIContainer_Uncertainty.java b/src/main/java/com/github/technus/tectech/elementalMatter/gui/GT_GUIContainer_Uncertainty.java new file mode 100644 index 0000000000..35f21b93c0 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/gui/GT_GUIContainer_Uncertainty.java @@ -0,0 +1,108 @@ +package com.github.technus.tectech.elementalMatter.gui; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.XSTR; +import net.minecraft.entity.player.InventoryPlayer; +import org.lwjgl.opengl.GL11; + +import static com.github.technus.tectech.TecTech.proxy; +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; + +public class GT_GUIContainer_Uncertainty extends GT_GUIContainerMetaTile_Machine { +    private static final XSTR ran= new XSTR(); + +    public GT_GUIContainer_Uncertainty(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { +        super(new GT_Container_Uncertainty(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "Uncertainty.png"); +    } + +    protected void drawGuiContainerForegroundLayer(int par1, int par2) { +        proxy.renderUnicodeString("Schrödinger", 46, 7,167, 0xffffff); +        if (this.mContainer != null && ((GT_Container_Uncertainty) this.mContainer).status==0) +            proxy.renderUnicodeString("Status: OK", 46, 16,167, 0xffffff); +        else +            proxy.renderUnicodeString("Status: NG", 46, 16,167, 0xffffff); +    } + +    protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { +        super.drawGuiContainerBackgroundLayer(par1, par2, par3); +        int x = (this.width - this.xSize) / 2; +        int y = (this.height - this.ySize) / 2; +        drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); +        if (this.mContainer != null && ((GT_Container_Uncertainty) this.mContainer).matrix!=null) { +            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); +            final short bU=0,rU=70,fU=192,V=210,Vs=216; x+=52; y+=33; +            final int state=((GT_Container_Uncertainty) this.mContainer).status; +            switch(((GT_Container_Uncertainty) this.mContainer).mode){ +                case 1://ooo oxo ooo +                    drawTexturedModalRect(x + 12, y + 12, +                            rU + (state==0?76:12), +                            Vs + 12, 10, 10); +                    break; +                case 2://ooo xox ooo +                    drawTexturedModalRect(x, y + 12, +                            rU + ((state&1)==0?64:0), +                            Vs + 12, 10, 10); +                    drawTexturedModalRect(x+24, y + 12, +                            rU + ((state&2)==0?88:24), +                            Vs + 12, 10, 10); +                    break; +                case 3://oxo xox oxo +                    drawTexturedModalRect(x+12, y, +                            rU + ((state&1)==0?76:12), +                            Vs, 10, 10); +                    drawTexturedModalRect(x, y + 12, +                            rU + ((state&2)==0?64:0), +                            Vs + 12, 10, 10); +                    drawTexturedModalRect(x+24, y + 12, +                            rU + ((state&4)==0?88:24), +                            Vs + 12, 10, 10); +                    drawTexturedModalRect(x+12, y + 24, +                            rU + ((state&8)==0?76:12), +                            Vs + 24, 10, 10); +                    break; +                case 4://xox ooo xox +                    drawTexturedModalRect(x, y, +                            rU + ((state&1)==0?64:0), +                            Vs, 10, 10); +                    drawTexturedModalRect(x+24, y, +                            rU + ((state&2)==0?88:24), +                            Vs, 10, 10); +                    drawTexturedModalRect(x, y+24, +                            rU + ((state&4)==0?64:0), +                            Vs+24, 10, 10); +                    drawTexturedModalRect(x+24, y + 24, +                            rU + ((state&8)==0?88:24), +                            Vs + 24, 10, 10); +                    break; +                case 5://xox ooo xox +                    drawTexturedModalRect(x, y, +                            rU + ((state&1)==0?64:0), +                            Vs, 10, 10); +                    drawTexturedModalRect(x+24, y, +                            rU + ((state&2)==0?88:24), +                            Vs, 10, 10); +                    drawTexturedModalRect(x + 12, y + 12, +                            rU + ((state&4)==0?76:12), +                            Vs + 12, 10, 10); +                    drawTexturedModalRect(x, y+24, +                            rU + ((state&8)==0?64:0), +                            Vs+24, 10, 10); +                    drawTexturedModalRect(x+24, y + 24, +                            rU + ((state&16)==0?88:24), +                            Vs + 24, 10, 10); +                    break; +            } +            x-=6;y-=6; +            for(int i=0;i<16;i++) +                if(ran.nextInt(1000)<((GT_Container_Uncertainty) this.mContainer).matrix[i]) +                    drawTexturedModalRect(x + 12*(i/4), y + 12*(i%4), +                            fU + 12*(i/4), V + 12*(i%4), 10, 10); +            if(((GT_Container_Uncertainty) this.mContainer).selection>-1) { +                int sel=((GT_Container_Uncertainty) this.mContainer).selection; +                drawTexturedModalRect(x + 12*(sel/4), y + 12*(sel%4), +                        bU + 12*(sel/4), V + 12*(sel%4), 10, 10); +            } +        } +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/gui/GT_GUIContainer_UncertaintyAdv.java b/src/main/java/com/github/technus/tectech/elementalMatter/gui/GT_GUIContainer_UncertaintyAdv.java new file mode 100644 index 0000000000..4bae824207 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/gui/GT_GUIContainer_UncertaintyAdv.java @@ -0,0 +1,117 @@ +package com.github.technus.tectech.elementalMatter.gui; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.XSTR; +import net.minecraft.entity.player.InventoryPlayer; +import org.lwjgl.opengl.GL11; + +import static com.github.technus.tectech.TecTech.proxy; +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; +import static org.lwjgl.opengl.GL11.*; + +public final class GT_GUIContainer_UncertaintyAdv extends GT_GUIContainerMetaTile_Machine { +    protected static final XSTR ran= new XSTR(); +    protected static final short sX=52,sY=33,bU=0,rU=70,fU=192,V=210,Vs=216; + +    public GT_GUIContainer_UncertaintyAdv(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { +        super(new GT_Container_Uncertainty(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "Uncertainty.png"); +    } + +    protected void drawGuiContainerForegroundLayer(int par1, int par2) { +        proxy.renderUnicodeString("Schrödinger X", 46, 7,167, 0xffffff); +        if (this.mContainer != null && ((GT_Container_Uncertainty) this.mContainer).status==0) +            proxy.renderUnicodeString("Status: OK", 46, 16,167, 0xffffff); +        else +            proxy.renderUnicodeString("Status: NG", 46, 16,167, 0xffffff); +    } + +    protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { +        super.drawGuiContainerBackgroundLayer(par1, par2, par3); +        int x = (this.width - this.xSize) / 2; +        int y = (this.height - this.ySize) / 2; +        drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); +        if (this.mContainer != null && ((GT_Container_Uncertainty) this.mContainer).matrix!=null) { +            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); +            x+=sX; y+=sY; +            final int state=((GT_Container_Uncertainty) this.mContainer).status; +            switch(((GT_Container_Uncertainty) this.mContainer).mode){ +                case 1://ooo oxo ooo +                    drawTexturedModalRect(x + 12, y + 12, +                            rU + (state==0?76:12), +                            Vs + 12, 10, 10); +                    break; +                case 2://ooo xox ooo +                    drawTexturedModalRect(x, y + 12, +                            rU + ((state&1)==0?64:0), +                            Vs + 12, 10, 10); +                    drawTexturedModalRect(x+24, y + 12, +                            rU + ((state&2)==0?88:24), +                            Vs + 12, 10, 10); +                    break; +                case 3://oxo xox oxo +                    drawTexturedModalRect(x+12, y, +                            rU + ((state&1)==0?76:12), +                            Vs, 10, 10); +                    drawTexturedModalRect(x, y + 12, +                            rU + ((state&2)==0?64:0), +                            Vs + 12, 10, 10); +                    drawTexturedModalRect(x+24, y + 12, +                            rU + ((state&4)==0?88:24), +                            Vs + 12, 10, 10); +                    drawTexturedModalRect(x+12, y + 24, +                            rU + ((state&8)==0?76:12), +                            Vs + 24, 10, 10); +                    break; +                case 4://xox ooo xox +                    drawTexturedModalRect(x, y, +                            rU + ((state&1)==0?64:0), +                            Vs, 10, 10); +                    drawTexturedModalRect(x+24, y, +                            rU + ((state&2)==0?88:24), +                            Vs, 10, 10); +                    drawTexturedModalRect(x, y+24, +                            rU + ((state&4)==0?64:0), +                            Vs+24, 10, 10); +                    drawTexturedModalRect(x+24, y + 24, +                            rU + ((state&8)==0?88:24), +                            Vs + 24, 10, 10); +                    break; +                case 5://xox ooo xox +                    drawTexturedModalRect(x, y, +                            rU + ((state&1)==0?64:0), +                            Vs, 10, 10); +                    drawTexturedModalRect(x+24, y, +                            rU + ((state&2)==0?88:24), +                            Vs, 10, 10); +                    drawTexturedModalRect(x + 12, y + 12, +                            rU + ((state&4)==0?76:12), +                            Vs + 12, 10, 10); +                    drawTexturedModalRect(x, y+24, +                            rU + ((state&8)==0?64:0), +                            Vs+24, 10, 10); +                    drawTexturedModalRect(x+24, y + 24, +                            rU + ((state&16)==0?88:24), +                            Vs + 24, 10, 10); +                    break; +            } +            x-=6;y-=6; + +            glEnable(GL_BLEND); +            glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); +            for(int i=0;i<16;i++){ +                GL11.glColor4f(1f,1f,1f,(float)((GT_Container_Uncertainty) this.mContainer).matrix[i]/1000f); +                drawTexturedModalRect(x + 12 * (i / 4), y + 12 * (i % 4), +                        fU + 12 * (i / 4), V + 12 * (i % 4), 10, 10); +            } +            glDisable(GL_BLEND); + +            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); +            if(((GT_Container_Uncertainty) this.mContainer).selection>-1) { +                int sel=((GT_Container_Uncertainty) this.mContainer).selection; +                drawTexturedModalRect(x + 12*(sel/4), y + 12*(sel%4), +                        bU + 12*(sel/4), V + 12*(sel%4), 10, 10); +            } +        } +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iConnectsToEMpipe.java b/src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iConnectsToEMpipe.java new file mode 100644 index 0000000000..9d9d0ebea9 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iConnectsToEMpipe.java @@ -0,0 +1,8 @@ +package com.github.technus.tectech.elementalMatter.interfaces; + +/** + * Created by Tec on 26.02.2017. + */ +public interface iConnectsToEMpipe { +    boolean canConnect(byte side); +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iElementalDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iElementalDefinition.java new file mode 100644 index 0000000000..484636ebe8 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iElementalDefinition.java @@ -0,0 +1,47 @@ +package com.github.technus.tectech.elementalMatter.interfaces; + +import com.github.technus.tectech.elementalMatter.classes.cElementalDecay; +import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStackTree; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.FluidStack; + +/** + * Created by danie_000 on 11.11.2016. + */ +public interface iElementalDefinition extends Comparable<iElementalDefinition> { +    //Nomenclature +    String getName(); + +    String getSymbol(); + +    byte getType(); + +    byte getClassType();//bigger number means bigger things usually, but it is just used to differentiate between classes of iED + +    //Not dynamically changing stuff +    iElementalDefinition getAnti();//gives new anti particle def + +    cElementalDecay[] getDecayArray();//possible decays + +    cElementalDecay[] getNaturalDecayInstant();//natural decay if lifespan <1tick + +    cElementalDecay[] getEnergeticDecayInstant();//energetic decay if lifespan <1tick + +    float getMass();//mass... MeV/c^2 + +    int getCharge();//charge 1/3 electron charge + +    //dynamically changing stuff +    byte getColor();//-1 nope cannot 0 it can but undefined + +    float getRawLifeTime();//defined in static fields or generated + +    cElementalDefinitionStackTree getSubParticles();//contents... null if none + +    ItemStack materializesIntoItem(); + +    FluidStack materializesIntoFluid(); + +    NBTTagCompound toNBT(); +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iElementalInstanceContainer.java b/src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iElementalInstanceContainer.java new file mode 100644 index 0000000000..309a51a559 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iElementalInstanceContainer.java @@ -0,0 +1,11 @@ +package com.github.technus.tectech.elementalMatter.interfaces; + +import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackTree; + +/** + * Created by danie_000 on 25.01.2017. + */ +public interface iElementalInstanceContainer { +    cElementalInstanceStackTree getContainerHandler(); +    float purgeOverflow(); +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iHasElementalDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iHasElementalDefinition.java new file mode 100644 index 0000000000..94f8e7bb14 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iHasElementalDefinition.java @@ -0,0 +1,9 @@ +package com.github.technus.tectech.elementalMatter.interfaces; + +/** + * Created by danie_000 on 30.01.2017. + */ +public interface iHasElementalDefinition extends Comparable<iHasElementalDefinition> { +    iElementalDefinition getDefinition(); +    int getAmount(); +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMbhg.java b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMbhg.java new file mode 100644 index 0000000000..982bef057a --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMbhg.java @@ -0,0 +1,94 @@ +package com.github.technus.tectech.elementalMatter.machine; + +import com.github.technus.tectech.casing.GT_Container_CasingsTT; +import com.github.technus.tectech.blocks.QuantumGlass; +import com.github.technus.tectech.elementalMatter.commonValues; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GT_RenderedTexture; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +import static gregtech.api.enums.GT_Values.E; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EMbhg extends GT_MetaTileEntity_MultiblockBase_Elemental { +    private static Textures.BlockIcons.CustomIcon ScreenOFF; +    private static Textures.BlockIcons.CustomIcon ScreenON; +    //Time dillatation - to slow down the explosion thing but REALLY REDUCE POWER OUTPUT +    //Startcodes to startup +    //per dim disable thingies +    private static final String[] s =new String[]{ +            "f202","f020","g0","c5g5","d55c55","f0a0","e21212", +            "d00c00","c0g0","b0i0","a20i02","a02i20","d0024200", +            "c022c220","b02g20","02k20","a03i30","21k12" +    }; +    private static final String[][] S =new String[][]{ +            {E,E,E,E,E,E,s[0],s[5],s[0]},//front +            {E,E,E,E,s[2],s[0],s[6],"d0033300",s[6],s[0],s[2]}, +            {E,E,E,s[2],s[1],s[1],s[7],"c033c330",s[7],s[1],s[1],s[2]}, +            {E,E,s[2],s[1],s[4],s[4],s[8],"b03g30",s[8],s[4],s[4],s[1],s[2]}, +            {E,s[2],s[1],s[4],s[3],s[3],s[9],s[16],s[9],s[3],s[3],s[4],s[1],s[2]}, +            {E,s[0],s[1],s[4],s[3],s[3],s[10],s[16],s[10],s[3],s[3],s[4],s[1],s[0]}, +            {s[0],s[6],s[7],s[8],s[9],s[10],s[17],"03k30",s[17],s[10],s[9],s[8],s[7],s[6],s[0]}, +            {s[5],s[12],s[13],s[14],s[11],s[11],s[15],"a3k3",s[15],s[11],s[11],s[14],s[13],s[12],s[5]} +    }; +    private static final String[][] shape=new String[][]{ +            S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[6],S[5],S[4],S[3],S[2],S[1],S[0] +    }; +    private static final Block[] blockType=new Block[]{ +            GT_Container_CasingsTT.sBlockCasingsTT, +            GT_Container_CasingsTT.sBlockCasingsTT, +            GT_Container_CasingsTT.sBlockCasingsTT, +            GT_Container_CasingsTT.sBlockCasingsTT, +            GT_Container_CasingsTT.sBlockCasingsTT, +            QuantumGlass.INSTANCE}; +    private static final byte[] blockMeta=new byte[]{3,4,5,6,7,0}; + +    public GT_MetaTileEntity_EMbhg(int aID, String aName, String aNameRegional) { +        super(aID, aName, aNameRegional); +    } + +    public GT_MetaTileEntity_EMbhg(String aName) { +        super(aName); +    } + +    public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { +        return new GT_MetaTileEntity_EMbhg(this.mName); +    } + +    @Override +    public void registerIcons(IIconRegister aBlockIconRegister) { +        ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_BHG"); +        ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_BHG_ACTIVE"); +        super.registerIcons(aBlockIconRegister); +    } + +    @Override +    public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { +        if (aSide == aFacing) { +            return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[83], new GT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; +        } +        return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[83]}; +    } + +    @Override +    public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { +        return stuctureCheck(shape,blockType,blockMeta,7,7,0,iGregTechTileEntity); +    } + +    @Override +    public String[] getDescription() { +        return new String[]{ +                commonValues.tecMark, +                "Singularity decay based power generation.", +                EnumChatFormatting.AQUA.toString()+EnumChatFormatting.BOLD+"Super unstable!!!" +        }; +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMcollider.java b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMcollider.java new file mode 100644 index 0000000000..c9a675df89 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMcollider.java @@ -0,0 +1,73 @@ +package com.github.technus.tectech.elementalMatter.machine; + +import com.github.technus.tectech.elementalMatter.commonValues; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GT_RenderedTexture; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EMcollider extends GT_MetaTileEntity_MultiblockBase_Elemental  { +    private static Textures.BlockIcons.CustomIcon ScreenOFF; +    private static Textures.BlockIcons.CustomIcon ScreenON; + +    //use multi A energy inputs, use less power the longer it runs +    private static final String[][] shape=new String[][]{ +            {"",//left to right top +                    "", +                    "" },//front +            {},//behind front +            {} //behind +    }; +    private static final int[] casingRequirements=new int[]{}; +    private static final Block[] blockType=new Block[]{}; +    private static final byte[] blockMeta=new byte[]{}; + +    public GT_MetaTileEntity_EMcollider(int aID, String aName, String aNameRegional) { +        super(aID, aName, aNameRegional); +    } + +    public GT_MetaTileEntity_EMcollider(String aName) { +        super(aName); +    } + +    public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { +        return new GT_MetaTileEntity_EMcollider(this.mName); +    } + +    @Override +    public void registerIcons(IIconRegister aBlockIconRegister) { +        ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER"); +        ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_ACTIVE"); +        super.registerIcons(aBlockIconRegister); +    } + +    @Override +    public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { +        if (aSide == aFacing) { +            return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[83], new GT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; +        } +        return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[83]}; +    } + +    @Override +    public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { +        return false; +    } + +    @Override +    public String[] getDescription() { +        return new String[]{ +                commonValues.tecMark, +                "Collide matter at extreme velocities.", +                EnumChatFormatting.AQUA.toString()+EnumChatFormatting.BOLD+"Faster than light!!!" +        }; +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMcrafter.java b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMcrafter.java new file mode 100644 index 0000000000..f1106e2277 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMcrafter.java @@ -0,0 +1,50 @@ +package com.github.technus.tectech.elementalMatter.machine; + +import com.github.technus.tectech.elementalMatter.commonValues; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EMcrafter extends GT_MetaTileEntity_MultiblockBase_Elemental  { +    private static final String[][] shape=new String[][]{ +            {"",//left to right top +                    "", +                    "" },//front +            {},//behind front +            {} //behind +    }; +    private static final int[] casingRequirements=new int[]{}; +    private static final Block[] blockType=new Block[]{}; +    private static final byte[] blockMeta=new byte[]{}; + +    public GT_MetaTileEntity_EMcrafter(int aID, String aName, String aNameRegional) { +        super(aID, aName, aNameRegional); +    } + +    public GT_MetaTileEntity_EMcrafter(String aName) { +        super(aName); +    } + +    public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { +        return new GT_MetaTileEntity_EMcrafter(this.mName); +    } + +    @Override +    public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { +        return false; +    } + +    @Override +    public String[] getDescription() { +        return new String[]{ +                commonValues.tecMark, +                "The most precise way of making stuff.", +                EnumChatFormatting.AQUA.toString()+EnumChatFormatting.BOLD+"(Trans-Planck process)" +        }; +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMdequantifier.java b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMdequantifier.java new file mode 100644 index 0000000000..4ec04c01a5 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMdequantifier.java @@ -0,0 +1,66 @@ +package com.github.technus.tectech.elementalMatter.machine; + +import com.github.technus.tectech.casing.GT_Container_CasingsTT; +import com.github.technus.tectech.blocks.QuantumGlass; +import com.github.technus.tectech.elementalMatter.commonValues; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.util.ForgeDirection; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EMdequantifier extends GT_MetaTileEntity_MultiblockBase_Elemental  { + +    public GT_MetaTileEntity_EMdequantifier(int aID, String aName, String aNameRegional) { +        super(aID, aName, aNameRegional); +    } + +    public GT_MetaTileEntity_EMdequantifier(String aName) { +        super(aName); +    } + +    public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { +        return new GT_MetaTileEntity_EMdequantifier(this.mName); +    } + +    @Override +    public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { +        int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; +        int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ; +        if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir)!= QuantumGlass.INSTANCE) { +            return false; +        } +        for (int i = -1; i < 2; i++) { +            for (int j = -1; j < 2; j++) { +                for (int h = -1; h < 2; h++) { +                    if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { +                        IGregTechTileEntity tTileEntity = iGregTechTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); +                        if (    (!addMaintenanceToMachineList(tTileEntity, 83)) && +                                (!addElementalInputToMachineList(tTileEntity, 83)) && +                                (!addClassicOutputToMachineList(tTileEntity, 83)) && +                                (!addMufflerToMachineList(tTileEntity, 83)) && +                                (!addEnergyIOToMachineList(tTileEntity, 83))) { +                            if (    iGregTechTileEntity.getBlockOffset(xDir + i, h, zDir + j) != GT_Container_CasingsTT.sBlockCasingsTT || +                                    iGregTechTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 3) { +                                return false; +                            } +                        } +                    } +                } +            } +        } +        return true; +    } + +    @Override +    public String[] getDescription() { +        return new String[]{ +                commonValues.tecMark, +                "Conveniently convert regular stuff into quantum form.", +                EnumChatFormatting.AQUA.toString()+EnumChatFormatting.BOLD+"To make it more inconvenient." +        }; +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMjunction.java b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMjunction.java new file mode 100644 index 0000000000..a358e21c77 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMjunction.java @@ -0,0 +1,114 @@ +package com.github.technus.tectech.elementalMatter.machine; + +import com.github.technus.tectech.casing.GT_Container_CasingsTT; +import com.github.technus.tectech.blocks.QuantumGlass; +import com.github.technus.tectech.elementalMatter.commonValues; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.util.ForgeDirection; + +import static gregtech.api.enums.GT_Values.V; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EMjunction extends GT_MetaTileEntity_MultiblockBase_Elemental  { +    public GT_MetaTileEntity_EMjunction(int aID, String aName, String aNameRegional) { +        super(aID, aName, aNameRegional); +        mEUt=-(int)V[9]; +    } + +    public GT_MetaTileEntity_EMjunction(String aName) { +        super(aName); +        mEUt=-(int)V[9]; +    } + +    public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { +        return new GT_MetaTileEntity_EMjunction(this.mName); +    } + +    @Override +    public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { +        int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; +        int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ; +        if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir)!= QuantumGlass.INSTANCE) { +            return false; +        } +        for (int i = -1; i < 2; i++) { +            for (int j = -1; j < 2; j++) { +                for (int h = -1; h < 2; h++) { +                    if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { +                        IGregTechTileEntity tTileEntity = iGregTechTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); +                        if (    (!addMaintenanceToMachineList(tTileEntity, 83)) && +                                (!addElementalInputToMachineList(tTileEntity, 83)) && +                                (!addElementalOutputToMachineList(tTileEntity, 83)) && +                                (!addMufflerToMachineList(tTileEntity, 83)) && +                                (!addEnergyIOToMachineList(tTileEntity, 83))) { +                            if (    iGregTechTileEntity.getBlockOffset(xDir + i, h, zDir + j) != GT_Container_CasingsTT.sBlockCasingsTT || +                                    iGregTechTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 3) { +                                return false; +                            } +                        } +                    } +                } +            } +        } +        return true; +    } + +    @Override +    public String[] getDescription() { +        return new String[]{ +                commonValues.tecMark, +                "Reroutes Matter", +                EnumChatFormatting.AQUA.toString()+EnumChatFormatting.BOLD+"Axis aligned movement!" +        }; +    } + +    @Override +    public void EM_checkParams() { +        for(int i=0;i<10;i++){ +            if(eParamsIn[i]<0)eParamsInStatus[i]=2; +            else if(eParamsIn[i]==0)eParamsInStatus[i]=0; +            else if(eParamsIn[i]>eInputHatches.size())eParamsInStatus[i]=4; +            else eParamsInStatus[i]=1; +        } +        for(int i=10;i<20;i++){ +            if(eParamsIn[i]<0)eParamsInStatus[i]=2; +            else if(eParamsIn[i]==0)eParamsInStatus[i]=3; +            else if(eParamsIn[i]>eOutputHatches.size())eParamsInStatus[i]=4; +            else eParamsInStatus[i]=1; +        } +    } + +    @Override +    public boolean EM_checkRecipe(ItemStack itemStack) { +        for(GT_MetaTileEntity_Hatch_InputElemental in: eInputHatches) +            if(in.getContainerHandler().hasStacks()) { +                ampereRating=1+((eInputHatches.size()+eOutputHatches.size())>>1); +                mMaxProgresstime=20; +                return true; +            } +        mMaxProgresstime=0; +        return false; +    } + +    @Override +    public void EM_outputFunction() { +        for(int i=0;i<10;i++){ +            if(((int) eParamsIn[i] - 1)<0 || ((int) eParamsIn[i] - 1)>=eInputHatches.size()) continue; +            GT_MetaTileEntity_Hatch_InputElemental in=eInputHatches.get((int) eParamsIn[i] - 1); +            if(eParamsIn[i+10]==0){ +                cleanHatchContent(in); +            }else{ +                GT_MetaTileEntity_Hatch_OutputElemental out=eOutputHatches.get((int)eParamsIn[i+10]-1); +                if (out != null) { +                    in.getContainerHandler().putUnifyAll(out.getContainerHandler()); +                    out.getContainerHandler().clear(); +                } +            } +        } +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMmachine.java b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMmachine.java new file mode 100644 index 0000000000..cbb91501af --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMmachine.java @@ -0,0 +1,50 @@ +package com.github.technus.tectech.elementalMatter.machine; + +import com.github.technus.tectech.elementalMatter.commonValues; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EMmachine extends GT_MetaTileEntity_MultiblockBase_Elemental  { +    private static final String[][] shape=new String[][]{ +            {"",//left to right top +                    "", +                    "" },//front +            {},//behind front +            {} //behind +    }; +    private static final int[] casingRequirements=new int[]{}; +    private static final Block[] blockType=new Block[]{}; +    private static final byte[] blockMeta=new byte[]{}; + +    public GT_MetaTileEntity_EMmachine(int aID, String aName, String aNameRegional) { +        super(aID, aName, aNameRegional); +    } + +    public GT_MetaTileEntity_EMmachine(String aName) { +        super(aName); +    } + +    public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { +        return new GT_MetaTileEntity_EMmachine(this.mName); +    } + +    @Override +    public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { +        return false; +    } + +    @Override +    public String[] getDescription() { +        return new String[]{ +                commonValues.tecMark, +                "Processing quantum matter since...", +                EnumChatFormatting.AQUA.toString()+EnumChatFormatting.BOLD+"the time u started using it." +        }; +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMpipe.java b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMpipe.java new file mode 100644 index 0000000000..d46ae64393 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMpipe.java @@ -0,0 +1,162 @@ +package com.github.technus.tectech.elementalMatter.machine; + +import com.github.technus.tectech.elementalMatter.commonValues; +import com.github.technus.tectech.elementalMatter.interfaces.iConnectsToEMpipe; +import gregtech.api.enums.Dyes; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IColoredTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaPipeEntity; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Utility; +import gregtech.common.GT_Client; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; + +import static gregtech.api.enums.Dyes.MACHINE_METAL; + +/** + * Created by Tec on 26.02.2017. + */ +public class GT_MetaTileEntity_EMpipe extends MetaPipeEntity implements iConnectsToEMpipe { +    private static Textures.BlockIcons.CustomIcon EMpipe; +    private static Textures.BlockIcons.CustomIcon EMcandy; +    public byte connectionCount=0; + +    public GT_MetaTileEntity_EMpipe(int aID, String aName, String aNameRegional) { +        super(aID, aName, aNameRegional, 0); +    } + +    public GT_MetaTileEntity_EMpipe(String aName) { +        super(aName, 0); +    } + +    @Override +    public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { +        return new GT_MetaTileEntity_EMpipe(mName); +    } + +    @Override +    public float getThickNess() { +        return 0.5F; +    } + +    @Override +    public void registerIcons(IIconRegister aBlockIconRegister) { +        EMpipe = new Textures.BlockIcons.CustomIcon("iconsets/EM_PIPE"); +        EMcandy = new Textures.BlockIcons.CustomIcon("iconsets/EM_CANDY"); +        super.registerIcons(aBlockIconRegister); +    } + +    @Override +    public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) { +        return new ITexture[]{new GT_RenderedTexture(EMpipe),new GT_RenderedTexture(EMcandy, Dyes.getModulation(aColorIndex, MACHINE_METAL.getRGBA()))}; +    } + +    @Override +    public boolean allowPutStack(IGregTechTileEntity iGregTechTileEntity, int i, byte b, ItemStack itemStack) { +        return false; +    } + +    @Override +    public boolean allowPullStack(IGregTechTileEntity iGregTechTileEntity, int i, byte b, ItemStack itemStack) { +        return false; +    } + +    @Override +    public void loadNBTData(NBTTagCompound nbtTagCompound) {} + +    @Override +    public void saveNBTData(NBTTagCompound nbtTagCompound) {} + +    @Override +    public boolean renderInside(byte b) { +        return false; +    } + +    @Override +    public byte getTileEntityBaseType() { +        return 4; +    } + +    @Override +    public String[] getDescription() { +        String tecMark; +		return new String[]{ +                commonValues.tecMark, +                "Quantum tunneling device.", +                EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Not a portal!!!", +                EnumChatFormatting.AQUA+"Must be painted to work", +                EnumChatFormatting.AQUA+"Do not cross,split or turn" +        }; +    } + +    @Override +    public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { +        return AxisAlignedBB.getBoundingBox(aX + 0.125D, aY + 0.125D, aZ + 0.125D, aX + 0.875D, aY + 0.875D, aZ + 0.875D); +    } + +    @Override +    public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { +        if (aBaseMetaTileEntity.isServerSide()) { +            if ((aTick & 31) == 0) { +                byte mOld=0; +                mConnections = 0; +                connectionCount=0; +                if(aBaseMetaTileEntity.getColorization()<0) return; +                for (byte i = 0, j; i < 6; i++) { +                    j = GT_Utility.getOppositeSide(i); +                    if (!aBaseMetaTileEntity.getCoverBehaviorAtSide(i).alwaysLookConnected(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), aBaseMetaTileEntity)) { +                        TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(i); +                        if (tTileEntity instanceof IColoredTileEntity) { +                            //if (aBaseMetaTileEntity.getColorization() >= 0) { +                                byte tColor = ((IColoredTileEntity) tTileEntity).getColorization(); +                                if (tColor != aBaseMetaTileEntity.getColorization()) continue; +                            //} +                        } +                        if (tTileEntity instanceof iConnectsToEMpipe && (((iConnectsToEMpipe) tTileEntity).canConnect(j))) { +                            mConnections |= (1 << i); +                            if(mOld!=mConnections){ +                                connectionCount++; +                                mOld=mConnections; +                            } +                            continue; +                        } +                        if (tTileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof iConnectsToEMpipe) { +                            if (((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).alwaysLookConnected(j, ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity) tTileEntity)) || +                                    ((iConnectsToEMpipe)((IGregTechTileEntity) tTileEntity).getMetaTileEntity()).canConnect(j)) { +                                mConnections |= (1 << i); +                                if(mOld!=mConnections){ +                                    connectionCount++; +                                    mOld=mConnections; +                                } +                            } +                        } +                    }else{ +                        mConnections |= (1 << i); +                        if(mOld!=mConnections){ +                            connectionCount++; +                            mOld=mConnections; +                        } +                    } + +                } +            } + +        } else if(aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected == 4) { +            aBaseMetaTileEntity.issueTextureUpdate(); +        } +    } + +    @Override +    public boolean canConnect(byte side) { +        return true; +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMquantifier.java b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMquantifier.java new file mode 100644 index 0000000000..cc78687406 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMquantifier.java @@ -0,0 +1,109 @@ +package com.github.technus.tectech.elementalMatter.machine; + +import com.github.technus.tectech.casing.GT_Container_CasingsTT; +import com.github.technus.tectech.blocks.QuantumGlass; +import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStack; +import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStack; +import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackTree; +import com.github.technus.tectech.elementalMatter.commonValues; +import com.github.technus.tectech.elementalMatter.definitions.dHadronDefinition; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; + +import java.util.HashMap; + +import static com.github.technus.tectech.elementalMatter.commonValues.DEBUGMODE; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EMquantifier extends GT_MetaTileEntity_MultiblockBase_Elemental  { +    public static HashMap<Item,cElementalDefinitionStack> itemBinds=new HashMap<>(200); +    public static HashMap<Fluid,cElementalDefinitionStack> fluidBind=new HashMap<>(200); + +    public GT_MetaTileEntity_EMquantifier(int aID, String aName, String aNameRegional) { +        super(aID, aName, aNameRegional); +    } + +    public GT_MetaTileEntity_EMquantifier(String aName) { +        super(aName); +    } + +    public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { +        return new GT_MetaTileEntity_EMquantifier(this.mName); +    } + +    @Override +    public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { +        int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; +        int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ; +        if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir)!= QuantumGlass.INSTANCE) { +            return false; +        } +        for (int i = -1; i < 2; i++) { +            for (int j = -1; j < 2; j++) { +                for (int h = -1; h < 2; h++) { +                    if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { +                        IGregTechTileEntity tTileEntity = iGregTechTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); +                        if (    (!addMaintenanceToMachineList(tTileEntity, 83)) && +                                (!addClassicInputToMachineList(tTileEntity, 83)) && +                                (!addElementalOutputToMachineList(tTileEntity, 83)) && +                                (!addMufflerToMachineList(tTileEntity, 83)) && +                                (!addEnergyIOToMachineList(tTileEntity, 83))) { +                            if (    iGregTechTileEntity.getBlockOffset(xDir + i, h, zDir + j) != GT_Container_CasingsTT.sBlockCasingsTT || +                                    iGregTechTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 3) { +                                return false; +                            } +                        } +                    } +                } +            } +        } +        return true; +    } + +    @Override +    public String[] getDescription() { +        return new String[]{ +                commonValues.tecMark, +                "Transform quantum form back to regular one...", +                EnumChatFormatting.AQUA.toString()+EnumChatFormatting.BOLD+"but why?" +        }; +    } + +    @Override +    public boolean EM_checkRecipe(ItemStack itemStack) { +        if(itemStack.getItem()==Items.iron_ingot){ +            mEUt=-1; +            mMaxProgresstime=20; + +            outputEM=new cElementalInstanceStackTree[1]; +            outputEM[0]=new cElementalInstanceStackTree(); +            outputEM[0].putReplace(new cElementalInstanceStack(dHadronDefinition.hadron_p,1000)); + +            return true; +        } +        return false; +    } + +    @Override +    public void EM_outputFunction() { +        try{ +            for(GT_MetaTileEntity_Hatch_OutputElemental hatch:eOutputHatches) +                hatch.getContainerHandler().putUnifyAll(outputEM[0]); +            //TODO FIX NPEs +        }catch (Exception e){ +            if(DEBUGMODE)e.printStackTrace(); +        } +    } + +    public static void recipeInit(){ +        itemBinds.put(Items.iron_ingot,new cElementalDefinitionStack(dHadronDefinition.hadron_p,1)); +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMscanner.java b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMscanner.java new file mode 100644 index 0000000000..550e1f832b --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMscanner.java @@ -0,0 +1,50 @@ +package com.github.technus.tectech.elementalMatter.machine; + +import com.github.technus.tectech.elementalMatter.commonValues; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EMscanner extends GT_MetaTileEntity_MultiblockBase_Elemental  { +    private static final String[][] shape=new String[][]{ +            {"",//left to right top +                    "", +                    "" },//front +            {},//behind front +            {} //behind +    }; +    private static final int[] casingRequirements=new int[]{}; +    private static final Block[] blockType=new Block[]{}; +    private static final byte[] blockMeta=new byte[]{}; + +    public GT_MetaTileEntity_EMscanner(int aID, String aName, String aNameRegional) { +        super(aID, aName, aNameRegional); +    } + +    public GT_MetaTileEntity_EMscanner(String aName) { +        super(aName); +    } + +    public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { +        return new GT_MetaTileEntity_EMscanner(this.mName); +    } + +    @Override +    public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { +        return false; +    } + +    @Override +    public String[] getDescription() { +        return new String[]{ +                commonValues.tecMark, +                "What is existing here?", +                EnumChatFormatting.AQUA.toString()+EnumChatFormatting.BOLD+"I HAVE NO IDEA (yet)!" +        }; +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMwormhole.java b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMwormhole.java new file mode 100644 index 0000000000..c170078876 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMwormhole.java @@ -0,0 +1,73 @@ +package com.github.technus.tectech.elementalMatter.machine; + +import com.github.technus.tectech.elementalMatter.commonValues; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GT_RenderedTexture; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EMwormhole extends GT_MetaTileEntity_MultiblockBase_Elemental  { +    private static Textures.BlockIcons.CustomIcon ScreenOFF; +    private static Textures.BlockIcons.CustomIcon ScreenON; + +    //use multi A energy inputs, use less power the longer it runs +    private static final String[][] shape=new String[][]{ +            {"",//left to right top +                    "", +                    "" },//front +            {},//behind front +            {} //behind +    }; +    private static final int[] casingRequirements=new int[]{}; +    private static final Block[] blockType=new Block[]{}; +    private static final byte[] blockMeta=new byte[]{}; + +    public GT_MetaTileEntity_EMwormhole(int aID, String aName, String aNameRegional) { +        super(aID, aName, aNameRegional); +    } + +    public GT_MetaTileEntity_EMwormhole(String aName) { +        super(aName); +    } + +    public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { +        return new GT_MetaTileEntity_EMwormhole(this.mName); +    } + +    @Override +    public void registerIcons(IIconRegister aBlockIconRegister) { +        ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_WH"); +        ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_WH_ACTIVE"); +        super.registerIcons(aBlockIconRegister); +    } + +    @Override +    public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { +        if (aSide == aFacing) { +            return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[83], new GT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; +        } +        return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[83]}; +    } + +    @Override +    public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { +        return false; +    } + +    @Override +    public String[] getDescription() { +        return new String[]{ +                commonValues.tecMark, +                "It is not full of worms.", +                EnumChatFormatting.AQUA.toString()+EnumChatFormatting.BOLD+"It is full of anti-worms!!!" +        }; +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_DynamoMulti.java b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_DynamoMulti.java new file mode 100644 index 0000000000..fa86cf5871 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_DynamoMulti.java @@ -0,0 +1,113 @@ +package com.github.technus.tectech.elementalMatter.machine; + +import com.github.technus.tectech.elementalMatter.commonValues; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + +import static gregtech.api.enums.GT_Values.V; + +/** + * Created by danie_000 on 16.12.2016. + */ +public class GT_MetaTileEntity_Hatch_DynamoMulti extends GT_MetaTileEntity_Hatch { +    public final int Amperes; + +    public GT_MetaTileEntity_Hatch_DynamoMulti(int aID, String aName, String aNameRegional, int aTier, int aAmp) { +        super(aID, aName, aNameRegional, aTier, 0, "Multiple Ampere Energy Extractor for Multiblocks"); +        Amperes =aAmp; +    } + +    public GT_MetaTileEntity_Hatch_DynamoMulti(String aName, int aTier, int aAmp, String aDescription, ITexture[][][] aTextures) { +        super(aName, aTier, 0, aDescription, aTextures); +        Amperes =aAmp; +    } + +    @Override +    public ITexture[] getTexturesActive(ITexture aBaseTexture) { +        return new ITexture[]{aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_OUT_POWER[mTier]}; +    } + +    @Override +    public ITexture[] getTexturesInactive(ITexture aBaseTexture) { +        return new ITexture[]{aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_OUT_POWER[mTier]}; +    } + +    @Override +    public boolean isSimpleMachine() { +        return true; +    } + +    @Override +    public boolean isFacingValid(byte aFacing) { +        return true; +    } + +    @Override +    public boolean isAccessAllowed(EntityPlayer aPlayer) { +        return true; +    } + +    @Override +    public boolean isEnetOutput() { +        return true; +    } + +    @Override +    public boolean isOutputFacing(byte aSide) { +        return aSide == getBaseMetaTileEntity().getFrontFacing(); +    } + +    @Override +    public boolean isValidSlot(int aIndex) { +        return false; +    } + +    @Override +    public long getMinimumStoredEU() { +        return 512 * Amperes; +    } + +    @Override +    public long maxEUOutput() { +        return V[mTier]; +    } + +    @Override +    public long maxEUStore() { +        return 512L + V[mTier] * 8L * Amperes; +    } + +    @Override +    public long maxAmperesOut() { +        return Amperes; +    } + +    @Override +    public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { +        return new GT_MetaTileEntity_Hatch_DynamoMulti(mName, mTier, Amperes, mDescription, mTextures); +    } + +    @Override +    public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { +        return false; +    } + +    @Override +    public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { +        return false; +    } + +    @Override +    public String[] getDescription() { +        return new String[]{ +                commonValues.tecMark, +                mDescription +                //"Amperes Out: "+ EnumChatFormatting.AQUA+Amperes+" A" +        }; +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_ElementalContainer.java new file mode 100644 index 0000000000..e8c7ed12fa --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -0,0 +1,231 @@ +package com.github.technus.tectech.elementalMatter.machine; + +import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackTree; +import com.github.technus.tectech.elementalMatter.classes.tElementalException; +import com.github.technus.tectech.elementalMatter.commonValues; +import com.github.technus.tectech.elementalMatter.interfaces.iConnectsToEMpipe; +import com.github.technus.tectech.elementalMatter.interfaces.iElementalInstanceContainer; +import gregtech.api.enums.Dyes; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.objects.GT_RenderedTexture; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.fluids.FluidStack; + +import static com.github.technus.tectech.elementalMatter.commonValues.*; +import static gregtech.api.enums.Dyes.MACHINE_METAL; +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity; + +/** + * Created by danie_000 on 11.12.2016. + */ +public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_MetaTileEntity_Hatch implements iElementalInstanceContainer,iConnectsToEMpipe { +    private static Textures.BlockIcons.CustomIcon EM_T_SIDES; +    private static Textures.BlockIcons.CustomIcon EM_T_ACTIVE; + +    protected cElementalInstanceStackTree content=new cElementalInstanceStackTree(); +    float lifeTimeMult=1f; +    int postEnergize=0; +    float overflowMatter=0f; +    public short id=-1; +    private byte deathDelay=2; + +    public GT_MetaTileEntity_Hatch_ElementalContainer(int aID, String aName, String aNameRegional, int aTier, String descr) { +        super(aID, aName, aNameRegional, aTier, 0, descr); +    } + +    public GT_MetaTileEntity_Hatch_ElementalContainer(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { +        super(aName, aTier, 0, aDescription, aTextures); +    } + +    @Override +    public void registerIcons(IIconRegister aBlockIconRegister) { +        super.registerIcons(aBlockIconRegister); +        EM_T_ACTIVE = new Textures.BlockIcons.CustomIcon("iconsets/OVERLAY_EM_T_ACTIVE"); +        EM_T_SIDES = new Textures.BlockIcons.CustomIcon("iconsets/OVERLAY_EM_T_SIDES"); +    } + +    @Override +    public ITexture[] getTexturesActive(ITexture aBaseTexture) { +        return new ITexture[]{aBaseTexture, new GT_RenderedTexture(EM_T_ACTIVE, Dyes.getModulation(getBaseMetaTileEntity().getColorization(), MACHINE_METAL.getRGBA())), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; +    } + +    @Override +    public ITexture[] getTexturesInactive(ITexture aBaseTexture) { +        return new ITexture[]{aBaseTexture, new GT_RenderedTexture(EM_T_SIDES, Dyes.getModulation(getBaseMetaTileEntity().getColorization(), MACHINE_METAL.getRGBA())), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; +    } + +    @Override +    public void saveNBTData(NBTTagCompound aNBT) { +        super.saveNBTData(aNBT); +        aNBT.setInteger("postEnergize",postEnergize); +        aNBT.setFloat("lifeTimeMult",lifeTimeMult); +        aNBT.setFloat("overflowMatter",overflowMatter); +        aNBT.setTag("eM_Stacks",content.toNBT()); +        aNBT.setShort("eID",id); +    } + +    @Override +    public void loadNBTData(NBTTagCompound aNBT) { +        super.loadNBTData(aNBT); +        postEnergize=aNBT.getInteger("postEnergize"); +        lifeTimeMult=aNBT.getFloat("lifeTimeMult"); +        overflowMatter=aNBT.getFloat("overflowMatter"); +        id=aNBT.getShort("eID"); +        try { +            content = cElementalInstanceStackTree.fromNBT(aNBT.getCompoundTag("eM_Stacks")); +        }catch (tElementalException e){ +            if(DEBUGMODE)e.printStackTrace(); +            if(content==null) content=new cElementalInstanceStackTree(); +        } +    } + +    @Override +    public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { +        if(aBaseMetaTileEntity.isServerSide()){ +            byte Tick= (byte)(aTick%20); +            if (decayAt == Tick) { +                purgeOverflow(); +                content.tickContent(lifeTimeMult, postEnergize); +                purgeOverflow(); +            } else if (overflowAt == Tick) { +                if(overflowMatter<=0) { +                    deathDelay=2; +                }else { +                    IGregTechTileEntity tGTTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()); +                    if (tGTTileEntity == null || !(tGTTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_MufflerElemental)) +                        tGTTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityAtSide((byte) 0); +                    if (tGTTileEntity == null || !(tGTTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_MufflerElemental)) +                        tGTTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityAtSide((byte) 1); +                    if (tGTTileEntity != null && (tGTTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_MufflerElemental)) { +                        GT_MetaTileEntity_Hatch_MufflerElemental aMetaTileEntity = (GT_MetaTileEntity_Hatch_MufflerElemental) tGTTileEntity.getMetaTileEntity(); +                        aMetaTileEntity.overflowMatter += overflowMatter; +                        if (aMetaTileEntity.overflowMatter > aMetaTileEntity.overflowMax) { +                            tGTTileEntity.doExplosion(V[15]); +                        } else overflowMatter = 0; +                    } else { +                        if(deathDelay==1) aBaseMetaTileEntity.setOnFire(); +                        else if(deathDelay<1) getBaseMetaTileEntity().doExplosion(V[15]); +                        deathDelay--; +                    } +                } +            } else if (moveAt==Tick){ +                moveAround(aBaseMetaTileEntity); +                getBaseMetaTileEntity().setActive(content.hasStacks()); +            } +        } +    } + +    public void moveAround(IGregTechTileEntity aBaseMetaTileEntity){} + +    @Override +    public cElementalInstanceStackTree getContainerHandler() { +        return content; +    } + +    @Override +    public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { +        return true; +    } + +    @Override +    public boolean isFacingValid(byte aFacing) { +        return true; +    } + +    @Override +    public boolean isAccessAllowed(EntityPlayer aPlayer) { +        return true; +    } + +    @Override +    public boolean isLiquidInput(byte aSide) { +        return false; +    } + +    @Override +    public boolean isFluidInputAllowed(FluidStack aFluid) { +        return false; +    } + +    @Override +    public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { +        return false; +    } + +    @Override +    public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { +        return false; +    } + +    @Override +    public boolean isValidSlot(int aIndex) { +        return false; +    } + +    public int getMaxStacksCount() { +        return mTier*2; +    } + +    public int getMaxStackSize() { +        return mTier*(mTier-7)*1000; +    } + +    @Override +    public float purgeOverflow(){ +        return overflowMatter+=content.removeOverflow(getMaxStacksCount(),getMaxStackSize()); +    } + +    @Override +    public boolean isGivingInformation() { +        return true; +    } + +    @Override +    public String[] getInfoData() { +        if (id>=0){ +            if(content==null || content.size()==0) return new String[]{"ID: "+EnumChatFormatting.AQUA+id,"No Stacks"}; +            else { +                final String[] lines=content.getElementalInfo(); +                final String[] output=new String[lines.length+1]; +                output[0]="ID: "+EnumChatFormatting.AQUA+id; +                System.arraycopy(lines, 0, output, 1, lines.length); +                return output; +            } +        } +        if(content==null || content.size()==0) return new String[]{"No Stacks"}; +        return content.getElementalInfo(); +    } + +    public float updateSlots(){ +        return purgeOverflow(); +    } + +    @Override +    public String[] getDescription() { +        return new String[]{ +                commonValues.tecMark, +                mDescription, +                "Max stacks amount: "+EnumChatFormatting.AQUA+ getMaxStacksCount(), +                "Stack capacity: "+EnumChatFormatting.AQUA+ getMaxStackSize(), +                "Place Overflow Hatch behind,on top or below", +                "to provide overflow protection while this block", +                "is not attached to multi block.", +                "Transport range can be extended in straight", +                "line up to 15 blocks with quantum tunnels.", +                EnumChatFormatting.AQUA+"Must be painted to work" +        }; +    } + +    @Override +    public void onRemoval() { +        if(isValidMetaTileEntity(this) && getBaseMetaTileEntity().isActive()) getBaseMetaTileEntity().doExplosion(V[15]); +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_EnergyMulti.java b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_EnergyMulti.java new file mode 100644 index 0000000000..9f6cdbf020 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_EnergyMulti.java @@ -0,0 +1,114 @@ +package com.github.technus.tectech.elementalMatter.machine; + +import com.github.technus.tectech.elementalMatter.commonValues; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +import static gregtech.api.enums.GT_Values.V; + +/** + * Created by danie_000 on 16.12.2016. + */ +public class GT_MetaTileEntity_Hatch_EnergyMulti extends GT_MetaTileEntity_Hatch { +    public final int Amperes; + +    public GT_MetaTileEntity_Hatch_EnergyMulti(int aID, String aName, String aNameRegional, int aTier, int aAmp) { +        super(aID, aName, aNameRegional, aTier, 0, "Multiple Ampere Energy Injector for Multiblocks"); +        Amperes =aAmp; +    } + +    public GT_MetaTileEntity_Hatch_EnergyMulti(String aName, int aTier, int aAmp,String aDescription, ITexture[][][] aTextures) { +        super(aName, aTier, 0, aDescription, aTextures); +        Amperes =aAmp; +    } + +    @Override +    public ITexture[] getTexturesActive(ITexture aBaseTexture) { +        return new ITexture[]{aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_POWER[mTier]}; +    } + +    @Override +    public ITexture[] getTexturesInactive(ITexture aBaseTexture) { +        return new ITexture[]{aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_POWER[mTier]}; +    } + +    @Override +    public boolean isSimpleMachine() { +        return true; +    } + +    @Override +    public boolean isFacingValid(byte aFacing) { +        return true; +    } + +    @Override +    public boolean isAccessAllowed(EntityPlayer aPlayer) { +        return true; +    } + +    @Override +    public boolean isEnetInput() { +        return true; +    } + +    @Override +    public boolean isInputFacing(byte aSide) { +        return aSide == getBaseMetaTileEntity().getFrontFacing(); +    } + +    @Override +    public boolean isValidSlot(int aIndex) { +        return false; +    } + +    @Override +    public long getMinimumStoredEU() { +        return 512L * Amperes; +    } + +    @Override +    public long maxEUInput() { +        return V[mTier]; +    } + +    @Override +    public long maxEUStore() { +        return 512L + V[mTier] * 8L * Amperes; +    } + +    @Override +    public long maxAmperesIn() { +        return Amperes+(Amperes>>2); +    } + +    @Override +    public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { +        return new GT_MetaTileEntity_Hatch_EnergyMulti(mName, mTier, Amperes, mDescription, mTextures); +    } + +    @Override +    public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { +        return false; +    } + +    @Override +    public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { +        return false; +    } + +    @Override +    public String[] getDescription() { +        return new String[]{ +                commonValues.tecMark, +                mDescription, +                "Amperes In: "+ EnumChatFormatting.AQUA+maxAmperesIn()+" A" +        }; +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_InputElemental.java b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_InputElemental.java new file mode 100644 index 0000000000..8071f114e9 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_InputElemental.java @@ -0,0 +1,43 @@ +package com.github.technus.tectech.elementalMatter.machine; + +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; + +/** + * Created by danie_000 on 27.10.2016. + */ +public class GT_MetaTileEntity_Hatch_InputElemental extends GT_MetaTileEntity_Hatch_ElementalContainer { +    public GT_MetaTileEntity_Hatch_InputElemental(int aID, String aName, String aNameRegional, int aTier) { +        super(aID, aName, aNameRegional, aTier, "Elemental Input for Multiblocks (" + 1000 * aTier*(aTier-7) + "U, " + aTier * 2 + " stacks)"); +    } + +    public GT_MetaTileEntity_Hatch_InputElemental(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { +        super(aName, aTier, aDescription, aTextures); +    } + +    @Override +    public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { +        return new GT_MetaTileEntity_Hatch_InputElemental(mName, mTier, mDescription, mTextures); +    } + +    @Override +    public boolean isInputFacing(byte aSide) { +        return aSide==getBaseMetaTileEntity().getFrontFacing(); +    } + +    @Override +    public boolean isOutputFacing(byte aSide) { +        return false; +    } + +    @Override +    public boolean isSimpleMachine() { +        return true; +    } + +    @Override +    public boolean canConnect(byte side) { +        return isInputFacing(side); +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_MufflerElemental.java b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_MufflerElemental.java new file mode 100644 index 0000000000..430a19f4f9 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_MufflerElemental.java @@ -0,0 +1,192 @@ +package com.github.technus.tectech.elementalMatter.machine; + +import com.github.technus.tectech.elementalMatter.commonValues; +import gregtech.api.enums.Dyes; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.objects.XSTR; +import net.minecraft.client.Minecraft; +import net.minecraft.client.particle.EntityExplodeFX; +import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.EnumSkyBlock; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +import static com.github.technus.tectech.elementalMatter.commonValues.disperseAt; +import static gregtech.api.enums.Dyes.MACHINE_METAL; +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity; + +/** + * Created by danie_000 on 12.12.2016. + */ +public class GT_MetaTileEntity_Hatch_MufflerElemental extends GT_MetaTileEntity_Hatch { +    private static Textures.BlockIcons.CustomIcon EM_T_SIDES; +    private static Textures.BlockIcons.CustomIcon EM_T_ACTIVE; +    private static Textures.BlockIcons.CustomIcon MufflerEM; +    public float overflowMatter=0f; +    public final float overflowMax; +    public final float overflowDisperse; + +    public GT_MetaTileEntity_Hatch_MufflerElemental(int aID, String aName, String aNameRegional, int aTier,float max) { +        super(aID, aName, aNameRegional, aTier, 0, "Disposes excess elemental Matter"); +        overflowMatter=max/2; +        overflowMax=max; +        overflowDisperse =overflowMax/(float)(30-aTier); +    } + +    public GT_MetaTileEntity_Hatch_MufflerElemental(String aName, int aTier,float max, String aDescription, ITexture[][][] aTextures) { +        super(aName, aTier, 0, aDescription, aTextures); +        overflowMatter=max/2; +        overflowMax=max; +        overflowDisperse =overflowMax/(float)(30-aTier); +    } + +    @Override +    public void registerIcons(IIconRegister aBlockIconRegister) { +        super.registerIcons(aBlockIconRegister); +        EM_T_ACTIVE = new Textures.BlockIcons.CustomIcon("iconsets/OVERLAY_EM_T_ACTIVE"); +        EM_T_SIDES = new Textures.BlockIcons.CustomIcon("iconsets/OVERLAY_EM_T_SIDES"); +        MufflerEM = new Textures.BlockIcons.CustomIcon("iconsets/MUFFLER_EM"); +    } + +    @Override +    public ITexture[] getTexturesActive(ITexture aBaseTexture) { +        return new ITexture[]{aBaseTexture, new GT_RenderedTexture(EM_T_ACTIVE, Dyes.getModulation(getBaseMetaTileEntity().getColorization(), MACHINE_METAL.getRGBA())), new GT_RenderedTexture(MufflerEM)}; +    } + +    @Override +    public ITexture[] getTexturesInactive(ITexture aBaseTexture) { +        return new ITexture[]{aBaseTexture, new GT_RenderedTexture(EM_T_SIDES, Dyes.getModulation(getBaseMetaTileEntity().getColorization(), MACHINE_METAL.getRGBA())), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_MUFFLER)}; +    } + +    @Override +    public String[] getDescription() { +        return new String[]{ +                commonValues.tecMark, +                mDescription, +                "Mass capacity: "+EnumChatFormatting.AQUA+String.format(java.util.Locale.ENGLISH,"%+.2E",overflowMax)+" eV/c^2", +                "Disposal Speed: "+EnumChatFormatting.AQUA+String.format(java.util.Locale.ENGLISH,"%+.2E",overflowDisperse)+" (eV/c^2)/s", +                "DO NOT OBSTRUCT THE OUTPUT!" +            }; +    } + +    @Override +    public boolean isSimpleMachine() { +        return true; +    } + +    @Override +    public boolean isFacingValid(byte aFacing) { +        return true; +    } + +    @Override +    public boolean isAccessAllowed(EntityPlayer aPlayer) { +        return true; +    } + +    @Override +    public boolean isValidSlot(int aIndex) { +        return false; +    } + +    @Override +    public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { +        return new GT_MetaTileEntity_Hatch_MufflerElemental(mName, mTier,overflowMax, mDescription, mTextures); +    } + +    @Override +    public void saveNBTData(NBTTagCompound aNBT) { +        super.saveNBTData(aNBT); +        aNBT.setFloat("overflowMatter",overflowMatter); +    } + +    @Override +    public void loadNBTData(NBTTagCompound aNBT) { +        super.loadNBTData(aNBT); +        overflowMatter=aNBT.getFloat("overflowMatter"); +    } + +    @Override +    public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { +        return false; +    } + +    @Override +    public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { +        return false; +    } + +    @Override +    public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { +        if(aBaseMetaTileEntity.isServerSide() && (aTick%20)==disperseAt){ +            if(aBaseMetaTileEntity.isActive()){ +                overflowMatter-= overflowDisperse; +                if(overflowMatter<0){ +                    overflowMatter=0; +                    aBaseMetaTileEntity.setActive(false); +                    aBaseMetaTileEntity.setLightValue((byte)0); +                    aBaseMetaTileEntity.getWorld().updateLightByType(EnumSkyBlock.Block,aBaseMetaTileEntity.getXCoord(),aBaseMetaTileEntity.getYCoord(),aBaseMetaTileEntity.getZCoord()); +                } +            }else{ +                if(overflowMatter>0) { +                    aBaseMetaTileEntity.setActive(true); +                    aBaseMetaTileEntity.setLightValue((byte)15); +                    aBaseMetaTileEntity.getWorld().updateLightByType(EnumSkyBlock.Block,aBaseMetaTileEntity.getXCoord(),aBaseMetaTileEntity.getYCoord(),aBaseMetaTileEntity.getZCoord()); +                } +            } +        }else if(aBaseMetaTileEntity.isClientSide() && this.getBaseMetaTileEntity().isActive()){ +            particles(this.getBaseMetaTileEntity().getWorld()); +        } +        super.onPostTick(aBaseMetaTileEntity, aTick); +        //DOES NOT CHECK FOR TOO MUCH, it is done only while putting stuff in (OPTIMIZATION!!!) +    } + +    private static XSTR floatGen=new XSTR(); + +    public void particles(World aWorld){//CUTE! +        IGregTechTileEntity aMuffler=this.getBaseMetaTileEntity(); +        ForgeDirection aDir=ForgeDirection.getOrientation(aMuffler.getFrontFacing()); +        float xPos=aDir.offsetX*0.76F+aMuffler.getXCoord()+0.25F; +        float yPos=aDir.offsetY*0.76F+aMuffler.getYCoord()+0.25F; +        float zPos=aDir.offsetZ*0.76F+aMuffler.getZCoord()+0.25F; + +        float ySpd=0; +                //aDir.offsetY*0.1F+0.2F+0.1F*floatGen.nextFloat(); +        float xSpd=0; +        float zSpd=0; +        EntityFX particle=new EntityExplodeFX(aWorld, xPos + floatGen.nextFloat()*0.5F, yPos + floatGen.nextFloat()*0.5F, zPos + floatGen.nextFloat()*0.5F, xSpd, ySpd, zSpd); +        particle.setRBGColorF(0,0.6F*floatGen.nextFloat(),0.8f); +        Minecraft.getMinecraft().effectRenderer.addEffect(particle); +    } + +    @Override +    public boolean isGivingInformation() { +        return true; +    } + +    @Override +    public String[] getInfoData() { +        return new String[]{ +                "Contained mass:", +                EnumChatFormatting.RED+Double.toString(overflowMatter)+EnumChatFormatting.RESET+" eV/c^2 /", +                EnumChatFormatting.GREEN+Double.toString(overflowMax)+EnumChatFormatting.RESET+" eV/c^2", +                "Mass Disposal speed: "+EnumChatFormatting.BLUE+Double.toString(overflowDisperse)+EnumChatFormatting.RESET+" (eV/c^2)/s" +        }; +    } + +    @Override +    public void onRemoval() { +        if(isValidMetaTileEntity(this) && getBaseMetaTileEntity().isActive()) getBaseMetaTileEntity().doExplosion(V[15]); +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_OutputElemental.java b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_OutputElemental.java new file mode 100644 index 0000000000..b925022b73 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_OutputElemental.java @@ -0,0 +1,70 @@ +package com.github.technus.tectech.elementalMatter.machine; + +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.util.GT_Utility; + +/** + * Created by danie_000 on 27.10.2016. + */ +public class GT_MetaTileEntity_Hatch_OutputElemental extends GT_MetaTileEntity_Hatch_ElementalContainer{ +    public GT_MetaTileEntity_Hatch_OutputElemental(int aID, String aName, String aNameRegional, int aTier) { +        super(aID, aName, aNameRegional, aTier, "Elemental Output for Multiblocks (" + 1000 * aTier*(aTier-7) + "U, " + aTier * 2 + " stacks)"); +    } + +    public GT_MetaTileEntity_Hatch_OutputElemental(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { +        super(aName, aTier, aDescription, aTextures); +    } + +    @Override +    public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { +        return new GT_MetaTileEntity_Hatch_OutputElemental(mName, mTier, mDescription, mTextures); +    } + +    @Override +    public boolean isOutputFacing(byte aSide) { +        return aSide==getBaseMetaTileEntity().getFrontFacing(); +    } + +    @Override +    public boolean isInputFacing(byte aSide) { +        return false; +    } + +    @Override +    public boolean isSimpleMachine() { +        return true; +    } + +    @Override +    public void moveAround(IGregTechTileEntity aBaseMetaTileEntity) { +        byte color=getBaseMetaTileEntity().getColorization(); +        if(color<0)return; +        byte front = aBaseMetaTileEntity.getFrontFacing(); +        byte opposite = GT_Utility.getOppositeSide(getBaseMetaTileEntity().getFrontFacing()); +        for (byte dist = 1; dist < 16; dist++) { +            IGregTechTileEntity tGTTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityAtSideAndDistance(front, dist); +            if (tGTTileEntity != null && tGTTileEntity.getColorization()==color) { +                IMetaTileEntity aMetaTileEntity = tGTTileEntity.getMetaTileEntity(); +                if (aMetaTileEntity != null){ +                    if(aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputElemental && +                        opposite == aMetaTileEntity.getBaseMetaTileEntity().getFrontFacing()) { +                        ((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity).getContainerHandler().putUnifyAll(content); +                        ((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity).updateSlots(); +                        content.clear(); +                        return; +                    }else if(aMetaTileEntity instanceof GT_MetaTileEntity_EMpipe){ +                        if (((GT_MetaTileEntity_EMpipe) aMetaTileEntity).connectionCount>2) return; +                    }else return; +                }else return; +            }else return; +        } +    } + +    @Override +    public boolean canConnect(byte side) { +        return isOutputFacing(side); +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_Param.java b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_Param.java new file mode 100644 index 0000000000..daca46c37b --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_Param.java @@ -0,0 +1,182 @@ +package com.github.technus.tectech.elementalMatter.machine; + +import com.github.technus.tectech.elementalMatter.commonValues; +import com.github.technus.tectech.elementalMatter.gui.GT_Container_Param; +import com.github.technus.tectech.elementalMatter.gui.GT_GUIContainer_Param; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.objects.GT_RenderedTexture; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.fluids.FluidStack; + +/** + * Created by danie_000 on 15.12.2016. + */ +public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { +    public int exponent = 0; +    public int value2 = 0; +    public int value1 = 0; +    public int param = -1; +    public float value1f=0; +    public float value2f=0; +    public float input1f=0; +    public float input2f=0; +    private static Textures.BlockIcons.CustomIcon ScreenON; +    private static Textures.BlockIcons.CustomIcon ScreenOFF; + +    public GT_MetaTileEntity_Hatch_Param(int aID, String aName, String aNameRegional, int aTier) { +        super(aID, aName, aNameRegional, aTier, 0, "For parametrization of Multiblocks"); +    } + +    public GT_MetaTileEntity_Hatch_Param(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { +        super(aName, aTier, 0, aDescription, aTextures); +    } + +    @Override +    public void registerIcons(IIconRegister aBlockIconRegister) { +        super.registerIcons(aBlockIconRegister); +        ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/PARAM"); +        ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/PARAM_ACTIVE"); +    } + +    @Override +    public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { +        return new GT_Container_Param(aPlayerInventory, aBaseMetaTileEntity); +    } + +    @Override +    public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { +        return new GT_GUIContainer_Param(aPlayerInventory, aBaseMetaTileEntity); +    } + +    @Override +    public ITexture[] getTexturesActive(ITexture aBaseTexture) { +        return new ITexture[]{aBaseTexture, new GT_RenderedTexture(ScreenON)}; +    } + +    @Override +    public ITexture[] getTexturesInactive(ITexture aBaseTexture) { +        return new ITexture[]{aBaseTexture, new GT_RenderedTexture(ScreenOFF)}; +    } + +    //@Override +    //public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { +    //    if (aBaseMetaTileEntity.isClientSide() && (aTick % 20L == 0L)) { +    //        //refresh casing on state change +    //        int Xpos = aBaseMetaTileEntity.getXCoord(); +    //        int Ypos = aBaseMetaTileEntity.getYCoord(); +    //        int Zpos = aBaseMetaTileEntity.getZCoord(); +    //        try { +    //            aBaseMetaTileEntity.getWorld().markBlockRangeForRenderUpdate(Xpos , Ypos, Zpos , Xpos , Ypos, Zpos ); +    //        } catch (Exception e) {} +    //    } +    //    super.onPostTick(aBaseMetaTileEntity, aTick); +    //} + +    @Override +    public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { +        return new GT_MetaTileEntity_Hatch_Param(mName, mTier, mDescription, mTextures); +    } + +    @Override +    public boolean isGivingInformation() { +        return true; +    } + +    @Override +    public String[] getInfoData() { +        return new String[]{ +                "Parameter ID: " + EnumChatFormatting.GREEN + param, +                "Value 1: " + EnumChatFormatting.AQUA + value1f, +                "Value 2: " + EnumChatFormatting.BLUE + value2f, +                "Input 1: " + EnumChatFormatting.GOLD + input1f, +                "Input 2: " + EnumChatFormatting.YELLOW + input2f +        }; +    } + +    @Override +    public boolean isSimpleMachine() { +        return  true; +    } + +    @Override +    public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { +        return false; +    } + +    @Override +    public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { +        return false; +    } + +    public void saveNBTData(NBTTagCompound aNBT) { +        super.saveNBTData(aNBT); +        aNBT.setInteger("mEXP", exponent); +        aNBT.setInteger("mV2", value2); +        aNBT.setInteger("mV1", value1); +        aNBT.setInteger("mParam", param); +        //aNBT.setFloat("mI1",input1f);//no need to store this. +        //aNBT.setFloat("mI2",input2f); +    } + +    public void loadNBTData(NBTTagCompound aNBT) { +        super.loadNBTData(aNBT); +        exponent = aNBT.getInteger("mEXP"); +        value2 = aNBT.getInteger("mV2"); +        value1 = aNBT.getInteger("mV1"); +        param = aNBT.getInteger("mParam"); +        value1f=(float)(value1 * Math.pow(2, exponent)); +        value2f=(float)(value2 * Math.pow(2, exponent)); +        //input1f=aNBT.getFloat("mI1"); +        //input2f=aNBT.getFloat("mI2"); +    } + +    @Override +    public boolean isFacingValid(byte aFacing) { +        return true; +    } + +    @Override +    public boolean isAccessAllowed(EntityPlayer aPlayer) { +        return true; +    } + +    @Override +    public boolean isValidSlot(int aIndex) { +        return false; +    } + +    @Override +    public boolean isLiquidInput(byte aSide) { +        return false; +    } + +    @Override +    public boolean isFluidInputAllowed(FluidStack aFluid) { +        return false; +    } + +    @Override +    public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { +        if (aBaseMetaTileEntity.isClientSide()) return true; +        aBaseMetaTileEntity.openGUI(aPlayer); +        return true; +    } + +    @Override +    public String[] getDescription() { +        return new String[]{ +                commonValues.tecMark, +                mDescription, +                EnumChatFormatting.AQUA.toString()+EnumChatFormatting.BOLD+"E=M*C^2" +        }; +    } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_Uncertainty.java b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_Uncertainty.java new file mode 100644 index 0000000000..341c9701e8 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_Uncertainty.java @@ -0,0 +1,289 @@ +package com.github.technus.tectech.elementalMatter.machine; + +import com.github.technus.tectech.elementalMatter.commonValues; +import com.github.technus.tectech.elementalMatter.gui.GT_Container_Uncertainty; +import com.github.technus.tectech.elementalMatter.gui.GT_GUIContainer_Uncertainty; +import com.github.technus.tectech.elementalMatter.gui.GT_GUIContainer_UncertaintyAdv; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.objects.XSTR; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.fluids.FluidStack; + +/** + * Created by danie_000 on 15.12.2016. + */ +public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch { +    private static Textures.BlockIcons.CustomIcon ScreenON; +    private static Textures.BlockIcons.CustomIcon ScreenOFF; +    private static float errorMargin=0.05f; +    public short[] matrix=new short[]{500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500}; +    public byte selection=-1,mode=0,status=-128; +    private static final XSTR ran=new XSTR(); + +    public GT_MetaTileEntity_Hatch_Uncertainty(int aID, String aName, String aNameRegional, int aTier) { +        super(aID, aName, aNameRegional, aTier, 0, "Feeling certain, or not?"); +        regenerate(); +    } + +    public GT_MetaTileEntity_Hatch_Uncertainty(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { +        super(aName, aTier, 0, aDescription, aTextures); +        regenerate(); +    } + +    @Override +    public void registerIcons(IIconRegister aBlockIconRegister) { +        super.registerIcons(aBlockIconRegister); +        ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/UC"); +        ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/UC_ACTIVE"); +    } + +    @Override +    public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { +        return new GT_Container_Uncertainty(aPlayerInventory, aBaseMetaTileEntity); +    } + +    @Override +    public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { +        if(mTier>6) return new GT_GUIContainer_UncertaintyAdv(aPlayerInventory,aBaseMetaTileEntity); +        return new GT_GUIContainer_Uncertainty(aPlayerInventory, aBaseMetaTileEntity); +    } + +    @Override +    public ITexture[] getTexturesActive(ITexture aBaseTexture) { +        return new ITexture[]{aBaseTexture, new GT_RenderedTexture(ScreenON)}; +    } + +    @Override +    public ITexture[] getTexturesInactive(ITexture aBaseTexture) { +        return new ITexture[]{aBaseTexture, new GT_RenderedTexture(ScreenOFF)}; +    } + +    @Override +    public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { +        if(aBaseMetaTileEntity.isServerSide() && (aTick&15)==0) { +            shift(); +            compute(); +            if(mode==0)aBaseMetaTileEntity.setActive(false); +            else aBaseMetaTileEntity.setActive(true); +        } +    } + +    @Override +    public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { +        return new GT_MetaTileEntity_Hatch_Uncertainty(mName, mTier, mDescription, mTextures); +    } + +    @Override +    public boolean isGivingInformation() { +        return true; +    } + +    @Override +    public String[] getInfoData() { +        return new String[]{ +            "Status: "+EnumChatFormatting.GOLD+status +        }; +    } + +    @Override +    public boolean isSimpleMachine() { +        return  true; +    } + +    @Override +    public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { +        return false; +    } + +    @Override +    public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { +        return false; +    } + +    public void saveNBTData(NBTTagCompound aNBT) { +        super.saveNBTData(aNBT); +        aNBT.setByte("mSel",selection); +        aNBT.setByte("mMode",mode); +        aNBT.setByte("mStatus",status); +        NBTTagCompound mat=new NBTTagCompound(); +        for(int i=0;i<16;i++) +            mat.setShort(Integer.toString(i),matrix[i]); +        aNBT.setTag("mMat",mat); +    } + +    public void loadNBTData(NBTTagCompound aNBT) { +        super.loadNBTData(aNBT); +        selection=aNBT.getByte("mSel"); +        mode=aNBT.getByte("mMode"); +        status=aNBT.getByte("mStatus"); +        NBTTagCompound mat=aNBT.getCompoundTag("mMat"); +        for(int i=0;i<16;i++) +            matrix[i]=mat.getShort(Integer.toString(i)); +    } + +    @Override +    public boolean isFacingValid(byte aFacing) { +        return true; +    } + +    @Override +    public boolean isAccessAllowed(EntityPlayer aPlayer) { +        return true; +    } + +    @Override +    public boolean isValidSlot(int aIndex) { +        return false; +    } + +    @Override +    public boolean isLiquidInput(byte aSide) { +        return false; +    } + +    @Override +    public boolean isFluidInputAllowed(FluidStack aFluid) { +        return false; +    } + +    @Override +    public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { +        if (aBaseMetaTileEntity.isClientSide()) return true; +        aBaseMetaTileEntity.openGUI(aPlayer); +        return true; +    } + +    @Override +    public String[] getDescription() { +        return new String[]{ +                commonValues.tecMark, +                mDescription, +                EnumChatFormatting.AQUA.toString()+EnumChatFormatting.BOLD+"Schrödinger equation in a box" +        }; +    } + +    private float massOffset(int sideLenY, int sideLenX, short... masses){ +        int mass=0; +        int massI=0,massJ=0; +        for (int i = 0; i < sideLenY; i++) { +            for (int j = 0; j < sideLenY*sideLenX; j+=sideLenY) { +                mass+=masses[i+j]; +                massI+=((float)i-((float)sideLenY/2f)+.5f)*masses[i+j]; +                massJ+=((float)(j/sideLenY)-((float)sideLenX/2f)+.5f)*masses[i+j]; +            } +        } +        return ((Math.abs(massI/(float)mass)/(float) sideLenY)+(Math.abs(massJ/(float)mass))/(float) sideLenX); +    } + +    public void regenerate(){ +        for(int i=0;i<matrix.length;i++) +            matrix[i]=(short)ran.nextInt(1000); +    } + +    public byte compute(){ +        int result=0; +        switch(mode){ +            case 1://ooo oxo ooo +                result=(massOffset(4,4,matrix)<errorMargin)?0:1; +                break; +            case 2://ooo xox ooo +                result+=(massOffset(4,2, +                        matrix[0],matrix[4], +                        matrix[1],matrix[5], +                        matrix[2],matrix[6], +                        matrix[3],matrix[7])<errorMargin)?0:1; +                result+=(massOffset(4,2, +                        matrix[8 ],matrix[12], +                        matrix[9 ],matrix[13], +                        matrix[10],matrix[14], +                        matrix[11],matrix[15])<errorMargin)?0:2; +                break; +            case 3://oxo xox oxo +                result+=(massOffset(2,4, +                        matrix[0],matrix[4], matrix[8],matrix[12], +                        matrix[1],matrix[5], matrix[9],matrix[13])<errorMargin)?0:1; +                result+=(massOffset(4,2, +                        matrix[0],matrix[4], +                        matrix[1],matrix[5], +                        matrix[2],matrix[6], +                        matrix[3],matrix[7])<errorMargin)?0:2; +                result+=(massOffset(4,2, +                        matrix[8 ],matrix[12], +                        matrix[9 ],matrix[13], +                        matrix[10],matrix[14], +                        matrix[11],matrix[15])<errorMargin)?0:4; +                result+=(massOffset(2,4, +                        matrix[2],matrix[6], matrix[10],matrix[14], +                        matrix[3],matrix[7], matrix[11],matrix[15])<errorMargin)?0:8; +                break; +            case 4://xox ooo xox +                result+=(massOffset(2,2, +                        matrix[0],matrix[4], +                        matrix[1],matrix[5])<errorMargin)?0:1; +                result+=(massOffset(2,2, +                        matrix[8],matrix[12], +                        matrix[9],matrix[13])<errorMargin)?0:2; +                result+=(massOffset(2,2, +                        matrix[2],matrix[6], +                        matrix[3],matrix[7])<errorMargin)?0:4; +                result+=(massOffset(2,2, +                        matrix[10],matrix[14], +                        matrix[11],matrix[15])<errorMargin)?0:8; +                break; +            case 5://xox oxo xox +                result+=(massOffset(2,2, +                        matrix[0],matrix[4], +                        matrix[1],matrix[5])<errorMargin)?0:1; +                result+=(massOffset(2,2, +                        matrix[8],matrix[12], +                        matrix[9],matrix[13])<errorMargin)?0:2; +                result+=(massOffset(4,4,matrix)<errorMargin)?0:4; +                result+=(massOffset(2,2, +                        matrix[2],matrix[6], +                        matrix[3],matrix[7])<errorMargin)?0:8; +                result+=(massOffset(2,2, +                        matrix[10],matrix[14], +                        matrix[11],matrix[15])<errorMargin)?0:16; +                break; +        } +        return status=(byte)result; +    } + +    private void shift(){ +        final int i=ran.nextInt(16),j=ran.nextInt(2); +        matrix[i]+=(((matrix[i]&1)==0)?2:-2)*j; +        switch(matrix[i]){ +            case 1002: matrix[i]-=3; break; +            case 1001: matrix[i]-=1; break; +            case -1:   matrix[i]+=1; break; +            case -2:   matrix[i]+=3; break; +        } +    } + +    public byte update(int newMode){ +        if(newMode==mode)return mode; +        if(newMode<0 || newMode>5) newMode=0; +        mode=(byte)newMode; +        regenerate(); +        compute(); +        return status; +    } + +    //@Override +    //public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { +    //    if(aSide == this.getBaseMetaTileEntity().getFrontFacing()) { +    //        changeMode(++mode); +    //        GT_Utility.sendChatToPlayer(aPlayer, "Equation mode: "+mode); +    //    } +    //} +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_MultiblockBase_Elemental.java b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_MultiblockBase_Elemental.java new file mode 100644 index 0000000000..bd9f139547 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_MultiblockBase_Elemental.java @@ -0,0 +1,1041 @@ +package com.github.technus.tectech.elementalMatter.machine; + +import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStack; +import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStack; +import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackTree; +import com.github.technus.tectech.elementalMatter.classes.tElementalException; +import com.github.technus.tectech.elementalMatter.commonValues; +import com.github.technus.tectech.elementalMatter.gui.GT_Container_MultiMachineEM; +import com.github.technus.tectech.elementalMatter.gui.GT_GUIContainer_MultiMachineEM; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.*; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gregtech.common.GT_Pollution; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.ChunkPosition; +import net.minecraftforge.fluids.FluidStack; + +import java.util.ArrayList; + +import static com.github.technus.tectech.elementalMatter.commonValues.*; +import static gregtech.api.enums.GT_Values.V; + +/** + * Created by danie_000 on 27.10.2016. + */ +public abstract class GT_MetaTileEntity_MultiblockBase_Elemental extends GT_MetaTileEntity_MultiBlockBase { +    protected cElementalInstanceStackTree[] outputEM=new cElementalInstanceStackTree[0]; +    private static Textures.BlockIcons.CustomIcon ScreenOFF; +    private static Textures.BlockIcons.CustomIcon ScreenON; + +    public ArrayList<GT_MetaTileEntity_Hatch_InputElemental> eInputHatches = new ArrayList<>(); +    public ArrayList<GT_MetaTileEntity_Hatch_OutputElemental> eOutputHatches = new ArrayList<>(); +    public ArrayList<GT_MetaTileEntity_Hatch_MufflerElemental> eMufflerHatches = new ArrayList<>(); +    public ArrayList<GT_MetaTileEntity_Hatch_Param> eParamHatches = new ArrayList<>(); +    public ArrayList<GT_MetaTileEntity_Hatch_Uncertainty> eUncertainHatches = new ArrayList<>(); +    public ArrayList<GT_MetaTileEntity_Hatch_EnergyMulti> eEnergyMulti = new ArrayList<>(); +    public ArrayList<GT_MetaTileEntity_Hatch_DynamoMulti> eDynamoMulti = new ArrayList<>(); + +    public final float[] eParamsIn=new float[20]; +    public final float[] eParamsOut=new float[20]; +    public final byte[] eParamsInStatus =new byte[20]; +    public final byte[] eParamsOutStatus=new byte[20]; + +    //TO ENABLE this change value in <init> to false and/or other than 0, can also be added in recipe check or whatever +    public boolean eParameters=true,ePowerPass=false,eSafeVoid=false; +    public byte eCertainMode=0,eCertainStatus=0; +    private int maxAmps=0; +    public int ampereRating=1,minRepairStatus=2; + +    //init param states in constructor, or implement it in checkrecipe/outputfunction + +    //METHODS TO OVERRIDE + +    //if you want to add checks that run periodically when machine works then make onRunningTick better +    //if you want to add checks that run periodically when machine is built then use check params + +    public boolean EM_checkRecipe(ItemStack itemStack){ +        return false; +    } + +    public void EM_checkParams(){ +    }//update status of parameters in guis and "machine state" + +    public void EM_outputFunction(){ +        //it can also be here to do the last param check. +    } +    // based on "machine state" do output, +    // this must move to output EM things and can also modify output items/fluids + +    //RATHER LEAVE ALONE +    public GT_MetaTileEntity_MultiblockBase_Elemental(int aID, String aName, String aNameRegional) { +        super(aID, aName, aNameRegional); +    } + +    public GT_MetaTileEntity_MultiblockBase_Elemental(String aName) { +        super(aName); +    } + +    @Override +    public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { +        return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity); +    } + +    @Override +    public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { +        return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "EMDisplay.png"); +    } + +    @Override +    public void registerIcons(IIconRegister aBlockIconRegister) { +        ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_CONTROLLER"); +        ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_CONTROLLER_ACTIVE"); +        super.registerIcons(aBlockIconRegister); +    } + +    public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { +        if (aSide == aFacing) { +            return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[83], new GT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; +        } +        return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[83]}; +    } + +    @Override +    public final byte getTileEntityBaseType() { +        return 3; +    } + +    @Override +    public void saveNBTData(NBTTagCompound aNBT) { +        super.saveNBTData(aNBT); + +        //Fix supermethod shit. +        if(mOutputItems!=null) +            aNBT.setInteger("eItemsOut",mOutputItems.length); +        if(mOutputFluids!=null) +            aNBT.setInteger("eFluidsOut",mOutputFluids.length); + +        aNBT.setInteger("eRating",ampereRating); +        aNBT.setByte("eCertainM",eCertainMode); +        aNBT.setByte("eCertainS",eCertainStatus); +        aNBT.setBoolean("eParam",!eParameters); +        aNBT.setBoolean("ePass",ePowerPass); +        aNBT.setBoolean("eVoid",eSafeVoid); + +        if (outputEM!=null) { +            aNBT.setInteger("outputStackCount", outputEM.length); +            NBTTagCompound output = new NBTTagCompound(); +            for (int i = 0; i < outputEM.length; i++) +                output.setTag(Integer.toString(i), outputEM[i].toNBT()); +            aNBT.setTag("outputEM", output); +        } else { +            aNBT.setInteger("outputStackCount", 0); +            aNBT.removeTag("outputEM"); +        } + +        NBTTagCompound paramI=new NBTTagCompound(); +        for(int i=0;i<20;i++) +            paramI.setFloat(Integer.toString(i),eParamsIn[i]); +        aNBT.setTag("eParamsIn",paramI); + +        NBTTagCompound paramO=new NBTTagCompound(); +        for(int i=0;i<20;i++) +            paramO.setFloat(Integer.toString(i),eParamsOut[i]); +        aNBT.setTag("eParamsOut",paramO); + +        NBTTagCompound paramIs=new NBTTagCompound(); +        for(int i=0;i<20;i++) +            paramIs.setByte(Integer.toString(i),eParamsInStatus[i]); +        aNBT.setTag("eParamsInS",paramIs); + +        NBTTagCompound paramOs=new NBTTagCompound(); +        for(int i=0;i<20;i++) +            paramOs.setByte(Integer.toString(i),eParamsOutStatus[i]); +        aNBT.setTag("eParamsOutS",paramOs); +    } + +    @Override +    public void loadNBTData(NBTTagCompound aNBT) { +        super.loadNBTData(aNBT); + +        ampereRating=aNBT.getInteger("eRating"); +        eCertainMode=aNBT.getByte("eCertainM"); +        eCertainStatus=aNBT.getByte("eCertainS"); +        eParameters=!aNBT.getBoolean("eParam"); +        ePowerPass=aNBT.getBoolean("ePass"); +        eSafeVoid=aNBT.getBoolean("eVoid"); + +        //Fix supermethod shit. +        mOutputItems = new ItemStack[aNBT.getInteger("eItemsOut")]; +        for (int i = 0; i < mOutputItems.length; i++) +            mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i); +        mOutputFluids = new FluidStack[aNBT.getInteger("eFluidsOut")]; +        for (int i = 0; i < mOutputFluids.length; i++) +            mOutputFluids[i] = GT_Utility.loadFluid(aNBT, "mOutputFluids" + i); + +        final int outputLen=aNBT.getInteger("outputStackCount"); +        if(outputLen>0){ +            outputEM=new cElementalInstanceStackTree[outputLen]; +            for(int i=0;i<outputEM.length;i++) +                try { +                    outputEM[i] = cElementalInstanceStackTree.fromNBT( +                            aNBT.getCompoundTag("outputEM").getCompoundTag(Integer.toString(i))); +                }catch (tElementalException e){ +                    if(DEBUGMODE)e.printStackTrace(); +                    outputEM[i] = new cElementalInstanceStackTree(); +                } +        }else outputEM=new cElementalInstanceStackTree[0]; + +        NBTTagCompound paramI=aNBT.getCompoundTag("eParamsIn"); +        for(int i=0;i<eParamsIn.length;i++) +            eParamsIn[i]=paramI.getFloat(Integer.toString(i)); + +        NBTTagCompound paramO=aNBT.getCompoundTag("eParamsOut"); +        for(int i=0;i<eParamsOut.length;i++) +            eParamsOut[i]=paramO.getFloat(Integer.toString(i)); + +        NBTTagCompound paramIs=aNBT.getCompoundTag("eParamsInS"); +        for(int i=0;i<eParamsInStatus.length;i++) +            eParamsInStatus[i]=paramIs.getByte(Integer.toString(i)); + +        NBTTagCompound paramOs=aNBT.getCompoundTag("eParamsOutS"); +        for(int i=0;i<eParamsOutStatus.length;i++) +            eParamsOutStatus[i]=paramOs.getByte(Integer.toString(i)); +    } + +    @Override +    public final long maxEUStore() { +        return getMaxInputVoltage()*maxAmps<<3; +    } + +    @Override +    public final long getMinimumStoredEU() { +        return maxEUStore()>>1; +    } + +    @Override +    public final long maxAmperesIn() { +        return 0L; +    } + +    @Override +    public final long maxAmperesOut() { +        return 0L; +    } + +    @Override +    public int getPollutionPerTick(ItemStack itemStack) { +        return 0; +    } + +    @Override +    public final void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { +        if (aBaseMetaTileEntity.isServerSide()) { +            if (mEfficiency < 0) mEfficiency = 0; +            if (--mUpdate == 0 || --mStartUpCheck == 0) { + +                mInputHatches.clear(); +                mInputBusses.clear(); +                mOutputHatches.clear(); +                mOutputBusses.clear(); +                mDynamoHatches.clear(); +                mEnergyHatches.clear(); +                mMufflerHatches.clear(); +                mMaintenanceHatches.clear(); + +                for(GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental:eOutputHatches) +                    hatch_elemental.id=-1; +                for(GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental:eInputHatches) +                    hatch_elemental.id=-1; +                for(GT_MetaTileEntity_Hatch_Uncertainty hatch:eUncertainHatches) +                    hatch.getBaseMetaTileEntity().setActive(false); +                for(GT_MetaTileEntity_Hatch_Param hatch:eParamHatches) +                    hatch.getBaseMetaTileEntity().setActive(false); + +                eUncertainHatches.clear(); +                eEnergyMulti.clear(); +                eInputHatches.clear(); +                eOutputHatches.clear(); +                eParamHatches.clear(); +                eMufflerHatches.clear(); +                eDynamoMulti.clear(); + +                mMachine = checkMachine(aBaseMetaTileEntity, mInventory[1]); +                if(eUncertainHatches.size()>1) mMachine=false; + +                if(mMachine) { +                    short id=1; +                    for(GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental:eOutputHatches) +                        hatch_elemental.id=id++; +                    id=1; +                    for(GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental:eInputHatches) +                        hatch_elemental.id=id++; + +                    maxAmps=mEnergyHatches.size(); +                    for(GT_MetaTileEntity_Hatch_EnergyMulti hatch:eEnergyMulti) +                        maxAmps+=hatch.Amperes; + +                    for (GT_MetaTileEntity_Hatch_Uncertainty hatch : eUncertainHatches) +                        hatch.getBaseMetaTileEntity().setActive(true); +                    for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) +                        hatch.getBaseMetaTileEntity().setActive(true); +                }else{ +                    maxAmps=0; +                } +            } + +            if (mStartUpCheck < 0 ) {//E +                if (mMachine) {//S +                    final byte Tick=(byte)(aTick%20); +                    if (multiPurge1At==Tick || multiPurge2At==Tick) +                        purgeAll(); +                    else if (multiCheckAt==Tick) +                        for (GT_MetaTileEntity_Hatch_Maintenance tHatch : mMaintenanceHatches) { +                            if (isValidMetaTileEntity(tHatch)) { +                                if (disableMaintenance){ +                                    mWrench = true; +                                    mScrewdriver = true; +                                    mSoftHammer = true; +                                    mHardHammer = true; +                                    mSolderingTool = true; +                                    mCrowbar = true; +                                } else { +                                    if (tHatch.mAuto && !(mWrench&&mScrewdriver&&mSoftHammer&&mHardHammer&&mSolderingTool&&mCrowbar))tHatch.isRecipeInputEqual(true); +                                    if (tHatch.mWrench) mWrench = true; +                                    if (tHatch.mScrewdriver) mScrewdriver = true; +                                    if (tHatch.mSoftHammer) mSoftHammer = true; +                                    if (tHatch.mHardHammer) mHardHammer = true; +                                    if (tHatch.mSolderingTool) mSolderingTool = true; +                                    if (tHatch.mCrowbar) mCrowbar = true; + +                                    tHatch.mWrench = false; +                                    tHatch.mScrewdriver = false; +                                    tHatch.mSoftHammer = false; +                                    tHatch.mHardHammer = false; +                                    tHatch.mSolderingTool = false; +                                    tHatch.mCrowbar = false; +                                } +                            } +                        } +                    else if(moveAt==Tick && eSafeVoid) { +                        for(GT_MetaTileEntity_Hatch_MufflerElemental voider:eMufflerHatches) { +                            if(voider.overflowMax<voider.overflowMatter) continue; +                            float remaining=voider.overflowMax-voider.overflowMatter; +                            for(GT_MetaTileEntity_Hatch_InputElemental in:eInputHatches){ +                                for(cElementalInstanceStack instance:in.getContainerHandler().values()){ +                                    int qty=(int)Math.floor(remaining/instance.definition.getMass()); +                                    if(qty>0){ +                                        qty=Math.min(qty,instance.amount); +                                        voider.overflowMatter+=instance.definition.getMass()*qty; +                                        in.getContainerHandler().removeAmount(false,new cElementalDefinitionStack(instance.definition,qty)); +                                    } +                                } +                            } +                            for(GT_MetaTileEntity_Hatch_OutputElemental out:eOutputHatches){ +                                for(cElementalInstanceStack instance:out.getContainerHandler().values()){ +                                    int qty=(int)Math.floor(remaining/instance.definition.getMass()); +                                    if(qty>0){ +                                        qty=Math.min(qty,instance.amount); +                                        voider.overflowMatter+=instance.definition.getMass()*qty; +                                        out.getContainerHandler().removeAmount(false,new cElementalDefinitionStack(instance.definition,qty)); +                                    } +                                } +                            } +                            //in case some weird shit happened here, it will still be safe +                            if(voider.overflowMatter>voider.overflowMax)voider.overflowMatter=voider.overflowMax; +                        } +                    } + +                    if(ePowerPass && (mDynamoHatches.size()>0 || eDynamoMulti.size()>0)){ +                        IGregTechTileEntity base=this.getBaseMetaTileEntity(); +                        for(GT_MetaTileEntity_Hatch_Energy tHatch:mEnergyHatches){ +                            if(this.getEUVar()>this.getMinimumStoredEU()) break; +                            if(isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(tHatch.maxEUInput(),false)) +                                this.setEUVar(this.getEUVar()+tHatch.maxEUInput()); +                        } +                        for(GT_MetaTileEntity_Hatch_EnergyMulti tHatch:eEnergyMulti){ +                            if(this.getEUVar()>this.getMinimumStoredEU()) break; +                            if(isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(tHatch.maxEUInput()*tHatch.Amperes,false)) +                                this.setEUVar(this.getEUVar()+tHatch.maxEUInput()*tHatch.Amperes); +                        } +                        for(GT_MetaTileEntity_Hatch_Dynamo tHatch:mDynamoHatches) +                            if(     isValidMetaTileEntity(tHatch) && +                                    tHatch.getBaseMetaTileEntity().getStoredEU()<=(tHatch.maxEUStore()-tHatch.maxEUOutput()) && +                                    base.decreaseStoredEnergyUnits(tHatch.maxEUOutput(),false)) +                                tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU()+tHatch.maxEUOutput()); +                        for(GT_MetaTileEntity_Hatch_DynamoMulti tHatch:eDynamoMulti) +                            if(isValidMetaTileEntity(tHatch) && +                                    tHatch.getBaseMetaTileEntity().getStoredEU()<=(tHatch.maxEUStore()-tHatch.maxEUOutput()*tHatch.Amperes) && +                                    base.decreaseStoredEnergyUnits(tHatch.maxEUOutput()*tHatch.Amperes,false)) +                                tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU()+tHatch.maxEUOutput()*tHatch.Amperes); +                    } + +                    if (getRepairStatus() >= minRepairStatus) {//S +                        if (multiCheckAt==Tick) +                            paramsUpdate(); + +                        if (mMaxProgresstime > 0 && doRandomMaintenanceDamage()) {//Start +                            if (onRunningTick(mInventory[1])) {//Compute EU +                                if (!polluteEnvironment(getPollutionPerTick(mInventory[1]))) +                                    stopMachine(); + +                                if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime && recipeAt==Tick ) {//progress increase and done +                                    paramsUpdate(); +                                    EM_outputFunction(); +                                    purgeAll(); + +                                    if (mOutputItems != null) for (ItemStack tStack : mOutputItems) +                                        if (tStack != null) +                                            addOutput(tStack); + +                                    if (mOutputFluids != null && mOutputFluids.length == 1) +                                        for (FluidStack tStack : mOutputFluids) +                                            if (tStack != null) +                                                addOutput(tStack); +                                    else if (mOutputFluids != null && mOutputFluids.length > 1) +                                        addFluidOutputs(mOutputFluids); + +                                    mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); +                                    mOutputItems = null; +                                    mOutputFluids = null; +                                    outputEM=null; +                                    mProgresstime = 0; +                                    mMaxProgresstime = 0; +                                    mEfficiencyIncrease = 0; +                                    if (aBaseMetaTileEntity.isAllowedToWork()) checkRecipe(mInventory[1]); +                                } +                            } +                        } else { +                            if (recipeAt==Tick) { +                                if (aBaseMetaTileEntity.isAllowedToWork()) checkRecipe(mInventory[1]); +                                if (mMaxProgresstime <= 0) mEfficiency = Math.max(0, mEfficiency - 1000); +                            } +                        } +                    } else {//not repaired +                        stopMachine(); +                    } +                } else {//not machine +                    stopMachine(); +                } +            } +            aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & -512) | (mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8) | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64) | ((eCertainStatus == 0) ? 0 : 128) | (eParameters ? 0 : 256)); +            aBaseMetaTileEntity.setActive(mMaxProgresstime > 0); +            boolean active = aBaseMetaTileEntity.isActive() && mPollution > 0; +            for (GT_MetaTileEntity_Hatch_Muffler aMuffler : mMufflerHatches) +                aMuffler.getBaseMetaTileEntity().setActive(active); +        } +    } + +    @Deprecated +    @Override +    public final int getAmountOfOutputs() { +        return 0; +    } + +    private void addFluidOutputs(FluidStack[] mOutputFluids2) { +        for(int i = 0; i < mOutputFluids2.length; ++i) { +            if(this.mOutputHatches.size() > i && this.mOutputHatches.get(i) != null && mOutputFluids2[i] != null && isValidMetaTileEntity((MetaTileEntity)this.mOutputHatches.get(i))) { +                ((GT_MetaTileEntity_Hatch_Output)this.mOutputHatches.get(i)).fill(mOutputFluids2[i], true); +            } +        } +    } + +    @Override +    public int getMaxEfficiency(ItemStack itemStack) { +        return 10000; +    } + +    @Override +    public int getIdealStatus() { +        return 8; +    } + +    @Override +    public int getRepairStatus() { +        return super.getRepairStatus() + ((eCertainStatus==0)?1:0) + (this.eParameters?1:0); +    } + +    @Override +    public boolean onRunningTick(ItemStack aStack) { +        if(ampereRating<=0) return true; +        else if(this.mEUt > 0) { +            this.addEnergyOutput((long)this.mEUt * (long) ampereRating * (long)this.mEfficiency / getMaxEfficiency(aStack)); +            return true; +        } else if(this.mEUt < 0 && !this.drainEnergyInput((long)(-this.mEUt) * (long) ampereRating * getMaxEfficiency(aStack) / (long)Math.max(1000, this.mEfficiency))) { +            this.stopMachine(); +            return false; +        } else return true; +    } + +    @Override +    public final boolean addEnergyOutput(long aEU) { +        if(aEU <= 0L) { +            return true; +        } else { +            for(GT_MetaTileEntity_Hatch tHatch:eDynamoMulti) +                if(isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(aEU,false)) +                    return true; +            for(GT_MetaTileEntity_Hatch tHatch:mDynamoHatches) +                if(isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(aEU,false)) +                    return true; +            return false; +        } +    } + +    @Override +    public final boolean drainEnergyInput(long aEU) { +        if(aEU <= 0L) { +            return true; +        } else { +            for(GT_MetaTileEntity_Hatch tHatch:eEnergyMulti) +                if(isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEU,false)) +                    return true; +            for(GT_MetaTileEntity_Hatch tHatch:mEnergyHatches) +                if(isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEU,false)) +                    return true; +            return false; +        } +    } + +    @Override +    public final long getMaxInputVoltage() { +        long rVoltage = 0; +        for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) +            if (isValidMetaTileEntity(tHatch)) rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage(); +        for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) +            if (isValidMetaTileEntity(tHatch)) rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage(); +        return rVoltage; +    } + +    @Override +    public final void stopMachine() { +        super.stopMachine(); +        float mass=0; +        if(outputEM==null) return; +        for(cElementalInstanceStackTree tree:outputEM) +            mass+=tree.getMass(); +        if(mass>0) { +            if (eMufflerHatches.size()<1) explodeMultiblock(); +            mass /= eMufflerHatches.size(); +            for (GT_MetaTileEntity_Hatch_MufflerElemental dump : eMufflerHatches) { +                dump.overflowMatter += mass; +                if (dump.overflowMatter > dump.overflowMax) explodeMultiblock(); +            } +        } +        outputEM = null; +    } + +    @Override +    public GT_Recipe.GT_Recipe_Map getRecipeMap() { +        return null; +    } + +    private void purgeAll(){ +        float mass=0; +        for(GT_MetaTileEntity_Hatch_InputElemental tHatch: eInputHatches) { +            if (isValidMetaTileEntity(tHatch)) tHatch.updateSlots(); +            mass+=tHatch.overflowMatter; +            tHatch.overflowMatter=0; +        } +        for(GT_MetaTileEntity_Hatch_OutputElemental tHatch: eOutputHatches) { +            if (isValidMetaTileEntity(tHatch)) tHatch.updateSlots(); +            mass+=tHatch.overflowMatter; +            tHatch.overflowMatter=0; +        } +        if(mass>0) { +            if (eMufflerHatches.size()<1) explodeMultiblock(); +            mass /= eMufflerHatches.size(); +            for (GT_MetaTileEntity_Hatch_MufflerElemental dump : eMufflerHatches) { +                dump.overflowMatter += mass; +                if (dump.overflowMatter > dump.overflowMax) explodeMultiblock(); +            } +        } +    } + +    public void cleanHatchContent(GT_MetaTileEntity_Hatch_ElementalContainer target){ +        float mass=target.getContainerHandler().getMass(); +        if(mass>0) { +            if (eMufflerHatches.size()<1) explodeMultiblock(); +            mass /= eMufflerHatches.size(); +            for (GT_MetaTileEntity_Hatch_MufflerElemental dump : eMufflerHatches) { +                dump.overflowMatter += mass; +                if (dump.overflowMatter > dump.overflowMax) explodeMultiblock(); +            } +        } +    } + +    @Override +    public final boolean checkRecipe(ItemStack itemStack){//do recipe checks, based on "machine content and state" +        paramsUpdate(); +        return EM_checkRecipe(itemStack); +    } + +    private void paramsUpdate(){ +        for(GT_MetaTileEntity_Hatch_Param param:eParamHatches){ +            int paramID=param.param; +            if(paramID<0)continue; +            eParamsIn[paramID]=param.value1f; +            eParamsIn[paramID+10]=param.value2f; +            param.input1f=eParamsOut[paramID]; +            param.input2f=eParamsOut[paramID+10]; +        } +        EM_checkParams(); +        for(GT_MetaTileEntity_Hatch_Uncertainty uncertainty:eUncertainHatches){ +            eCertainStatus=uncertainty.update(eCertainMode); +        } +    } + +    @Override +    public boolean isCorrectMachinePart(ItemStack itemStack) { +        return true; +    } + +    @Override +    public int getDamageToComponent(ItemStack itemStack) { +        return 0; +    } + +    @Override +    public boolean explodesOnComponentBreak(ItemStack itemStack) { +        return false; +    } + +    @Override +    public void explodeMultiblock() {//BEST METHOD EVER!!! +        GT_Pollution.addPollution(new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 600000); +        mInventory[1] = null; +        for (MetaTileEntity tTileEntity : mInputBusses)         tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); +        for (MetaTileEntity tTileEntity : mOutputBusses)        tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); +        for (MetaTileEntity tTileEntity : mInputHatches)        tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); +        for (MetaTileEntity tTileEntity : mOutputHatches)       tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); +        for (MetaTileEntity tTileEntity : mDynamoHatches)       tTileEntity.getBaseMetaTileEntity().doExplosion(V[14]); +        for (MetaTileEntity tTileEntity : mMufflerHatches)      tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); +        for (MetaTileEntity tTileEntity : mEnergyHatches)       tTileEntity.getBaseMetaTileEntity().doExplosion(V[14]); +        for (MetaTileEntity tTileEntity : mMaintenanceHatches)  tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); +        for (MetaTileEntity tTileEntity : eParamHatches)        tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); +        for (MetaTileEntity tTileEntity : eInputHatches)        tTileEntity.getBaseMetaTileEntity().doExplosion(V[14]); +        for (MetaTileEntity tTileEntity : eOutputHatches)       tTileEntity.getBaseMetaTileEntity().doExplosion(V[14]); +        for (MetaTileEntity tTileEntity : eMufflerHatches)      tTileEntity.getBaseMetaTileEntity().doExplosion(V[14]); +        for (MetaTileEntity tTileEntity : eEnergyMulti)         tTileEntity.getBaseMetaTileEntity().doExplosion(V[14]); +        for (MetaTileEntity tTileEntity : eUncertainHatches)    tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); +        for (MetaTileEntity tTileEntity : eDynamoMulti)         tTileEntity.getBaseMetaTileEntity().doExplosion(V[14]); +        getBaseMetaTileEntity().doExplosion(V[15]); +    } + +    @Override +    public final boolean addToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { +        if (aTileEntity == null) return false; +        IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); +        if (aMetaTileEntity == null) return false; +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) +            ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) +            return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) +            return mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) +            return mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) +            return mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) +            return mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) +            return mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) +            return mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) +            return mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputElemental) +            return eInputHatches.add((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity); +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputElemental) +            return eOutputHatches.add((GT_MetaTileEntity_Hatch_OutputElemental) aMetaTileEntity); +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Param) +            return eParamHatches.add((GT_MetaTileEntity_Hatch_Param) aMetaTileEntity); +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Uncertainty) +            return eUncertainHatches.add((GT_MetaTileEntity_Hatch_Uncertainty) aMetaTileEntity); +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_MufflerElemental) +            return eMufflerHatches.add((GT_MetaTileEntity_Hatch_MufflerElemental) aMetaTileEntity); +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyMulti) +            return eEnergyMulti.add((GT_MetaTileEntity_Hatch_EnergyMulti) aMetaTileEntity); +        return false; +    } + +    @Override +    public final boolean addMufflerToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { +        if (aTileEntity == null) return false; +        IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); +        if (aMetaTileEntity == null) return false; +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { +            ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            return mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); +        } +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_MufflerElemental) { +            ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            return eMufflerHatches.add((GT_MetaTileEntity_Hatch_MufflerElemental) aMetaTileEntity); +        } +        return false; +    } + +    @Override +    public final boolean addInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { +        if (aTileEntity == null) return false; +        IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); +        if (aMetaTileEntity == null) return false; +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { +            ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = getRecipeMap(); +            return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); +        } +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { +            ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = getRecipeMap(); +            return mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); +        } +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputElemental) { +            ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            //((GT_MetaTileEntity_Hatch_Elemental) aMetaTileEntity).mRecipeMap = getRecipeMap(); +            return eInputHatches.add((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity); +        } +        return false; +    } + +    @Override +    public final boolean addOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { +        if (aTileEntity == null) return false; +        IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); +        if (aMetaTileEntity == null) return false; +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { +            ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            return mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); +        } +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { +            ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            return mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); +        } +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputElemental) { +            ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            return eOutputHatches.add((GT_MetaTileEntity_Hatch_OutputElemental) aMetaTileEntity); +        } +        return false; +    } + +    @Deprecated +    @Override +    public final boolean addEnergyInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { +        if (aTileEntity == null) return false; +        IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); +        if (aMetaTileEntity == null) return false; +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { +            ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            return mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); +        } +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyMulti) { +            ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            return eEnergyMulti.add((GT_MetaTileEntity_Hatch_EnergyMulti) aMetaTileEntity); +        } +        return false; +    } + +    @Deprecated +    @Override +    public final boolean addDynamoToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { +        if (aTileEntity == null) return false; +        IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); +        if (aMetaTileEntity == null) return false; +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { +            ((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            return mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); +        } +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DynamoMulti) { +            ((GT_MetaTileEntity_Hatch_DynamoMulti) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            return eDynamoMulti.add((GT_MetaTileEntity_Hatch_DynamoMulti) aMetaTileEntity); +        } +        return false; +    } + +    //New Method +    public final boolean addEnergyIOToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { +        if (aTileEntity == null) return false; +        IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); +        if (aMetaTileEntity == null) return false; +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { +            ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            return mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); +        } +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyMulti) { +            ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            return eEnergyMulti.add((GT_MetaTileEntity_Hatch_EnergyMulti) aMetaTileEntity); +        } +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { +            ((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            return mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); +        } +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DynamoMulti) { +            ((GT_MetaTileEntity_Hatch_DynamoMulti) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            return eDynamoMulti.add((GT_MetaTileEntity_Hatch_DynamoMulti) aMetaTileEntity); +        } +        return false; +    } + +    //NEW METHOD +    public final boolean addElementalInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { +        if (aTileEntity == null) return false; +        IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); +        if (aMetaTileEntity == null) return false; +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputElemental) { +            ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            //((GT_MetaTileEntity_Hatch_Elemental) aMetaTileEntity).mRecipeMap = getRecipeMap(); +            return eInputHatches.add((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity); +        } +        return false; +    } + +    //NEW METHOD +    public final boolean addElementalOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { +        if (aTileEntity == null) return false; +        IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); +        if (aMetaTileEntity == null) return false; +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputElemental) { +            ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            return eOutputHatches.add((GT_MetaTileEntity_Hatch_OutputElemental) aMetaTileEntity); +        } +        return false; +    } + +    //NEW METHOD +    public final boolean addClassicInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { +        if (aTileEntity == null) return false; +        IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); +        if (aMetaTileEntity == null) return false; +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { +            ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = getRecipeMap(); +            return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); +        } +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { +            ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = getRecipeMap(); +            return mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); +        } +        return false; +    } + +    //NEW METHOD +    public final boolean addClassicOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { +        if (aTileEntity == null) return false; +        IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); +        if (aMetaTileEntity == null) return false; +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { +            ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            return mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); +        } +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { +            ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            return mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); +        } +        return false; +    } + +    //NEW METHOD +    public final boolean addParametrizerToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { +        if (aTileEntity == null) { +            return false; +        } +        IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); +        if (aMetaTileEntity == null) return false; +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Param) { +            ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            return eParamHatches.add((GT_MetaTileEntity_Hatch_Param) aMetaTileEntity); +        } +        return false; +    } + +    //NEW METHOD +    public final boolean addUncertainToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { +        if (aTileEntity == null) { +            return false; +        } +        IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); +        if (aMetaTileEntity == null) return false; +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Uncertainty) { +            ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            return eUncertainHatches.add((GT_MetaTileEntity_Hatch_Uncertainty) aMetaTileEntity); +        } +        return false; +    } + +    @Override +    public final boolean addMaintenanceToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex){ +        if (aTileEntity == null) return false; +        IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); +        if (aMetaTileEntity == null) return false; +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { +            ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            return mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); +        } +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Param) { +            ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            return eParamHatches.add((GT_MetaTileEntity_Hatch_Param) aMetaTileEntity); +        } +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Uncertainty) { +            ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            return eUncertainHatches.add((GT_MetaTileEntity_Hatch_Uncertainty) aMetaTileEntity); +        } +        return false; +    } + +    //NEW METHOD +    public final boolean addClassicMaintenanceToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex){ +        if (aTileEntity == null) return false; +        IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); +        if (aMetaTileEntity == null) return false; +        if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { +            ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; +            return mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); +        } +        return false; +    } + +    @Override +    public String[] getInfoData() {//TODO Do it +        long storedEnergy=0; +        long maxEnergy=0; +        for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { +            if (isValidMetaTileEntity(tHatch)) { +                storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU(); +                maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity(); +            } +        } +        for(GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) { +            if (isValidMetaTileEntity(tHatch)) { +                storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU(); +                maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity(); +            } +        } + +        return new String[]{ +                "Progress:", +                EnumChatFormatting.GREEN + Integer.toString(mProgresstime/20) + EnumChatFormatting.RESET +" s / "+ +                        EnumChatFormatting.YELLOW + Integer.toString(mMaxProgresstime/20) + EnumChatFormatting.RESET +" s", +                "Stored Energy:", +                EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+ +                        EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU", +                "Probably uses: "+ +                        EnumChatFormatting.RED + Integer.toString(-mEUt) + EnumChatFormatting.RESET + " EU/t", +                "Maximum total power (to all Energy Hatches, not single ones): ", +                EnumChatFormatting.YELLOW+Long.toString(getMaxInputVoltage())+EnumChatFormatting.RESET+ " EU/t * 2A", +                "Problems: "+ +                        EnumChatFormatting.RED+ (getIdealStatus() - getRepairStatus())+EnumChatFormatting.RESET+ +                        " Efficiency: "+ +                        EnumChatFormatting.YELLOW+Float.toString(mEfficiency / 100.0F)+EnumChatFormatting.RESET + " %", +                "PowerPass(tm): "+EnumChatFormatting.BLUE+ePowerPass, +                "SafeVoid(tm): "+EnumChatFormatting.BLUE+eSafeVoid +        }; +    } + +    @Override +    public boolean isGivingInformation() { +        return true; +    } + +    //Check Machine Structure based on string array array, ond offset of the controller +    public static boolean stuctureCheck(String[][] structure,//0-9 casing, +- air no air, a-z ignore +                                        Block[] blockType,//use numbers 0-9 for casing types +                                        byte[] blockMeta,//use numbers 0-9 for casing types +                                        int horizontalOffset, int verticalOffset, int depthOffset, +                                        IGregTechTileEntity aBaseMetaTileEntity){ +        //TE Rotation +        byte facing=aBaseMetaTileEntity.getFrontFacing(); + +        int x,y,z,a,c;//b is y no matter what + +        //perform your duties +        c=-depthOffset; +        for (String[] _structure:structure) {//front to back +            y=verticalOffset; +            for (String __structure : _structure) {//top to bottom +                a=-horizontalOffset; +                for (char block : __structure.toCharArray()) {//left to right +                    if(block>'`'){//small characters allow to skip check a-1 skip, b-2 skips etc. +                        a+=block-'`'; +                    } else { +                        //get x y z from rotation +                        switch (facing) {//translation +                            case 4: x =  c; z =  a; break; +                            case 3: x =  a; z = -c; break; +                            case 5: x = -c; z = -a; break; +                            case 2: x = -a; z =  c; break; +                            default: return false; +                        } +                        //Check block +                        switch (block) { +                            case '-'://must be air +                                if (!aBaseMetaTileEntity.getAirOffset(x, y, z)) return false; +                                break; +                            case '+'://must not be air +                                if (aBaseMetaTileEntity.getAirOffset(x, y, z)) return false; +                                break; +                            default: {//check for block (countable) +                                int pointer = block - '0'; +                                //countable air -> net.minecraft.block.BlockAir +                                if (aBaseMetaTileEntity.getBlockOffset(x, y, z) != blockType[pointer])  return false; +                                    //System.out.println("Keked1:"+x+" "+y+" "+z+"/"+a+" "+c+"/"+aBaseMetaTileEntity.getBlockOffset (x,y,z)+" "+blockType[pointer]); +                                if (aBaseMetaTileEntity.getMetaIDOffset(x, y, z) != blockMeta[pointer]) return false; +                                    //System.out.println("Keked2:"+x+" "+y+" "+z+"/"+a+" "+c+"/"+aBaseMetaTileEntity.getMetaIDOffset(x,y,z)+" "+blockMeta[pointer]); +                            } +                        } +                        a++;//block in horizontal layer +                    } +                } +                y--;//horizontal layer +            } +            c++;//depth +        } +        return true; +    } + +    @Override +    public String[] getDescription() { +        return new String[]{ +                commonValues.tecMark, +                "Nothing special just override me." +        }; +    } + +    @Override +    public void onRemoval() { +        try { +            if(eOutputHatches!=null) { +                for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eOutputHatches) +                    hatch_elemental.id = -1; +                for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eInputHatches) +                    hatch_elemental.id = -1; +                for (GT_MetaTileEntity_Hatch_Uncertainty hatch : eUncertainHatches) +                    hatch.getBaseMetaTileEntity().setActive(false); +                for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) +                    hatch.getBaseMetaTileEntity().setActive(false); +            } +            if(outputEM!=null) { +                for (cElementalInstanceStackTree output : outputEM) { +                    if (output.hasStacks()) { +                        getBaseMetaTileEntity().doExplosion(V[15]); +                        return; +                    } +                } +            } +        }catch (Exception e){ +            if(DEBUGMODE) e.printStackTrace(); +        } +    } +} diff --git a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java new file mode 100644 index 0000000000..226c80f58f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java @@ -0,0 +1,55 @@ +package com.github.technus.tectech.proxy; + +import com.github.technus.tectech.blocks.QuantumGlassRender; +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.client.registry.RenderingRegistry; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; +import org.lwjgl.opengl.GL11; + +public class ClientProxy extends CommonProxy { +	public void registerRenderInfo() { +		QuantumGlassRender.renderID = RenderingRegistry.getNextAvailableRenderId(); +		RenderingRegistry.registerBlockHandler(QuantumGlassRender.renderID, new QuantumGlassRender()); +	} + +	@Override +	public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { +		return null; +	} + +	@Override +	public World getClientWorld() { +		return FMLClientHandler.instance().getClient().theWorld; +	} + +	@Override +	public void renderUnicodeString(String str, int x, int y, int maxWidth, int color) { +		Minecraft mc = Minecraft.getMinecraft(); +		FontRenderer fontRenderer = mc.fontRenderer; + +		boolean origFont = fontRenderer.getUnicodeFlag(); + +		if ((mc.gameSettings.guiScale) == 3) { +			fontRenderer.setUnicodeFlag(true); +			float dist = 0.08F; +			y--; +			for (int cycle = 0; cycle < 2; cycle++) { +				GL11.glTranslatef(-dist, 0F, 0F); +				fontRenderer.drawSplitString(str, x, y, maxWidth, color); +				GL11.glTranslatef(dist, -dist, 0F); +				fontRenderer.drawSplitString(str, x, y, maxWidth, color); +				GL11.glTranslatef(dist, 0F, 0F); +				fontRenderer.drawSplitString(str, x, y, maxWidth, color); +				GL11.glTranslatef(-dist, dist, 0F); + +				dist = -dist; +			} +			fontRenderer.setUnicodeFlag(origFont); +		} else +			fontRenderer.drawSplitString(str, x, y, maxWidth, color); + +	} +} diff --git a/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java b/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java new file mode 100644 index 0000000000..f26a2bfd16 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java @@ -0,0 +1,34 @@ +package com.github.technus.tectech.proxy; + +import cpw.mods.fml.common.network.IGuiHandler; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; + +public class CommonProxy implements IGuiHandler { +	public void registerRenderInfo() { + +	} + +	@Override +	public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { +		return null; +	} + +	@Override +	public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { +		return null; +	} + +	public World getClientWorld() { +		return null; +	} + +	public void renderUnicodeString(String str, int x, int y, int maxWidth, int color) { +	} + +	public void setCustomRenderer() { +	} + +	public void setCustomRenderers() { +	} +} diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/DEBUG_.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/DEBUG_.pngBinary files differ new file mode 100644 index 0000000000..daa7f4a2cf --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/DEBUG_.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/DEBUG_0.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/DEBUG_0.pngBinary files differ new file mode 100644 index 0000000000..94fd31b985 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/DEBUG_0.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/DEBUG_1.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/DEBUG_1.pngBinary files differ new file mode 100644 index 0000000000..bb23e9953e --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/DEBUG_1.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/DEBUG_2.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/DEBUG_2.pngBinary files differ new file mode 100644 index 0000000000..d9f3fbd2b7 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/DEBUG_2.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/DEBUG_3.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/DEBUG_3.pngBinary files differ new file mode 100644 index 0000000000..016f84f8af --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/DEBUG_3.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/DEBUG_4.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/DEBUG_4.pngBinary files differ new file mode 100644 index 0000000000..deab155c98 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/DEBUG_4.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/DEBUG_5.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/DEBUG_5.pngBinary files differ new file mode 100644 index 0000000000..a6382d4475 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/DEBUG_5.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_BHG.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_BHG.pngBinary files differ new file mode 100644 index 0000000000..524dab8595 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_BHG.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_BHG.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_BHG.png.mcmeta new file mode 100644 index 0000000000..7ab8340b0c --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_BHG.png.mcmeta @@ -0,0 +1,5 @@ +{ +   "animation":{ +      "frametime":16 +   } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_BHG_ACTIVE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_BHG_ACTIVE.pngBinary files differ new file mode 100644 index 0000000000..cfe7ac9cf5 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_BHG_ACTIVE.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_BHG_ACTIVE.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_BHG_ACTIVE.png.mcmeta new file mode 100644 index 0000000000..7ab8340b0c --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_BHG_ACTIVE.png.mcmeta @@ -0,0 +1,5 @@ +{ +   "animation":{ +      "frametime":16 +   } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_CANDY.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_CANDY.pngBinary files differ new file mode 100644 index 0000000000..54da4a849c --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_CANDY.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_CANDY.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_CANDY.png.mcmeta new file mode 100644 index 0000000000..97596ba817 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_CANDY.png.mcmeta @@ -0,0 +1,5 @@ +{ +   "animation":{ +      "frametime":2 +   } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_CASING.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_CASING.pngBinary files differ new file mode 100644 index 0000000000..3116b8973c --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_CASING.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_COIL.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_COIL.pngBinary files differ new file mode 100644 index 0000000000..4be4639f40 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_COIL.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_COIL_NONSIDE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_COIL_NONSIDE.pngBinary files differ new file mode 100644 index 0000000000..2bb3f0f031 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_COIL_NONSIDE.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_COLLIDER.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_COLLIDER.pngBinary files differ new file mode 100644 index 0000000000..5276027477 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_COLLIDER.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_COLLIDER.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_COLLIDER.png.mcmeta new file mode 100644 index 0000000000..5e86a7cd5f --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_COLLIDER.png.mcmeta @@ -0,0 +1,5 @@ +{ +   "animation":{ +      "frametime":8 +   } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_COLLIDER_ACTIVE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_COLLIDER_ACTIVE.pngBinary files differ new file mode 100644 index 0000000000..d5a0655928 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_COLLIDER_ACTIVE.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_COLLIDER_ACTIVE.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_COLLIDER_ACTIVE.png.mcmeta new file mode 100644 index 0000000000..97596ba817 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_COLLIDER_ACTIVE.png.mcmeta @@ -0,0 +1,5 @@ +{ +   "animation":{ +      "frametime":2 +   } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_CONTROLLER.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_CONTROLLER.pngBinary files differ new file mode 100644 index 0000000000..fc64d8dbe5 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_CONTROLLER.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_CONTROLLER.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_CONTROLLER.png.mcmeta new file mode 100644 index 0000000000..5e86a7cd5f --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_CONTROLLER.png.mcmeta @@ -0,0 +1,5 @@ +{ +   "animation":{ +      "frametime":8 +   } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_CONTROLLER_ACTIVE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_CONTROLLER_ACTIVE.pngBinary files differ new file mode 100644 index 0000000000..093caca191 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_CONTROLLER_ACTIVE.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_CONTROLLER_ACTIVE.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_CONTROLLER_ACTIVE.png.mcmeta new file mode 100644 index 0000000000..5e86a7cd5f --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_CONTROLLER_ACTIVE.png.mcmeta @@ -0,0 +1,5 @@ +{ +   "animation":{ +      "frametime":8 +   } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_FIELD.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_FIELD.pngBinary files differ new file mode 100644 index 0000000000..61fc2a2e36 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_FIELD.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_FIELD.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_FIELD.png.mcmeta new file mode 100644 index 0000000000..dfae8cae16 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_FIELD.png.mcmeta @@ -0,0 +1,5 @@ +{ +   "animation":{ +      "frametime":1 +   } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_FIELD_CASING.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_FIELD_CASING.pngBinary files differ new file mode 100644 index 0000000000..02bbbc95f7 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_FIELD_CASING.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_PIPE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_PIPE.pngBinary files differ new file mode 100644 index 0000000000..0be901b802 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_PIPE.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_TELE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_TELE.pngBinary files differ new file mode 100644 index 0000000000..d9da4f4578 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_TELE.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_TELE.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_TELE.png.mcmeta new file mode 100644 index 0000000000..60af678259 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_TELE.png.mcmeta @@ -0,0 +1,5 @@ +{ +   "animation":{ +      "frametime":4 +   } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_TIMESPACE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_TIMESPACE.pngBinary files differ new file mode 100644 index 0000000000..ed2770f533 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_TIMESPACE.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_TIMESPACE.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_TIMESPACE.png.mcmeta new file mode 100644 index 0000000000..dfae8cae16 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_TIMESPACE.png.mcmeta @@ -0,0 +1,5 @@ +{ +   "animation":{ +      "frametime":1 +   } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_WH.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_WH.pngBinary files differ new file mode 100644 index 0000000000..ac53d4adf9 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_WH.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_WH.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_WH.png.mcmeta new file mode 100644 index 0000000000..97596ba817 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_WH.png.mcmeta @@ -0,0 +1,5 @@ +{ +   "animation":{ +      "frametime":2 +   } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_WH_ACTIVE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_WH_ACTIVE.pngBinary files differ new file mode 100644 index 0000000000..c93a69ec0f --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_WH_ACTIVE.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_WH_ACTIVE.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_WH_ACTIVE.png.mcmeta new file mode 100644 index 0000000000..97596ba817 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_WH_ACTIVE.png.mcmeta @@ -0,0 +1,5 @@ +{ +   "animation":{ +      "frametime":2 +   } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/MUFFLER_EM.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/MUFFLER_EM.pngBinary files differ new file mode 100644 index 0000000000..5462d44897 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/MUFFLER_EM.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/MUFFLER_EM.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/MUFFLER_EM.png.mcmeta new file mode 100644 index 0000000000..97596ba817 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/MUFFLER_EM.png.mcmeta @@ -0,0 +1,5 @@ +{ +   "animation":{ +      "frametime":2 +   } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_EM_T_ACTIVE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_EM_T_ACTIVE.pngBinary files differ new file mode 100644 index 0000000000..140a461f3c --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_EM_T_ACTIVE.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_EM_T_ACTIVE.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_EM_T_ACTIVE.png.mcmeta new file mode 100644 index 0000000000..60af678259 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_EM_T_ACTIVE.png.mcmeta @@ -0,0 +1,5 @@ +{ +   "animation":{ +      "frametime":4 +   } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_EM_T_SIDES.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_EM_T_SIDES.pngBinary files differ new file mode 100644 index 0000000000..e84a0364f9 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_EM_T_SIDES.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_EM_T_SIDES.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_EM_T_SIDES.png.mcmeta new file mode 100644 index 0000000000..97596ba817 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_EM_T_SIDES.png.mcmeta @@ -0,0 +1,5 @@ +{ +   "animation":{ +      "frametime":2 +   } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/PARAM.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PARAM.pngBinary files differ new file mode 100644 index 0000000000..5c8823e743 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PARAM.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/PARAM.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PARAM.png.mcmeta new file mode 100644 index 0000000000..5e86a7cd5f --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PARAM.png.mcmeta @@ -0,0 +1,5 @@ +{ +   "animation":{ +      "frametime":8 +   } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/PARAM_ACTIVE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PARAM_ACTIVE.pngBinary files differ new file mode 100644 index 0000000000..3d80f25c0e --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PARAM_ACTIVE.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/PARAM_ACTIVE.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PARAM_ACTIVE.png.mcmeta new file mode 100644 index 0000000000..5e86a7cd5f --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PARAM_ACTIVE.png.mcmeta @@ -0,0 +1,5 @@ +{ +   "animation":{ +      "frametime":8 +   } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/UC.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/UC.pngBinary files differ new file mode 100644 index 0000000000..222e0b82b7 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/UC.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/UC.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/UC.png.mcmeta new file mode 100644 index 0000000000..5e86a7cd5f --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/UC.png.mcmeta @@ -0,0 +1,5 @@ +{ +   "animation":{ +      "frametime":8 +   } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/UC_ACTIVE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/UC_ACTIVE.pngBinary files differ new file mode 100644 index 0000000000..dc5dcd1af0 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/UC_ACTIVE.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/UC_ACTIVE.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/UC_ACTIVE.png.mcmeta new file mode 100644 index 0000000000..5e86a7cd5f --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/UC_ACTIVE.png.mcmeta @@ -0,0 +1,5 @@ +{ +   "animation":{ +      "frametime":8 +   } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/gui/Parametrizer.png b/src/main/resources/assets/gregtech/textures/gui/Parametrizer.pngBinary files differ new file mode 100644 index 0000000000..28f5422625 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/gui/Parametrizer.png diff --git a/src/main/resources/assets/gregtech/textures/gui/Uncertainty.png b/src/main/resources/assets/gregtech/textures/gui/Uncertainty.pngBinary files differ new file mode 100644 index 0000000000..6b8dd0aa2a --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/gui/Uncertainty.png diff --git a/src/main/resources/assets/gregtech/textures/gui/multimachines/EMDisplay.png b/src/main/resources/assets/gregtech/textures/gui/multimachines/EMDisplay.pngBinary files differ new file mode 100644 index 0000000000..b3a8ec6b41 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/gui/multimachines/EMDisplay.png diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang new file mode 100644 index 0000000000..26459ea81b --- /dev/null +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -0,0 +1 @@ +tile.QuantumGlass.name=Quantum Glass
\ No newline at end of file diff --git a/src/main/resources/assets/tectech/textures/blocks/blockQuantumGlass.png b/src/main/resources/assets/tectech/textures/blocks/blockQuantumGlass.pngBinary files differ new file mode 100644 index 0000000000..0176d7f27a --- /dev/null +++ b/src/main/resources/assets/tectech/textures/blocks/blockQuantumGlass.png diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info new file mode 100644 index 0000000000..f480667560 --- /dev/null +++ b/src/main/resources/mcmod.info @@ -0,0 +1,16 @@ +[ +{ +  "modid": "examplemod", +  "name": "Example Mod", +  "description": "Example placeholder mod.", +  "version": "${version}", +  "mcversion": "${mcversion}", +  "url": "", +  "updateUrl": "", +  "authorList": ["ExampleDude"], +  "credits": "The Forge and FML guys, for making this example", +  "logoFile": "", +  "screenshots": [], +  "dependencies": [] +} +] | 
