-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added clockwork machine with a controller GUI. Mostly placeholder stuff.
- Loading branch information
Showing
84 changed files
with
2,090 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 0 additions & 16 deletions
16
src/main/java/lumaceon/mods/clockworkphase2/api/block/clockwork/IClockworkDestination.java
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
...main/java/lumaceon/mods/clockworkphase2/api/block/clockwork/IClockworkNetworkMachine.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/lumaceon/mods/clockworkphase2/api/block/clockwork/IClockworkNetworkTile.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} |
16 changes: 0 additions & 16 deletions
16
src/main/java/lumaceon/mods/clockworkphase2/api/block/clockwork/IClockworkSource.java
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
src/main/java/lumaceon/mods/clockworkphase2/api/block/clockwork/IClockworkTile.java
This file was deleted.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
src/main/java/lumaceon/mods/clockworkphase2/api/block/clockwork/IMainspringTile.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package lumaceon.mods.clockworkphase2.api.block.clockwork; | ||
|
||
public interface IMainspringTile extends IClockworkNetworkTile | ||
{ | ||
|
||
} |
45 changes: 45 additions & 0 deletions
45
...in/java/lumaceon/mods/clockworkphase2/api/clockworknetwork/ClockworkNetworkContainer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) {} | ||
} |
45 changes: 45 additions & 0 deletions
45
...in/java/lumaceon/mods/clockworkphase2/api/clockworknetwork/ClockworkNetworkGuiClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<GuiButton> 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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/main/java/lumaceon/mods/clockworkphase2/api/util/ClockworkNetwork.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<IMainspringTile> mainsprings = new ArrayList<IMainspringTile>(2); | ||
private ArrayList<IClockworkNetworkMachine> machines = new ArrayList<IClockworkNetworkMachine>(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<IMainspringTile> getMainsprings() { return mainsprings; } | ||
public ArrayList<IClockworkNetworkMachine> getMachines() { return machines; } | ||
|
||
public void joinNetworks(ClockworkNetwork clockworkNetwork) | ||
{ | ||
ArrayList<IMainspringTile> newNetworkMainsprings = clockworkNetwork.getMainsprings(); | ||
ArrayList<IClockworkNetworkMachine> newNetworkMachines = clockworkNetwork.getMachines(); | ||
for(IMainspringTile m : newNetworkMainsprings) | ||
addMainspring(m); | ||
|
||
for(IClockworkNetworkMachine m : newNetworkMachines) | ||
addMachine(m); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/main/java/lumaceon/mods/clockworkphase2/block/clockwork/BlockClockworkBrewery.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/lumaceon/mods/clockworkphase2/block/clockwork/BlockClockworkController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/lumaceon/mods/clockworkphase2/block/clockwork/BlockClockworkMixer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} |
Oops, something went wrong.