diff --git a/build.gradle b/build.gradle index 9646a11..f448486 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "DEV" +version = "DEV1" group= "lumaceon.mods.clockworkphase2" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "clockworkphase2" diff --git a/src/main/java/lumaceon/mods/clockworkphase2/api/block/clockwork/IClockworkDestination.java b/src/main/java/lumaceon/mods/clockworkphase2/api/block/clockwork/IClockworkDestination.java deleted file mode 100644 index a847c87..0000000 --- a/src/main/java/lumaceon/mods/clockworkphase2/api/block/clockwork/IClockworkDestination.java +++ /dev/null @@ -1,16 +0,0 @@ -package lumaceon.mods.clockworkphase2.api.block.clockwork; - -import net.minecraftforge.common.util.ForgeDirection; - -public interface IClockworkDestination extends IClockworkTile -{ - public boolean canReceiveFrom(ForgeDirection direction); - - /** - * Called to transfer clockwork energy into this destination. - * - * @param maxReception The amount of energy this destination is being exposed to. - * @return The amount of energy taken by this destination. - */ - public int receiveClockworkEnergy(ForgeDirection from, int maxReception); -} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/api/block/clockwork/IClockworkNetworkMachine.java b/src/main/java/lumaceon/mods/clockworkphase2/api/block/clockwork/IClockworkNetworkMachine.java new file mode 100644 index 0000000..a685722 --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/api/block/clockwork/IClockworkNetworkMachine.java @@ -0,0 +1,12 @@ +package lumaceon.mods.clockworkphase2.api.block.clockwork; + +import lumaceon.mods.clockworkphase2.api.clockworknetwork.ClockworkNetworkContainer; + +public interface IClockworkNetworkMachine extends IClockworkNetworkTile +{ + /** + * Go through a proxy to separate client and server code here. + * @return A Clockwork Network GUI class representing this gui. + */ + public ClockworkNetworkContainer getGui(); +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/api/block/clockwork/IClockworkNetworkTile.java b/src/main/java/lumaceon/mods/clockworkphase2/api/block/clockwork/IClockworkNetworkTile.java new file mode 100644 index 0000000..fa1a12f --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/api/block/clockwork/IClockworkNetworkTile.java @@ -0,0 +1,11 @@ +package lumaceon.mods.clockworkphase2.api.block.clockwork; + +import lumaceon.mods.clockworkphase2.api.util.ClockworkNetwork; + +/** + * Tiles implementing this are marked as being part of a clockwork network. + */ +public interface IClockworkNetworkTile +{ + public ClockworkNetwork getClockworkNetwork(); +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/api/block/clockwork/IClockworkSource.java b/src/main/java/lumaceon/mods/clockworkphase2/api/block/clockwork/IClockworkSource.java deleted file mode 100644 index 5c83785..0000000 --- a/src/main/java/lumaceon/mods/clockworkphase2/api/block/clockwork/IClockworkSource.java +++ /dev/null @@ -1,16 +0,0 @@ -package lumaceon.mods.clockworkphase2.api.block.clockwork; - -import net.minecraftforge.common.util.ForgeDirection; - -public interface IClockworkSource extends IClockworkTile -{ - public boolean canDistributeTo(ForgeDirection direction); - - /** - * Called to transfer clockwork energy from this source outward. - * - * @param maxExtraction The amount of energy trying to be extracted. - * @return The amount of energy taken from this source. - */ - public int distributeClockworkEnergy(ForgeDirection direction, int maxExtraction); -} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/api/block/clockwork/IClockworkTile.java b/src/main/java/lumaceon/mods/clockworkphase2/api/block/clockwork/IClockworkTile.java deleted file mode 100644 index 69234fb..0000000 --- a/src/main/java/lumaceon/mods/clockworkphase2/api/block/clockwork/IClockworkTile.java +++ /dev/null @@ -1,14 +0,0 @@ -package lumaceon.mods.clockworkphase2.api.block.clockwork; - -public interface IClockworkTile -{ - public int getMaxCapacity(); - public int getEnergyStored(); - - /** - * All clockwork tiles can be wound up, regardless of whether they are a destination or not. - * @param tension Tension to wind. - * @return The tension that was wound. - */ - public int wind(int tension); -} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/api/block/clockwork/IMainspringTile.java b/src/main/java/lumaceon/mods/clockworkphase2/api/block/clockwork/IMainspringTile.java new file mode 100644 index 0000000..f35f464 --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/api/block/clockwork/IMainspringTile.java @@ -0,0 +1,6 @@ +package lumaceon.mods.clockworkphase2.api.block.clockwork; + +public interface IMainspringTile extends IClockworkNetworkTile +{ + +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/api/clockworknetwork/ClockworkNetworkContainer.java b/src/main/java/lumaceon/mods/clockworkphase2/api/clockworknetwork/ClockworkNetworkContainer.java new file mode 100644 index 0000000..e00858c --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/api/clockworknetwork/ClockworkNetworkContainer.java @@ -0,0 +1,45 @@ +package lumaceon.mods.clockworkphase2.api.clockworknetwork; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.tileentity.TileEntity; + +public abstract class ClockworkNetworkContainer +{ + public TileEntity te; + protected int xSize, ySize; + + public ClockworkNetworkContainer(TileEntity te, int xSize, int ySize) { + this.te = te; + this.xSize = xSize; + this.ySize = ySize; + } + /** + * Gets a list of slots for the corresponding container, coordinates should be local (based on this GUI). + * @return A list of slots or null if the gui has none. + */ + public abstract Slot[] getSlots(); + + public int getSizeX() { return xSize; } + public int getSizeY() { return ySize; } + + /** + * @return The number of values this container needs to update. + */ + public int getUpdateCount() { + return 0; + } + + /** + * Called for initial GUI parameter updates. + */ + public void initialCraftingUpdate(ICrafting crafting, int startingIndex, Container container) {} + + public void detectAndSendChanges(ICrafting crafting, int startingIndex, Container container) {} + + @SideOnly(Side.CLIENT) + public void updateProgressBar(int id, int value) {} +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/api/clockworknetwork/ClockworkNetworkGuiClient.java b/src/main/java/lumaceon/mods/clockworkphase2/api/clockworknetwork/ClockworkNetworkGuiClient.java new file mode 100644 index 0000000..2f1433e --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/api/clockworknetwork/ClockworkNetworkGuiClient.java @@ -0,0 +1,45 @@ +package lumaceon.mods.clockworkphase2.api.clockworknetwork; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.tileentity.TileEntity; + +import java.util.List; + +public abstract class ClockworkNetworkGuiClient extends ClockworkNetworkContainer +{ + public ClockworkNetworkGuiClient(TileEntity te, int xSize, int ySize) { + super(te, xSize, ySize); + } + + /** + * Called to get buttons to initialize every time the master gui is initialized. Buttons should be created with + * local IDs starting from 0 and going up like a standard gui. + * @param guiLeft Left coordinate of this gui. + * @param guiTop Top coordinate of this gui. + * @return A list of buttons which will be added to the master gui. + */ + public List getButtonsToAdd(int guiLeft, int guiTop) { return null; } + + /** + * Similar to actionPerformed in GuiScreen, except that the id parameter passed in should be used rather than the + * id of the button itself. + * @param button The button clicked. + * @param id The id of the button in relation to this gui. + */ + public void actionPerformed(GuiButton button, int id) {} + + public abstract void drawBackground(int left, int top, float zLevel); + public abstract void drawForeground(int left, int top, float zLevel); + + public void drawTexturedModalRect(int left, int top, int xSize, int ySize, float zLevel) + { + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + tessellator.addVertexWithUV((double) left, (double)(top + ySize), (double) zLevel, 0, 1); + tessellator.addVertexWithUV((double)(left + xSize), (double)(top + ySize), (double) zLevel, 1, 1); + tessellator.addVertexWithUV((double) (left + xSize), (double) top, (double) zLevel, 1, 0); + tessellator.addVertexWithUV((double) left, (double) top, (double) zLevel, 0, 0); + tessellator.draw(); + } +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/api/item/IToolUpgrade.java b/src/main/java/lumaceon/mods/clockworkphase2/api/item/IToolUpgrade.java index a7b5ad3..4b36c6d 100644 --- a/src/main/java/lumaceon/mods/clockworkphase2/api/item/IToolUpgrade.java +++ b/src/main/java/lumaceon/mods/clockworkphase2/api/item/IToolUpgrade.java @@ -6,16 +6,18 @@ public interface IToolUpgrade { /** * Called to activate or deactivate this tool upgrade - * @param item A stack representing the tool upgrade. + * @param upgradeStack A stack representing the tool upgrade. + * @param toolStack A stack representing the tool this is upgrade is in. * @param active True to set this to active, false to turn it off. */ - public void setActive(ItemStack item, boolean active); + public void setActive(ItemStack upgradeStack, ItemStack toolStack, boolean active); /** - * @param item The tool upgrade stack. + * @param upgradeStack The tool upgrade stack. + * @param toolStack The tool this upgrade is in. * @return Whether or not this itemstack is active. */ - public boolean getActive(ItemStack item); + public boolean getActive(ItemStack upgradeStack, ItemStack toolStack); public float getQualityMultiplier(ItemStack item); public float getSpeedMultiplier(ItemStack item); diff --git a/src/main/java/lumaceon/mods/clockworkphase2/api/util/ClockworkNetwork.java b/src/main/java/lumaceon/mods/clockworkphase2/api/util/ClockworkNetwork.java new file mode 100644 index 0000000..ea9a4fa --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/api/util/ClockworkNetwork.java @@ -0,0 +1,40 @@ +package lumaceon.mods.clockworkphase2.api.util; + +import lumaceon.mods.clockworkphase2.api.block.clockwork.IClockworkNetworkMachine; +import lumaceon.mods.clockworkphase2.api.block.clockwork.IMainspringTile; + +import java.util.ArrayList; + +public class ClockworkNetwork +{ + private ArrayList mainsprings = new ArrayList(2); + private ArrayList machines = new ArrayList(5); + + public void addMainspring(IMainspringTile mainspring) { + for(IMainspringTile m : mainsprings) + if(m.equals(mainspring)) + return; + mainsprings.add(mainspring); + } + + public void addMachine(IClockworkNetworkMachine clockworkMachine) { + for(IClockworkNetworkMachine m : machines) + if(m.equals(clockworkMachine)) + return; + machines.add(clockworkMachine); + } + + public ArrayList getMainsprings() { return mainsprings; } + public ArrayList getMachines() { return machines; } + + public void joinNetworks(ClockworkNetwork clockworkNetwork) + { + ArrayList newNetworkMainsprings = clockworkNetwork.getMainsprings(); + ArrayList newNetworkMachines = clockworkNetwork.getMachines(); + for(IMainspringTile m : newNetworkMainsprings) + addMainspring(m); + + for(IClockworkNetworkMachine m : newNetworkMachines) + addMachine(m); + } +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/block/BlockMoonFlower.java b/src/main/java/lumaceon/mods/clockworkphase2/block/BlockMoonFlower.java index a303c0f..af08453 100644 --- a/src/main/java/lumaceon/mods/clockworkphase2/block/BlockMoonFlower.java +++ b/src/main/java/lumaceon/mods/clockworkphase2/block/BlockMoonFlower.java @@ -27,8 +27,7 @@ public class BlockMoonFlower extends BlockClockworkPhase implements IPlantable, @SideOnly(Side.CLIENT) private IIcon[] blockIcons; - public BlockMoonFlower(Material blockMaterial, String unlocalizedName) - { + public BlockMoonFlower(Material blockMaterial, String unlocalizedName) { super(blockMaterial, unlocalizedName); this.setHardness(0.0F); this.setTickRandomly(true); @@ -48,8 +47,7 @@ protected boolean canPlaceBlockOn(Block block) { } @Override - public void onNeighborBlockChange(World world, int x, int y, int z, Block block) - { + public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { super.onNeighborBlockChange(world, x, y, z, block); this.checkAndDropBlock(world, x, y, z); } @@ -59,22 +57,23 @@ public void updateTick(World world, int x, int y, int z, Random random) { this.checkAndDropBlock(world, x, y, z); int meta = world.getBlockMetadata(x, y, z); - if(meta < 3) + if(world.canBlockSeeTheSky(x, y, z)) { - if(world.canBlockSeeTheSky(x, y, z) && !world.isDaytime() && random.nextInt(2) == 0) + if(!world.isDaytime()) //It's nighttime, plant can grow taller if lucky. { - ++meta; - world.setBlockMetadataWithNotify(x, y, z, meta, 2); + if(meta <= 3 && random.nextInt(5) == 0) + { + ++meta; + world.setBlockMetadataWithNotify(x, y, z, meta, 2); + } } - } - else if(meta == 3) - { - if(world.canBlockSeeTheSky(x, y, z) && !world.isDaytime()) + else //It's daytime, plant WILL grow backwards if possible { - if(Phases.isPhaseActive(world, x, y, z, Phases.elysianComet)) - world.setBlockMetadataWithNotify(x, y, z, 5, 2); //Set meta to 5 (temporal material) - else - world.setBlockMetadataWithNotify(x, y, z, 4, 2); //Set meta to 4 (moon pearl) + if(meta > 0) + { + --meta; + world.setBlockMetadataWithNotify(x, y, z, meta, 2); + } } } } @@ -117,14 +116,7 @@ protected Item getSeeds() { } protected Item getProduce(int metadata) { - switch(metadata) - { - case 4: - return ModItems.moonPearl; - case 5: - return ModItems.elysianGem; - } - return null; + return metadata == 4 ? ModItems.temporalPearl : null; } public void dropBlockAsItemWithChance(World world, int x, int y, int z, int p_149690_5_, float p_149690_6_, int p_149690_7_) { diff --git a/src/main/java/lumaceon/mods/clockworkphase2/block/clockwork/BlockClockworkBrewery.java b/src/main/java/lumaceon/mods/clockworkphase2/block/clockwork/BlockClockworkBrewery.java new file mode 100644 index 0000000..66444ee --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/block/clockwork/BlockClockworkBrewery.java @@ -0,0 +1,20 @@ +package lumaceon.mods.clockworkphase2.block.clockwork; + +import lumaceon.mods.clockworkphase2.block.BlockClockworkPhase; +import lumaceon.mods.clockworkphase2.tile.clockwork.TileClockworkBrewery; +import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.material.Material; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class BlockClockworkBrewery extends BlockClockworkPhase implements ITileEntityProvider +{ + public BlockClockworkBrewery(Material blockMaterial, String unlocalizedName) { + super(blockMaterial, unlocalizedName); + } + + @Override + public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { + return new TileClockworkBrewery(); + } +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/block/clockwork/BlockClockworkController.java b/src/main/java/lumaceon/mods/clockworkphase2/block/clockwork/BlockClockworkController.java new file mode 100644 index 0000000..5fe0f8c --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/block/clockwork/BlockClockworkController.java @@ -0,0 +1,32 @@ +package lumaceon.mods.clockworkphase2.block.clockwork; + +import lumaceon.mods.clockworkphase2.ClockworkPhase2; +import lumaceon.mods.clockworkphase2.block.BlockClockworkPhase; +import lumaceon.mods.clockworkphase2.tile.clockwork.TileClockworkController; +import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.material.Material; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class BlockClockworkController extends BlockClockworkPhase implements ITileEntityProvider +{ + public BlockClockworkController(Material blockMaterial, String unlocalizedName) { + super(blockMaterial, unlocalizedName); + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int meta, float f0, float f1, float f2) + { + if(player.isSneaking()) + return false; + if(!world.isRemote) + player.openGui(ClockworkPhase2.instance, 5, world, x, y, z); + return true; + } + + @Override + public TileEntity createNewTileEntity(World world, int p_149915_2_) { + return new TileClockworkController(); + } +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/block/clockwork/BlockClockworkMixer.java b/src/main/java/lumaceon/mods/clockworkphase2/block/clockwork/BlockClockworkMixer.java new file mode 100644 index 0000000..b42994e --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/block/clockwork/BlockClockworkMixer.java @@ -0,0 +1,20 @@ +package lumaceon.mods.clockworkphase2.block.clockwork; + +import lumaceon.mods.clockworkphase2.block.BlockClockworkPhase; +import lumaceon.mods.clockworkphase2.tile.clockwork.TileClockworkMixer; +import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.material.Material; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class BlockClockworkMixer extends BlockClockworkPhase implements ITileEntityProvider +{ + public BlockClockworkMixer(Material blockMaterial, String unlocalizedName) { + super(blockMaterial, unlocalizedName); + } + + @Override + public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { + return new TileClockworkMixer(); + } +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/block/clockwork/BlockCrank.java b/src/main/java/lumaceon/mods/clockworkphase2/block/clockwork/BlockCrank.java index 3810440..224d968 100644 --- a/src/main/java/lumaceon/mods/clockworkphase2/block/clockwork/BlockCrank.java +++ b/src/main/java/lumaceon/mods/clockworkphase2/block/clockwork/BlockCrank.java @@ -1,6 +1,6 @@ package lumaceon.mods.clockworkphase2.block.clockwork; -import lumaceon.mods.clockworkphase2.api.block.clockwork.IClockworkTile; +import lumaceon.mods.clockworkphase2.api.block.clockwork.IClockworkNetworkTile; import lumaceon.mods.clockworkphase2.block.BlockClockworkPhase; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; @@ -18,42 +18,42 @@ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer p { if(!player.isSneaking()) { - TileEntity te = world.getTileEntity(x + 1, y, z); - if(te != null && te instanceof IClockworkTile) + /*TileEntity te = world.getTileEntity(x + 1, y, z); + if(te != null && te instanceof IClockworkNetworkTile) { - ((IClockworkTile) te).wind(1000 * 10); + ((IClockworkNetworkTile) te).wind(1000 * 10); return false; } te = world.getTileEntity(x - 1, y, z); - if(te != null && te instanceof IClockworkTile) + if(te != null && te instanceof IClockworkNetworkTile) { - ((IClockworkTile) te).wind(1000 * 10); + ((IClockworkNetworkTile) te).wind(1000 * 10); return false; } te = world.getTileEntity(x, y + 1, z); - if(te != null && te instanceof IClockworkTile) + if(te != null && te instanceof IClockworkNetworkTile) { - ((IClockworkTile) te).wind(1000 * 10); + ((IClockworkNetworkTile) te).wind(1000 * 10); return false; } te = world.getTileEntity(x, y - 1, z); - if(te != null && te instanceof IClockworkTile) + if(te != null && te instanceof IClockworkNetworkTile) { - ((IClockworkTile) te).wind(1000 * 10); + ((IClockworkNetworkTile) te).wind(1000 * 10); return false; } te = world.getTileEntity(x, y, z + 1); - if(te != null && te instanceof IClockworkTile) + if(te != null && te instanceof IClockworkNetworkTile) { - ((IClockworkTile) te).wind(1000 * 10); + ((IClockworkNetworkTile) te).wind(1000 * 10); return false; } te = world.getTileEntity(x, y, z - 1); - if(te != null && te instanceof IClockworkTile) + if(te != null && te instanceof IClockworkNetworkTile) { - ((IClockworkTile) te).wind(1000 * 10); + ((IClockworkNetworkTile) te).wind(1000 * 10); return false; - } + }*/ } return false; } diff --git a/src/main/java/lumaceon/mods/clockworkphase2/block/itemblock/ItemBlockClockworkBrewery.java b/src/main/java/lumaceon/mods/clockworkphase2/block/itemblock/ItemBlockClockworkBrewery.java new file mode 100644 index 0000000..c568f5c --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/block/itemblock/ItemBlockClockworkBrewery.java @@ -0,0 +1,11 @@ +package lumaceon.mods.clockworkphase2.block.itemblock; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemBlock; + +public class ItemBlockClockworkBrewery extends ItemBlock +{ + public ItemBlockClockworkBrewery(Block p_i45328_1_) { + super(p_i45328_1_); + } +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/block/itemblock/ItemBlockClockworkMixer.java b/src/main/java/lumaceon/mods/clockworkphase2/block/itemblock/ItemBlockClockworkMixer.java new file mode 100644 index 0000000..85a32ca --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/block/itemblock/ItemBlockClockworkMixer.java @@ -0,0 +1,11 @@ +package lumaceon.mods.clockworkphase2.block.itemblock; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemBlock; + +public class ItemBlockClockworkMixer extends ItemBlock +{ + public ItemBlockClockworkMixer(Block p_i45328_1_) { + super(p_i45328_1_); + } +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/client/gui/GuiClockworkController.java b/src/main/java/lumaceon/mods/clockworkphase2/client/gui/GuiClockworkController.java new file mode 100644 index 0000000..33abe64 --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/client/gui/GuiClockworkController.java @@ -0,0 +1,354 @@ +package lumaceon.mods.clockworkphase2.client.gui; + +import lumaceon.mods.clockworkphase2.api.block.clockwork.IClockworkNetworkMachine; +import lumaceon.mods.clockworkphase2.api.clockworknetwork.ClockworkNetworkContainer; +import lumaceon.mods.clockworkphase2.api.clockworknetwork.ClockworkNetworkGuiClient; +import lumaceon.mods.clockworkphase2.api.util.ClockworkNetwork; +import lumaceon.mods.clockworkphase2.client.gui.components.GuiButtonCNGui; +import lumaceon.mods.clockworkphase2.client.gui.components.GuiCNGuiElement; +import lumaceon.mods.clockworkphase2.container.ContainerClockworkController; +import lumaceon.mods.clockworkphase2.lib.Textures; +import lumaceon.mods.clockworkphase2.tile.clockwork.TileClockworkController; +import lumaceon.mods.clockworkphase2.util.ChildGuiData; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.world.World; +import org.lwjgl.opengl.GL11; + +import java.util.ArrayList; + +public class GuiClockworkController extends GuiContainer +{ + private Minecraft mc = Minecraft.getMinecraft(); + private ScaledResolution resolution; + private State guiState = State.DEFAULT; + public TileClockworkController te; + public InventoryPlayer ip; + + public ArrayList guiDataList = new ArrayList(8); + private ArrayList inactiveGUIs = new ArrayList(8); + private ClockworkNetwork cn; + private int pageNumber = 0; + + private int mouseClickedAtX, mouseClickedAtY, selectionOriginX, selectionOriginY; + private GuiCNGuiElement selectedConfigurationGui = null; + + //Fixes a bug where actionPerformed is called twice if the state changes and adds a button at the clicked location + private boolean stateChangedThisTick = false; + + public GuiClockworkController(InventoryPlayer ip, TileClockworkController te, World world) { + super(null); + this.resolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); + this.inventorySlots = new ContainerClockworkController(ip, te, world, resolution.getScaledWidth(), resolution.getScaledHeight()); + this.te = te; + this.ip = ip; + this.cn = te.getClockworkNetwork(); + this.xSize = resolution.getScaledWidth(); + this.ySize = resolution.getScaledHeight(); + } + + @Override + public void initGui() + { + resolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); + this.xSize = resolution.getScaledWidth(); + this.ySize = resolution.getScaledHeight(); + super.initGui(); + + buttonList.clear(); + calculateActiveGUIs(); + if(guiState.equals(State.DEFAULT)) + { + ((ContainerClockworkController)inventorySlots).reinitializeSlots(ip, guiDataList, guiLeft - 86 + xSize / 2, guiTop + ySize - 85, xSize, ySize, false); + buttonList.add(new GuiButton(0, guiLeft - 125 + xSize / 2, guiTop + 4, 250, 20, "Configure GUI")); + } + else if(guiState.equals(State.CONFIG)) + { + ((ContainerClockworkController)inventorySlots).reinitializeSlots(ip, guiDataList, 0, 0, xSize, ySize, true); + buttonList.add(new GuiButton(0, guiLeft, guiTop, 60, 20, "Save Setup")); + buttonList.add(new GuiButton(1, guiLeft + xSize - 20, guiTop, 20, 20, "+")); + + int iterations = 0; + if(guiDataList != null && !guiDataList.isEmpty()) + for(ChildGuiData child : guiDataList) + if(child != null && child.gui != null && child.machine != null) + { + buttonList.add(new GuiCNGuiElement(child, 2+iterations, child.getX(xSize), child.getY(ySize), child.gui.getSizeX(), child.gui.getSizeY())); + ++iterations; + } + } + else if(guiState.equals(State.ADD_MACHINE)) + { + ((ContainerClockworkController)inventorySlots).reinitializeSlots(ip, guiDataList, 0, 0, xSize, ySize, true); + buttonList.add(new GuiButton(0, guiLeft - 30 + xSize / 2, guiTop, 60, 20, "Done")); + buttonList.add(new GuiButton(1, guiLeft, guiTop, 20, 20, "<-")); + buttonList.add(new GuiButton(2, guiLeft + xSize - 20, guiTop, 20, 20, "->")); + + int iterations = 0; + if(inactiveGUIs != null && !inactiveGUIs.isEmpty()) + for(int n = pageNumber*4; n < inactiveGUIs.size() && n < (pageNumber+1) * 4; n++) + { + ChildGuiData child = inactiveGUIs.get(n); + if(child != null) + { + buttonList.add(new GuiButtonCNGui(child.gui, 3+iterations, child.getX(xSize), child.getY(ySize), child.gui.getSizeX(), child.gui.getSizeY())); + ++iterations; + } + } + } + } + + private void calculateActiveGUIs() + { + inactiveGUIs.clear(); + int iterations = 0; + ArrayList machines = cn.getMachines(); + if(machines != null) + for(IClockworkNetworkMachine machine : machines) + if(machine != null) + { + ClockworkNetworkContainer gui = machine.getGui(); + if(gui != null) + { + boolean skip = false; + for(ChildGuiData child : guiDataList) //Don't list active GUIs as inactive. + if(child != null && child.machine != null && child.machine.equals(machine)) + { + skip = true; + break; + } + if(skip) + continue; + int x = iterations % 2 == 0 ? guiLeft : xSize - gui.getSizeX(); + int y = iterations % 4 >= 2 ? 160 : 40; + inactiveGUIs.add(new ChildGuiData(machine, gui, x, y, xSize, ySize)); + ++iterations; + } + } + } + + @Override + public void drawScreen(int x, int y, float partialTicks) { + super.drawScreen(x, y, partialTicks); + if(stateChangedThisTick) + stateChangedThisTick = false; + } + + @Override + protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) + { + GL11.glEnable(GL11.GL_BLEND); + drawStaticBackgrounds(); + GL11.glColor4f(1F, 1F, 1F, 1F); + if(guiState.equals(State.DEFAULT)) + for(ChildGuiData child : guiDataList) + if(child.gui != null && child.gui instanceof ClockworkNetworkGuiClient) + ((ClockworkNetworkGuiClient) child.gui).drawBackground(guiLeft + child.getX(xSize), guiTop + child.getY(ySize), zLevel); + } + + @Override + protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) + { + GL11.glEnable(GL11.GL_BLEND); + GL11.glColor4f(1F, 1F, 1F, 1F); + if(guiState.equals(State.DEFAULT)) + for(ChildGuiData child : guiDataList) + if(child.gui != null && child.gui instanceof ClockworkNetworkGuiClient) + ((ClockworkNetworkGuiClient) child.gui).drawForeground(guiLeft + child.getX(xSize), guiTop + child.getY(ySize), zLevel); + } + + @Override + public void actionPerformed(GuiButton button) + { + if(stateChangedThisTick) + return; + switch(guiState.ordinal()) + { + case 0: //DEFAULT + setGuiState(State.CONFIG); + initGui(); + return; + case 1: //CONFIG + switch(button.id) + { + case 0: //Save + setGuiState(State.DEFAULT); + initGui(); + return; + case 1: //Add machine + setGuiState(State.ADD_MACHINE); + pageNumber = 0; + initGui(); + return; + } + return; + case 2: //ADD_MACHINE + switch(button.id) + { + case 0: //Done, back to config state. + setGuiState(State.CONFIG); + initGui(); + return; + case 1: //Scroll left + --pageNumber; + if(pageNumber < 0) + pageNumber = (inactiveGUIs.size()-1) / 4; + initGui(); + return; + case 2: //Scroll right + ++pageNumber; + if(pageNumber > (inactiveGUIs.size()-1) / 4) + pageNumber = 0; + initGui(); + return; + default: //Add a machine by returning to config state and adding the gui. + setGuiState(State.CONFIG); + ChildGuiData child = inactiveGUIs.get(button.id - 3); + if(child == null || child.gui == null || child.machine == null) + return; + child.setLocation((xSize / 2) - child.gui.getSizeX() / 2, (ySize / 2) - 40 - child.gui.getSizeY() / 2, xSize, ySize); + guiDataList.add(child); + initGui(); + break; + } + } + } + + @Override + protected void mouseClicked(int x, int y, int buttonID) + { + super.mouseClicked(x, y, buttonID); + mouseClickedAtX = x; + mouseClickedAtY = y; + if(guiState.equals(State.CONFIG)) + { + for(int n = buttonList.size() - 1; n > 1; n--) //Loop backwards from draw order to select the top gui first. + { + GuiButton button = (GuiButton) buttonList.get(n); + if(button != null && button.mousePressed(mc, x, y) && button instanceof GuiCNGuiElement) + { + this.selectedConfigurationGui = (GuiCNGuiElement) button; + selectionOriginX = button.xPosition; + selectionOriginY = button.yPosition; + break; + } + } + } + } + + /** + * Called when a mouse button is pressed and the mouse is moved around. + */ + @Override + protected void mouseClickMove(int mouseX, int mouseY, int lastButtonClicked, long timeSinceMouseClick) + { + super.mouseClickMove(mouseX, mouseY, lastButtonClicked, timeSinceMouseClick); + if(guiState.equals(State.CONFIG)) + if(selectedConfigurationGui != null) + { + int newX = selectionOriginX + (mouseX - mouseClickedAtX); + int newY = selectionOriginY + (mouseY - mouseClickedAtY); + if(newX < guiLeft) + newX = guiLeft; + if(newX > guiLeft + xSize - selectedConfigurationGui.width) + newX = guiLeft + xSize - selectedConfigurationGui.width; + if(newY < guiTop) + newY = guiTop; + if(newY > guiTop + ySize - selectedConfigurationGui.height) + newY = guiTop + ySize - selectedConfigurationGui.height; + selectedConfigurationGui.moveGui(newX, newY, xSize, ySize); + } + } + + @Override + protected void keyTyped(char p_73869_1_, int p_73869_2_) { + if(p_73869_2_ == 1 || p_73869_2_ == this.mc.gameSettings.keyBindInventory.getKeyCode()) + this.mc.thePlayer.closeScreen(); + } + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + @Override + public void drawTexturedModalRect(int p_73729_1_, int p_73729_2_, int p_73729_3_, int p_73729_4_, int p_73729_5_, int p_73729_6_) + { + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + tessellator.addVertexWithUV((double)(p_73729_1_ + 0), (double)(p_73729_2_ + p_73729_6_), (double)this.zLevel, 0, 1); + tessellator.addVertexWithUV((double)(p_73729_1_ + p_73729_5_), (double)(p_73729_2_ + p_73729_6_), (double)this.zLevel, 1, 1); + tessellator.addVertexWithUV((double) (p_73729_1_ + p_73729_5_), (double) (p_73729_2_ + 0), (double) this.zLevel, 1, 0); + tessellator.addVertexWithUV((double) (p_73729_1_ + 0), (double) (p_73729_2_ + 0), (double) this.zLevel, 0, 0); + tessellator.draw(); + } + + public State getGuiState() { + return this.guiState; + } + + public void setGuiState(State state) { + this.stateChangedThisTick = true; + this.guiState = state; + } + + private void drawStaticBackgrounds() + { + boolean isDefault = guiState.equals(State.DEFAULT); + if(!isDefault) + GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.3F); + else + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + //PLAYER INVENTORY + mc.renderEngine.bindTexture(Textures.GUI.PLAYER_INVENTORY); + this.drawTexturedModalRect(this.guiLeft - 86 + this.xSize / 2, this.guiTop + this.ySize - 85, 0, 0, 172, 85); + //PLAYER INVENTORY + + //POWER METER TENSION + mc.renderEngine.bindTexture(Textures.GUI.POWER_METER); + this.drawTexturedModalRect(this.guiLeft, this.guiTop + this.ySize - 84, 0, 0, 84, 84); + + if(isDefault) + { + GL11.glPushMatrix(); + GL11.glTranslatef(guiLeft + 42F, guiTop + ySize - 42F, 0F); + GL11.glRotatef(-134, 0F, 0F, 1F); + GL11.glTranslatef(-guiLeft - 42F, -guiTop - ySize + 42F, 0F); + mc.renderEngine.bindTexture(Textures.GUI.POWER_METER_HAND); + this.drawTexturedModalRect(this.guiLeft, this.guiTop + this.ySize - 84, 0, 0, 84, 84); + GL11.glPopMatrix(); + + mc.renderEngine.bindTexture(Textures.GUI.POWER_METER_CENTER); + this.drawTexturedModalRect(this.guiLeft, this.guiTop + this.ySize - 84, 0, 0, 84, 84); + } + //POWER METER TENSION + + //POWER METER TIME + mc.renderEngine.bindTexture(Textures.GUI.POWER_METER); + this.drawTexturedModalRect(this.guiLeft + this.xSize - 84, this.guiTop + this.ySize - 84, 0, 0, 84, 84); + + if(isDefault) + { + GL11.glPushMatrix(); + GL11.glTranslatef(guiLeft + xSize - 42F, guiTop + ySize - 42F, 0F); + GL11.glRotatef(-134, 0F, 0F, 1F); + GL11.glTranslatef(-guiLeft - xSize + 42F, -guiTop - ySize + 42F, 0F); + mc.renderEngine.bindTexture(Textures.GUI.POWER_METER_HAND); + this.drawTexturedModalRect(this.guiLeft + this.xSize - 84, this.guiTop + this.ySize - 84, 0, 0, 84, 84); + GL11.glPopMatrix(); + + mc.renderEngine.bindTexture(Textures.GUI.POWER_METER_CENTER); + this.drawTexturedModalRect(this.guiLeft + this.xSize - 84, this.guiTop + this.ySize - 84, 0, 0, 84, 84); + } + //POWER METER TIME + } + + public static enum State { + DEFAULT, CONFIG, ADD_MACHINE + } +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/client/gui/GuiHandler.java b/src/main/java/lumaceon/mods/clockworkphase2/client/gui/GuiHandler.java index 1ebf9b6..ede8be9 100644 --- a/src/main/java/lumaceon/mods/clockworkphase2/client/gui/GuiHandler.java +++ b/src/main/java/lumaceon/mods/clockworkphase2/client/gui/GuiHandler.java @@ -2,13 +2,16 @@ import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.NetworkRegistry; +import cpw.mods.fml.relauncher.Side; import lumaceon.mods.clockworkphase2.ClockworkPhase2; import lumaceon.mods.clockworkphase2.api.assembly.ContainerAssemblyTable; import lumaceon.mods.clockworkphase2.api.util.internal.NBTHelper; import lumaceon.mods.clockworkphase2.api.util.internal.NBTTags; +import lumaceon.mods.clockworkphase2.container.ContainerClockworkController; import lumaceon.mods.clockworkphase2.container.ContainerClockworkFurnace; import lumaceon.mods.clockworkphase2.container.ContainerTemporalFurnace; import lumaceon.mods.clockworkphase2.container.ContainerTimeWell; +import lumaceon.mods.clockworkphase2.tile.clockwork.TileClockworkController; import lumaceon.mods.clockworkphase2.tile.clockwork.TileClockworkFurnace; import lumaceon.mods.clockworkphase2.tile.temporal.TileTemporalFurnace; import lumaceon.mods.clockworkphase2.tile.temporal.TileTimeWell; @@ -38,6 +41,9 @@ public Object getServerGuiElement(int ID, EntityPlayer player, World world, int return new ContainerClockworkFurnace(player.inventory, (TileClockworkFurnace) te, world); case 3: return new ContainerTemporalFurnace(player.inventory, (TileTemporalFurnace) te, world); + //SKIP 4 as it is client only. + case 5: + return new ContainerClockworkController(player.inventory, (TileClockworkController) te, world, 0, 0); } return null; } @@ -59,14 +65,13 @@ public Object getClientGuiElement(int ID, EntityPlayer player, World world, int case 4: if(player == null || player.getHeldItem() == null || !NBTHelper.hasTag(player.getHeldItem(), NBTTags.COMPONENT_INVENTORY)) return null; - ItemStack[] items = new ItemStack[5]; ItemStack[] componentInventory = NBTHelper.INVENTORY.get(player.getHeldItem(), NBTTags.COMPONENT_INVENTORY); - items[0] = componentInventory[2]; - items[1] = componentInventory[3]; - items[2] = componentInventory[4]; - items[3] = componentInventory[5]; - items[4] = componentInventory[6]; + ItemStack[] items = new ItemStack[componentInventory.length - 2]; + for(int i = 0; i < items.length; i++) + items[i] = componentInventory[i + 2]; return new GuiClockworkTool(items); + case 5: + return new GuiClockworkController(player.inventory, (TileClockworkController) te, world); } return null; } diff --git a/src/main/java/lumaceon/mods/clockworkphase2/client/gui/cngui/GuiClockworkBreweryClient.java b/src/main/java/lumaceon/mods/clockworkphase2/client/gui/cngui/GuiClockworkBreweryClient.java new file mode 100644 index 0000000..bd75a07 --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/client/gui/cngui/GuiClockworkBreweryClient.java @@ -0,0 +1,29 @@ +package lumaceon.mods.clockworkphase2.client.gui.cngui; + +import lumaceon.mods.clockworkphase2.api.clockworknetwork.ClockworkNetworkGuiClient; +import lumaceon.mods.clockworkphase2.lib.Textures; +import net.minecraft.client.Minecraft; +import net.minecraft.inventory.Slot; +import net.minecraft.tileentity.TileEntity; + +public class GuiClockworkBreweryClient extends ClockworkNetworkGuiClient +{ + public GuiClockworkBreweryClient(TileEntity te, int xSize, int ySize) { + super(te, xSize, ySize); + } + + @Override + public void drawBackground(int left, int top, float zLevel) + { + Minecraft.getMinecraft().renderEngine.bindTexture(Textures.GUI.BREWERY); + this.drawTexturedModalRect(left, top, xSize, ySize, zLevel); + } + + @Override + public void drawForeground(int left, int top, float zLevel) {} + + @Override + public Slot[] getSlots() { + return new Slot[4]; + } +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/client/gui/cngui/GuiClockworkFurnaceClient.java b/src/main/java/lumaceon/mods/clockworkphase2/client/gui/cngui/GuiClockworkFurnaceClient.java new file mode 100644 index 0000000..7a26dcb --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/client/gui/cngui/GuiClockworkFurnaceClient.java @@ -0,0 +1,107 @@ +package lumaceon.mods.clockworkphase2.client.gui.cngui; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import lumaceon.mods.clockworkphase2.api.clockworknetwork.ClockworkNetworkGuiClient; +import lumaceon.mods.clockworkphase2.client.render.RenderItemTransparent; +import lumaceon.mods.clockworkphase2.inventory.slot.SlotInventoryValid; +import lumaceon.mods.clockworkphase2.lib.Textures; +import lumaceon.mods.clockworkphase2.tile.clockwork.TileClockworkFurnace; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.FurnaceRecipes; +import net.minecraft.tileentity.TileEntity; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class GuiClockworkFurnaceClient extends ClockworkNetworkGuiClient +{ + protected Slot[] slots; + private TileClockworkFurnace furnace; + private static RenderItemTransparent itemRenderer = RenderItemTransparent.getInstance(); + private static Minecraft mc; + + private int previousCookTime; + + public GuiClockworkFurnaceClient(TileEntity te, int xSize, int ySize) { + super(te, xSize, ySize); + itemRenderer.renderWithColor = true; + mc = Minecraft.getMinecraft(); + if(te != null && te instanceof IInventory) + { + furnace = (TileClockworkFurnace) te; + + Slot input = new SlotInventoryValid((IInventory) te, 0, 3, 3); + Slot output = new SlotInventoryValid((IInventory) te, 1, 154, 3); + + slots = new Slot[] { input, output }; + } + } + + @Override + public void drawBackground(int left, int top, float zLevel) + { + mc.renderEngine.bindTexture(Textures.GUI.FURNACE); + this.drawTexturedModalRect(left, top, xSize, ySize, zLevel); + ItemStack input = furnace.getStackInSlot(0); + if(input != null) + { + ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(input); + float distance = slots[1].xDisplayPosition - slots[0].xDisplayPosition; + float scaledCookProgress = furnace.getCookProgressScaled((int) distance); + if(result != null && itemRenderer != null) + { + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + RenderHelper.enableGUIStandardItemLighting(); + if(scaledCookProgress == 0) + itemRenderer.renderItemIntoGUI(mc.fontRenderer, mc.getTextureManager(), input, left + slots[0].xDisplayPosition, top + slots[0].yDisplayPosition); + else + { + itemRenderer.renderItemIntoGUIAlpha(mc.fontRenderer, mc.getTextureManager(), result, left + slots[0].xDisplayPosition + (int) scaledCookProgress, top + slots[0].yDisplayPosition, false, scaledCookProgress / distance); + itemRenderer.renderItemIntoGUIAlpha(mc.fontRenderer, mc.getTextureManager(), input, left + slots[0].xDisplayPosition + (int) scaledCookProgress, top + slots[0].yDisplayPosition, false, 1.0F - scaledCookProgress / distance); + } + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + RenderHelper.disableStandardItemLighting(); + } + } + } + + @Override + public void drawForeground(int left, int top, float zLevel) {} + + @Override + public Slot[] getSlots() { + return slots; + } + + @Override + public int getUpdateCount() { + return 1; + } + + @Override + public void initialCraftingUpdate(ICrafting crafting, int startingIndex, Container container) { + crafting.sendProgressBarUpdate(container, startingIndex, furnace.furnaceCookTime); + } + + @Override + public void detectAndSendChanges(ICrafting crafting, int startingIndex, Container container) { + if(furnace.furnaceCookTime != previousCookTime) + crafting.sendProgressBarUpdate(container, startingIndex, furnace.furnaceCookTime); + previousCookTime = furnace.furnaceCookTime; + } + + @Override + @SideOnly(Side.CLIENT) + public void updateProgressBar(int id, int value) { + //if(id == 0) + furnace.furnaceCookTime = value; + } +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/client/gui/cngui/GuiClockworkMelterClient.java b/src/main/java/lumaceon/mods/clockworkphase2/client/gui/cngui/GuiClockworkMelterClient.java new file mode 100644 index 0000000..b4909c7 --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/client/gui/cngui/GuiClockworkMelterClient.java @@ -0,0 +1,44 @@ +package lumaceon.mods.clockworkphase2.client.gui.cngui; + +import lumaceon.mods.clockworkphase2.api.clockworknetwork.ClockworkNetworkGuiClient; +import lumaceon.mods.clockworkphase2.inventory.slot.SlotInventoryValid; +import lumaceon.mods.clockworkphase2.lib.Textures; +import net.minecraft.client.Minecraft; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.tileentity.TileEntity; + +public class GuiClockworkMelterClient extends ClockworkNetworkGuiClient +{ + protected Slot[] slots; + //private TileClockworkMelter melter; + private static Minecraft mc; + + public GuiClockworkMelterClient(TileEntity te, int xSize, int ySize) { + super(te, xSize, ySize); + mc = Minecraft.getMinecraft(); + if(te != null && te instanceof IInventory) + { + //melter = (TileClockworkMelter) te; + + Slot input = new SlotInventoryValid((IInventory) te, 0, 3, 3); + Slot output = new SlotInventoryValid((IInventory) te, 1, 154, 3); + + slots = new Slot[] { input, output }; + } + } + + @Override + public void drawBackground(int left, int top, float zLevel) { + mc.renderEngine.bindTexture(Textures.GUI.MELTER); + this.drawTexturedModalRect(left, top, xSize, ySize, zLevel); + } + + @Override + public void drawForeground(int left, int top, float zLevel) {} + + @Override + public Slot[] getSlots() { + return slots; + } +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/client/gui/cngui/GuiClockworkMixerClient.java b/src/main/java/lumaceon/mods/clockworkphase2/client/gui/cngui/GuiClockworkMixerClient.java new file mode 100644 index 0000000..dcdcced --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/client/gui/cngui/GuiClockworkMixerClient.java @@ -0,0 +1,28 @@ +package lumaceon.mods.clockworkphase2.client.gui.cngui; + +import lumaceon.mods.clockworkphase2.api.clockworknetwork.ClockworkNetworkGuiClient; +import lumaceon.mods.clockworkphase2.lib.Textures; +import net.minecraft.client.Minecraft; +import net.minecraft.inventory.Slot; +import net.minecraft.tileentity.TileEntity; + +public class GuiClockworkMixerClient extends ClockworkNetworkGuiClient +{ + public GuiClockworkMixerClient(TileEntity te, int xSize, int ySize) { + super(te, xSize, ySize); + } + + @Override + public void drawBackground(int left, int top, float zLevel) { + Minecraft.getMinecraft().renderEngine.bindTexture(Textures.GUI.MIXER); + this.drawTexturedModalRect(left, top, xSize, ySize, zLevel); + } + + @Override + public void drawForeground(int left, int top, float zLevel) {} + + @Override + public Slot[] getSlots() { + return new Slot[7]; + } +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/client/gui/components/GuiButtonCNGui.java b/src/main/java/lumaceon/mods/clockworkphase2/client/gui/components/GuiButtonCNGui.java new file mode 100644 index 0000000..f8310c9 --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/client/gui/components/GuiButtonCNGui.java @@ -0,0 +1,39 @@ +package lumaceon.mods.clockworkphase2.client.gui.components; + +import lumaceon.mods.clockworkphase2.api.clockworknetwork.ClockworkNetworkContainer; +import lumaceon.mods.clockworkphase2.api.clockworknetwork.ClockworkNetworkGuiClient; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import org.lwjgl.opengl.GL11; + +public class GuiButtonCNGui extends GuiButton +{ + private ClockworkNetworkContainer gui; + + public GuiButtonCNGui(ClockworkNetworkContainer gui, int id, int x, int y, int width, int height) { + super(id, x, y, width, height, ""); + this.gui = gui; + } + + @Override + public void drawButton(Minecraft p_146112_1_, int p_146112_2_, int p_146112_3_) + { + if(this.visible) + { + this.field_146123_n = p_146112_2_ >= this.xPosition && p_146112_3_ >= this.yPosition && p_146112_2_ < this.xPosition + this.width && p_146112_3_ < this.yPosition + this.height; + int hoverState = this.getHoverState(this.field_146123_n); + if(gui != null && gui instanceof ClockworkNetworkGuiClient) + { + if(hoverState == 2) + GL11.glColor4f(1.5F, 1.5F, 1.5F, 1.0F); + else if(hoverState == 1) + GL11.glColor4f(0.5F, 0.5F, 0.5F, 1.0F); + else + GL11.glColor4f(0.5F, 0.5F, 0.5F, 1.0F); + ((ClockworkNetworkGuiClient) gui).drawBackground(this.xPosition, this.yPosition, this.zLevel); + ((ClockworkNetworkGuiClient) gui).drawForeground(this.xPosition, this.yPosition, this.zLevel); + } + this.mouseDragged(p_146112_1_, p_146112_2_, p_146112_3_); + } + } +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/client/gui/components/GuiCNGuiElement.java b/src/main/java/lumaceon/mods/clockworkphase2/client/gui/components/GuiCNGuiElement.java new file mode 100644 index 0000000..84049de --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/client/gui/components/GuiCNGuiElement.java @@ -0,0 +1,50 @@ +package lumaceon.mods.clockworkphase2.client.gui.components; + +import lumaceon.mods.clockworkphase2.api.clockworknetwork.ClockworkNetworkGuiClient; +import lumaceon.mods.clockworkphase2.client.gui.GuiClockworkController; +import lumaceon.mods.clockworkphase2.util.ChildGuiData; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import org.lwjgl.opengl.GL11; + +public class GuiCNGuiElement extends GuiButton +{ + public ChildGuiData guiData; + + public GuiCNGuiElement(ChildGuiData guiData, int id, int x, int y, int width, int height) { + super(id, x, y, width, height, ""); + this.guiData = guiData; + } + + @Override + public void drawButton(Minecraft mc, int mouseX, int mouseY) + { + if(this.visible) + { + this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; + int hoverState = this.getHoverState(this.field_146123_n); + if(guiData != null && guiData.gui != null && guiData.gui instanceof ClockworkNetworkGuiClient) + { + GL11.glEnable(GL11.GL_BLEND); + if(hoverState == 2) + GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.9F); + else + GL11.glColor4f(0.9F, 0.9F, 0.9F, 0.9F); + + ((ClockworkNetworkGuiClient) guiData.gui).drawBackground(this.xPosition, this.yPosition, this.zLevel); + ((ClockworkNetworkGuiClient) guiData.gui).drawForeground(this.xPosition, this.yPosition, this.zLevel); + } + this.mouseDragged(mc, mouseX, mouseY); + } + } + + public void moveGui(int newX, int newY, int guiSizeX, int guiSizeY) + { + if(guiData != null) + { + this.xPosition = newX; + this.yPosition = newY; + guiData.setLocation(newX, newY, guiSizeX, guiSizeY); + } + } +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/client/render/RenderItemTransparent.java b/src/main/java/lumaceon/mods/clockworkphase2/client/render/RenderItemTransparent.java new file mode 100644 index 0000000..d528dff --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/client/render/RenderItemTransparent.java @@ -0,0 +1,186 @@ +package lumaceon.mods.clockworkphase2.client.render; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +public class RenderItemTransparent extends RenderItem +{ + private RenderBlocks renderBlocksRi = new RenderBlocks(); + + public void renderItemIntoGUIAlpha(FontRenderer p_77015_1_, TextureManager p_77015_2_, ItemStack p_77015_3_, int p_77015_4_, int p_77015_5_, boolean renderEffect, float alpha) + { + int k = p_77015_3_.getItemDamage(); + Object object = p_77015_3_.getIconIndex(); + int l; + float f; + float f3; + float f4; + + if (p_77015_3_.getItemSpriteNumber() == 0 && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(p_77015_3_.getItem()).getRenderType())) + { + p_77015_2_.bindTexture(TextureMap.locationBlocksTexture); + Block block = Block.getBlockFromItem(p_77015_3_.getItem()); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_BLEND); + + if (block.getRenderBlockPass() != 0) + { + GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + } + else + { + GL11.glAlphaFunc(GL11.GL_GREATER, 0.5F); + } + + GL11.glPushMatrix(); + GL11.glTranslatef((float)(p_77015_4_ - 2), (float)(p_77015_5_ + 3), -3.0F + this.zLevel); + GL11.glScalef(10.0F, 10.0F, 10.0F); + GL11.glTranslatef(1.0F, 0.5F, 1.0F); + GL11.glScalef(1.0F, 1.0F, -1.0F); + GL11.glRotatef(210.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + l = p_77015_3_.getItem().getColorFromItemStack(p_77015_3_, 0); + f3 = (float)(l >> 16 & 255) / 255.0F; + f4 = (float)(l >> 8 & 255) / 255.0F; + f = (float)(l & 255) / 255.0F; + + if(this.renderWithColor) + GL11.glColor4f(f3, f4, f, alpha); + else + GL11.glColor4f(1.0F, 1.0F, 1.0F, alpha); + + GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); + this.renderBlocksRi.useInventoryTint = false; + this.renderBlocksRi.renderBlockAsItem(block, k, 1.0F); + this.renderBlocksRi.useInventoryTint = true; + + if (block.getRenderBlockPass() == 0) + { + GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); + } + + GL11.glPopMatrix(); + } + else if (p_77015_3_.getItem().requiresMultipleRenderPasses()) + { + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_ALPHA_TEST); + p_77015_2_.bindTexture(TextureMap.locationItemsTexture); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glEnable(GL11.GL_BLEND); + OpenGlHelper.glBlendFunc(0, 0, 0, 0); + GL11.glColorMask(false, false, false, true); + GL11.glColor4f(1.0F, 1.0F, 1.0F, alpha); + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + tessellator.setColorOpaque_I(-1); + tessellator.addVertex((double)(p_77015_4_ - 2), (double)(p_77015_5_ + 18), (double)this.zLevel); + tessellator.addVertex((double)(p_77015_4_ + 18), (double)(p_77015_5_ + 18), (double)this.zLevel); + tessellator.addVertex((double)(p_77015_4_ + 18), (double)(p_77015_5_ - 2), (double)this.zLevel); + tessellator.addVertex((double)(p_77015_4_ - 2), (double)(p_77015_5_ - 2), (double)this.zLevel); + tessellator.draw(); + GL11.glColorMask(true, true, true, true); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glEnable(GL11.GL_ALPHA_TEST); + + Item item = p_77015_3_.getItem(); + for (l = 0; l < item.getRenderPasses(k); ++l) + { + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + p_77015_2_.bindTexture(item.getSpriteNumber() == 0 ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture); + IIcon iicon = item.getIcon(p_77015_3_, l); + int i1 = p_77015_3_.getItem().getColorFromItemStack(p_77015_3_, l); + f = (float)(i1 >> 16 & 255) / 255.0F; + float f1 = (float)(i1 >> 8 & 255) / 255.0F; + float f2 = (float)(i1 & 255) / 255.0F; + + if(this.renderWithColor) + GL11.glColor4f(f, f1, f2, alpha); + else + GL11.glColor4f(1.0F, 1.0F, 1.0F, alpha); + + GL11.glDisable(GL11.GL_LIGHTING); //Forge: Make sure that render states are reset, ad renderEffect can derp them up. + GL11.glEnable(GL11.GL_ALPHA_TEST); + + this.renderIcon(p_77015_4_, p_77015_5_, iicon, 16, 16); + + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_LIGHTING); + + if (renderEffect && p_77015_3_.hasEffect(l)) + { + renderEffect(p_77015_2_, p_77015_4_, p_77015_5_); + } + } + + GL11.glEnable(GL11.GL_LIGHTING); + } + else + { + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_BLEND); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + ResourceLocation resourcelocation = p_77015_2_.getResourceLocation(p_77015_3_.getItemSpriteNumber()); + p_77015_2_.bindTexture(resourcelocation); + + if (object == null) + { + object = ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(resourcelocation)).getAtlasSprite("missingno"); + } + + l = p_77015_3_.getItem().getColorFromItemStack(p_77015_3_, 0); + f3 = (float)(l >> 16 & 255) / 255.0F; + f4 = (float)(l >> 8 & 255) / 255.0F; + f = (float)(l & 255) / 255.0F; + + if(this.renderWithColor) + GL11.glColor4f(f3, f4, f, alpha); + else + GL11.glColor4f(1.0F, 1.0F, 1.0F, alpha); + + GL11.glDisable(GL11.GL_LIGHTING); //Forge: Make sure that render states are reset, a renderEffect can derp them up. + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_BLEND); + + this.renderIcon(p_77015_4_, p_77015_5_, (IIcon)object, 16, 16); + + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glDisable(GL11.GL_BLEND); + + if (renderEffect && p_77015_3_.hasEffect(0)) + { + renderEffect(p_77015_2_, p_77015_4_, p_77015_5_); + } + GL11.glEnable(GL11.GL_LIGHTING); + } + + GL11.glEnable(GL11.GL_CULL_FACE); + } + + private static RenderItemTransparent instance; + /** + * Returns a single lazy loaded instance of RenderItem, for use in mods who + * don't care about the interaction of other objects on the current state of the RenderItem they are using. + * @return A global instance of RenderItem + */ + public static RenderItemTransparent getInstance() + { + if (instance == null) instance = new RenderItemTransparent(); + return instance; + } +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/container/ContainerClockworkController.java b/src/main/java/lumaceon/mods/clockworkphase2/container/ContainerClockworkController.java new file mode 100644 index 0000000..86d023c --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/container/ContainerClockworkController.java @@ -0,0 +1,222 @@ +package lumaceon.mods.clockworkphase2.container; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import lumaceon.mods.clockworkphase2.api.block.clockwork.IClockworkNetworkMachine; +import lumaceon.mods.clockworkphase2.api.clockworknetwork.ClockworkNetworkContainer; +import lumaceon.mods.clockworkphase2.tile.clockwork.TileClockworkController; +import lumaceon.mods.clockworkphase2.api.util.ClockworkNetwork; +import lumaceon.mods.clockworkphase2.util.ChildGuiData; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +import java.lang.reflect.Array; +import java.util.ArrayList; + +public class ContainerClockworkController extends Container +{ + public World world; + public TileClockworkController te; + public ClockworkNetwork clockworkNetwork; + + public ContainerClockworkController(InventoryPlayer ip, TileClockworkController te, World world, int playerInventoryX, int playerInventoryY) + { + this.world = world; + this.te = te; + this.clockworkNetwork = te.getClockworkNetwork(); + + for(int x = 0; x < 9; x++) + this.addSlotToContainer(new Slot(ip, x, playerInventoryX + x * 18 , playerInventoryY)); + + for(int x = 0; x < 9; x++) + for(int y = 0; y < 3; y++) + this.addSlotToContainer(new Slot(ip, 9 + y * 9 + x, playerInventoryX + x * 18, playerInventoryY + y * 18)); + + if(clockworkNetwork != null) + { + ArrayList machines = clockworkNetwork.getMachines(); + if(machines != null && !machines.isEmpty()) + for(IClockworkNetworkMachine machine : machines) + if(machine != null) + { + ClockworkNetworkContainer container = machine.getGui(); + if(container == null) + continue; + + Slot[] slots = container.getSlots(); + if(slots != null) + for(Slot slot : slots) + if(slot != null) + this.addSlotToContainer(slot); + } + } + } + + @Override + public void addCraftingToCrafters(ICrafting crafting) { + super.addCraftingToCrafters(crafting); + int startingIndex = 0; + if(clockworkNetwork != null) + { + ArrayList machines = clockworkNetwork.getMachines(); + if(machines != null && !machines.isEmpty()) + for (IClockworkNetworkMachine machine : machines) + if(machine != null) + { + ClockworkNetworkContainer container = machine.getGui(); + if(container == null) + continue; + container.initialCraftingUpdate(crafting, startingIndex, this); + startingIndex += container.getUpdateCount(); + } + + } + } + + @Override + public void detectAndSendChanges() + { + super.detectAndSendChanges(); + ICrafting crafting; + int startingIndex = 0; + if(clockworkNetwork != null) + { + ArrayList machines = clockworkNetwork.getMachines(); + if(machines != null && !machines.isEmpty()) + for(IClockworkNetworkMachine machine : machines) + if(machine != null) + { + ClockworkNetworkContainer container = machine.getGui(); + if(container == null) + continue; + + for(Object i : this.crafters) + if(i instanceof ICrafting) + { + crafting = (ICrafting) i; + container.detectAndSendChanges(crafting, startingIndex, this); + } + startingIndex += container.getUpdateCount(); + } + } + } + + @Override + @SideOnly(Side.CLIENT) + public void updateProgressBar(int id, int value) + { + int startingIndex = 0; + if(clockworkNetwork != null) + { + ArrayList machines = clockworkNetwork.getMachines(); + if(machines != null && !machines.isEmpty()) + for(IClockworkNetworkMachine machine : machines) + if(machine != null) + { + ClockworkNetworkContainer container = machine.getGui(); + if(container == null) + continue; + + if(startingIndex >= id && startingIndex <= startingIndex + container.getUpdateCount() - 1) + container.updateProgressBar(id - startingIndex, value); + + startingIndex += container.getUpdateCount(); + } + } + } + + public void clearSlots() { + this.inventorySlots.clear(); + } + + public void reinitializeSlots(InventoryPlayer ip, ArrayList childGUIs, int playerInventoryX, int playerInventoryY, int guiSizeX, int guiSizeY, boolean hideSlots) + { + clearSlots(); + + if(hideSlots) //GUI is being configured, hide all the slots off-screen. + { + //Player Inventory + for(int n = 0; n < 36; n++) + this.addSlotToContainer(new Slot(ip, n, -100, 100)); + + if(clockworkNetwork != null) + { + ArrayList machines = clockworkNetwork.getMachines(); + if(machines != null && !machines.isEmpty()) + for(IClockworkNetworkMachine machine : machines) + if(machine != null) + { + ClockworkNetworkContainer container = machine.getGui(); + if(container == null) + continue; + + Slot[] slots = container.getSlots(); + if(slots != null) + for(Slot slot : slots) + if(slot != null) + { + Slot newSlot = new Slot(slot.inventory, slot.getSlotIndex(), -100, -100); + this.addSlotToContainer(newSlot); + } + } + } + } + else //GUI is in a usable state, display the slots normally. + { + //Player Inventory + for(int x = 0; x < 9; x++) + this.addSlotToContainer(new Slot(ip, x, playerInventoryX+6 + x * 18 , playerInventoryY+63)); + + for(int x = 0; x < 9; x++) + for(int y = 0; y < 3; y++) + this.addSlotToContainer(new Slot(ip, 9 + y * 9 + x, playerInventoryX+6 + x * 18, playerInventoryY+5 + y * 18)); + + if(clockworkNetwork != null) + { + ArrayList machines = clockworkNetwork.getMachines(); + if(machines != null && !machines.isEmpty()) + for(IClockworkNetworkMachine machine : machines) + if(machine != null) + { + ClockworkNetworkContainer container = machine.getGui(); + if(container == null) + continue; + + ChildGuiData child = null; + for(ChildGuiData child1 : childGUIs) + if(child1 != null && child1.gui != null && child1.machine != null && child1.machine.equals(machine)) + child = child1; + + Slot[] slots = container.getSlots(); + if(slots != null) + for(Slot slot : slots) + if(slot != null) + { + Slot newSlot; + if(child == null) + newSlot = new Slot(slot.inventory, slot.getSlotIndex(), -100, -100); + else + newSlot = new Slot(slot.inventory, slot.getSlotIndex(), child.getX(guiSizeX) + slot.xDisplayPosition, child.getY(guiSizeY) + slot.yDisplayPosition); + this.addSlotToContainer(newSlot); + } + } + } + } + + } + + @Override + public boolean canInteractWith(EntityPlayer player) { + return te.isUseableByPlayer(player); + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) { + return null; + } +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/container/clockworknetwork/ContainerCNBrewery.java b/src/main/java/lumaceon/mods/clockworkphase2/container/clockworknetwork/ContainerCNBrewery.java new file mode 100644 index 0000000..ba8b4ac --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/container/clockworknetwork/ContainerCNBrewery.java @@ -0,0 +1,17 @@ +package lumaceon.mods.clockworkphase2.container.clockworknetwork; + +import lumaceon.mods.clockworkphase2.api.clockworknetwork.ClockworkNetworkContainer; +import net.minecraft.inventory.Slot; +import net.minecraft.tileentity.TileEntity; + +public class ContainerCNBrewery extends ClockworkNetworkContainer +{ + public ContainerCNBrewery(TileEntity te, int xSize, int ySize) { + super(te, xSize, ySize); + } + + @Override + public Slot[] getSlots() { + return new Slot[4]; + } +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/container/clockworknetwork/ContainerCNFurnace.java b/src/main/java/lumaceon/mods/clockworkphase2/container/clockworknetwork/ContainerCNFurnace.java new file mode 100644 index 0000000..a1b2982 --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/container/clockworknetwork/ContainerCNFurnace.java @@ -0,0 +1,51 @@ +package lumaceon.mods.clockworkphase2.container.clockworknetwork; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import lumaceon.mods.clockworkphase2.api.clockworknetwork.ClockworkNetworkContainer; +import lumaceon.mods.clockworkphase2.inventory.slot.SlotInventoryValid; +import lumaceon.mods.clockworkphase2.tile.clockwork.TileClockworkFurnace; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.tileentity.TileEntity; + +public class ContainerCNFurnace extends ClockworkNetworkContainer +{ + protected Slot[] slots; + private TileClockworkFurnace furnace; + + private int previousCookTime; + + public ContainerCNFurnace(TileEntity te, int xSize, int ySize) { + super(te, xSize, ySize); + if(te != null && te instanceof IInventory) + { + slots = new Slot[] { new SlotInventoryValid((IInventory) te, 0, 3, 3), new SlotInventoryValid((IInventory) te, 1, 154, 3)}; + furnace = (TileClockworkFurnace) te; + } + } + + @Override + public Slot[] getSlots() { + return slots; + } + + @Override + public int getUpdateCount() { + return 1; + } + + @Override + public void initialCraftingUpdate(ICrafting crafting, int startingIndex, Container container) { + crafting.sendProgressBarUpdate(container, startingIndex, furnace.furnaceCookTime); + } + + @Override + public void detectAndSendChanges(ICrafting crafting, int startingIndex, Container container) { + if(furnace.furnaceCookTime != previousCookTime) + crafting.sendProgressBarUpdate(container, startingIndex, furnace.furnaceCookTime); + previousCookTime = furnace.furnaceCookTime; + } +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/container/clockworknetwork/ContainerCNMixer.java b/src/main/java/lumaceon/mods/clockworkphase2/container/clockworknetwork/ContainerCNMixer.java new file mode 100644 index 0000000..ed908c7 --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/container/clockworknetwork/ContainerCNMixer.java @@ -0,0 +1,17 @@ +package lumaceon.mods.clockworkphase2.container.clockworknetwork; + +import lumaceon.mods.clockworkphase2.api.clockworknetwork.ClockworkNetworkContainer; +import net.minecraft.inventory.Slot; +import net.minecraft.tileentity.TileEntity; + +public class ContainerCNMixer extends ClockworkNetworkContainer +{ + public ContainerCNMixer(TileEntity te, int xSize, int ySize) { + super(te, xSize, ySize); + } + + @Override + public Slot[] getSlots() { + return new Slot[7]; + } +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/handler/WorldHandler.java b/src/main/java/lumaceon/mods/clockworkphase2/handler/WorldHandler.java index 743a57c..0f32d95 100644 --- a/src/main/java/lumaceon/mods/clockworkphase2/handler/WorldHandler.java +++ b/src/main/java/lumaceon/mods/clockworkphase2/handler/WorldHandler.java @@ -53,13 +53,13 @@ public void onBlockHarvested(BlockEvent.HarvestDropsEvent event) ItemStack[] inventory = NBTHelper.INVENTORY.get(heldItem, NBTTags.COMPONENT_INVENTORY); for(ItemStack item : inventory) { - if(item != null && item.getItem().equals(ModItems.toolUpgradeSilk) && ((ItemToolUpgradeSilk) item.getItem()).getActive(item)) + if(item != null && item.getItem().equals(ModItems.toolUpgradeSilk) && ((ItemToolUpgradeSilk) item.getItem()).getActive(item, heldItem)) { silk = (IToolUpgrade) item.getItem(); silkStack = item; } - if(item != null && item.getItem().equals(ModItems.toolUpgradeFurnace) && ((ItemToolUpgradeFurnace) item.getItem()).getActive(item)) + if(item != null && item.getItem().equals(ModItems.toolUpgradeFurnace) && ((ItemToolUpgradeFurnace) item.getItem()).getActive(item, heldItem)) smelt = (IToolUpgrade) item.getItem(); } } @@ -106,7 +106,7 @@ else if(smelt != null && !event.drops.isEmpty()) for(ItemStack item : items) { - if(item != null && item.getItem().equals(ModItems.toolUpgradeRelocate) && ((ItemToolUpgradeRelocate) item.getItem()).getActive(item)) + if(item != null && item.getItem().equals(ModItems.toolUpgradeRelocate) && ((ItemToolUpgradeRelocate) item.getItem()).getActive(item, heldItem)) { int x = NBTHelper.INT.get(item, "cp_x"); int y = NBTHelper.INT.get(item, "cp_y"); diff --git a/src/main/java/lumaceon/mods/clockworkphase2/init/ModBlocks.java b/src/main/java/lumaceon/mods/clockworkphase2/init/ModBlocks.java index 6c82116..c0126f9 100644 --- a/src/main/java/lumaceon/mods/clockworkphase2/init/ModBlocks.java +++ b/src/main/java/lumaceon/mods/clockworkphase2/init/ModBlocks.java @@ -2,13 +2,17 @@ import cpw.mods.fml.common.registry.GameRegistry; import lumaceon.mods.clockworkphase2.block.*; -import lumaceon.mods.clockworkphase2.block.clockwork.BlockClockworkFurnace; -import lumaceon.mods.clockworkphase2.block.clockwork.BlockCrank; +import lumaceon.mods.clockworkphase2.block.clockwork.*; +import lumaceon.mods.clockworkphase2.block.itemblock.ItemBlockClockworkBrewery; import lumaceon.mods.clockworkphase2.block.itemblock.ItemBlockClockworkFurnace; +import lumaceon.mods.clockworkphase2.block.itemblock.ItemBlockClockworkMixer; import lumaceon.mods.clockworkphase2.block.steammachine.BlockBoiler; import lumaceon.mods.clockworkphase2.lib.Names; import lumaceon.mods.clockworkphase2.tile.*; +import lumaceon.mods.clockworkphase2.tile.clockwork.TileClockworkBrewery; +import lumaceon.mods.clockworkphase2.tile.clockwork.TileClockworkController; import lumaceon.mods.clockworkphase2.tile.clockwork.TileClockworkFurnace; +import lumaceon.mods.clockworkphase2.tile.clockwork.TileClockworkMixer; import lumaceon.mods.clockworkphase2.tile.temporal.TileTemporalFurnace; import lumaceon.mods.clockworkphase2.tile.machine.TileTimezoneFluidExporter; import lumaceon.mods.clockworkphase2.tile.machine.TileTimezoneFluidImporter; @@ -41,14 +45,29 @@ public static void initSteamMachines() } public static Block crank; + public static Block clockworkController; public static Block clockworkFurnace; + public static Block clockworkLiquefier; + public static Block clockworkSewingMachine; + public static Block clockworkBrewery; + public static Block clockworkMixer; public static void initClockworkMachines() { crank = new BlockCrank(Material.iron, Names.BLOCK.CRANK); + clockworkController = new BlockClockworkController(Material.iron, Names.BLOCK.CLOCKWORK_CONTROLLER); clockworkFurnace = new BlockClockworkFurnace(Material.iron, Names.BLOCK.CLOCKWORK_FURNACE); + //clockworkLiquefier = new BlockClockworkLiquedier(Material.iron, Names.BLOCK.CLOCKWORK_LIQUEFIER); + //clockworkSewingMachine = new BlockClockworkSewingMachine(Material.iron, Names.BLOCK.CLOCKWORK_SEWING_MACHINE); + clockworkBrewery = new BlockClockworkBrewery(Material.iron, Names.BLOCK.CLOCKWORK_BREWERY); + clockworkMixer = new BlockClockworkMixer(Material.iron, Names.BLOCK.CLOCKWORK_MIXER); GameRegistry.registerBlock(crank, Names.BLOCK.CRANK); GameRegistry.registerBlock(clockworkFurnace, ItemBlockClockworkFurnace.class, Names.BLOCK.CLOCKWORK_FURNACE); + GameRegistry.registerBlock(clockworkController, Names.BLOCK.CLOCKWORK_CONTROLLER); + //GameRegistry.registerBlock(clockworkLiquefier, ItemBlockClockworkLiquedier.class, Names.BLOCK.CLOCKWORK_LIQUEFIER); + //GameRegistry.registerBlock(clockworkSewingMachine, ItemBlockClockworkSewingMachine.class, Names.BLOCK.CLOCKWORK_SEWING_MACHINE); + GameRegistry.registerBlock(clockworkBrewery, ItemBlockClockworkBrewery.class, Names.BLOCK.CLOCKWORK_BREWERY); + GameRegistry.registerBlock(clockworkMixer, ItemBlockClockworkMixer.class, Names.BLOCK.CLOCKWORK_MIXER); } public static Block celestialCompass; @@ -172,7 +191,10 @@ public static void initMisc() public static void initTE() { + GameRegistry.registerTileEntity(TileClockworkController.class, Names.BLOCK.CLOCKWORK_CONTROLLER); GameRegistry.registerTileEntity(TileClockworkFurnace.class, Names.BLOCK.CLOCKWORK_FURNACE); + GameRegistry.registerTileEntity(TileClockworkBrewery.class, Names.BLOCK.CLOCKWORK_BREWERY); + GameRegistry.registerTileEntity(TileClockworkMixer.class, Names.BLOCK.CLOCKWORK_MIXER); GameRegistry.registerTileEntity(TileCelestialCompass.class, Names.BLOCK.CELESTIAL_COMPASS); GameRegistry.registerTileEntity(TileTemporalDisplacementAltar.class, Names.BLOCK.TEMPORAL_DISPLACEMENT_ALTAR); GameRegistry.registerTileEntity(TileTDA.class, Names.BLOCK.TDA); diff --git a/src/main/java/lumaceon/mods/clockworkphase2/init/ModItems.java b/src/main/java/lumaceon/mods/clockworkphase2/init/ModItems.java index d8924f5..7e91811 100644 --- a/src/main/java/lumaceon/mods/clockworkphase2/init/ModItems.java +++ b/src/main/java/lumaceon/mods/clockworkphase2/init/ModItems.java @@ -3,9 +3,7 @@ import cpw.mods.fml.common.registry.GameRegistry; import lumaceon.mods.clockworkphase2.api.util.TimeConverter; import lumaceon.mods.clockworkphase2.item.*; -import lumaceon.mods.clockworkphase2.item.components.clockworktool.ItemToolUpgradeFurnace; -import lumaceon.mods.clockworkphase2.item.components.clockworktool.ItemToolUpgradeRelocate; -import lumaceon.mods.clockworkphase2.item.components.clockworktool.ItemToolUpgradeSilk; +import lumaceon.mods.clockworkphase2.item.components.clockworktool.*; import lumaceon.mods.clockworkphase2.item.construct.tool.*; import lumaceon.mods.clockworkphase2.item.timestream.*; import lumaceon.mods.clockworkphase2.item.components.ItemClockworkCore; @@ -39,15 +37,24 @@ public static void init() public static Item toolUpgradeSilk; public static Item toolUpgradeFurnace; public static Item toolUpgradeRelocate; + public static Item toolUpgradeArea; + public static Item toolUpgradeFortune; + public static Item toolUpgradeXp; public static void initToolUpgrades() { toolUpgradeSilk = new ItemToolUpgradeSilk(1, 100, Names.ITEM.TOOL_UPGRADE_SILK); toolUpgradeFurnace = new ItemToolUpgradeFurnace(1, 100, Names.ITEM.TOOL_UPGRADE_FURNACE); toolUpgradeRelocate = new ItemToolUpgradeRelocate(1, 100, Names.ITEM.TOOL_UPGRADE_RELOCATE); + toolUpgradeArea = new ItemToolUpgradeArea(1, 100, Names.ITEM.TOOL_UPGRADE_AREA); + toolUpgradeFortune = new ItemToolUpgradeFortune(1, 100, Names.ITEM.TOOL_UPGRADE_FORTUNE); + toolUpgradeXp = new ItemToolUpgradeXP(1, 100, Names.ITEM.TOOL_UPGRADE_XP); GameRegistry.registerItem(toolUpgradeSilk, Names.ITEM.TOOL_UPGRADE_SILK); GameRegistry.registerItem(toolUpgradeFurnace, Names.ITEM.TOOL_UPGRADE_FURNACE); GameRegistry.registerItem(toolUpgradeRelocate, Names.ITEM.TOOL_UPGRADE_RELOCATE); + GameRegistry.registerItem(toolUpgradeArea, Names.ITEM.TOOL_UPGRADE_AREA); + GameRegistry.registerItem(toolUpgradeFortune, Names.ITEM.TOOL_UPGRADE_FORTUNE); + GameRegistry.registerItem(toolUpgradeXp, Names.ITEM.TOOL_UPGRADE_XP); } public static Item timezoneModuleTank; @@ -235,8 +242,7 @@ public static void initMetals() public static Item temporalDriveModify; public static Item temporalDriveDuplicate; public static Item moonFlowerSeeds; - public static Item moonPearl; - public static Item elysianGem; + public static Item temporalPearl; public static void initMisc() { bugSwatter = new ItemBugSwatter(1, 100, "bug_swatter"); @@ -246,8 +252,7 @@ public static void initMisc() temporalDriveModify = new ItemClockworkPhase(64, 100, Names.ITEM.TEMPORAL_DRIVE_MODIFY); temporalDriveDuplicate = new ItemClockworkPhase(64, 100, Names.ITEM.TEMPORAL_DRIVE_DUPLICATE); moonFlowerSeeds = new ItemMoonFlowerSeeds(64, 0, Names.ITEM.MOON_FLOWER_SEEDS); - moonPearl = new ItemClockworkPhase(64, 0, Names.ITEM.MOON_PEARL); - elysianGem = new ItemClockworkPhase(64, 0, Names.ITEM.ELYSIAN_GEM); + temporalPearl = new ItemClockworkPhase(64, 0, Names.ITEM.TEMPORAL_PEARL); GameRegistry.registerItem(bugSwatter, "bug_swatter"); GameRegistry.registerItem(ageDev, "age_developer"); @@ -256,7 +261,6 @@ public static void initMisc() GameRegistry.registerItem(temporalDriveModify, Names.ITEM.TEMPORAL_DRIVE_MODIFY); GameRegistry.registerItem(temporalDriveDuplicate, Names.ITEM.TEMPORAL_DRIVE_DUPLICATE); GameRegistry.registerItem(moonFlowerSeeds, Names.ITEM.MOON_FLOWER_SEEDS); - GameRegistry.registerItem(moonPearl, Names.ITEM.MOON_PEARL); - GameRegistry.registerItem(elysianGem, Names.ITEM.ELYSIAN_GEM); + GameRegistry.registerItem(temporalPearl, Names.ITEM.TEMPORAL_PEARL); } } diff --git a/src/main/java/lumaceon/mods/clockworkphase2/inventory/slot/SlotToolUpgrade.java b/src/main/java/lumaceon/mods/clockworkphase2/inventory/slot/SlotToolUpgrade.java index e76efe7..047eb37 100644 --- a/src/main/java/lumaceon/mods/clockworkphase2/inventory/slot/SlotToolUpgrade.java +++ b/src/main/java/lumaceon/mods/clockworkphase2/inventory/slot/SlotToolUpgrade.java @@ -20,7 +20,7 @@ private boolean alreadyExists(ItemStack is) { for(int i = 0; i < inventory.getSizeInventory(); i++) { - if(i == slotNumber) + if(i == getSlotIndex()) continue; ItemStack item = inventory.getStackInSlot(i); if(item != null && item.getItem().equals(is.getItem())) diff --git a/src/main/java/lumaceon/mods/clockworkphase2/item/components/clockworktool/ItemToolUpgradeArea.java b/src/main/java/lumaceon/mods/clockworkphase2/item/components/clockworktool/ItemToolUpgradeArea.java new file mode 100644 index 0000000..f2d45ec --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/item/components/clockworktool/ItemToolUpgradeArea.java @@ -0,0 +1,38 @@ +package lumaceon.mods.clockworkphase2.item.components.clockworktool; + +import lumaceon.mods.clockworkphase2.api.item.IToolUpgrade; +import lumaceon.mods.clockworkphase2.api.util.internal.NBTHelper; +import lumaceon.mods.clockworkphase2.api.util.internal.NBTTags; +import lumaceon.mods.clockworkphase2.item.ItemClockworkPhase; +import net.minecraft.item.ItemStack; + +public class ItemToolUpgradeArea extends ItemClockworkPhase implements IToolUpgrade +{ + public ItemToolUpgradeArea(int maxStack, int maxDamage, String unlocalizedName) { + super(maxStack, maxDamage, unlocalizedName); + } + + @Override + public void setActive(ItemStack upgradeStack, ItemStack toolStack, boolean active) { + NBTHelper.BOOLEAN.set(upgradeStack, NBTTags.ACTIVE, active); + } + + @Override + public boolean getActive(ItemStack upgradeStack, ItemStack toolStack) { + return NBTHelper.BOOLEAN.get(upgradeStack, NBTTags.ACTIVE); + } + + @Override + public float getQualityMultiplier(ItemStack item) { + return 1.0F; + } + + @Override + public float getSpeedMultiplier(ItemStack item) { + return 1.0F; + } + + public int getAreaRadius(ItemStack stack) { + return NBTHelper.hasTag(stack, "area_radius") ? NBTHelper.INT.get(stack, "area_radius") : 3; + } +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/item/components/clockworktool/ItemToolUpgradeFortune.java b/src/main/java/lumaceon/mods/clockworkphase2/item/components/clockworktool/ItemToolUpgradeFortune.java new file mode 100644 index 0000000..37be511 --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/item/components/clockworktool/ItemToolUpgradeFortune.java @@ -0,0 +1,46 @@ +package lumaceon.mods.clockworkphase2.item.components.clockworktool; + +import lumaceon.mods.clockworkphase2.api.item.IToolUpgrade; +import lumaceon.mods.clockworkphase2.api.util.internal.NBTHelper; +import lumaceon.mods.clockworkphase2.api.util.internal.NBTTags; +import lumaceon.mods.clockworkphase2.item.ItemClockworkPhase; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.item.ItemStack; + +import java.util.Map; + +public class ItemToolUpgradeFortune extends ItemClockworkPhase implements IToolUpgrade +{ + public ItemToolUpgradeFortune(int maxStack, int maxDamage, String unlocalizedName) { + super(maxStack, maxDamage, unlocalizedName); + } + + @Override + public void setActive(ItemStack upgradeStack, ItemStack toolStack, boolean active) { + NBTHelper.BOOLEAN.set(upgradeStack, NBTTags.ACTIVE, active); + if(active) + toolStack.addEnchantment(Enchantment.fortune, 3); + else if(toolStack.isItemEnchanted()) + { + Map enchantmentMap = EnchantmentHelper.getEnchantments(toolStack); + enchantmentMap.remove(Enchantment.fortune.effectId); + EnchantmentHelper.setEnchantments(enchantmentMap, toolStack); + } + } + + @Override + public boolean getActive(ItemStack upgradeStack, ItemStack toolStack) { + return NBTHelper.BOOLEAN.get(upgradeStack, NBTTags.ACTIVE); + } + + @Override + public float getQualityMultiplier(ItemStack item) { + return 1.0F; + } + + @Override + public float getSpeedMultiplier(ItemStack item) { + return 1.0F; + } +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/item/components/clockworktool/ItemToolUpgradeFurnace.java b/src/main/java/lumaceon/mods/clockworkphase2/item/components/clockworktool/ItemToolUpgradeFurnace.java index 3e1090e..a0eda59 100644 --- a/src/main/java/lumaceon/mods/clockworkphase2/item/components/clockworktool/ItemToolUpgradeFurnace.java +++ b/src/main/java/lumaceon/mods/clockworkphase2/item/components/clockworktool/ItemToolUpgradeFurnace.java @@ -13,13 +13,13 @@ public ItemToolUpgradeFurnace(int maxStack, int maxDamage, String unlocalizedNam } @Override - public void setActive(ItemStack item, boolean active) { - NBTHelper.BOOLEAN.set(item, NBTTags.ACTIVE, active); + public void setActive(ItemStack upgradeStack, ItemStack toolStack, boolean active) { + NBTHelper.BOOLEAN.set(upgradeStack, NBTTags.ACTIVE, active); } @Override - public boolean getActive(ItemStack item) { - return NBTHelper.BOOLEAN.get(item, NBTTags.ACTIVE); + public boolean getActive(ItemStack upgradeStack, ItemStack toolStack) { + return NBTHelper.BOOLEAN.get(upgradeStack, NBTTags.ACTIVE); } @Override diff --git a/src/main/java/lumaceon/mods/clockworkphase2/item/components/clockworktool/ItemToolUpgradeRelocate.java b/src/main/java/lumaceon/mods/clockworkphase2/item/components/clockworktool/ItemToolUpgradeRelocate.java index f3da1a4..66d3de5 100644 --- a/src/main/java/lumaceon/mods/clockworkphase2/item/components/clockworktool/ItemToolUpgradeRelocate.java +++ b/src/main/java/lumaceon/mods/clockworkphase2/item/components/clockworktool/ItemToolUpgradeRelocate.java @@ -36,13 +36,13 @@ public boolean onItemUse(ItemStack is, EntityPlayer player, World world, int x, } @Override - public void setActive(ItemStack item, boolean active) { - NBTHelper.BOOLEAN.set(item, NBTTags.ACTIVE, active); + public void setActive(ItemStack upgradeStack, ItemStack toolStack, boolean active) { + NBTHelper.BOOLEAN.set(upgradeStack, NBTTags.ACTIVE, active); } @Override - public boolean getActive(ItemStack item) { - return NBTHelper.BOOLEAN.get(item, NBTTags.ACTIVE); + public boolean getActive(ItemStack upgradeStack, ItemStack toolStack) { + return NBTHelper.BOOLEAN.get(upgradeStack, NBTTags.ACTIVE); } @Override diff --git a/src/main/java/lumaceon/mods/clockworkphase2/item/components/clockworktool/ItemToolUpgradeSilk.java b/src/main/java/lumaceon/mods/clockworkphase2/item/components/clockworktool/ItemToolUpgradeSilk.java index f7199ef..86c4b44 100644 --- a/src/main/java/lumaceon/mods/clockworkphase2/item/components/clockworktool/ItemToolUpgradeSilk.java +++ b/src/main/java/lumaceon/mods/clockworkphase2/item/components/clockworktool/ItemToolUpgradeSilk.java @@ -13,13 +13,13 @@ public ItemToolUpgradeSilk(int maxStack, int maxDamage, String unlocalizedName) } @Override - public void setActive(ItemStack item, boolean active) { - NBTHelper.BOOLEAN.set(item, NBTTags.ACTIVE, active); + public void setActive(ItemStack upgradeStack, ItemStack toolStack, boolean active) { + NBTHelper.BOOLEAN.set(upgradeStack, NBTTags.ACTIVE, active); } @Override - public boolean getActive(ItemStack item) { - return NBTHelper.BOOLEAN.get(item, NBTTags.ACTIVE); + public boolean getActive(ItemStack upgradeStack, ItemStack toolStack) { + return NBTHelper.BOOLEAN.get(upgradeStack, NBTTags.ACTIVE); } @Override diff --git a/src/main/java/lumaceon/mods/clockworkphase2/item/components/clockworktool/ItemToolUpgradeXP.java b/src/main/java/lumaceon/mods/clockworkphase2/item/components/clockworktool/ItemToolUpgradeXP.java new file mode 100644 index 0000000..1850836 --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/item/components/clockworktool/ItemToolUpgradeXP.java @@ -0,0 +1,34 @@ +package lumaceon.mods.clockworkphase2.item.components.clockworktool; + +import lumaceon.mods.clockworkphase2.api.item.IToolUpgrade; +import lumaceon.mods.clockworkphase2.api.util.internal.NBTHelper; +import lumaceon.mods.clockworkphase2.api.util.internal.NBTTags; +import lumaceon.mods.clockworkphase2.item.ItemClockworkPhase; +import net.minecraft.item.ItemStack; + +public class ItemToolUpgradeXP extends ItemClockworkPhase implements IToolUpgrade +{ + public ItemToolUpgradeXP(int maxStack, int maxDamage, String unlocalizedName) { + super(maxStack, maxDamage, unlocalizedName); + } + + @Override + public void setActive(ItemStack upgradeStack, ItemStack toolStack, boolean active) { + NBTHelper.BOOLEAN.set(upgradeStack, NBTTags.ACTIVE, active); + } + + @Override + public boolean getActive(ItemStack upgradeStack, ItemStack toolStack) { + return NBTHelper.BOOLEAN.get(upgradeStack, NBTTags.ACTIVE); + } + + @Override + public float getQualityMultiplier(ItemStack item) { + return 1.0F; + } + + @Override + public float getSpeedMultiplier(ItemStack item) { + return 1.0F; + } +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/item/construct/tool/ItemClockworkAxe.java b/src/main/java/lumaceon/mods/clockworkphase2/item/construct/tool/ItemClockworkAxe.java index ea875e4..e9a917e 100644 --- a/src/main/java/lumaceon/mods/clockworkphase2/item/construct/tool/ItemClockworkAxe.java +++ b/src/main/java/lumaceon/mods/clockworkphase2/item/construct/tool/ItemClockworkAxe.java @@ -19,21 +19,13 @@ public ItemClockworkAxe(ToolMaterial material, String unlocalizedName) { } @Override - public float func_150893_a(ItemStack is, Block block) - { - float efficiency = block.getMaterial() != Material.wood && block.getMaterial() != Material.plants && block.getMaterial() != Material.vine ? super.func_150893_a(is, block) : this.efficiencyOnProperMaterial; - if(efficiency == 1.0F) - return efficiency; - - int tension = NBTHelper.INT.get(is, NBTTags.CURRENT_TENSION); - if(tension <= 0) - return 1.0F; - - int speed = NBTHelper.INT.get(is, NBTTags.SPEED); - if(speed <= 0) - return 1.0F; + public String getHarvestType() { + return "axe"; + } - return (float) speed / 25; + @Override + public Material[] getEffectiveMaterials() { + return new Material[] { Material.wood, Material.plants, Material.vine, Material.gourd }; } @Override diff --git a/src/main/java/lumaceon/mods/clockworkphase2/item/construct/tool/ItemClockworkPickaxe.java b/src/main/java/lumaceon/mods/clockworkphase2/item/construct/tool/ItemClockworkPickaxe.java index 66e35c4..eebe910 100644 --- a/src/main/java/lumaceon/mods/clockworkphase2/item/construct/tool/ItemClockworkPickaxe.java +++ b/src/main/java/lumaceon/mods/clockworkphase2/item/construct/tool/ItemClockworkPickaxe.java @@ -24,21 +24,13 @@ public boolean func_150897_b(Block p_150897_1_) { } @Override - public float func_150893_a(ItemStack is, Block block) - { - float efficiency = block.getMaterial() != Material.iron && block.getMaterial() != Material.anvil && block.getMaterial() != Material.rock ? super.func_150893_a(is, block) : this.efficiencyOnProperMaterial; - if(efficiency == 1.0F) - return efficiency; - - int tension = NBTHelper.INT.get(is, NBTTags.CURRENT_TENSION); - if(tension <= 0) - return 1.0F; - - int speed = NBTHelper.INT.get(is, NBTTags.SPEED); - if(speed <= 0) - return 1.0F; + public String getHarvestType() { + return "pickaxe"; + } - return (float) speed / 25; + @Override + public Material[] getEffectiveMaterials() { + return new Material[] { Material.rock, Material.iron, Material.anvil }; } @Override diff --git a/src/main/java/lumaceon/mods/clockworkphase2/item/construct/tool/ItemClockworkShovel.java b/src/main/java/lumaceon/mods/clockworkphase2/item/construct/tool/ItemClockworkShovel.java index 4416d2e..a5ee070 100644 --- a/src/main/java/lumaceon/mods/clockworkphase2/item/construct/tool/ItemClockworkShovel.java +++ b/src/main/java/lumaceon/mods/clockworkphase2/item/construct/tool/ItemClockworkShovel.java @@ -4,6 +4,7 @@ import lumaceon.mods.clockworkphase2.api.util.internal.NBTHelper; import lumaceon.mods.clockworkphase2.api.util.internal.NBTTags; import net.minecraft.block.Block; +import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; @@ -22,6 +23,16 @@ public boolean func_150897_b(Block p_150897_1_) { return p_150897_1_ == Blocks.snow_layer ? true : p_150897_1_ == Blocks.snow; } + @Override + public String getHarvestType() { + return "shovel"; + } + + @Override + public Material[] getEffectiveMaterials() { + return new Material[] { Material.ground, Material.grass, Material.sand, Material.snow }; + } + @Override public void setTier(ItemStack item, int tier) { super.setTier(item, tier); diff --git a/src/main/java/lumaceon/mods/clockworkphase2/item/construct/tool/ItemClockworkTool.java b/src/main/java/lumaceon/mods/clockworkphase2/item/construct/tool/ItemClockworkTool.java index cae674c..262fdd5 100644 --- a/src/main/java/lumaceon/mods/clockworkphase2/item/construct/tool/ItemClockworkTool.java +++ b/src/main/java/lumaceon/mods/clockworkphase2/item/construct/tool/ItemClockworkTool.java @@ -12,30 +12,41 @@ import lumaceon.mods.clockworkphase2.init.ModItems; import lumaceon.mods.clockworkphase2.inventory.slot.SlotItemSpecific; import lumaceon.mods.clockworkphase2.inventory.slot.SlotToolUpgrade; +import lumaceon.mods.clockworkphase2.item.components.clockworktool.ItemToolUpgradeArea; import lumaceon.mods.clockworkphase2.lib.Defaults; import lumaceon.mods.clockworkphase2.api.util.internal.NBTTags; import lumaceon.mods.clockworkphase2.lib.Textures; import lumaceon.mods.clockworkphase2.api.util.AssemblyHelper; import lumaceon.mods.clockworkphase2.api.util.internal.NBTHelper; +import lumaceon.mods.clockworkphase2.util.RayTraceHelper; import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemTool; +import net.minecraft.network.play.client.C07PacketPlayerDigging; +import net.minecraft.network.play.server.S23PacketBlockChange; +import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.event.world.BlockEvent; import java.util.List; import java.util.Set; -public class ItemClockworkTool extends ItemTool implements IAssemblable, IClockworkConstruct, IKeybindActivation +/** + * Credits to Tinker's Construct for a lot of the AOE code. + */ +public abstract class ItemClockworkTool extends ItemTool implements IAssemblable, IClockworkConstruct, IKeybindActivation { - public ItemClockworkTool(float var1, ToolMaterial toolMaterial, Set set, String unlocalizedName) - { + public ItemClockworkTool(float var1, ToolMaterial toolMaterial, Set set, String unlocalizedName) { super(var1, toolMaterial, set); this.setMaxStackSize(1); this.setMaxDamage(100); @@ -49,6 +60,111 @@ public void addInformation(ItemStack is, EntityPlayer player, List list, boolean InformationDisplay.addClockworkConstructInformation(is, player, list, flag); } + @Override + public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) + { + Block block = player.worldObj.getBlock(x, y, z); + int metadata = player.worldObj.getBlockMetadata(x, y, z); + if(block == null || !isEffective(block, metadata)) //The tool is ineffective or non-functional. + return super.onBlockStartBreak(stack, x, y, z, player); + + boolean found = false; + int areaRadius = 1; + ItemStack[] components = NBTHelper.INVENTORY.get(stack, NBTTags.COMPONENT_INVENTORY); + if(components != null) + for(ItemStack item : components) //Loop through the tool's component inventory. + if(item != null && item.getItem() instanceof ItemToolUpgradeArea && ((ItemToolUpgradeArea) item.getItem()).getActive(item, stack)) + { + areaRadius = ((ItemToolUpgradeArea) item.getItem()).getAreaRadius(item); + found = true; + break; + } + if(!found) //No area upgrade found. + return super.onBlockStartBreak(stack, x, y, z, player); + + MovingObjectPosition mop = RayTraceHelper.rayTrace(player.worldObj, player, false, 4.5); + if(mop == null) + return super.onBlockStartBreak(stack, x, y, z, player); + + int xRadius = areaRadius; + int yRadius = areaRadius; + int zRadius = 1; + switch(mop.sideHit) + { + case 0: + case 1: + yRadius = 1; //DEPTH + zRadius = areaRadius; + break; + case 2: + case 3: + xRadius = areaRadius; + zRadius = 1; //DEPTH + break; + case 4: + case 5: + xRadius = 1; //DEPTH + zRadius = areaRadius; + break; + } + + for(int x1 = x - xRadius + 1; x1 <= x + xRadius - 1; x1++) + for(int y1 = y - yRadius + 1; y1 <= y + yRadius - 1; y1++) + for(int z1 = z - zRadius + 1; z1 <= z + zRadius - 1; z1++) + { + if((x1 == x && y1 == y && z1 == z) || super.onBlockStartBreak(stack, x1, y1, z1, player)) + continue; + aoeBlockBreak(stack, player.worldObj, x1, y1, z1, player); + } + return false; + } + + private void aoeBlockBreak(ItemStack stack, World world, int x, int y, int z, EntityPlayer player) + { + if(world.isAirBlock(x, y, z)) + return; + + if(!(player instanceof EntityPlayerMP)) + return; + EntityPlayerMP playerMP = (EntityPlayerMP) player; + + Block block = world.getBlock(x, y, z); + int metadata = world.getBlockMetadata(x, y, z); + if(!isEffective(block, metadata) || !ForgeHooks.canHarvestBlock(block, player, metadata)) + return; + + BlockEvent.BreakEvent event = ForgeHooks.onBlockBreakEvent(world, playerMP.theItemInWorldManager.getGameType(), playerMP, x, y, z); + if(event.isCanceled()) + return; + + stack.func_150999_a(world, block, x, y, z, player); + if(!world.isRemote) + { + block.onBlockHarvested(world, x, y, z, metadata, player); + if(block.removedByPlayer(world, player, x, y, z, true)) + { + block.onBlockDestroyedByPlayer( world, x,y,z, metadata); + block.harvestBlock(world, player, x,y,z, metadata); + block.dropXpOnBlockBreak(world, x,y,z, event.getExpToDrop()); + } + playerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world)); + } + else //CLIENT + { + world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (metadata << 12)); + if(block.removedByPlayer(world, player, x, y, z, true)) + block.onBlockDestroyedByPlayer(world, x, y, z, metadata); + ItemStack itemstack = player.getCurrentEquippedItem(); + if(itemstack != null) + { + itemstack.func_150999_a(world, block, x, y, z, player); + if(itemstack.stackSize == 0) + player.destroyCurrentEquippedItem(); + } + Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C07PacketPlayerDigging(2, x,y,z, Minecraft.getMinecraft().objectMouseOver.sideHit)); + } + } + @Override public int getHarvestLevel(ItemStack stack, String toolClass) { @@ -66,17 +182,25 @@ public int getHarvestLevel(ItemStack stack, String toolClass) @Override public float func_150893_a(ItemStack is, Block block) { + boolean correctMaterial = false; + for(Material mat : getEffectiveMaterials()) + if(mat.equals(block.getMaterial())) + correctMaterial = true; + + if(!correctMaterial) + return 1.0F; + float efficiency = super.func_150893_a(is, block); if(efficiency == 1.0F) - return efficiency; + return 1.0F; int tension = NBTHelper.INT.get(is, NBTTags.CURRENT_TENSION); if(tension <= 0) - return 1.0F; + return 0.0F; int speed = NBTHelper.INT.get(is, NBTTags.SPEED); if(speed <= 0) - return 1.0F; + return 0.0F; return (float) speed / 25; } @@ -88,17 +212,31 @@ public float getDigSpeed(ItemStack stack, Block block, int meta) { int tension = NBTHelper.INT.get(stack, NBTTags.CURRENT_TENSION); if(tension <= 0) - return 1.0F; + return 0.0F; int speed = NBTHelper.INT.get(stack, NBTTags.SPEED); if(speed <= 0) - return 1.0F; + return 0.0F; return (float) speed / 25; } return func_150893_a(stack, block); } + public abstract String getHarvestType(); + public abstract Material[] getEffectiveMaterials(); + + public boolean isEffective(Block block, int meta) { + return this.getHarvestType().equals(block.getHarvestTool(meta)) || isEffective(block.getMaterial()); + } + + public boolean isEffective(Material material) { + for(Material m : getEffectiveMaterials()) + if(m == material) + return true; + return false; + } + @Override public boolean hitEntity(ItemStack p_77644_1_, EntityLivingBase p_77644_2_, EntityLivingBase p_77644_3_) { return true; @@ -110,7 +248,7 @@ public boolean onBlockDestroyed(ItemStack is, World world, Block block, int x, i if(block.getBlockHardness(world, x, y, z) <= 0 || !(is.getItem() instanceof IClockworkConstruct)) return true; - if(getDigSpeed(is, block, world.getBlockMetadata(x, y, z)) <= 1.0F) + if(!isEffective(block, world.getBlockMetadata(x, y, z))) return true; IClockworkConstruct clockworkConstruct = (IClockworkConstruct) is.getItem(); @@ -200,7 +338,7 @@ public ResourceLocation getGUIBackground(ContainerAssemblyTable container) { @Override public InventoryAssemblyTableComponents getGUIInventory(ContainerAssemblyTable container) { - InventoryAssemblyTableComponents inventory = new InventoryAssemblyTableComponents(container, 7, 1); + InventoryAssemblyTableComponents inventory = new InventoryAssemblyTableComponents(container, 10, 1); AssemblyHelper.GET_GUI_INVENTORY.loadStandardComponentInventory(container, inventory); return inventory; } @@ -217,6 +355,9 @@ public Slot[] getContainerSlots(IInventory inventory) new SlotToolUpgrade(inventory, 4, 20, 60), new SlotToolUpgrade(inventory, 5, 20, 80), new SlotToolUpgrade(inventory, 6, 20, 100), + new SlotToolUpgrade(inventory, 7, 20, 120), + new SlotToolUpgrade(inventory, 8, 20, 140), + new SlotToolUpgrade(inventory, 9, 20, 160), }; } diff --git a/src/main/java/lumaceon/mods/clockworkphase2/lib/Names.java b/src/main/java/lumaceon/mods/clockworkphase2/lib/Names.java index b95780d..42d01c9 100644 --- a/src/main/java/lumaceon/mods/clockworkphase2/lib/Names.java +++ b/src/main/java/lumaceon/mods/clockworkphase2/lib/Names.java @@ -8,13 +8,17 @@ public class Names public class BLOCK { public static final String CRANK = "crank"; + public static final String CLOCKWORK_CONTROLLER = "clockwork_controller"; public static final String CLOCKWORK_FURNACE = "clockwork_furnace"; + public static final String CLOCKWORK_LIQUEFIER = "clockwork_liquefier"; + public static final String CLOCKWORK_SEWING_MACHINE = "clockwork_sewing_machine"; + public static final String CLOCKWORK_BREWERY = "clockwork_brewery"; + public static final String CLOCKWORK_MIXER = "clockwork_mixer"; public static final String TIME_SAND = "time_sand"; public static final String BASIC_WINDING_BOX = "basic_winding_box"; public static final String ASSEMBLY_TABLE = "assembly_table"; public static final String ASSEMBLY_TABLE_SB = "assembly_table_sb"; - public static final String TEMPORAL_CONDUIT = "temporal_conduit"; public static final String CELESTIAL_COMPASS = "celestial_compass"; public static final String CELESTIAL_COMPASS_SB = "celestial_compass_sb"; public static final String TEMPORAL_DISPLACEMENT_ALTAR = "temporal_displacement_altar"; @@ -75,8 +79,7 @@ public class ITEM public static final String TEMPORAL_DRIVE_MODIFY = "temporal_drive_modify"; public static final String TEMPORAL_DRIVE_DUPLICATE = "temporal_drive_duplicate"; public static final String MOON_FLOWER_SEEDS = "moon_flower_seeds"; - public static final String MOON_PEARL = "moon_pearl"; - public static final String ELYSIAN_GEM = "elysian_gem"; + public static final String TEMPORAL_PEARL = "temporal_pearl"; public static final String TIMESTREAM_RELOCATION = "timestream_relocation"; public static final String TIMESTREAM_SILKY_HARVEST = "timestream_silky_harvest"; @@ -88,6 +91,9 @@ public class ITEM public static final String TOOL_UPGRADE_SILK = "tool_upgrade_silk"; public static final String TOOL_UPGRADE_FURNACE = "tool_upgrade_furnace"; public static final String TOOL_UPGRADE_RELOCATE = "tool_upgrade_relocate"; + public static final String TOOL_UPGRADE_AREA = "tool_upgrade_area"; + public static final String TOOL_UPGRADE_FORTUNE = "tool_upgrade_fortune"; + public static final String TOOL_UPGRADE_XP = "tool_upgrade_xp"; public static final String TIMEZONE_MODULE_TANK = "timezone_module_tank"; public static final String TIMEZONE_MODULE_MOB_REPELL = "timezone_module_mob_repell"; diff --git a/src/main/java/lumaceon/mods/clockworkphase2/lib/Reference.java b/src/main/java/lumaceon/mods/clockworkphase2/lib/Reference.java index 04d22fe..bc9109a 100644 --- a/src/main/java/lumaceon/mods/clockworkphase2/lib/Reference.java +++ b/src/main/java/lumaceon/mods/clockworkphase2/lib/Reference.java @@ -4,7 +4,7 @@ public class Reference { public static final String MOD_ID = "clockworkphase2"; public static final String MOD_NAME = "ClockworkPhase2"; - public static final String VERSION = "1.7.10-DEV"; + public static final String VERSION = "1.7.10-DEV1"; public static final String CLIENT_PROXY = "lumaceon.mods.clockworkphase2.proxy.ClientProxy"; public static final String SERVER_PROXY = "lumaceon.mods.clockworkphase2.proxy.ServerProxy"; } \ No newline at end of file diff --git a/src/main/java/lumaceon/mods/clockworkphase2/lib/Textures.java b/src/main/java/lumaceon/mods/clockworkphase2/lib/Textures.java index d6c140b..83dd5b6 100644 --- a/src/main/java/lumaceon/mods/clockworkphase2/lib/Textures.java +++ b/src/main/java/lumaceon/mods/clockworkphase2/lib/Textures.java @@ -23,6 +23,18 @@ public static class GUI public static ResourceLocation ASSEMBLY_TABLE = new ResourceLocation(Reference.MOD_ID, "textures/gui/assembly_table.png"); public static ResourceLocation ASSEMBLY_TABLE_MAINSPRING = new ResourceLocation(Reference.MOD_ID, "textures/gui/assembly_table_mainspring.png"); + + public static ResourceLocation PLAYER_INVENTORY = new ResourceLocation(Reference.MOD_ID, "textures/gui/clockworkmachine/player_inventory.png"); + public static ResourceLocation POWER_METER = new ResourceLocation(Reference.MOD_ID, "textures/gui/clockworkmachine/power.png"); + public static ResourceLocation POWER_METER_HAND = new ResourceLocation(Reference.MOD_ID, "textures/gui/clockworkmachine/power_hand.png"); + public static ResourceLocation POWER_METER_CENTER = new ResourceLocation(Reference.MOD_ID, "textures/gui/clockworkmachine/power_center.png"); + + public static ResourceLocation FURNACE = new ResourceLocation(Reference.MOD_ID, "textures/gui/clockworkmachine/furnace.png"); + public static ResourceLocation BREWERY = new ResourceLocation(Reference.MOD_ID, "textures/gui/clockworkmachine/brewery.png"); + public static ResourceLocation ALLOY_FURNACE = new ResourceLocation(Reference.MOD_ID, "textures/gui/clockworkmachine/alloy_furnace.png"); + public static ResourceLocation MELTER = new ResourceLocation(Reference.MOD_ID, "textures/gui/clockworkmachine/melter.png"); + public static ResourceLocation MIXER = new ResourceLocation(Reference.MOD_ID, "textures/gui/clockworkmachine/mixer.png"); + public static ResourceLocation CHEST = new ResourceLocation(Reference.MOD_ID, "textures/gui/clockworkmachine/chest.png"); } public static class GLYPH diff --git a/src/main/java/lumaceon/mods/clockworkphase2/network/message/handler/HandlerToolUpgradeActivate.java b/src/main/java/lumaceon/mods/clockworkphase2/network/message/handler/HandlerToolUpgradeActivate.java index a5196f3..6651726 100644 --- a/src/main/java/lumaceon/mods/clockworkphase2/network/message/handler/HandlerToolUpgradeActivate.java +++ b/src/main/java/lumaceon/mods/clockworkphase2/network/message/handler/HandlerToolUpgradeActivate.java @@ -29,7 +29,7 @@ public IMessage onMessage(MessageToolUpgradeActivate message, MessageContext ctx if(upgrade != null && upgrade.getItem() instanceof IToolUpgrade) { IToolUpgrade upgradeItem = (IToolUpgrade) upgrade.getItem(); - upgradeItem.setActive(upgrade, !upgradeItem.getActive(upgrade)); + upgradeItem.setActive(upgrade, item, !upgradeItem.getActive(upgrade, item)); NBTHelper.INVENTORY.set(item, NBTTags.COMPONENT_INVENTORY, items); } } diff --git a/src/main/java/lumaceon/mods/clockworkphase2/proxy/ClientProxy.java b/src/main/java/lumaceon/mods/clockworkphase2/proxy/ClientProxy.java index 3beadf9..57a512d 100644 --- a/src/main/java/lumaceon/mods/clockworkphase2/proxy/ClientProxy.java +++ b/src/main/java/lumaceon/mods/clockworkphase2/proxy/ClientProxy.java @@ -3,9 +3,12 @@ import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.common.FMLCommonHandler; import lumaceon.mods.clockworkphase2.api.assembly.ContainerAssemblyTable; +import lumaceon.mods.clockworkphase2.api.clockworknetwork.ClockworkNetworkContainer; import lumaceon.mods.clockworkphase2.client.ClientTickHandler; import lumaceon.mods.clockworkphase2.client.gui.ButtonInitializer; -import lumaceon.mods.clockworkphase2.client.gui.GuiHandler; +import lumaceon.mods.clockworkphase2.client.gui.cngui.GuiClockworkBreweryClient; +import lumaceon.mods.clockworkphase2.client.gui.cngui.GuiClockworkFurnaceClient; +import lumaceon.mods.clockworkphase2.client.gui.cngui.GuiClockworkMixerClient; import lumaceon.mods.clockworkphase2.client.keybind.KeyHandler; import lumaceon.mods.clockworkphase2.client.keybind.Keybindings; import lumaceon.mods.clockworkphase2.client.render.RenderHandler; @@ -20,6 +23,7 @@ import lumaceon.mods.clockworkphase2.tile.machine.TileTimezoneFluidExporter; import lumaceon.mods.clockworkphase2.world.provider.forthage.WorldProviderForthAge; import net.minecraft.client.Minecraft; +import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraft.world.WorldProvider; import net.minecraftforge.client.IRenderHandler; @@ -115,4 +119,19 @@ public void initializeButtonsViaProxy(int id, List buttonList, ContainerAssembly public File getMinecraftDataDirectory() { return Minecraft.getMinecraft().mcDataDir; } + + @Override + public ClockworkNetworkContainer getClockworkNetworkGui(TileEntity te, int id) + { + switch(id) + { + case 0: //Clockwork Furnace + return new GuiClockworkFurnaceClient(te, 172, 22); + case 1: //Clockwork Brewery + return new GuiClockworkBreweryClient(te, 80, 74); + case 2: //Clockwork Mixer + return new GuiClockworkMixerClient(te, 172, 80); + } + return null; + } } diff --git a/src/main/java/lumaceon/mods/clockworkphase2/proxy/IProxy.java b/src/main/java/lumaceon/mods/clockworkphase2/proxy/IProxy.java index 250f56e..a905268 100644 --- a/src/main/java/lumaceon/mods/clockworkphase2/proxy/IProxy.java +++ b/src/main/java/lumaceon/mods/clockworkphase2/proxy/IProxy.java @@ -1,6 +1,8 @@ package lumaceon.mods.clockworkphase2.proxy; import lumaceon.mods.clockworkphase2.api.assembly.ContainerAssemblyTable; +import lumaceon.mods.clockworkphase2.api.clockworknetwork.ClockworkNetworkContainer; +import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraft.world.WorldProvider; import net.minecraftforge.client.IRenderHandler; @@ -20,4 +22,5 @@ public interface IProxy public IRenderHandler getSkyRendererForWorld(WorldProvider worldProvider); public void initializeButtonsViaProxy(int id, List buttonList, ContainerAssemblyTable container, int guiLeft, int guiTop); public File getMinecraftDataDirectory(); + public ClockworkNetworkContainer getClockworkNetworkGui(TileEntity te, int id); } diff --git a/src/main/java/lumaceon/mods/clockworkphase2/proxy/ServerProxy.java b/src/main/java/lumaceon/mods/clockworkphase2/proxy/ServerProxy.java index 475908d..70945e6 100644 --- a/src/main/java/lumaceon/mods/clockworkphase2/proxy/ServerProxy.java +++ b/src/main/java/lumaceon/mods/clockworkphase2/proxy/ServerProxy.java @@ -1,6 +1,12 @@ package lumaceon.mods.clockworkphase2.proxy; import lumaceon.mods.clockworkphase2.api.assembly.ContainerAssemblyTable; +import lumaceon.mods.clockworkphase2.api.clockworknetwork.ClockworkNetworkContainer; +import lumaceon.mods.clockworkphase2.client.gui.cngui.GuiClockworkFurnaceClient; +import lumaceon.mods.clockworkphase2.container.clockworknetwork.ContainerCNBrewery; +import lumaceon.mods.clockworkphase2.container.clockworknetwork.ContainerCNFurnace; +import lumaceon.mods.clockworkphase2.container.clockworknetwork.ContainerCNMixer; +import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraft.world.WorldProvider; import net.minecraftforge.client.IRenderHandler; @@ -30,4 +36,19 @@ public void clearWorldRenderers(World world, int x, int y, int z) {} public void initializeButtonsViaProxy(int id, List buttonList, ContainerAssemblyTable container, int guiLeft, int guiTop) {} @Override public File getMinecraftDataDirectory() { return null; } + + @Override + public ClockworkNetworkContainer getClockworkNetworkGui(TileEntity te, int id) + { + switch(id) + { + case 0: //Clockwork Furnace + return new ContainerCNFurnace(te, 174, 22); + case 1: //Clockwork Brewery + return new ContainerCNBrewery(te, 80, 76); + case 2: //Clockwork Mixer + return new ContainerCNMixer(te, 172, 80); + } + return null; + } } diff --git a/src/main/java/lumaceon/mods/clockworkphase2/recipe/Recipes.java b/src/main/java/lumaceon/mods/clockworkphase2/recipe/Recipes.java index 524150a..31472d6 100644 --- a/src/main/java/lumaceon/mods/clockworkphase2/recipe/Recipes.java +++ b/src/main/java/lumaceon/mods/clockworkphase2/recipe/Recipes.java @@ -82,6 +82,7 @@ public static void initFurnaceRecipes() GameRegistry.addSmelting(ModBlocks.oreCopper, new ItemStack(ModItems.ingotCopper), 0.7F); GameRegistry.addSmelting(ModBlocks.oreZinc, new ItemStack(ModItems.ingotZinc), 0.7F); GameRegistry.addSmelting(ModItems.lumpBrass, new ItemStack(ModItems.ingotBrass), 1.5F); + GameRegistry.addSmelting(ModItems.temporalPearl, new ItemStack(ModItems.ingotTemporal), 10F); } public static void addGearRecipe(ItemStack result, String materialName) { diff --git a/src/main/java/lumaceon/mods/clockworkphase2/tile/clockwork/TileClockwork.java b/src/main/java/lumaceon/mods/clockworkphase2/tile/clockwork/TileClockwork.java index d689183..b2157af 100644 --- a/src/main/java/lumaceon/mods/clockworkphase2/tile/clockwork/TileClockwork.java +++ b/src/main/java/lumaceon/mods/clockworkphase2/tile/clockwork/TileClockwork.java @@ -1,14 +1,17 @@ package lumaceon.mods.clockworkphase2.tile.clockwork; -import lumaceon.mods.clockworkphase2.api.block.clockwork.IClockworkDestination; +import lumaceon.mods.clockworkphase2.api.block.clockwork.IClockworkNetworkMachine; +import lumaceon.mods.clockworkphase2.api.clockworknetwork.ClockworkNetworkContainer; +import lumaceon.mods.clockworkphase2.api.util.ClockworkNetwork; import lumaceon.mods.clockworkphase2.api.util.internal.NBTTags; import lumaceon.mods.clockworkphase2.tile.generic.TileClockworkPhase; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; -public class TileClockwork extends TileClockworkPhase implements IClockworkDestination +public abstract class TileClockwork extends TileClockworkPhase implements IClockworkNetworkMachine { + private ClockworkNetwork clockworkNetwork; public ItemStack itemBlock; public int quality; //Tension efficiency; higher = less tension used per operation. public int speed; //Work speed; higher = faster machines. @@ -48,31 +51,10 @@ public void readFromNBT(NBTTagCompound nbt) } @Override - public boolean canReceiveFrom(ForgeDirection direction) { - return ForgeDirection.getOrientation(blockMetadata).ordinal() != direction.getOpposite().ordinal(); + public ClockworkNetwork getClockworkNetwork() { + return clockworkNetwork; } @Override - public int receiveClockworkEnergy(ForgeDirection from, int maxReception) { - int energyTaken = canReceiveFrom(from) ? Math.min(maxTension - currentTension, maxReception) : 0; - currentTension += energyTaken; - return energyTaken; - } - - @Override - public int getMaxCapacity() { return maxTension; } - @Override - public int getEnergyStored() { return currentTension; } - - @Override - public int wind(int tension) { - int amountToAdd = Math.min(this.maxTension - this.currentTension, tension); - currentTension += amountToAdd; - return amountToAdd; - } - - @Override - public void setState(int state) {} - @Override - public void setStateAndUpdate(int state) {} + public abstract ClockworkNetworkContainer getGui(); } diff --git a/src/main/java/lumaceon/mods/clockworkphase2/tile/clockwork/TileClockworkBrewery.java b/src/main/java/lumaceon/mods/clockworkphase2/tile/clockwork/TileClockworkBrewery.java new file mode 100644 index 0000000..bf136de --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/tile/clockwork/TileClockworkBrewery.java @@ -0,0 +1,17 @@ +package lumaceon.mods.clockworkphase2.tile.clockwork; + +import lumaceon.mods.clockworkphase2.ClockworkPhase2; +import lumaceon.mods.clockworkphase2.api.clockworknetwork.ClockworkNetworkContainer; + +public class TileClockworkBrewery extends TileClockwork +{ + @Override + public ClockworkNetworkContainer getGui() { + return ClockworkPhase2.proxy.getClockworkNetworkGui(this, 1); + } + + @Override + public void setState(int state) {} + @Override + public void setStateAndUpdate(int state) {} +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/tile/clockwork/TileClockworkController.java b/src/main/java/lumaceon/mods/clockworkphase2/tile/clockwork/TileClockworkController.java new file mode 100644 index 0000000..db7b2fc --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/tile/clockwork/TileClockworkController.java @@ -0,0 +1,62 @@ +package lumaceon.mods.clockworkphase2.tile.clockwork; + +import lumaceon.mods.clockworkphase2.api.block.clockwork.IClockworkNetworkMachine; +import lumaceon.mods.clockworkphase2.api.block.clockwork.IClockworkNetworkTile; +import lumaceon.mods.clockworkphase2.api.util.ClockworkNetwork; +import lumaceon.mods.clockworkphase2.tile.generic.TileClockworkPhase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; + +public class TileClockworkController extends TileClockworkPhase implements IClockworkNetworkTile +{ + private ClockworkNetwork clockworkNetwork = new ClockworkNetwork(); + boolean setup = false; + + @Override + public void updateEntity() + { + if(!setup) + { + TileEntity te = worldObj.getTileEntity(xCoord + 1, yCoord, zCoord); + if(te != null && te instanceof IClockworkNetworkMachine) + clockworkNetwork.addMachine((IClockworkNetworkMachine) te); + te = worldObj.getTileEntity(xCoord - 1, yCoord, zCoord); + if(te != null && te instanceof IClockworkNetworkMachine) + clockworkNetwork.addMachine((IClockworkNetworkMachine) te); + te = worldObj.getTileEntity(xCoord, yCoord, zCoord + 1); + if(te != null && te instanceof IClockworkNetworkMachine) + clockworkNetwork.addMachine((IClockworkNetworkMachine) te); + te = worldObj.getTileEntity(xCoord, yCoord, zCoord - 1); + if(te != null && te instanceof IClockworkNetworkMachine) + clockworkNetwork.addMachine((IClockworkNetworkMachine) te); + + te = worldObj.getTileEntity(xCoord + 2, yCoord, zCoord); + if(te != null && te instanceof IClockworkNetworkMachine) + clockworkNetwork.addMachine((IClockworkNetworkMachine) te); + te = worldObj.getTileEntity(xCoord - 2, yCoord, zCoord); + if(te != null && te instanceof IClockworkNetworkMachine) + clockworkNetwork.addMachine((IClockworkNetworkMachine) te); + te = worldObj.getTileEntity(xCoord, yCoord, zCoord + 2); + if(te != null && te instanceof IClockworkNetworkMachine) + clockworkNetwork.addMachine((IClockworkNetworkMachine) te); + te = worldObj.getTileEntity(xCoord, yCoord, zCoord - 2); + if(te != null && te instanceof IClockworkNetworkMachine) + clockworkNetwork.addMachine((IClockworkNetworkMachine) te); + setup = true; + } + } + + @Override + public ClockworkNetwork getClockworkNetwork() { + return clockworkNetwork; + } + + public boolean isUseableByPlayer(EntityPlayer player) { + return player.getDistance((double) xCoord, (double) yCoord, (double) zCoord) <= 8; + } + + @Override + public void setState(int state) {} + @Override + public void setStateAndUpdate(int state) {} +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/tile/clockwork/TileClockworkFurnace.java b/src/main/java/lumaceon/mods/clockworkphase2/tile/clockwork/TileClockworkFurnace.java index 9992b76..e9efc75 100644 --- a/src/main/java/lumaceon/mods/clockworkphase2/tile/clockwork/TileClockworkFurnace.java +++ b/src/main/java/lumaceon/mods/clockworkphase2/tile/clockwork/TileClockworkFurnace.java @@ -2,6 +2,8 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import lumaceon.mods.clockworkphase2.ClockworkPhase2; +import lumaceon.mods.clockworkphase2.api.clockworknetwork.ClockworkNetworkContainer; import lumaceon.mods.clockworkphase2.api.item.clockwork.IClockwork; import lumaceon.mods.clockworkphase2.api.util.ClockworkHelper; import lumaceon.mods.clockworkphase2.api.util.internal.NBTHelper; @@ -59,6 +61,7 @@ public void readFromNBT(NBTTagCompound nbt) @Override public void updateEntity() { + currentTension += 50; //TODO remove this when done testing. boolean furnaceOn = isBurning(); boolean isChanged = false; @@ -229,17 +232,12 @@ public boolean canExtractItem(int slotID, ItemStack outputStack, int side) { return slotID == 1; } - @Override - public int wind(int tension) { - int amountToAdd = Math.min(this.maxTension - this.currentTension, tension); - currentTension += amountToAdd; - return amountToAdd; - } - public void setTileDataFromItemStack(ItemStack item) { this.itemBlock = item.copy(); ItemStack[] items = NBTHelper.INVENTORY.get(item, NBTTags.COMPONENT_INVENTORY); + if(items == null) + return; if(items[0] != null && items[0].getItem() instanceof ItemMainspring) this.maxTension = NBTHelper.INT.get(items[0], NBTTags.MAX_TENSION); if(items[1] != null && items[1].getItem() instanceof IClockwork) @@ -248,4 +246,14 @@ public void setTileDataFromItemStack(ItemStack item) this.speed = ((IClockwork) items[1].getItem()).getSpeed(items[1]); } } + + @Override + public ClockworkNetworkContainer getGui() { + return ClockworkPhase2.proxy.getClockworkNetworkGui(this, 0); + } + + @Override + public void setState(int state) {} + @Override + public void setStateAndUpdate(int state) {} } diff --git a/src/main/java/lumaceon/mods/clockworkphase2/tile/clockwork/TileClockworkMelter.java b/src/main/java/lumaceon/mods/clockworkphase2/tile/clockwork/TileClockworkMelter.java new file mode 100644 index 0000000..ade811c --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/tile/clockwork/TileClockworkMelter.java @@ -0,0 +1,21 @@ +package lumaceon.mods.clockworkphase2.tile.clockwork; + +import lumaceon.mods.clockworkphase2.api.clockworknetwork.ClockworkNetworkContainer; + +public class TileClockworkMelter extends TileClockwork +{ + @Override + public ClockworkNetworkContainer getGui() { + return null; + } + + @Override + public void setState(int state) { + + } + + @Override + public void setStateAndUpdate(int state) { + + } +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/tile/clockwork/TileClockworkMixer.java b/src/main/java/lumaceon/mods/clockworkphase2/tile/clockwork/TileClockworkMixer.java new file mode 100644 index 0000000..60d81ef --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/tile/clockwork/TileClockworkMixer.java @@ -0,0 +1,17 @@ +package lumaceon.mods.clockworkphase2.tile.clockwork; + +import lumaceon.mods.clockworkphase2.ClockworkPhase2; +import lumaceon.mods.clockworkphase2.api.clockworknetwork.ClockworkNetworkContainer; + +public class TileClockworkMixer extends TileClockwork +{ + @Override + public ClockworkNetworkContainer getGui() { + return ClockworkPhase2.proxy.getClockworkNetworkGui(this, 2); + } + + @Override + public void setState(int state) {} + @Override + public void setStateAndUpdate(int state) {} +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/util/ChildGuiData.java b/src/main/java/lumaceon/mods/clockworkphase2/util/ChildGuiData.java new file mode 100644 index 0000000..5d22f5b --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/util/ChildGuiData.java @@ -0,0 +1,40 @@ +package lumaceon.mods.clockworkphase2.util; + +import lumaceon.mods.clockworkphase2.api.block.clockwork.IClockworkNetworkMachine; +import lumaceon.mods.clockworkphase2.api.clockworknetwork.ClockworkNetworkContainer; + +public class ChildGuiData +{ + public IClockworkNetworkMachine machine; + public ClockworkNetworkContainer gui; + private int x, y; //Position is relative to the bottom-center of the screen. + + public ChildGuiData(IClockworkNetworkMachine machine, ClockworkNetworkContainer gui, int x, int y, int guiX, int guiY) { + this.machine = machine; + this.gui = gui; + setLocation(x, y, guiX, guiY); + } + + public void setLocation(int x, int y, int guiX, int guiY) { + this.x = x - guiX / 2; + this.y = y - guiY; + } + + /** + * Calculates the desired x coordinate from the left of the screen. + * @param guiX The xSize of the gui. + * @return The distance of this child gui's left coordinate from the left of the parent gui. + */ + public int getX(int guiX) { + return x + guiX / 2; + } + + /** + * Calculates the desired y coordinate from the top of the screen. + * @param guiY The ySize of the gui. + * @return The distance of this child gui's top coordinate from the top of the parent gui. + */ + public int getY(int guiY) { + return y + guiY; + } +} diff --git a/src/main/java/lumaceon/mods/clockworkphase2/util/RayTraceHelper.java b/src/main/java/lumaceon/mods/clockworkphase2/util/RayTraceHelper.java new file mode 100644 index 0000000..de5a35d --- /dev/null +++ b/src/main/java/lumaceon/mods/clockworkphase2/util/RayTraceHelper.java @@ -0,0 +1,36 @@ +package lumaceon.mods.clockworkphase2.util; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class RayTraceHelper +{ + public static MovingObjectPosition rayTrace(World world, Entity player, boolean par3, double range) + { + float f = 1.0F; + float f1 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * f; + float f2 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * f; + double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double) f; + double d1 = player.prevPosY + (player.posY - player.prevPosY) * (double) f; + if(!world.isRemote && player instanceof EntityPlayer) + d1 += 1.62D; + double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double) f; + Vec3 vec3 = Vec3.createVectorHelper(d0, d1, d2); + float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI); + float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI); + float f5 = -MathHelper.cos(-f1 * 0.017453292F); + float f6 = MathHelper.sin(-f1 * 0.017453292F); + float f7 = f4 * f5; + float f8 = f3 * f5; + double d3 = range; + if(player instanceof EntityPlayerMP) + d3 = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance(); + Vec3 vec31 = vec3.addVector((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); + return world.func_147447_a(vec3, vec31, par3, !par3, par3); + } +} diff --git a/src/main/resources/assets/clockworkphase2/lang/en_US.lang b/src/main/resources/assets/clockworkphase2/lang/en_US.lang index 2a42b13..49e9131 100644 --- a/src/main/resources/assets/clockworkphase2/lang/en_US.lang +++ b/src/main/resources/assets/clockworkphase2/lang/en_US.lang @@ -18,6 +18,9 @@ item.clockworkphase2:gold_gear.name=Golden Gear item.clockworkphase2:diamond_gear.name=Diamond Gear item.clockworkphase2:emerald_gear.name=Emerald Gear item.clockworkphase2:quartz_gear.name=Quartz Gear +item.clockworkphase2:zinc_gear.name=Zinc Gear +item.clockworkphase2:copper_gear.name=Copper Gear +item.clockworkphase2:brass_gear.name=Brass Gear item.clockworkphase2:broken_elysian_gear.name=Elysian Gear (Broken) item.clockworkphase2:temporal_core.name=Temporal Core @@ -26,17 +29,11 @@ item.clockworkphase2:temporal_hourglass.name=Temporal Hourglass item.clockworkphase2:temporal_drive_simulate.name=Temporal Simulation Drive item.clockworkphase2:temporal_drive_modify.name=Temporal Modification Drive item.clockworkphase2:temporal_drive_duplicate.name=Temporal Duplication Drive -item.clockworkphase2:timestream_relocation.name=Timestream of Teleportation -item.clockworkphase2:timestream_silky_harvest.name=Timestream of Silky Excavation -item.clockworkphase2:timestream_smelt.name=Timestream of Smelting -item.clockworkphase2:timestream_tank.name=Timestream of Fluidic Storage -item.clockworkphase2:timestream_mob_repulser.name=Timestream of Mob Repulsion -item.clockworkphase2:timestream_lightning.name=Timestream of Lightning -item.clockworkphase2:timestream_lightning_rod.name=Timestream of Lightning {Cannibalized} item.clockworkphase2:tool_upgrade_silk.name=Tool Module: Silk Touch item.clockworkphase2:tool_upgrade_furnace.name=Tool Module: Internal Furnace item.clockworkphase2:tool_upgrade_relocate.name=Tool Module: Relocation Matrix +item.clockworkphase2:tool_upgrade_area.name=Tool Module: Area Miner item.clockworkphase2:timezone_module_tank.name=Timezone Function: Fluid Tank @@ -47,10 +44,19 @@ item.clockworkphase2:brass_ingot.name=Brass Ingot item.clockworkphase2:brass_lump.name=Brass Lump item.clockworkphase2:schematic_tool.name=Schematic Maker +item.clockworkphase2:bug_swatter.name=Bug Swatter +item.clockworkphase2:age_developer.name=Developer Time Turner (Developers Only) +item.clockworkphase2:wire_duster.name=Wire Duster +item.clockworkphase2:wooden_trowel.name=Wooden Trowel +item.clockworkphase2:stone_trowel.name=Stone Trowel +item.clockworkphase2:iron_trowel.name=Iron Trowel +item.clockworkphase2:diamond_trowel.name=Diamond Trowel #Block tile.clockworkphase2:time_sand.name=Time Sand tile.clockworkphase2:basic_winding_box.name=Manual Winding Box +tile.clockworkphase2:clockwork_furnace.name=Clockwork Furnace +tile.clockworkphase2:temporal_furnace.name=Temporal Furnace tile.clockworkphase2:assembly_table.name=Worktable tile.clockworkphase2:assembly_table_sb.name=Worktable diff --git a/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/alloy_furnace.png b/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/alloy_furnace.png new file mode 100644 index 0000000..79ce57f Binary files /dev/null and b/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/alloy_furnace.png differ diff --git a/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/brewery.png b/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/brewery.png new file mode 100644 index 0000000..e960cc4 Binary files /dev/null and b/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/brewery.png differ diff --git a/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/chest.png b/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/chest.png new file mode 100644 index 0000000..74df22a Binary files /dev/null and b/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/chest.png differ diff --git a/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/furnace.png b/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/furnace.png new file mode 100644 index 0000000..b430110 Binary files /dev/null and b/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/furnace.png differ diff --git a/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/melter.png b/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/melter.png new file mode 100644 index 0000000..13c07a9 Binary files /dev/null and b/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/melter.png differ diff --git a/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/mixer.png b/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/mixer.png new file mode 100644 index 0000000..2b377c6 Binary files /dev/null and b/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/mixer.png differ diff --git a/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/player_inventory.png b/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/player_inventory.png new file mode 100644 index 0000000..75b60ab Binary files /dev/null and b/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/player_inventory.png differ diff --git a/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/power.png b/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/power.png new file mode 100644 index 0000000..69ec4ea Binary files /dev/null and b/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/power.png differ diff --git a/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/power_center.png b/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/power_center.png new file mode 100644 index 0000000..6d5aa33 Binary files /dev/null and b/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/power_center.png differ diff --git a/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/power_hand.png b/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/power_hand.png new file mode 100644 index 0000000..e07479c Binary files /dev/null and b/src/main/resources/assets/clockworkphase2/textures/gui/clockworkmachine/power_hand.png differ diff --git a/src/main/resources/assets/clockworkphase2/textures/items/brass_ingot.png b/src/main/resources/assets/clockworkphase2/textures/items/brass_ingot.png index 65c726e..aac47ef 100644 Binary files a/src/main/resources/assets/clockworkphase2/textures/items/brass_ingot.png and b/src/main/resources/assets/clockworkphase2/textures/items/brass_ingot.png differ diff --git a/src/main/resources/assets/clockworkphase2/textures/items/brass_lump.png b/src/main/resources/assets/clockworkphase2/textures/items/brass_lump.png index 7fcc950..f9f4ea6 100644 Binary files a/src/main/resources/assets/clockworkphase2/textures/items/brass_lump.png and b/src/main/resources/assets/clockworkphase2/textures/items/brass_lump.png differ diff --git a/src/main/resources/assets/clockworkphase2/textures/items/clockwork_core.png b/src/main/resources/assets/clockworkphase2/textures/items/clockwork_core.png index 7172249..89543d2 100644 Binary files a/src/main/resources/assets/clockworkphase2/textures/items/clockwork_core.png and b/src/main/resources/assets/clockworkphase2/textures/items/clockwork_core.png differ diff --git a/src/main/resources/assets/clockworkphase2/textures/items/copper_ingot.png b/src/main/resources/assets/clockworkphase2/textures/items/copper_ingot.png index ac10bae..21814c1 100644 Binary files a/src/main/resources/assets/clockworkphase2/textures/items/copper_ingot.png and b/src/main/resources/assets/clockworkphase2/textures/items/copper_ingot.png differ diff --git a/src/main/resources/assets/clockworkphase2/textures/items/tool_upgrade_area.png b/src/main/resources/assets/clockworkphase2/textures/items/tool_upgrade_area.png new file mode 100644 index 0000000..6c96372 Binary files /dev/null and b/src/main/resources/assets/clockworkphase2/textures/items/tool_upgrade_area.png differ diff --git a/src/main/resources/assets/clockworkphase2/textures/items/tool_upgrade_fortune.png b/src/main/resources/assets/clockworkphase2/textures/items/tool_upgrade_fortune.png new file mode 100644 index 0000000..f34282d Binary files /dev/null and b/src/main/resources/assets/clockworkphase2/textures/items/tool_upgrade_fortune.png differ diff --git a/src/main/resources/assets/clockworkphase2/textures/items/tool_upgrade_furnace.png b/src/main/resources/assets/clockworkphase2/textures/items/tool_upgrade_furnace.png new file mode 100644 index 0000000..180f4ae Binary files /dev/null and b/src/main/resources/assets/clockworkphase2/textures/items/tool_upgrade_furnace.png differ diff --git a/src/main/resources/assets/clockworkphase2/textures/items/tool_upgrade_relocate.png b/src/main/resources/assets/clockworkphase2/textures/items/tool_upgrade_relocate.png new file mode 100644 index 0000000..683f338 Binary files /dev/null and b/src/main/resources/assets/clockworkphase2/textures/items/tool_upgrade_relocate.png differ diff --git a/src/main/resources/assets/clockworkphase2/textures/items/tool_upgrade_silk.png b/src/main/resources/assets/clockworkphase2/textures/items/tool_upgrade_silk.png new file mode 100644 index 0000000..7bd1c93 Binary files /dev/null and b/src/main/resources/assets/clockworkphase2/textures/items/tool_upgrade_silk.png differ diff --git a/src/main/resources/assets/clockworkphase2/textures/items/tool_upgrade_xp.png b/src/main/resources/assets/clockworkphase2/textures/items/tool_upgrade_xp.png new file mode 100644 index 0000000..4a73216 Binary files /dev/null and b/src/main/resources/assets/clockworkphase2/textures/items/tool_upgrade_xp.png differ diff --git a/src/main/resources/assets/clockworkphase2/textures/items/zinc_ingot.png b/src/main/resources/assets/clockworkphase2/textures/items/zinc_ingot.png index 6e3e829..417200c 100644 Binary files a/src/main/resources/assets/clockworkphase2/textures/items/zinc_ingot.png and b/src/main/resources/assets/clockworkphase2/textures/items/zinc_ingot.png differ diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 51827b3..1f036ac 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,13 +3,12 @@ "modid": "clockworkphase2", "name": "Clockwork Phase 2", "description": "Adding time magic to Minecraft since tomorrow.", - "version": "1.7.10-DEV", + "version": "1.7.10-DEV1", "mcversion": "1.7.10", "url": "", "updateUrl": "", "authorList": [ - "Lumaceon", - "The J" + "Lumaceon" ], "logoFile": "", "screenshots": [