aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus
diff options
context:
space:
mode:
authorAlkalus <draknyte1@hotmail.com>2017-11-11 02:36:20 +1000
committerAlkalus <draknyte1@hotmail.com>2017-11-11 02:36:20 +1000
commitbad0601f3e340e66ce164d124cb7105445158981 (patch)
treeee0d72a179f88175aa1e946103b0519b790daad7 /src/Java/gtPlusPlus
parentbab1fd921740a9184f67f3bbb34500221b2029b7 (diff)
downloadGT5-Unofficial-bad0601f3e340e66ce164d124cb7105445158981.tar.gz
GT5-Unofficial-bad0601f3e340e66ce164d124cb7105445158981.tar.bz2
GT5-Unofficial-bad0601f3e340e66ce164d124cb7105445158981.zip
+ More work on modular stuff.
Diffstat (limited to 'src/Java/gtPlusPlus')
-rw-r--r--src/Java/gtPlusPlus/core/block/machine/Machine_ModularityTable.java80
-rw-r--r--src/Java/gtPlusPlus/core/container/Container_ModularityTable.java236
-rw-r--r--src/Java/gtPlusPlus/core/gui/machine/GUI_ModularityTable.java38
-rw-r--r--src/Java/gtPlusPlus/core/handler/GuiHandler.java7
-rw-r--r--src/Java/gtPlusPlus/core/item/ModItems.java2
-rw-r--r--src/Java/gtPlusPlus/core/item/bauble/BaseBauble.java10
-rw-r--r--src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java123
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java3
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java104
-rw-r--r--src/Java/gtPlusPlus/core/util/nbt/ModularArmourUtils.java11
10 files changed, 595 insertions, 19 deletions
diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_ModularityTable.java b/src/Java/gtPlusPlus/core/block/machine/Machine_ModularityTable.java
new file mode 100644
index 0000000000..d95fc7a985
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/block/machine/Machine_ModularityTable.java
@@ -0,0 +1,80 @@
+package gtPlusPlus.core.block.machine;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.common.registry.LanguageRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gtPlusPlus.GTplusplus;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable;
+import net.minecraft.block.BlockContainer;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+
+public class Machine_ModularityTable extends BlockContainer
+{
+ @SideOnly(Side.CLIENT)
+ private IIcon textureTop;
+ @SideOnly(Side.CLIENT)
+ private IIcon textureBottom;
+ @SideOnly(Side.CLIENT)
+ private IIcon textureFront;
+
+ @SuppressWarnings("deprecation")
+ public Machine_ModularityTable()
+ {
+ super(Material.iron);
+ this.setBlockName("blockModularity");
+ this.setCreativeTab(AddToCreativeTab.tabMachines);
+ GameRegistry.registerBlock(this, "blockModularity");
+ LanguageRegistry.addName(this, "Modularity Configurator");
+
+ }
+
+ /**
+ * Gets the block's texture. Args: side, meta
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(final int p_149691_1_, final int p_149691_2_)
+ {
+ return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : ((p_149691_1_ != 2) && (p_149691_1_ != 4) ? this.blockIcon : this.textureFront));
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(final IIconRegister p_149651_1_)
+ {
+ this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "cover_crafting");
+ this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "cover_crafting");
+ this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "cover_crafting");
+ this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "cover_crafting");
+ }
+
+ /**
+ * Called upon block activation (right click on the block.)
+ */
+ @Override
+ public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz){
+ if (world.isRemote) {
+ return true;
+ }
+ final TileEntity te = world.getTileEntity(x, y, z);
+ if ((te != null) && (te instanceof TileEntityModularityTable)){
+ player.openGui(GTplusplus.instance, 1, world, x, y, z);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
+ return new TileEntityModularityTable();
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/container/Container_ModularityTable.java b/src/Java/gtPlusPlus/core/container/Container_ModularityTable.java
new file mode 100644
index 0000000000..df3ee63f92
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/container/Container_ModularityTable.java
@@ -0,0 +1,236 @@
+package gtPlusPlus.core.container;
+
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.inventories.projecttable.InventoryProjectMain;
+import gtPlusPlus.core.inventories.projecttable.InventoryProjectOutput;
+import gtPlusPlus.core.slots.*;
+import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable;
+import gtPlusPlus.core.util.Utils;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.*;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.crafting.CraftingManager;
+import net.minecraft.world.World;
+
+public class Container_ModularityTable extends Container {
+
+ /** The crafting matrix inventory (3x3). */
+ public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3);
+ public IInventory craftResult = new InventoryCraftResult();
+
+ protected TileEntityModularityTable tile_entity;
+ public final InventoryProjectMain inventoryGrid;
+ public final InventoryProjectOutput inventoryOutputs;
+
+ private final World worldObj;
+ private final int posX;
+ private final int posY;
+ private final int posZ;
+
+ private final int[] slotOutputs = new int[2];
+ private final int[] slotGrid = new int[9];
+
+
+ public Container_ModularityTable(final InventoryPlayer inventory, final TileEntityModularityTable tile){
+ this.tile_entity = tile;
+ this.inventoryGrid = tile.inventoryGrid;
+ this.inventoryOutputs = tile.inventoryOutputs;
+ this.tile_entity.setContainer(this);
+
+ int var6;
+ int var7;
+ this.worldObj = tile.getWorldObj();
+ this.posX = tile.xCoord;
+ this.posY = tile.yCoord;
+ this.posZ = tile.zCoord;
+
+ int nextFreeSlot = 0;
+
+
+ //Output slots
+ this.addSlotToContainer(new SlotDataStick(this.inventoryOutputs, 0, 26+(18*6), 8));
+ this.addSlotToContainer(new SlotNoInput(this.inventoryOutputs, 1, 26+(18*6), 44));
+
+ this.addSlotToContainer(new SlotCraftingNoCollect(inventory.player, this.craftMatrix, this.craftResult, 0, 26+(18*4), 25));
+
+
+ int o = 0;
+ //Storage Side
+ for (var6 = 0; var6 < 3; ++var6)
+ {
+ for (var7 = 0; var7 < 3; ++var7)
+ {
+ //Utils.LOG_WARNING("Adding slots at var:"+(var7 + var6 * 4)+" x:"+(8 + var7 * 18)+" y:"+(7 + var6 * 18));
+ this.addSlotToContainer(new Slot(this.craftMatrix, nextFreeSlot, 8+18 + (var7 * 18), 8 + (var6 * 18)));
+ this.slotGrid[o] = nextFreeSlot;
+ nextFreeSlot++;
+ o++;
+ }
+ }
+
+
+ //Player Inventory
+ for (var6 = 0; var6 < 3; ++var6)
+ {
+ for (var7 = 0; var7 < 9; ++var7)
+ {
+ this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18)));
+ }
+ }
+
+ //Player Hotbar
+ for (var6 = 0; var6 < 9; ++var6)
+ {
+ this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142));
+ }
+
+ this.onCraftMatrixChanged(this.craftMatrix);
+
+ }
+
+ /**
+ * Callback for when the crafting matrix is changed.
+ */
+ public void onCraftMatrixChanged(IInventory p_75130_1_)
+ {
+ this.craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj));
+ }
+
+ /**
+ * Called when the container is closed.
+ */
+ public void onContainerClosed(EntityPlayer p_75134_1_){
+ super.onContainerClosed(p_75134_1_);
+ if (!this.worldObj.isRemote){
+ for (int i = 0; i < 9; ++i){
+ ItemStack itemstack = this.craftMatrix.getStackInSlotOnClosing(i);
+ if (itemstack != null){
+ p_75134_1_.dropPlayerItemWithRandomChoice(itemstack, false);
+ }
+ }
+ }
+ }
+
+ @Override
+ public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer){
+
+ if (!aPlayer.worldObj.isRemote){
+ if ((aSlotIndex == 999) || (aSlotIndex == -999)){
+ //Utils.LOG_WARNING("??? - "+aSlotIndex);
+ }
+
+ if (aSlotIndex == 0){
+ Utils.LOG_INFO("Player Clicked on the Data Stick slot");
+ //TODO
+ }if (aSlotIndex == 1){
+ Utils.LOG_INFO("Player Clicked on the output slot");
+ //TODO
+ }
+
+ for (final int x : this.slotGrid){
+ if (aSlotIndex == x){
+ Utils.LOG_INFO("Player Clicked slot "+aSlotIndex+" in the crafting Grid");
+ }
+ }
+ }
+ //Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Grid");
+ return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+ }
+
+ @Override
+ public boolean canInteractWith(final EntityPlayer par1EntityPlayer){
+ if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockProjectTable){
+ return false;
+ }
+
+ return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D;
+ }
+
+
+ @Override
+ public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2)
+ {
+
+ return null;
+
+ /*ItemStack var3 = null;
+ final Slot var4 = (Slot)this.inventorySlots.get(par2);
+
+ if ((var4 != null) && var4.getHasStack())
+ {
+ final ItemStack var5 = var4.getStack();
+ var3 = var5.copy();
+
+ if (par2 == 0)
+ {
+ if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, true))
+ {
+ return null;
+ }
+
+ var4.onSlotChange(var5, var3);
+ }
+ else if ((par2 >= InOutputSlotNumber) && (par2 < InventoryOutSlotNumber))
+ {
+ if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false))
+ {
+ return null;
+ }
+ }
+ else if ((par2 >= InventoryOutSlotNumber) && (par2 < FullSlotNumber))
+ {
+ if (!this.mergeItemStack(var5, InOutputSlotNumber, InventoryOutSlotNumber, false))
+ {
+ return null;
+ }
+ }
+ else if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, false))
+ {
+ return null;
+ }
+
+ if (var5.stackSize == 0)
+ {
+ var4.putStack((ItemStack)null);
+ }
+ else
+ {
+ var4.onSlotChanged();
+ }
+
+ if (var5.stackSize == var3.stackSize)
+ {
+ return null;
+ }
+
+ var4.onPickupFromSlot(par1EntityPlayer, var5);
+ }
+
+ return var3;*/
+ }
+
+ //Can merge Slot
+ public boolean func_94530_a(ItemStack p_94530_1_, Slot p_94530_2_){
+ return p_94530_2_.inventory != this.craftResult && super.func_94530_a(p_94530_1_, p_94530_2_);
+ }
+
+ public ItemStack getOutputContent(){
+ ItemStack output = this.craftResult.getStackInSlot(0);
+ if (output != null){
+ return output;
+ }
+ return null;
+ }
+
+ public ItemStack[] getInputComponents(){
+ ItemStack inputs[] = new ItemStack[9];
+ for (int r=0;r<this.craftMatrix.getSizeInventory();r++){
+ ItemStack temp = this.craftMatrix.getStackInSlot(r);
+ inputs[r] = temp;
+ }
+ return inputs;
+ }
+
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_ModularityTable.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_ModularityTable.java
new file mode 100644
index 0000000000..d6454cdd03
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_ModularityTable.java
@@ -0,0 +1,38 @@
+package gtPlusPlus.core.gui.machine;
+
+import org.lwjgl.opengl.GL11;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gtPlusPlus.core.container.Container_ModularityTable;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.util.ResourceLocation;
+
+@SideOnly(Side.CLIENT)
+public class GUI_ModularityTable extends GuiContainer {
+
+ private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/ProjectTable.png");
+
+ public GUI_ModularityTable(final InventoryPlayer player_inventory, final TileEntityModularityTable tile){
+ super(new Container_ModularityTable(player_inventory, tile));
+ }
+
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(final int i, final int j){
+ }
+
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){
+ GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+ this.mc.renderEngine.bindTexture(craftingTableGuiTextures);
+ final int x = (this.width - this.xSize) / 2;
+ final int y = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/handler/GuiHandler.java b/src/Java/gtPlusPlus/core/handler/GuiHandler.java
index a35795a906..0e2528b6ca 100644
--- a/src/Java/gtPlusPlus/core/handler/GuiHandler.java
+++ b/src/Java/gtPlusPlus/core/handler/GuiHandler.java
@@ -14,6 +14,7 @@ import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.tileentities.base.TileEntityBase;
import gtPlusPlus.core.tileentities.general.TileEntityFishTrap;
import gtPlusPlus.core.tileentities.general.TileEntityHeliumGenerator;
+import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable;
import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable;
import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable;
import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench;
@@ -55,8 +56,7 @@ public class GuiHandler implements IGuiHandler {
return new Container_ProjectTable(player.inventory, (TileEntityProjectTable)te);
}
else if (ID == GUI2){
- //HeliumGenerator
- return new Container_HeliumGenerator(player.inventory, (TileEntityHeliumGenerator)te);
+ return new Container_ModularityTable(player.inventory, (TileEntityModularityTable) te);
}
}
@@ -101,8 +101,7 @@ public class GuiHandler implements IGuiHandler {
return new GUI_ProjectTable(player.inventory, (TileEntityProjectTable)te);
}
else if (ID == GUI2){
- Utils.LOG_WARNING("Opening Gui with Id: "+ID+" RTG");
- return new GUI_HeliumGenerator(player.inventory, (TileEntityHeliumGenerator) te);
+ return new GUI_ModularityTable(player.inventory, (TileEntityModularityTable) te);
}
}
diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java
index 9e17af13e0..f60f7e454f 100644
--- a/src/Java/gtPlusPlus/core/item/ModItems.java
+++ b/src/Java/gtPlusPlus/core/item/ModItems.java
@@ -20,6 +20,7 @@ import gtPlusPlus.core.item.base.misc.BaseItemMisc.MiscTypes;
import gtPlusPlus.core.item.base.plates.BaseItemPlate;
import gtPlusPlus.core.item.base.plates.BaseItemPlateDouble;
import gtPlusPlus.core.item.bauble.HealthBoostBauble;
+import gtPlusPlus.core.item.bauble.ModularBauble;
import gtPlusPlus.core.item.chemistry.CoalTar;
import gtPlusPlus.core.item.effects.RarityUncommon;
import gtPlusPlus.core.item.general.*;
@@ -631,6 +632,7 @@ public final class ModItems {
//Baubles
if (LoadedMods.Baubles){
tI = new HealthBoostBauble();
+ tI = new ModularBauble();
}
//EnderIO Resources
diff --git a/src/Java/gtPlusPlus/core/item/bauble/BaseBauble.java b/src/Java/gtPlusPlus/core/item/bauble/BaseBauble.java
index 60d5aa4e57..654d92ff36 100644
--- a/src/Java/gtPlusPlus/core/item/bauble/BaseBauble.java
+++ b/src/Java/gtPlusPlus/core/item/bauble/BaseBauble.java
@@ -66,7 +66,15 @@ public class BaseBauble extends Item implements IBauble{
}
public boolean addDamageNegation(DamageSource damageSource){
- return damageNegations.add(damageSource.drown.damageType);
+ return addDamageNegation(damageSource, null);
+ }
+
+ public boolean addDamageNegation(DamageSource damageSource,ItemStack aStack){
+ return damageNegations.add(damageSource.damageType);
+ }
+
+ public void clearDamageNegation(){
+ damageNegations.clear();
}
@Override
diff --git a/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java b/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java
index 755f94ef8d..5d5bdce8cf 100644
--- a/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java
+++ b/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java
@@ -19,18 +19,93 @@ import net.minecraft.util.EnumChatFormatting;
public class ModularBauble extends BaseBauble{
-
+
public ModularBauble() {
- super(BaubleType.AMULET, "Does Fancy Things.");
- addDamageNegation(DamageSource.wither);
+ super(BaubleType.AMULET, "Modular Bauble");
this.setTextureName(CORE.MODID + ":" + "itemKeyGold");
}
@Override
void fillModifiers(Multimap<String, AttributeModifier> attributes, ItemStack stack) {
- attributes.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "Bauble modifier", 40, 0));
+
+ //Get Stats
+ int mStatlevel = 0;
+ if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_DAMAGE)) > 0){
+ if (mStatlevel == 1){
+ attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "AD"+mStatlevel, 1, 0));
+ }
+ else if (mStatlevel == 2){
+ attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "AD"+mStatlevel, 2, 0));
+ }
+ else if (mStatlevel == 3){
+ attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "AD"+mStatlevel, 4, 0));
+ }
+ else if (mStatlevel == 4){
+ attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "AD"+mStatlevel, 8, 0));
+ }
+ else if (mStatlevel == 5){
+ attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "AD"+mStatlevel, 16, 0));
+ }
+ }
+ if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_DEF)) > 0){
+ if (mStatlevel == 1){
+ attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "BD"+mStatlevel, 1, 0));
+ }
+ else if (mStatlevel == 2){
+ attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "BD"+mStatlevel, 2, 0));
+ }
+ else if (mStatlevel == 3){
+ attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "BD"+mStatlevel, 3, 0));
+ }
+ else if (mStatlevel == 4){
+ attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "BD"+mStatlevel, 6, 0));
+ }
+ else if (mStatlevel == 5){
+ attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "BD"+mStatlevel, 10, 0));
+ }
+ }
+ if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_HP)) > 0){
+ if (mStatlevel == 1){
+ attributes.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "HP"+mStatlevel, 15, 0));
+ }
+ else if (mStatlevel == 2){
+ attributes.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "HP"+mStatlevel, 20, 0));
+ }
+ else if (mStatlevel == 3){
+ attributes.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "HP"+mStatlevel, 25, 0));
+ }
+ else if (mStatlevel == 4){
+ attributes.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "HP"+mStatlevel, 30, 0));
+ }
+ else if (mStatlevel == 5){
+ attributes.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "HP"+mStatlevel, 40, 0));
+ }
+ }
+ if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_SPEED)) > 0){
+ if (mStatlevel == 1){
+ attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "SP"+mStatlevel, 1, 0));
+ }
+ else if (mStatlevel == 2){
+ attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "SP"+mStatlevel, 2, 0));
+ }
+ else if (mStatlevel == 3){
+ attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "SP"+mStatlevel, 3, 0));
+ }
+ else if (mStatlevel == 4){
+ attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "SP"+mStatlevel, 4, 0));
+ }
+ else if (mStatlevel == 5){
+ attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "SP"+mStatlevel, 5, 0));
+ }
+ }
+ if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_MINING)) > 0){
+ }
+ if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_HOLY)) > 0){
+ }
+
}
-
+
+ @SuppressWarnings({ "unchecked"})
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
//Bauble Type
@@ -46,7 +121,7 @@ public class ModularBauble extends BaseBauble{
list.add(EnumChatFormatting.GRAY+"Current Form: "+EnumChatFormatting.RED+"Belt"+EnumChatFormatting.GRAY+".");
list.add(EnumChatFormatting.GRAY+"You can change this into a Ring or an Amulet.");
}
-
+
//Get Stats
int mStatlevel = 0;
if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_DAMAGE)) > 0){
@@ -67,14 +142,34 @@ public class ModularBauble extends BaseBauble{
if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_HOLY)) > 0){
list.add(EnumChatFormatting.GRAY+"Holy Boost: "+EnumChatFormatting.GOLD+mStatlevel+EnumChatFormatting.GRAY+".");
}
-
+
super.addInformation(stack, player, list, bool);
}
@Override
- public boolean addDamageNegation(DamageSource damageSource) {
- // TODO Auto-generated method stub
- return super.addDamageNegation(damageSource);
+ public boolean addDamageNegation(DamageSource damageSource,ItemStack aStack) {
+
+ this.clearDamageNegation();
+ int mStatlevel = 0;
+ if ((mStatlevel = ModularArmourUtils.getModifierLevel(aStack, Modifiers.BOOST_HOLY)) > 0){
+ addDamageNegation(DamageSource.cactus);
+ if (mStatlevel == 1){
+ addDamageNegation(DamageSource.inWall);
+ }
+ else if (mStatlevel == 2){
+ addDamageNegation(DamageSource.drown);
+ }
+ else if (mStatlevel == 3){
+ addDamageNegation(DamageSource.starve);
+ }
+ else if (mStatlevel == 4){
+ addDamageNegation(DamageSource.fall);
+ }
+ else if (mStatlevel == 5){
+ addDamageNegation(DamageSource.lava);
+ }
+ }
+ return super.addDamageNegation(damageSource, null);
}
@Override
@@ -110,8 +205,8 @@ public class ModularBauble extends BaseBauble{
// TODO Auto-generated method stub
super.onUnequipped(stack, player);
}
-
-
-
-
+
+
+
+
}
diff --git a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java
index 6d089ee29c..6eb1942493 100644
--- a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java
+++ b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java
@@ -2,6 +2,7 @@ package gtPlusPlus.core.tileentities;
import cpw.mods.fml.common.registry.GameRegistry;
import gtPlusPlus.core.tileentities.general.*;
+import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable;
import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable;
import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable;
import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench;
@@ -25,6 +26,8 @@ public class ModTileEntities {
GameRegistry.registerTileEntity(TileEntityInfiniteFluid.class, "TileInfiniteFluid");
GameRegistry.registerTileEntity(TileEntityProjectTable.class, "TileProjectTable");
GameRegistry.registerTileEntity(TileEntityTradeTable.class, "TileTradeTable");
+ GameRegistry.registerTileEntity(TileEntityModularityTable.class, "TileEntityModularityTable");
+
}
}
diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java
new file mode 100644
index 0000000000..592ee8a9b6
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java
@@ -0,0 +1,104 @@
+package gtPlusPlus.core.tileentities.machines;
+
+import gtPlusPlus.core.container.Container_ModularityTable;
+import gtPlusPlus.core.container.Container_ProjectTable;
+import gtPlusPlus.core.inventories.projecttable.InventoryProjectMain;
+import gtPlusPlus.core.inventories.projecttable.InventoryProjectOutput;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.nbt.NBTUtils;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.InventoryCrafting;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+
+public class TileEntityModularityTable extends TileEntity {
+
+ public InventoryProjectMain inventoryGrid;
+ public InventoryProjectOutput inventoryOutputs;
+
+ /** The crafting matrix inventory (3x3). */
+ public InventoryCrafting craftMatrix;
+ public IInventory craftResult;
+ private Container_ModularityTable container;
+
+ public TileEntityModularityTable(){
+ this.inventoryGrid = new InventoryProjectMain();//number of slots - without product slot
+ this.inventoryOutputs = new InventoryProjectOutput();//number of slots - without product slot
+ this.canUpdate();
+ }
+
+ public void setContainer(Container_ModularityTable container_ModularityTable){
+ this.container = container_ModularityTable;
+ }
+
+ @SuppressWarnings("static-method")
+ public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag){
+ if(!nbt.hasKey(tag))
+ {
+ nbt.setTag(tag, new NBTTagCompound());
+ }
+ return nbt.getCompoundTag(tag);
+ }
+
+ @Override
+ public void writeToNBT(final NBTTagCompound nbt){
+ super.writeToNBT(nbt);
+ this.inventoryGrid.writeToNBT(this.getTag(nbt, "ContentsGrid"));
+ this.inventoryOutputs.writeToNBT(this.getTag(nbt, "ContentsOutput"));
+
+ }
+
+ @Override
+ public void readFromNBT(final NBTTagCompound nbt){
+ super.readFromNBT(nbt);
+ this.inventoryGrid.readFromNBT(nbt.getCompoundTag("ContentsGrid"));
+ this.inventoryOutputs.readFromNBT(nbt.getCompoundTag("ContentsOutput"));
+ }
+
+ @Override
+ public void updateEntity() {
+ if (!this.worldObj.isRemote){
+ //Data stick
+ ItemStack dataStick = this.inventoryOutputs.getStackInSlot(0);
+ if (dataStick != null && this.container != null && container.getOutputContent() != null){
+ Utils.LOG_WARNING("Found Data Stick and valid container.");
+
+
+ ItemStack outputComponent = container.getOutputContent();
+ ItemStack[] craftInputComponent = container.getInputComponents();
+
+
+ ItemStack newStick = NBTUtils.writeItemsToNBT(dataStick, new ItemStack[]{outputComponent}, "Output");
+ newStick = NBTUtils.writeItemsToNBT(newStick, craftInputComponent);
+ NBTUtils.setBookTitle(newStick, "Encrypted Project Data");
+ NBTUtils.setBoolean(newStick, "mEncrypted", true);
+ int slotm=0;
+ Utils.LOG_WARNING("Uploading to Data Stick.");
+ for (ItemStack is : NBTUtils.readItemsFromNBT(newStick)){
+ if (is != null){
+ Utils.LOG_WARNING("Uploaded "+is.getDisplayName()+" into memory slot "+slotm+".");
+ }
+ else {
+ Utils.LOG_WARNING("Left memory slot "+slotm+" blank.");
+ }
+ slotm++;
+ }
+ Utils.LOG_WARNING("Encrypting Data Stick.");
+ this.inventoryOutputs.setInventorySlotContents(1, newStick);
+ this.inventoryOutputs.setInventorySlotContents(0, null);
+ }
+ }
+ super.updateEntity();
+ }
+
+ @Override
+ public boolean canUpdate() {
+ return true;
+ }
+
+
+
+
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/util/nbt/ModularArmourUtils.java b/src/Java/gtPlusPlus/core/util/nbt/ModularArmourUtils.java
index 5fb70ab540..d37e79b8cb 100644
--- a/src/Java/gtPlusPlus/core/util/nbt/ModularArmourUtils.java
+++ b/src/Java/gtPlusPlus/core/util/nbt/ModularArmourUtils.java
@@ -125,4 +125,15 @@ public class ModularArmourUtils {
}
}
+ public static ItemStack setDefaultStats(ItemStack aStack){
+ ItemStack tempStack = aStack;
+ setModifierLevel(tempStack, Modifiers.BOOST_DAMAGE, 0);
+ setModifierLevel(tempStack, Modifiers.BOOST_DEF, 0);
+ setModifierLevel(tempStack, Modifiers.BOOST_HOLY, 0);
+ setModifierLevel(tempStack, Modifiers.BOOST_HP, 0);
+ setModifierLevel(tempStack, Modifiers.BOOST_MINING, 0);
+ setModifierLevel(tempStack, Modifiers.BOOST_SPEED, 0);
+ return tempStack;
+ }
+
}