mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-26 23:13:21 +00:00
Stub farm station block.
This commit is contained in:
1 parent
cba68638c7
commit
6e7c4e7f0b
11 files changed
+325
No files matched your search
@@ -36,6 +36,8 @@ import crazypants.enderio.conduit.render.DefaultConduitRenderer;
|
||||
import crazypants.enderio.conduit.render.ItemConduitRenderer;
|
||||
import crazypants.enderio.enderface.EnderIoRenderer;
|
||||
import crazypants.enderio.enderface.TileEnderIO;
|
||||
import crazypants.enderio.farm.BlockFarmStation;
|
||||
import crazypants.enderio.farm.FarmingStationRenderer;
|
||||
import crazypants.enderio.item.PoweredItemRenderer;
|
||||
import crazypants.enderio.item.YetaWrenchOverlayRenderer;
|
||||
import crazypants.enderio.item.YetaWrenchTickHandler;
|
||||
@@ -120,6 +122,9 @@ public class ClientProxy extends CommonProxy {
|
||||
BlockFusedQuartz.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new FusedQuartzRenderer());
|
||||
|
||||
BlockFarmStation.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new FarmingStationRenderer());
|
||||
|
||||
BlockCombustionGenerator.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
CombustionGeneratorRenderer cr = new CombustionGeneratorRenderer();
|
||||
RenderingRegistry.registerBlockHandler(cr);
|
||||
|
||||
@@ -32,6 +32,7 @@ import crazypants.enderio.conduit.redstone.ItemRedstoneConduit;
|
||||
import crazypants.enderio.enderface.BlockEnderIO;
|
||||
import crazypants.enderio.enderface.EnderfaceRecipes;
|
||||
import crazypants.enderio.enderface.ItemEnderface;
|
||||
import crazypants.enderio.farm.BlockFarmStation;
|
||||
import crazypants.enderio.fluid.BlockFluidEio;
|
||||
import crazypants.enderio.fluid.Fluids;
|
||||
import crazypants.enderio.fluid.ItemBucketEio;
|
||||
@@ -171,6 +172,8 @@ public class EnderIO {
|
||||
public static ItemDarkSteelSword itemDarkSteelSword;
|
||||
public static ItemDarkSteelPickaxe itemDarkSteelPickaxe;
|
||||
|
||||
public static BlockFarmStation blockFarmStation;
|
||||
|
||||
|
||||
|
||||
// public static ITrigger triggerNoEnergy;
|
||||
@@ -198,6 +201,7 @@ public class EnderIO {
|
||||
blockAlloySmelter = BlockAlloySmelter.create();
|
||||
blockVat = BlockVat.create();
|
||||
blockPowerMonitor = BlockPowerMonitor.create();
|
||||
blockFarmStation = BlockFarmStation.create();
|
||||
blockCapacitorBank = BlockCapacitorBank.create();
|
||||
|
||||
blockPainter = BlockPainter.create();
|
||||
|
||||
@@ -34,6 +34,7 @@ public class GuiHandler implements IGuiHandler {
|
||||
public static final int GUI_ID_TRAVEL_AUTH = 19;
|
||||
public static final int GUI_ID_STILL = 20;
|
||||
public static final int GUI_ID_COMBUSTION_GEN = 21;
|
||||
public static final int GUI_ID_FARM_STATATION = 22;
|
||||
|
||||
protected final Map<Integer, IGuiHandler> guiHandlers = new HashMap<Integer, IGuiHandler>();
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ public enum ModObject {
|
||||
blockHyperCube,
|
||||
blockPowerMonitor,
|
||||
blockVat,
|
||||
blockFarmStation,
|
||||
|
||||
blockElectricLight,
|
||||
blockLightNode,
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
package crazypants.enderio.farm;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import crazypants.enderio.GuiHandler;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.machine.AbstractMachineBlock;
|
||||
|
||||
public class BlockFarmStation extends AbstractMachineBlock<TileFarmStation> {
|
||||
|
||||
public static BlockFarmStation create() {
|
||||
BlockFarmStation result = new BlockFarmStation();
|
||||
result.init();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static int renderId;
|
||||
|
||||
protected BlockFarmStation() {
|
||||
super(ModObject.blockFarmStation, TileFarmStation.class);
|
||||
setBlockBounds(0, 0, 0, 1, 0.85f, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof TileFarmStation) {
|
||||
return new FarmStationContainer(player.inventory, (TileFarmStation)te);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof TileFarmStation) {
|
||||
return new GuiFarmStation(player.inventory, (TileFarmStation) te);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getGuiId() {
|
||||
return GuiHandler.GUI_ID_FARM_STATATION;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getMachineFrontIconKey(boolean active) {
|
||||
return "enderio:blankMachinePanel";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getSideIconKey(boolean active) {
|
||||
return "enderio:itemConduitIoConnector";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return renderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public IIcon getFrontIcon() {
|
||||
return iconBuffer[0][3];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package crazypants.enderio.farm;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import crazypants.enderio.machine.AbstractMachineContainer;
|
||||
|
||||
public class FarmStationContainer extends AbstractMachineContainer {
|
||||
|
||||
public FarmStationContainer(InventoryPlayer inventory, TileFarmStation te) {
|
||||
super(inventory,te);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addMachineSlots(InventoryPlayer playerInv) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package crazypants.enderio.farm;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.render.BoundingBox;
|
||||
import crazypants.render.CubeRenderer;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.render.VertexTransform;
|
||||
import crazypants.vecmath.Vector3d;
|
||||
import crazypants.vecmath.Vector3f;
|
||||
|
||||
public class FarmingStationRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
private VertXForm xform = new VertXForm();
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
renderWorldBlock(null, 0, 0, 0, block, modelId, renderer);
|
||||
Tessellator.instance.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
|
||||
IIcon[] textures = new IIcon[6];
|
||||
textures[0] = EnderIO.blockFarmStation.getIcon(3, 0);
|
||||
textures[1] = EnderIO.blockFarmStation.getIcon(3, 0);
|
||||
textures[2] = EnderIO.blockFarmStation.getIcon(1, 0);
|
||||
textures[3] = EnderIO.blockFarmStation.getIcon(0, 0);
|
||||
textures[4] = EnderIO.blockFarmStation.getIcon(3, 0);
|
||||
textures[5] = EnderIO.blockFarmStation.getIcon(3, 0);
|
||||
|
||||
float b = 1;
|
||||
if(world instanceof World) {
|
||||
b = RenderUtil.claculateTotalBrightnessForLocation((World) world, x, y, z);
|
||||
}
|
||||
|
||||
float[] cols = new float[6];
|
||||
for (int i = 0; i < 6; i++) {
|
||||
float m = RenderUtil.getColorMultiplierForFace(ForgeDirection.values()[i]);
|
||||
cols[i] = b * m;
|
||||
}
|
||||
|
||||
BoundingBox bb = BoundingBox.UNIT_CUBE;
|
||||
xform.set(x, y, z);
|
||||
CubeRenderer.render(bb, textures, xform, cols);
|
||||
|
||||
float scale = 0.7f;
|
||||
float width = 0.4f;
|
||||
float trans = (1 - scale)/2;
|
||||
bb = BoundingBox.UNIT_CUBE.scale(1, scale, width);
|
||||
bb = bb.translate(0, -trans, 0);
|
||||
Tessellator.instance.addTranslation(x, y, z);
|
||||
CubeRenderer.render(bb, textures, null, cols);
|
||||
Tessellator.instance.addTranslation(-x, -y, -z);
|
||||
|
||||
bb = BoundingBox.UNIT_CUBE.scale(width, scale, 1);
|
||||
bb = bb.translate(0, -trans, 0);
|
||||
Tessellator.instance.addTranslation(x, y, z);
|
||||
CubeRenderer.render(bb, textures, null, cols);
|
||||
Tessellator.instance.addTranslation(-x, -y, -z);
|
||||
|
||||
float topWidth = 0.15f;
|
||||
bb = BoundingBox.UNIT_CUBE.scale(1, topWidth, 1);
|
||||
bb = bb.translate(0, 0.2f + topWidth/2f, 0);
|
||||
Tessellator.instance.addTranslation(x, y, z);
|
||||
CubeRenderer.render(bb, textures, null, cols);
|
||||
Tessellator.instance.addTranslation(-x, -y, -z);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return BlockFarmStation.renderId;
|
||||
}
|
||||
|
||||
private static class VertXForm implements VertexTransform {
|
||||
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
public VertXForm() {
|
||||
}
|
||||
|
||||
void set(int x, int y, int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Vector3d vec) {
|
||||
if(vec.y > 0.9) {
|
||||
|
||||
double pinch = 0.5;
|
||||
vec.x -= 0.5;
|
||||
vec.x *= pinch;
|
||||
vec.x += 0.5;
|
||||
vec.z -= 0.5;
|
||||
vec.z *= pinch;
|
||||
vec.z += 0.5;
|
||||
}
|
||||
|
||||
double scale = 0.8;
|
||||
vec.y -= 0.5;
|
||||
vec.y *= scale;
|
||||
vec.y += (0.5 * scale);
|
||||
|
||||
vec.add(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyToNormal(Vector3f vec) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package crazypants.enderio.farm;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import crazypants.enderio.machine.GuiMachineBase;
|
||||
import crazypants.render.RenderUtil;
|
||||
|
||||
public class GuiFarmStation extends GuiMachineBase {
|
||||
|
||||
public GuiFarmStation(InventoryPlayer par1InventoryPlayer, TileFarmStation machine) {
|
||||
super(machine, new FarmStationContainer(par1InventoryPlayer, machine));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderUtil.bindTexture("enderio:textures/gui/farmStation.png");
|
||||
int sx = (width - xSize) / 2;
|
||||
int sy = (height - ySize) / 2;
|
||||
|
||||
drawTexturedModalRect(sx, sy, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
super.drawGuiContainerBackgroundLayer(par1, par2, par3);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package crazypants.enderio.farm;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.machine.AbstractMachineEntity;
|
||||
import crazypants.enderio.machine.SlotDefinition;
|
||||
|
||||
public class TileFarmStation extends AbstractMachineEntity {
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return EnderIO.blockFarmStation.getLocalizedName();
|
||||
}
|
||||
|
||||
public TileFarmStation() {
|
||||
super(new SlotDefinition(6, 4));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockFarmStation.unlocalisedName;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isMachineItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return slotDefinition.isInputSlot(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getProgress() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean processTasks(boolean redstoneCheckPassed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user