diff options
author | draknyte1 <draknyte1@hotmail.com> | 2017-02-14 22:53:38 +1000 |
---|---|---|
committer | draknyte1 <draknyte1@hotmail.com> | 2017-02-14 22:53:38 +1000 |
commit | 099ad908e559e0d4753fe265462b2263dc6f3ba3 (patch) | |
tree | f86580ef3ed0423680761dc3fe36f0e84363af2b /src | |
parent | c5a1e14c4e5ba4cd514c8f8a7050fe74de6183bb (diff) | |
download | GT5-Unofficial-099ad908e559e0d4753fe265462b2263dc6f3ba3.tar.gz GT5-Unofficial-099ad908e559e0d4753fe265462b2263dc6f3ba3.tar.bz2 GT5-Unofficial-099ad908e559e0d4753fe265462b2263dc6f3ba3.zip |
+ Added Plasma cells for all missing elements. (Adds a few extra, which will get removed).
+ Added a function to generate Plasma.
- Removed Bedrockium generation.
$ Fixed the chemical symbol for Thallium.
$ Fixed an issue where a String in ClientProxy.java was being set server side.
Diffstat (limited to 'src')
16 files changed, 205 insertions, 28 deletions
diff --git a/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java index d5764fa86b..40a4b6e501 100644 --- a/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java @@ -12,6 +12,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; public class LoginEventHandler { @@ -25,9 +27,11 @@ public class LoginEventHandler { this.localPlayerRef = event.player; this.localPlayersName = event.player.getDisplayName(); this.localPlayersUUID = event.player.getUniqueID(); - + //Set this for easier use elsewhere. - ClientProxy.playerName = this.localPlayersName; + if (event.player.getEntityWorld().isRemote){ + ClientProxy.playerName = this.localPlayersName; + } try { @@ -36,19 +40,19 @@ public class LoginEventHandler { //Populates player cache if (!localPlayerRef.worldObj.isRemote){ - PlayerCache.appendParamChanges(localPlayersName, localPlayersUUID.toString()); - - if (!CORE.isModUpToDate){ - Utils.LOG_INFO("You're not using the latest recommended version of GT++, consider updating."); - if (!CORE.MASTER_VERSION.toLowerCase().equals("offline")) - Utils.LOG_INFO("Latest version is: "+CORE.MASTER_VERSION); - Utils.LOG_INFO("You currently have: "+CORE.VERSION); - PlayerUtils.messagePlayer(localPlayerRef, "You're not using the latest recommended version of GT++, consider updating."); - } - else { - Utils.LOG_INFO("You're using the latest recommended version of GT++."); - } - + PlayerCache.appendParamChanges(localPlayersName, localPlayersUUID.toString()); + + if (!CORE.isModUpToDate){ + Utils.LOG_INFO("You're not using the latest recommended version of GT++, consider updating."); + if (!CORE.MASTER_VERSION.toLowerCase().equals("offline")) + Utils.LOG_INFO("Latest version is: "+CORE.MASTER_VERSION); + Utils.LOG_INFO("You currently have: "+CORE.VERSION); + PlayerUtils.messagePlayer(localPlayerRef, "You're not using the latest recommended version of GT++, consider updating."); + } + else { + Utils.LOG_INFO("You're using the latest recommended version of GT++."); + } + } diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index 47b527aeab..ce5f8a2bce 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -578,7 +578,7 @@ public final class ModItems { if (LoadedMods.Extra_Utils|| LOAD_ALL_CONTENT){ Utils.LOG_INFO("ExtraUtilities Found - Loading Resources."); try { - MaterialGenerator.generate(ALLOY.BEDROCKIUM); + //MaterialGenerator.generate(ALLOY.BEDROCKIUM); } catch (NullPointerException e){ e.getClass(); } diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java index eb5694f1a9..5b585aed16 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java @@ -180,6 +180,7 @@ public class BaseItemComponent extends Item{ BOLT("Bolt", " Bolt", "bolt"), ROTOR("Rotor", " Rotor", "rotor"), RING("Ring", " Ring", "ring"), + PLASMACELL("CellPlasma", " Plasma Cell", "cellPlasma"), CELL("Cell", " Cell", "cell"), NUGGET("Nugget", " Nugget", "nugget"); diff --git a/src/Java/gtPlusPlus/core/item/base/cell/BaseItemPlasmaCell.java b/src/Java/gtPlusPlus/core/item/base/cell/BaseItemPlasmaCell.java new file mode 100644 index 0000000000..ba32be9b53 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/base/cell/BaseItemPlasmaCell.java @@ -0,0 +1,81 @@ +package gtPlusPlus.core.item.base.cell; + +import gtPlusPlus.core.item.base.BaseItemComponent; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.Utils; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BaseItemPlasmaCell extends BaseItemComponent{ + + private IIcon base; + private IIcon overlay; + ComponentTypes PlasmaCell = ComponentTypes.PLASMACELL; + private int tickCounter = 0; + private int tickCounterMax = 200; + private short[] fluidColour; + + public BaseItemPlasmaCell(Material material) { + super(material, ComponentTypes.PLASMACELL); + fluidColour = (short[]) ((material == null) ? extraData : material.getRGBA()); + } + + @Override + @SideOnly(Side.CLIENT) + public boolean requiresMultipleRenderPasses(){ + return true; + } + + @Override + public void registerIcons(IIconRegister i) { + this.base = i.registerIcon(CORE.MODID + ":" + "item"+PlasmaCell.getComponent()); + this.overlay = i.registerIcon(CORE.MODID + ":" + "item"+PlasmaCell.getComponent()+"_Overlay"); + //this.overlay = cellMaterial.getFluid(1000).getFluid().get + } + + + @Override + public int getColorFromItemStack(ItemStack stack, int renderPass) { + if (renderPass == 0){ + return Utils.rgbtoHexValue(230, 230, 230); + } + return componentColour; + } + + @Override + public IIcon getIconFromDamageForRenderPass(int damage, int pass) { + if(pass == 0) { + return this.base; + } + return this.overlay; + } + + @Override + public String getItemStackDisplayName(ItemStack cell) { + return materialName+" Plasma Cell"; + } + + @Override + public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { + if (componentMaterial != null){ + if (!world.isRemote){ + if(tickCounter < tickCounterMax ){ + tickCounter++; + } + else if(tickCounter >= tickCounterMax){ + entityHolding.attackEntityFrom(DamageSource.onFire, 2); + tickCounter = 0; + } + } + } + super.onUpdate(iStack, world, entityHolding, p_77663_4_, p_77663_5_); + } + +} diff --git a/src/Java/gtPlusPlus/core/item/init/ItemsMultiTools.java b/src/Java/gtPlusPlus/core/item/init/ItemsMultiTools.java index ca67ea1b54..6a55356f1e 100644 --- a/src/Java/gtPlusPlus/core/item/init/ItemsMultiTools.java +++ b/src/Java/gtPlusPlus/core/item/init/ItemsMultiTools.java @@ -43,7 +43,7 @@ public class ItemsMultiTools { toolFactory(ALLOY.TANTALLOY_61); toolFactory(ALLOY.STABALLOY); toolFactory(ALLOY.QUANTUM); - toolFactory(ALLOY.BEDROCKIUM); + //toolFactory(ALLOY.BEDROCKIUM); toolFactory(ALLOY.POTIN); toolFactory(ALLOY.TUMBAGA); toolFactory(ALLOY.TALONITE); diff --git a/src/Java/gtPlusPlus/core/material/ALLOY.java b/src/Java/gtPlusPlus/core/material/ALLOY.java index 5e29a75725..54c8017b18 100644 --- a/src/Java/gtPlusPlus/core/material/ALLOY.java +++ b/src/Java/gtPlusPlus/core/material/ALLOY.java @@ -122,7 +122,7 @@ public final class ALLOY { new MaterialStack(ELEMENT.getInstance().TIN, 20) }); - public static final Material BEDROCKIUM = new Material( + /*public static final Material BEDROCKIUM = new Material( "Bedrockium", //Material Name new short[]{32, 32, 32, 0}, //Material Colour 7735, //Melting Point in C @@ -131,7 +131,7 @@ public final class ALLOY { 100, //Neutrons false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. - null); + null);*/ public static final Material INCONEL_625 = new Material( "Inconel-625", //Material Name diff --git a/src/Java/gtPlusPlus/core/material/ELEMENT.java b/src/Java/gtPlusPlus/core/material/ELEMENT.java index 8d42279e5a..f3e695478b 100644 --- a/src/Java/gtPlusPlus/core/material/ELEMENT.java +++ b/src/Java/gtPlusPlus/core/material/ELEMENT.java @@ -98,7 +98,7 @@ public final class ELEMENT { public final Material PLATINUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Platinum); public final Material GOLD = MaterialUtils.generateMaterialFromGtENUM(Materials.Gold); public final Material MERCURY = MaterialUtils.generateMaterialFromGtENUM(Materials.Mercury); //Mercury - public final Material THALLIUM = new Material("Thallium", 25600, new short[]{175, 175, 175}, 304, 1457, 81, 123, false, "tl", 0);//Not a GT Inherited Material + public final Material THALLIUM = new Material("Thallium", 25600, new short[]{175, 175, 175}, 304, 1457, 81, 123, false, "Tl", 0);//Not a GT Inherited Material public final Material LEAD = MaterialUtils.generateMaterialFromGtENUM(Materials.Lead); public final Material BISMUTH = MaterialUtils.generateMaterialFromGtENUM(Materials.Bismuth); public final Material POLONIUM = new Material("Polonium", 25600, new short[]{180, 170, 180}, 254, 962, 84, 125, false, "Po", 1);//Not a GT Inherited Material diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java index d21a133690..6f111b6551 100644 --- a/src/Java/gtPlusPlus/core/material/Material.java +++ b/src/Java/gtPlusPlus/core/material/Material.java @@ -23,12 +23,14 @@ public class Material { private final String localizedName; private final Fluid vMoltenFluid; + private final Fluid vPlasma; protected Object dataVar = MathUtils.generateSingularRandomHexValue(); private ArrayList<MaterialStack> vMaterialInput = new ArrayList<MaterialStack>(); public final long[] vSmallestRatio; - + public final short vComponentCount; + private final short[] RGBA; private final boolean usesBlastFurnace; @@ -47,7 +49,7 @@ public class Material { public final int vVoltageMultiplier; public final String vChemicalFormula; public final String vChemicalSymbol; - + public final long vDurability; public final int vToolQuality; public final int vHarvestLevel; @@ -99,11 +101,12 @@ public class Material { if (m.getStackMaterial().vDurability != 0){ durabilityTemp = (durabilityTemp+m.getStackMaterial().vDurability); counterTemp++; + } } } if (durabilityTemp != 0 && counterTemp != 0){ - this.vDurability = (durabilityTemp/counterTemp); + this.vDurability = (durabilityTemp/counterTemp); } else { this.vDurability = 8196; @@ -113,7 +116,7 @@ public class Material { this.vDurability = 0; } } - + if (this.vDurability >= 0 && this.vDurability < 64000){ this.vToolQuality = 1; this.vHarvestLevel = 2; @@ -168,6 +171,7 @@ public class Material { } } + this.vComponentCount = getComponentCount(inputs); this.vSmallestRatio = getSmallestRatio(vMaterialInput); int tempSmallestSize = 0; @@ -200,21 +204,20 @@ public class Material { if (isValid == Materials._NULL){ this.vMoltenFluid = generateFluid(); } - else { + else { if (isValid.mFluid != null){ this.vMoltenFluid = isValid.mFluid; } else if (isValid.mGas != null){ this.vMoltenFluid = isValid.mGas; } - /*else if (isValid.mPlasma != null){ - this.vMoltenFluid = isValid.mPlasma; - }*/ else { this.vMoltenFluid = generateFluid(); } } + this.vPlasma = generatePlasma(); + //dataVar = MathUtils.generateSingularRandomHexValue(); String ratio = ""; @@ -369,6 +372,10 @@ public class Material { return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, stacksize); } + public final ItemStack getPlasmaCell(int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellPlasma"+unlocalizedName, stacksize); + } + public final ItemStack getNugget(int stacksize){ return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("nugget"+unlocalizedName, stacksize); } @@ -418,6 +425,21 @@ public class Material { } return new int[]{}; } + + private final short getComponentCount(MaterialStack[] inputs){ + int counterTemp = 0; + for (MaterialStack m : inputs){ + if (m.getStackMaterial() != null){ + counterTemp++; + } + } + if (counterTemp != 0){ + return (short) counterTemp; + } + else { + return 1; + } + } @SuppressWarnings("static-method") @@ -538,6 +560,21 @@ public class Material { return Materials.get(localizedName).mFluid; } + public final Fluid generatePlasma(){ + Materials isValid = Materials.get(getLocalizedName()); + if (isValid != Materials._NULL && isValid != null){ + if (isValid.mPlasma != null){ + Utils.LOG_INFO("Using a pre-defined Plasma from GT."); + return isValid.mPlasma; + } + } + Utils.LOG_INFO("Generating our own Plasma."); + return FluidUtils.addGTPlasma(this); + //return null; + } + + + final public FluidStack getFluid(int fluidAmount) { Utils.LOG_WARNING("Attempting to get "+fluidAmount+"L of "+this.vMoltenFluid.getName()); FluidStack moltenFluid = new FluidStack(this.vMoltenFluid, fluidAmount); diff --git a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java index eab0a301d8..a8d8f2bd82 100644 --- a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java +++ b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java @@ -27,7 +27,12 @@ public class MaterialGenerator { generate(matInfo, true); } + public static void generate(final Material matInfo, boolean generateEverything){ + generate(matInfo, generateEverything, true); + } + + public static void generate(final Material matInfo, boolean generateEverything, boolean generateBlastSmelterRecipes){ String unlocalizedName = matInfo.getUnlocalizedName(); String materialName = matInfo.getLocalizedName(); short[] C = matInfo.getRGBA(); diff --git a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java index 11e7f9853a..c9dd231423 100644 --- a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java +++ b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java @@ -15,7 +15,10 @@ import api.player.client.ClientPlayerAPI; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.event.*; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +@SideOnly(Side.CLIENT) public class ClientProxy extends CommonProxy{ /*private final HashSet<String> mCapeList = new HashSet<String>(); @@ -26,6 +29,7 @@ public class ClientProxy extends CommonProxy{ } */ + @SideOnly(Side.CLIENT) public static String playerName = ""; @Override diff --git a/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java b/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java index dd1fcfacbc..2a3527e9d1 100644 --- a/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java +++ b/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java @@ -2,9 +2,13 @@ package gtPlusPlus.core.util.fluid; import gregtech.api.enums.*; import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.fluids.GenericFluid; import gtPlusPlus.core.item.base.BaseItemComponent; +import gtPlusPlus.core.item.base.cell.BaseItemCell; +import gtPlusPlus.core.item.base.cell.BaseItemPlasmaCell; import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.material.MaterialStack; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; @@ -225,6 +229,41 @@ public class FluidUtils { public static Fluid addGTFluidNonMolten(final String aName, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) { return addGTFluid("fluid."+aName, "fluid.autogenerated", aLocalized, aRGBa, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount); } + + public static Fluid addGTPlasma(Material aMaterial) { + Utils.LOG_INFO("Generating a "+aMaterial.getLocalizedName()+" Plasma Cell"); + if (aMaterial.vComponentCount != 1){ + Utils.LOG_INFO("Compound made from: "); + for (MaterialStack x : aMaterial.getComposites()){ + Utils.LOG_INFO(x.getStackMaterial().getLocalizedName()); + } + Utils.LOG_INFO("Material is a composite, not generating plasma."); + return null; + } + + ItemStack temp = null; + //Generate a Cell if we need to + if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellPlasma"+aMaterial.getUnlocalizedName(), 1) == null){ + Item temp2 = new BaseItemPlasmaCell(aMaterial); + temp = aMaterial.getPlasmaCell(1); + } + else { + temp = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellPlasma"+aMaterial.getUnlocalizedName(), 1); + } + if (temp != null){ + return addGTFluid( + "plasma." + Utils.sanitizeString(aMaterial.getLocalizedName().toLowerCase()), + "plasma.autogenerated", + aMaterial.getLocalizedName() + " Plasma", + aMaterial.getRGBA(), + 3, + 10000, + temp, + ItemList.Cell_Empty.get(1L, new Object[0]), + 1000); + } + return null; + } public static Fluid addGTFluid(String aName, final String aTexture, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) { aName = Utils.sanitizeString(aName.toLowerCase()); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java index fe1e6d6f2d..c84989e950 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java @@ -36,6 +36,7 @@ public class RecipeGen_BlastSmelter implements Runnable{ FLUORIDES.THORIUM_HEXAFLUORIDE, FLUORIDES.THORIUM_TETRAFLUORIDE, ALLOY.BLOODSTEEL, + //ALLOY.BEDROCKIUM, NUCLIDE.LiFBeF2ThF4UF4, NUCLIDE.LiFBeF2ZrF4U235 }; diff --git a/src/resources/assets/miscutils/textures/blocks/fluids/fluid.plasma.autogenerated.png b/src/resources/assets/miscutils/textures/blocks/fluids/fluid.plasma.autogenerated.png Binary files differnew file mode 100644 index 0000000000..4acabc510c --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/fluids/fluid.plasma.autogenerated.png diff --git a/src/resources/assets/miscutils/textures/blocks/fluids/fluid.plasma.autogenerated.png.mcmeta b/src/resources/assets/miscutils/textures/blocks/fluids/fluid.plasma.autogenerated.png.mcmeta new file mode 100644 index 0000000000..87c542d295 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/fluids/fluid.plasma.autogenerated.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":1 + } +}
\ No newline at end of file diff --git a/src/resources/assets/miscutils/textures/items/itemCellPlasma.png b/src/resources/assets/miscutils/textures/items/itemCellPlasma.png Binary files differnew file mode 100644 index 0000000000..1c93293744 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/itemCellPlasma.png diff --git a/src/resources/assets/miscutils/textures/items/itemCellPlasma_Overlay.png b/src/resources/assets/miscutils/textures/items/itemCellPlasma_Overlay.png Binary files differnew file mode 100644 index 0000000000..ce3c6377c7 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/itemCellPlasma_Overlay.png |