aboutsummaryrefslogtreecommitdiff
path: root/src/Java
diff options
context:
space:
mode:
authorAlkalus <draknyte1@hotmail.com>2017-11-11 21:39:21 +1000
committerAlkalus <draknyte1@hotmail.com>2017-11-11 21:39:21 +1000
commit3e8d2c58af25cad0542cdc77b5056031c5ce186d (patch)
treee04a85bd4faad8349782582a16ee0d3c8b2d8679 /src/Java
parent12c0d5094f1b1d6b534727c6824ff6897bed8370 (diff)
downloadGT5-Unofficial-3e8d2c58af25cad0542cdc77b5056031c5ce186d.tar.gz
GT5-Unofficial-3e8d2c58af25cad0542cdc77b5056031c5ce186d.tar.bz2
GT5-Unofficial-3e8d2c58af25cad0542cdc77b5056031c5ce186d.zip
+ More modular work.
Diffstat (limited to 'src/Java')
-rw-r--r--src/Java/gtPlusPlus/core/container/Container_ModularityTable.java118
-rw-r--r--src/Java/gtPlusPlus/core/gui/machine/GUI_ModularityTable.java18
-rw-r--r--src/Java/gtPlusPlus/core/inventories/modulartable/InventoryModularMain.java202
-rw-r--r--src/Java/gtPlusPlus/core/inventories/modulartable/InventoryModularOutput.java188
-rw-r--r--src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java140
-rw-r--r--src/Java/gtPlusPlus/core/slots/SlotModularBauble.java31
-rw-r--r--src/Java/gtPlusPlus/core/slots/SlotModularBaubleUpgrades.java73
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java172
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java22
-rw-r--r--src/Java/gtPlusPlus/core/util/nbt/ModularArmourUtils.java16
10 files changed, 832 insertions, 148 deletions
diff --git a/src/Java/gtPlusPlus/core/container/Container_ModularityTable.java b/src/Java/gtPlusPlus/core/container/Container_ModularityTable.java
index 68b46d9aca..edc84a8c5f 100644
--- a/src/Java/gtPlusPlus/core/container/Container_ModularityTable.java
+++ b/src/Java/gtPlusPlus/core/container/Container_ModularityTable.java
@@ -1,14 +1,18 @@
package gtPlusPlus.core.container;
import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.inventories.modulartable.InventoryModularMain;
+import gtPlusPlus.core.inventories.modulartable.InventoryModularOutput;
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.tileentities.machines.TileEntityProjectTable;
import gtPlusPlus.core.util.Utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.*;
+import net.minecraft.inventory.SlotCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.world.World;
@@ -16,26 +20,21 @@ 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;
+ public final InventoryModularMain inventoryGrid;
+ public final InventoryModularOutput 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[] slotOutputs = new int[3];
private final int[] slotGrid = new int[9];
public Container_ModularityTable(final InventoryPlayer inventory, final TileEntityModularityTable tile){
-
- Utils.LOG_INFO("container created");
-
this.tile_entity = tile;
this.inventoryGrid = tile.inventoryGrid;
this.inventoryOutputs = tile.inventoryOutputs;
@@ -49,29 +48,14 @@ public class Container_ModularityTable extends Container {
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++;
- }
- }
+ this.addSlotToContainer(new SlotModularBauble(this.inventoryOutputs, 0, 26+(18*6), 8));
+ this.addSlotToContainer(new SlotModularBaubleUpgrades(this.inventoryOutputs, 1, 26+(18*5), 8));
+ this.addSlotToContainer(new SlotNoInput(this.inventoryOutputs, 2, 26+(18*6), 44));
+ int o = 0;
//Player Inventory
for (var6 = 0; var6 < 3; ++var6)
@@ -87,33 +71,33 @@ public class Container_ModularityTable extends Container {
{
this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142));
}
-
- this.onCraftMatrixChanged(this.craftMatrix);
+
+ //this.onCraftMatrixChanged(this.craftMatrix);
}
-
+
/**
- * Callback for when the crafting matrix is changed.
- */
- public void onCraftMatrixChanged(IInventory p_75130_1_)
+ * 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){
+ }*/
+
+ /**
+ * 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){
@@ -124,26 +108,32 @@ public class Container_ModularityTable extends Container {
}
if (aSlotIndex == 0){
- Utils.LOG_INFO("Player Clicked on the Data Stick slot");
+ Utils.LOG_INFO("Player Clicked on the bauble slot");
+ //TODO
+ }
+ else if (aSlotIndex == 1){
+ Utils.LOG_INFO("Player Clicked on the upgrade slot");
//TODO
- }if (aSlotIndex == 1){
+ }
+ else if (aSlotIndex == 2){
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");
+ else {
+ 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){
+ if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockModularTable){
return false;
}
@@ -154,9 +144,9 @@ public class Container_ModularityTable extends Container {
@Override
public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2)
{
-
+
return null;
-
+
/*ItemStack var3 = null;
final Slot var4 = (Slot)this.inventorySlots.get(par2);
@@ -214,18 +204,18 @@ public class Container_ModularityTable extends Container {
}
//Can merge Slot
- public boolean func_94530_a(ItemStack p_94530_1_, Slot p_94530_2_){
+ /*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(){
+ }*/
+
+ /*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++){
@@ -233,7 +223,7 @@ public class Container_ModularityTable extends Container {
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
index a89fd8142c..41ab5cce49 100644
--- a/src/Java/gtPlusPlus/core/gui/machine/GUI_ModularityTable.java
+++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_ModularityTable.java
@@ -7,7 +7,6 @@ import cpw.mods.fml.relauncher.SideOnly;
import gtPlusPlus.core.container.Container_ModularityTable;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable;
-import gtPlusPlus.core.util.Utils;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
@@ -20,12 +19,14 @@ public class GUI_ModularityTable extends GuiContainer {
public GUI_ModularityTable(final InventoryPlayer player_inventory, final TileEntityModularityTable tile){
super(new Container_ModularityTable(player_inventory, tile));
- Utils.LOG_INFO("valid gui created");
}
@Override
protected void drawGuiContainerForegroundLayer(final int i, final int j){
+ //this.fontRendererObj.drawString(I18n.format("Workbench", new Object[0]), 28, 6, 4210752);
+ //this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
+
}
@@ -38,14 +39,25 @@ public class GUI_ModularityTable extends GuiContainer {
this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
}
+
+ //This method is called when the Gui is first called!
@Override
public void initGui(){
+ //You have to add this line for the Gui to function properly!
super.initGui();
+
+ //The parameters of GuiButton are(id, x, y, width, height, text);
+ //this.buttonList.add(new GuiButton( 1, 367, 132, 18, 18, "X"));
+ //this.buttonList.add(new GuiButton( 2, 385, 132, 18, 18, "Y"));
+ //NOTE: the id always has to be different or else it might get called twice or never!
+
+ //Add any other buttons here too!
}
@Override
protected void actionPerformed(final GuiButton B){
-
+
+
}
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/inventories/modulartable/InventoryModularMain.java b/src/Java/gtPlusPlus/core/inventories/modulartable/InventoryModularMain.java
new file mode 100644
index 0000000000..5b7d85335b
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/inventories/modulartable/InventoryModularMain.java
@@ -0,0 +1,202 @@
+package gtPlusPlus.core.inventories.modulartable;
+
+import gtPlusPlus.core.util.Utils;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+
+public class InventoryModularMain implements IInventory{
+
+ private final String name = "Inventory Grid";
+
+ /** Defining your inventory size this way is handy */
+ public static final int INV_SIZE = 9;
+
+ /** Inventory's size must be same as number of slots you add to the Container class */
+ private ItemStack[] inventory = new ItemStack[INV_SIZE];
+
+ /**
+ * @param itemstack - the ItemStack to which this inventory belongs
+ */
+ public InventoryModularMain()
+ {
+
+ }
+
+ public void readFromNBT(final NBTTagCompound nbt)
+ {
+ final NBTTagList list = nbt.getTagList("Items", 10);
+ this.inventory = new ItemStack[INV_SIZE];
+ for(int i = 0;i<list.tagCount();i++)
+ {
+ final NBTTagCompound data = list.getCompoundTagAt(i);
+ final int slot = data.getInteger("Slot");
+ if((slot >= 0) && (slot < INV_SIZE))
+ {
+ this.inventory[slot] = ItemStack.loadItemStackFromNBT(data);
+ }
+ }
+ }
+
+ public void writeToNBT(final NBTTagCompound nbt)
+ {
+ final NBTTagList list = new NBTTagList();
+ for(int i = 0;i<INV_SIZE;i++)
+ {
+ final ItemStack stack = this.inventory[i];
+ if(stack != null)
+ {
+ final NBTTagCompound data = new NBTTagCompound();
+ stack.writeToNBT(data);
+ data.setInteger("Slot", i);
+ list.appendTag(data);
+ }
+ }
+ nbt.setTag("Items", list);
+ }
+
+ @Override
+ public int getSizeInventory()
+ {
+ return this.inventory.length;
+ }
+
+ public ItemStack[] getInventory(){
+ return this.inventory;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(final int slot)
+ {
+ //Utils.LOG_INFO("getStackInSlot["+slot+"]");
+ try {
+ if (slot>= this.inventory.length){
+ //Utils.LOG_INFO("Returning invalid slot item.");
+ return null;
+ }
+ return this.inventory[slot];
+ } catch (Throwable t){
+ t.printStackTrace();
+ return null;
+ }
+ }
+
+ @Override
+ public ItemStack decrStackSize(final int slot, final int amount)
+ {
+ ItemStack stack = this.getStackInSlot(slot);
+ if(stack != null)
+ {
+ if(stack.stackSize > amount)
+ {
+ stack = stack.splitStack(amount);
+ // Don't forget this line or your inventory will not be saved!
+ this.markDirty();
+ }
+ else
+ {
+ // this method also calls markDirty, so we don't need to call it again
+ this.setInventorySlotContents(slot, null);
+ }
+ }
+ return stack;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(final int slot)
+ {
+ final ItemStack stack = this.getStackInSlot(slot);
+ this.setInventorySlotContents(slot, null);
+ return stack;
+ }
+
+ @Override
+ public void setInventorySlotContents(final int slot, final ItemStack stack)
+ {
+ if (slot >= this.inventory.length){
+ return;
+ }
+ this.inventory[slot] = stack;
+
+ if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit()))
+ {
+ stack.stackSize = this.getInventoryStackLimit();
+ }
+
+ // Don't forget this line or your inventory will not be saved!
+ this.markDirty();
+ }
+
+ // 1.7.2+ renamed to getInventoryName
+ @Override
+ public String getInventoryName()
+ {
+ return this.name;
+ }
+
+ // 1.7.2+ renamed to hasCustomInventoryName
+ @Override
+ public boolean hasCustomInventoryName()
+ {
+ return this.name.length() > 0;
+ }
+
+ @Override
+ public int getInventoryStackLimit()
+ {
+ return 64;
+ }
+
+ /**
+ * This is the method that will handle saving the inventory contents, as it is called (or should be called!)
+ * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also
+ * let you change things in your inventory without ever opening a Gui, if you want.
+ */
+ // 1.7.2+ renamed to markDirty
+ @Override
+ public void markDirty()
+ {
+ for (int i = 0; i < this.getSizeInventory(); ++i)
+ {
+ final ItemStack temp = this.getStackInSlot(i);
+ if (temp != null){
+ //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize);
+ }
+
+ if ((temp != null) && (temp.stackSize == 0)) {
+ this.inventory[i] = null;
+ }
+ }
+ }
+
+ @Override
+ public boolean isUseableByPlayer(final EntityPlayer entityplayer)
+ {
+ return true;
+ }
+
+ // 1.7.2+ renamed to openInventory(EntityPlayer player)
+ @Override
+ public void openInventory() {}
+
+ // 1.7.2+ renamed to closeInventory(EntityPlayer player)
+ @Override
+ public void closeInventory() {}
+
+ /**
+ * This method doesn't seem to do what it claims to do, as
+ * items can still be left-clicked and placed in the inventory
+ * even when this returns false
+ */
+ @Override
+ public boolean isItemValidForSlot(final int slot, final ItemStack itemstack)
+ {
+ // Don't want to be able to store the inventory item within itself
+ // Bad things will happen, like losing your inventory
+ // Actually, this needs a custom Slot to work
+ return true;
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/inventories/modulartable/InventoryModularOutput.java b/src/Java/gtPlusPlus/core/inventories/modulartable/InventoryModularOutput.java
new file mode 100644
index 0000000000..0a4dc07a39
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/inventories/modulartable/InventoryModularOutput.java
@@ -0,0 +1,188 @@
+package gtPlusPlus.core.inventories.modulartable;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+
+public class InventoryModularOutput implements IInventory{
+
+ private final String name = "Inventory Output";
+
+ /** Defining your inventory size this way is handy */
+ public static final int INV_SIZE = 3;
+
+ /** Inventory's size must be same as number of slots you add to the Container class */
+ private ItemStack[] inventory = new ItemStack[INV_SIZE];
+
+ /**
+ * @param itemstack - the ItemStack to which this inventory belongs
+ */
+ public InventoryModularOutput()
+ {
+
+ }
+
+ public void readFromNBT(final NBTTagCompound nbt)
+ {
+ final NBTTagList list = nbt.getTagList("Items", 10);
+ this.inventory = new ItemStack[INV_SIZE];
+ for(int i = 0;i<list.tagCount();i++)
+ {
+ final NBTTagCompound data = list.getCompoundTagAt(i);
+ final int slot = data.getInteger("Slot");
+ if((slot >= 0) && (slot < INV_SIZE))
+ {
+ this.inventory[slot] = ItemStack.loadItemStackFromNBT(data);
+ }
+ }
+ }
+
+ public void writeToNBT(final NBTTagCompound nbt)
+ {
+ final NBTTagList list = new NBTTagList();
+ for(int i = 0;i<INV_SIZE;i++)
+ {
+ final ItemStack stack = this.inventory[i];
+ if(stack != null)
+ {
+ final NBTTagCompound data = new NBTTagCompound();
+ stack.writeToNBT(data);
+ data.setInteger("Slot", i);
+ list.appendTag(data);
+ }
+ }
+ nbt.setTag("Items", list);
+ }
+
+ @Override
+ public int getSizeInventory()
+ {
+ return this.inventory.length;
+ }
+
+ public ItemStack[] getInventory(){
+ return this.inventory;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(final int slot)
+ {
+ return this.inventory[slot];
+ }
+
+ @Override
+ public ItemStack decrStackSize(final int slot, final int amount)
+ {
+ ItemStack stack = this.getStackInSlot(slot);
+ if(stack != null)
+ {
+ if(stack.stackSize > amount)
+ {
+ stack = stack.splitStack(amount);
+ // Don't forget this line or your inventory will not be saved!
+ this.markDirty();
+ }
+ else
+ {
+ // this method also calls markDirty, so we don't need to call it again
+ this.setInventorySlotContents(slot, null);
+ }
+ }
+ return stack;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(final int slot)
+ {
+ final ItemStack stack = this.getStackInSlot(slot);
+ this.setInventorySlotContents(slot, null);
+ return stack;
+ }
+
+ @Override
+ public void setInventorySlotContents(final int slot, final ItemStack stack)
+ {
+ this.inventory[slot] = stack;
+
+ if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit()))
+ {
+ stack.stackSize = this.getInventoryStackLimit();
+ }
+
+ // Don't forget this line or your inventory will not be saved!
+ this.markDirty();
+ }
+
+ // 1.7.2+ renamed to getInventoryName
+ @Override
+ public String getInventoryName()
+ {
+ return this.name;
+ }
+
+ // 1.7.2+ renamed to hasCustomInventoryName
+ @Override
+ public boolean hasCustomInventoryName()
+ {
+ return this.name.length() > 0;
+ }
+
+ @Override
+ public int getInventoryStackLimit()
+ {
+ return 64;
+ }
+
+ /**
+ * This is the method that will handle saving the inventory contents, as it is called (or should be called!)
+ * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also
+ * let you change things in your inventory without ever opening a Gui, if you want.
+ */
+ // 1.7.2+ renamed to markDirty
+ @Override
+ public void markDirty()
+ {
+ for (int i = 0; i < this.getSizeInventory(); ++i)
+ {
+ final ItemStack temp = this.getStackInSlot(i);
+ if (temp != null){
+ //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize);
+ }
+
+ if ((temp != null) && (temp.stackSize == 0)) {
+ this.inventory[i] = null;
+ }
+ }
+ }
+
+ @Override
+ public boolean isUseableByPlayer(final EntityPlayer entityplayer)
+ {
+ return true;
+ }
+
+ // 1.7.2+ renamed to openInventory(EntityPlayer player)
+ @Override
+ public void openInventory() {}
+
+ // 1.7.2+ renamed to closeInventory(EntityPlayer player)
+ @Override
+ public void closeInventory() {}
+
+ /**
+ * This method doesn't seem to do what it claims to do, as
+ * items can still be left-clicked and placed in the inventory
+ * even when this returns false
+ */
+ @Override
+ public boolean isItemValidForSlot(final int slot, final ItemStack itemstack)
+ {
+ // Don't want to be able to store the inventory item within itself
+ // Bad things will happen, like losing your inventory
+ // Actually, this needs a custom Slot to work
+ return true;
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java b/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java
index 46f290753b..4ba475f4be 100644
--- a/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java
+++ b/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java
@@ -13,6 +13,7 @@ import gtPlusPlus.core.util.nbt.ModularArmourUtils;
import gtPlusPlus.core.util.nbt.ModularArmourUtils.BT;
import gtPlusPlus.core.util.nbt.ModularArmourUtils.Modifiers;
import gtPlusPlus.core.util.nbt.NBTUtils;
+import gtPlusPlus.core.util.player.PlayerUtils;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
@@ -37,70 +38,70 @@ public class ModularBauble extends BaseBauble{
//Get Stats
int mStatlevel = 0;
if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_DAMAGE)) > 0){
- if (mStatlevel == 1){
+ if (mStatlevel > 0 && mStatlevel < 20){
attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "AD"+mStatlevel, 1, 0));
}
- else if (mStatlevel == 2){
+ else if (mStatlevel > 20 && mStatlevel < 45){
attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "AD"+mStatlevel, 2, 0));
}
- else if (mStatlevel == 3){
+ else if (mStatlevel >= 45 && mStatlevel < 75){
attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "AD"+mStatlevel, 4, 0));
}
- else if (mStatlevel == 4){
+ else if (mStatlevel >= 75 && mStatlevel < 99){
attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "AD"+mStatlevel, 8, 0));
}
- else if (mStatlevel == 5){
+ else if (mStatlevel >= 100){
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){
+ if (mStatlevel > 0 && mStatlevel < 20){
attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "BD"+mStatlevel, 1, 0));
}
- else if (mStatlevel == 2){
+ else if (mStatlevel > 20 && mStatlevel < 45){
attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "BD"+mStatlevel, 2, 0));
}
- else if (mStatlevel == 3){
+ else if (mStatlevel > 45 && mStatlevel < 75){
attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "BD"+mStatlevel, 3, 0));
}
- else if (mStatlevel == 4){
+ else if (mStatlevel > 75 && mStatlevel < 99){
attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "BD"+mStatlevel, 6, 0));
}
- else if (mStatlevel == 5){
+ else if (mStatlevel >= 100){
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){
+ if (mStatlevel > 0 && mStatlevel < 20){
attributes.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "HP"+mStatlevel, 15, 0));
}
- else if (mStatlevel == 2){
+ else if (mStatlevel > 20 && mStatlevel < 45){
attributes.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "HP"+mStatlevel, 20, 0));
}
- else if (mStatlevel == 3){
+ else if (mStatlevel > 45 && mStatlevel < 75){
attributes.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "HP"+mStatlevel, 25, 0));
}
- else if (mStatlevel == 4){
+ else if (mStatlevel > 75 && mStatlevel < 99){
attributes.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "HP"+mStatlevel, 30, 0));
}
- else if (mStatlevel == 5){
+ else if (mStatlevel >= 100){
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){
+ if (mStatlevel > 0 && mStatlevel < 20){
attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "SP"+mStatlevel, 1, 0));
}
- else if (mStatlevel == 2){
+ else if (mStatlevel > 20 && mStatlevel < 45){
attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "SP"+mStatlevel, 2, 0));
}
- else if (mStatlevel == 3){
+ else if (mStatlevel > 45 && mStatlevel < 75){
attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "SP"+mStatlevel, 3, 0));
}
- else if (mStatlevel == 4){
+ else if (mStatlevel > 75 && mStatlevel < 99){
attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "SP"+mStatlevel, 4, 0));
}
- else if (mStatlevel == 5){
+ else if (mStatlevel >= 100){
attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "SP"+mStatlevel, 5, 0));
}
}
@@ -131,23 +132,63 @@ public class ModularBauble extends BaseBauble{
//Get Stats
int mStatlevel = 0;
if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_DAMAGE)) > 0){
- list.add(EnumChatFormatting.GRAY+"Damage Boost: "+EnumChatFormatting.DARK_RED+mStatlevel+EnumChatFormatting.GRAY+".");
- }
- if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_DEF)) > 0){
- list.add(EnumChatFormatting.GRAY+"Defence Boost: "+EnumChatFormatting.BLUE+mStatlevel+EnumChatFormatting.GRAY+".");
+ list.add(EnumChatFormatting.GRAY+"Damage Boost: "+EnumChatFormatting.DARK_RED+mStatlevel+EnumChatFormatting.GRAY+"/100.");
}
+
if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_HP)) > 0){
- list.add(EnumChatFormatting.GRAY+"Health Boost: "+EnumChatFormatting.RED+mStatlevel+EnumChatFormatting.GRAY+".");
+ list.add(EnumChatFormatting.GRAY+"Health Boost: "+EnumChatFormatting.RED+mStatlevel+EnumChatFormatting.GRAY+"/100.");
}
if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_SPEED)) > 0){
- list.add(EnumChatFormatting.GRAY+"Speed Boost: "+EnumChatFormatting.WHITE+mStatlevel+EnumChatFormatting.GRAY+".");
+ list.add(EnumChatFormatting.GRAY+"Speed Boost: "+EnumChatFormatting.WHITE+mStatlevel+EnumChatFormatting.GRAY+"/100.");
}
if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_MINING)) > 0){
- list.add(EnumChatFormatting.GRAY+"Mining Boost: "+EnumChatFormatting.DARK_GRAY+mStatlevel+EnumChatFormatting.GRAY+".");
+ list.add(EnumChatFormatting.GRAY+"Mining Boost: "+EnumChatFormatting.DARK_GRAY+mStatlevel+EnumChatFormatting.GRAY+"/100.");
}
if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_HOLY)) > 0){
- list.add(EnumChatFormatting.GRAY+"Holy Boost: "+EnumChatFormatting.GOLD+mStatlevel+EnumChatFormatting.GRAY+".");
+ list.add(EnumChatFormatting.GRAY+"Holy Boost: "+EnumChatFormatting.GOLD+mStatlevel+EnumChatFormatting.GRAY+"/100.");
+ }
+
+ //Defence Boost
+ if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_DEF)) > 0){
+ list.add(EnumChatFormatting.GRAY+"Defence Boost: "+EnumChatFormatting.BLUE+mStatlevel+EnumChatFormatting.GRAY+"/100.");
+
+ if (mStatlevel >= 1){
+ list.add(EnumChatFormatting.GRAY+"Protected From: "+EnumChatFormatting.BLUE+"Cactus"+EnumChatFormatting.GRAY+".");
+ }
+ if (mStatlevel >= 10){
+ list.add(EnumChatFormatting.GRAY+"Protected From: "+EnumChatFormatting.BLUE+"Falling Blocks"+EnumChatFormatting.GRAY+".");
+ }
+ if (mStatlevel >= 20){
+ list.add(EnumChatFormatting.GRAY+"Protected From: "+EnumChatFormatting.BLUE+"Wall Suffocation"+EnumChatFormatting.GRAY+".");
+ }
+ if (mStatlevel >= 35){
+ list.add(EnumChatFormatting.GRAY+"Protected From: "+EnumChatFormatting.BLUE+"Drowning"+EnumChatFormatting.GRAY+".");
+ }
+ if (mStatlevel >= 50){
+ list.add(EnumChatFormatting.GRAY+"Protected From: "+EnumChatFormatting.BLUE+"Starvation"+EnumChatFormatting.GRAY+".");
+ }
+ if (mStatlevel >= 60){
+ list.add(EnumChatFormatting.GRAY+"Protected From: "+EnumChatFormatting.BLUE+"Falling"+EnumChatFormatting.GRAY+".");
+ }
+ if (mStatlevel >= 75){
+ list.add(EnumChatFormatting.GRAY+"Protected From: "+EnumChatFormatting.BLUE+"Lava"+EnumChatFormatting.GRAY+".");
+ }
+ if (mStatlevel >= 80){
+ list.add(EnumChatFormatting.GRAY+"Protected From: "+EnumChatFormatting.BLUE+"Magic"+EnumChatFormatting.GRAY+".");
+ }
+ if (mStatlevel >= 95){
+ list.add(EnumChatFormatting.GRAY+"Protected From: "+EnumChatFormatting.BLUE+"Wither"+EnumChatFormatting.GRAY+".");
+ }
+ if (mStatlevel >= 100){
+ list.add(EnumChatFormatting.GRAY+"Protected From: "+EnumChatFormatting.BLUE+"Fire"+EnumChatFormatting.GRAY+".");
+ }
+ if (mStatlevel >= 100){
+ list.add(EnumChatFormatting.GRAY+"Protected From: "+EnumChatFormatting.BLUE+"Void"+EnumChatFormatting.GRAY+".");
+ }
+
}
+
+
if (NBTUtils.getBotanicaSoulboundOwner(stack) != null){
if (!NBTUtils.getBotanicaSoulboundOwner(stack).equals("")){
list.add(EnumChatFormatting.GRAY+"Relic Owner: "+EnumChatFormatting.GREEN+NBTUtils.getBotanicaSoulboundOwner(stack)+EnumChatFormatting.GRAY+".");
@@ -163,22 +204,42 @@ public class ModularBauble extends BaseBauble{
this.clearDamageNegation();
int mStatlevel = 0;
if ((mStatlevel = ModularArmourUtils.getModifierLevel(aStack, Modifiers.BOOST_HOLY)) > 0){
- addDamageNegation(DamageSource.cactus);
- if (mStatlevel == 1){
+ if (mStatlevel >= 1){
+ addDamageNegation(DamageSource.cactus);
+ }
+ if (mStatlevel >= 10){
+ addDamageNegation(DamageSource.fallingBlock);
+ }
+ if (mStatlevel >= 20){
addDamageNegation(DamageSource.inWall);
}
- else if (mStatlevel == 2){
+ if (mStatlevel >= 35){
addDamageNegation(DamageSource.drown);
}
- else if (mStatlevel == 3){
+ if (mStatlevel >= 50){
addDamageNegation(DamageSource.starve);
}
- else if (mStatlevel == 4){
+ if (mStatlevel >= 60){
addDamageNegation(DamageSource.fall);
}
- else if (mStatlevel == 5){
+ if (mStatlevel >= 75){
addDamageNegation(DamageSource.lava);
}
+ if (mStatlevel >= 80){
+ addDamageNegation(DamageSource.magic);
+ }
+ if (mStatlevel >= 95){
+ addDamageNegation(DamageSource.wither);
+ }
+ if (mStatlevel >= 100){
+ addDamageNegation(DamageSource.inFire);
+ }
+ if (mStatlevel >= 100){
+ addDamageNegation(DamageSource.onFire);
+ }
+ if (mStatlevel >= 100){
+ addDamageNegation(DamageSource.outOfWorld);
+ }
}
return super.addDamageNegation(damageSource, null);
}
@@ -197,6 +258,9 @@ public class ModularBauble extends BaseBauble{
else {
this.SetBaubleType(BT.TYPE_RING);
}
+ if (PlayerUtils.isPlayerOP((EntityPlayer) arg1)){