Start on Blast furnace will get @modmuss50 to finish

This commit is contained in:
Gig 2015-04-17 01:09:12 +01:00
parent 4a3214320c
commit dc6d186f67
12 changed files with 204 additions and 0 deletions

View file

@ -0,0 +1,63 @@
package techreborn.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.TileBlastFurnace;
import techreborn.tiles.TileCentrifuge;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
public class BlockBlastFurnace extends BlockContainer{
@SideOnly(Side.CLIENT)
private IIcon front;
@SideOnly(Side.CLIENT)
private IIcon other;
public BlockBlastFurnace(Material material)
{
super(material);
setCreativeTab(TechRebornCreativeTab.instance);
setBlockName("techreborn.blastfurnace");
setHardness(2F);
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
return new TileBlastFurnace();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.blastFurnaceID, world, x, y, z);
return true;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) {
front = icon.registerIcon("techreborn:machine/industrial_blast_furnace_front_off");
other = icon.registerIcon("techreborn:machine/machine_side");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int currentSide, int meta) {
if (currentSide == 2) {
return front;
} else {
return other;
}
}
}

View file

@ -15,6 +15,7 @@ public class GuiHandler implements IGuiHandler {
public static final int quantumChestID = 2; public static final int quantumChestID = 2;
public static final int centrifugeID = 3; public static final int centrifugeID = 3;
public static final int rollingMachineID = 4; public static final int rollingMachineID = 4;
public static final int blastFurnaceID = 5;
@Override @Override
@ -29,8 +30,11 @@ public class GuiHandler implements IGuiHandler {
return new ContainerCentrifuge((TileCentrifuge) world.getTileEntity(x, y, z), player); return new ContainerCentrifuge((TileCentrifuge) world.getTileEntity(x, y, z), player);
} else if (ID == rollingMachineID) { } else if (ID == rollingMachineID) {
return new ContainerRollingMachine((TileRollingMachine) world.getTileEntity(x, y, z), player); return new ContainerRollingMachine((TileRollingMachine) world.getTileEntity(x, y, z), player);
} else if (ID == blastFurnaceID) {
return new ContainerBlastFurnace((TileBlastFurnace) world.getTileEntity(x, y, z), player);
} }
return null; return null;
} }
@ -46,6 +50,8 @@ public class GuiHandler implements IGuiHandler {
return new GuiCentrifuge(player, (TileCentrifuge) world.getTileEntity(x, y, z)); return new GuiCentrifuge(player, (TileCentrifuge) world.getTileEntity(x, y, z));
} else if (ID == rollingMachineID) { } else if (ID == rollingMachineID) {
return new GuiRollingMachine(player, (TileRollingMachine) world.getTileEntity(x, y, z)); return new GuiRollingMachine(player, (TileRollingMachine) world.getTileEntity(x, y, z));
} else if (ID == blastFurnaceID) {
return new GuiBlastFurnace(player, (TileBlastFurnace) world.getTileEntity(x, y, z));
} }
return null; return null;
} }

View file

@ -0,0 +1,48 @@
package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import techreborn.client.SlotOutput;
import techreborn.tiles.TileBlastFurnace;
import techreborn.tiles.TileCentrifuge;
public class ContainerBlastFurnace extends TechRebornContainer {
EntityPlayer player;
TileBlastFurnace tile;
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
public int tickTime;
public ContainerBlastFurnace(TileBlastFurnace tileblastfurnace, EntityPlayer player) {
tile = tileblastfurnace;
this.player = player;
//input
this.addSlotToContainer(new Slot(tileblastfurnace.inventory, 0, 56, 25));
this.addSlotToContainer(new Slot(tileblastfurnace.inventory, 1, 56, 43));
//outputs
this.addSlotToContainer(new SlotOutput(tileblastfurnace.inventory, 2, 116, 35));
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
}

View file

@ -0,0 +1,37 @@
package techreborn.client.gui;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import techreborn.client.container.ContainerBlastFurnace;
import techreborn.client.container.ContainerCentrifuge;
import techreborn.tiles.TileBlastFurnace;
import techreborn.tiles.TileCentrifuge;
public class GuiBlastFurnace extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/industrial_blast_furnace.png");
TileBlastFurnace blastfurnace;
public GuiBlastFurnace(EntityPlayer player, TileBlastFurnace tileblastfurnace) {
super(new ContainerBlastFurnace(tileblastfurnace, player));
this.xSize = 176;
this.ySize = 167;
blastfurnace = tileblastfurnace;
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
this.fontRendererObj.drawString("Blastfurnace", 60, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
}
}

View file

@ -23,6 +23,7 @@ public class ModBlocks {
public static Block centrifuge; public static Block centrifuge;
public static Block RollingMachine; public static Block RollingMachine;
public static Block MachineCasing; public static Block MachineCasing;
public static Block BlastFurnace;
public static Block ore; public static Block ore;
public static Block storage; public static Block storage;
@ -48,6 +49,9 @@ public class ModBlocks {
GameRegistry.registerBlock(RollingMachine, "rollingmachine"); GameRegistry.registerBlock(RollingMachine, "rollingmachine");
GameRegistry.registerTileEntity(TileRollingMachine.class, "TileRollingMachine"); GameRegistry.registerTileEntity(TileRollingMachine.class, "TileRollingMachine");
BlastFurnace = new BlockBlastFurnace(Material.piston);
GameRegistry.registerBlock(BlastFurnace, "blastFurnace");
MachineCasing = new BlockMachineCasing(Material.piston); MachineCasing = new BlockMachineCasing(Material.piston);
GameRegistry.registerBlock(MachineCasing, ItemBlockMachineCasing.class, "machinecasing"); GameRegistry.registerBlock(MachineCasing, ItemBlockMachineCasing.class, "machinecasing");

View file

@ -0,0 +1,46 @@
package techreborn.tiles;
import techreborn.init.ModBlocks;
import techreborn.util.Inventory;
import ic2.api.energy.prefab.BasicSink;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
public class TileBlastFurnace extends TileMachineBase implements IWrenchable {
public int tickTime;
public BasicSink energy;
public Inventory inventory = new Inventory(3, "TileBlastFurnace", 64);
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public short getFacing() {
return 0;
}
@Override
public void setFacing(short facing) {
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public float getWrenchDropRate() {
return 1.0F;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(ModBlocks.BlastFurnace, 1);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB