Merge branch 'master' into power
This commit is contained in:
commit
f83e2072d6
9 changed files with 37 additions and 211 deletions
|
@ -1,12 +1,10 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) SpaceToad, 2011
|
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
|
||||||
* http://www.mod-buildcraft.com
|
|
||||||
*
|
*
|
||||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
|
||||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
* 1.0, or MMPL. Please check the contents of the license located in
|
||||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package buildcraft.core;
|
package buildcraft.core;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
@ -21,12 +19,11 @@ public class EntityBlock extends Entity {
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public Icon texture;
|
public Icon texture;
|
||||||
public float shadowSize = 0;
|
public float shadowSize = 0;
|
||||||
|
|
||||||
public float rotationX = 0;
|
public float rotationX = 0;
|
||||||
public float rotationY = 0;
|
public float rotationY = 0;
|
||||||
public float rotationZ = 0;
|
public float rotationZ = 0;
|
||||||
|
|
||||||
public double iSize, jSize, kSize;
|
public double iSize, jSize, kSize;
|
||||||
|
private int brightness = -1;
|
||||||
|
|
||||||
public EntityBlock(World world) {
|
public EntityBlock(World world) {
|
||||||
super(world);
|
super(world);
|
||||||
|
@ -68,28 +65,31 @@ public class EntityBlock extends Entity {
|
||||||
setPosition(posX + d, posY + d1, posZ + d2);
|
setPosition(posX + d, posY + d1, posZ + d2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBrightness(int brightness) {
|
||||||
|
this.brightness = brightness;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void entityInit() {
|
protected void entityInit() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
|
protected void readEntityFromNBT(NBTTagCompound data) {
|
||||||
iSize = nbttagcompound.getDouble("iSize");
|
iSize = data.getDouble("iSize");
|
||||||
jSize = nbttagcompound.getDouble("jSize");
|
jSize = data.getDouble("jSize");
|
||||||
kSize = nbttagcompound.getDouble("kSize");
|
kSize = data.getDouble("kSize");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {
|
protected void writeEntityToNBT(NBTTagCompound data) {
|
||||||
nbttagcompound.setDouble("iSize", iSize);
|
data.setDouble("iSize", iSize);
|
||||||
nbttagcompound.setDouble("jSize", jSize);
|
data.setDouble("jSize", jSize);
|
||||||
nbttagcompound.setDouble("kSize", kSize);
|
data.setDouble("kSize", kSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getBrightnessForRender(float par1) {
|
public int getBrightnessForRender(float par1) {
|
||||||
return 210;
|
return brightness > 0 ? brightness : super.getBrightnessForRender(par1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -330,6 +330,7 @@ public class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityBlock block = CoreProxy.proxy.newEntityBlock(world, i, j, k, iSize, jSize, kSize, kind);
|
EntityBlock block = CoreProxy.proxy.newEntityBlock(world, i, j, k, iSize, jSize, kSize, kind);
|
||||||
|
block.setBrightness(210);
|
||||||
|
|
||||||
world.spawnEntityInWorld(block);
|
world.spawnEntityInWorld(block);
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class GuiHandler implements IGuiHandler {
|
||||||
|
|
||||||
switch (ID) {
|
switch (ID) {
|
||||||
case GuiIds.PIPE_DIAMOND:
|
case GuiIds.PIPE_DIAMOND:
|
||||||
return new ContainerDiamondPipe(player.inventory, (PipeLogicDiamond) pipe.pipe.logic);
|
return new ContainerDiamondPipe(player.inventory, ((PipeLogicDiamond) pipe.pipe.logic).getFilters());
|
||||||
|
|
||||||
case GuiIds.PIPE_EMERALD_ITEM:
|
case GuiIds.PIPE_EMERALD_ITEM:
|
||||||
return new ContainerEmeraldPipe(player.inventory, (IInventory) pipe.pipe);
|
return new ContainerEmeraldPipe(player.inventory, (IInventory) pipe.pipe);
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class GuiDiamondPipe extends GuiBuildCraft {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||||
fontRenderer.drawString(filterInventory.getInvName(), getCenteredOffset(filterInventory.getInvName()), 6, 0x404040);
|
fontRenderer.drawString(filterInventory.getFilters().getInvName(), getCenteredOffset(filterInventory.getFilters().getInvName()), 6, 0x404040);
|
||||||
fontRenderer.drawString(StringUtils.localize("gui.inventory"), 8, ySize - 97, 0x404040);
|
fontRenderer.drawString(StringUtils.localize("gui.inventory"), 8, ySize - 97, 0x404040);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class GuiEmeraldPipe extends GuiBuildCraft {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||||
fontRenderer.drawString(filterInventory.getInvName(), getCenteredOffset(filterInventory.getInvName()), 6, 0x404040);
|
fontRenderer.drawString(filterInventory.getFilters().getInvName(), getCenteredOffset(filterInventory.getFilters().getInvName()), 6, 0x404040);
|
||||||
fontRenderer.drawString(StringUtils.localize("gui.inventory"), 8, ySize - 93, 0x404040);
|
fontRenderer.drawString(StringUtils.localize("gui.inventory"), 8, ySize - 93, 0x404040);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -322,7 +322,7 @@ public class PacketHandlerTransport implements IPacketHandler {
|
||||||
if (!(pipe.pipe.logic instanceof PipeLogicDiamond))
|
if (!(pipe.pipe.logic instanceof PipeLogicDiamond))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
((PipeLogicDiamond) pipe.pipe.logic).setInventorySlotContents(packet.slot, packet.stack);
|
((PipeLogicDiamond) pipe.pipe.logic).getFilters().setInventorySlotContents(packet.slot, packet.stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -339,7 +339,7 @@ public class PacketHandlerTransport implements IPacketHandler {
|
||||||
if (!(pipe.pipe instanceof PipeItemsEmerald))
|
if (!(pipe.pipe instanceof PipeItemsEmerald))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
((PipeItemsEmerald) pipe.pipe).setInventorySlotContents(packet.slot, packet.stack);
|
((PipeItemsEmerald) pipe.pipe).getFilters().setInventorySlotContents(packet.slot, packet.stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class PipeItemsDiamond extends Pipe implements IPipeTransportItemsHook, I
|
||||||
// no breaks here.
|
// no breaks here.
|
||||||
PipeLogicDiamond diamondLogic = (PipeLogicDiamond) logic;
|
PipeLogicDiamond diamondLogic = (PipeLogicDiamond) logic;
|
||||||
for (int slot = 0; slot < 9; ++slot) {
|
for (int slot = 0; slot < 9; ++slot) {
|
||||||
ItemStack stack = diamondLogic.getStackInSlot(dir.ordinal() * 9 + slot);
|
ItemStack stack = diamondLogic.getFilters().getStackInSlot(dir.ordinal() * 9 + slot);
|
||||||
|
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
foundFilter = true;
|
foundFilter = true;
|
||||||
|
|
|
@ -32,9 +32,9 @@ import buildcraft.transport.BlockGenericPipe;
|
||||||
import buildcraft.transport.PipeIconProvider;
|
import buildcraft.transport.PipeIconProvider;
|
||||||
import buildcraft.transport.PipeTransportItems;
|
import buildcraft.transport.PipeTransportItems;
|
||||||
|
|
||||||
public class PipeItemsEmerald extends PipeItemsWood implements ISpecialInventory, IClientState {
|
public class PipeItemsEmerald extends PipeItemsWood implements IClientState {
|
||||||
|
|
||||||
private SimpleInventory filters = new SimpleInventory(9, "items", 1);
|
private SimpleInventory filters = new SimpleInventory(9, "Filters", 1);
|
||||||
private int currentFilter = 0;
|
private int currentFilter = 0;
|
||||||
|
|
||||||
protected PipeItemsEmerald(int itemID, PipeTransportItems transport) {
|
protected PipeItemsEmerald(int itemID, PipeTransportItems transport) {
|
||||||
|
@ -209,91 +209,7 @@ public class PipeItemsEmerald extends PipeItemsWood implements ISpecialInventory
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ISPECIALINVENTORY */
|
public IInventory getFilters(){
|
||||||
@Override
|
return filters;
|
||||||
public int addItem(ItemStack stack, boolean doAdd, ForgeDirection from) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack[] extractItem(boolean doRemove, ForgeDirection from, int maxItemCount) {
|
|
||||||
return new ItemStack[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* IINVENTORY IMPLEMENTATION */
|
|
||||||
@Override
|
|
||||||
public int getSizeInventory() {
|
|
||||||
return filters.getSizeInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getStackInSlot(int i) {
|
|
||||||
return filters.getStackInSlot(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getInvName() {
|
|
||||||
return "Filters";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getInventoryStackLimit() {
|
|
||||||
return filters.getInventoryStackLimit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getStackInSlotOnClosing(int i) {
|
|
||||||
return filters.getStackInSlotOnClosing(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onInventoryChanged() {
|
|
||||||
filters.onInventoryChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isUseableByPlayer(EntityPlayer var1) {
|
|
||||||
return worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) == container;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void openChest() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void closeChest() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack decrStackSize(int i, int j) {
|
|
||||||
ItemStack stack = filters.decrStackSize(i, j);
|
|
||||||
|
|
||||||
if (CoreProxy.proxy.isSimulating(worldObj)) {
|
|
||||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
|
||||||
}
|
|
||||||
|
|
||||||
return stack;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
|
||||||
|
|
||||||
filters.setInventorySlotContents(i, itemstack);
|
|
||||||
if (CoreProxy.proxy.isSimulating(worldObj)) {
|
|
||||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isInvNameLocalized() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isStackValidForSlot(int i, ItemStack itemstack) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +1,25 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) SpaceToad, 2011
|
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
|
||||||
* http://www.mod-buildcraft.com
|
|
||||||
*
|
*
|
||||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
|
||||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
* 1.0, or MMPL. Please check the contents of the license located in
|
||||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package buildcraft.transport.pipes;
|
package buildcraft.transport.pipes;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
|
||||||
import buildcraft.BuildCraftTransport;
|
import buildcraft.BuildCraftTransport;
|
||||||
import buildcraft.api.inventory.ISpecialInventory;
|
|
||||||
import buildcraft.core.GuiIds;
|
import buildcraft.core.GuiIds;
|
||||||
import buildcraft.core.proxy.CoreProxy;
|
import buildcraft.core.proxy.CoreProxy;
|
||||||
import buildcraft.core.inventory.SimpleInventory;
|
import buildcraft.core.inventory.SimpleInventory;
|
||||||
import buildcraft.transport.BlockGenericPipe;
|
import buildcraft.transport.BlockGenericPipe;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
|
||||||
public class PipeLogicDiamond extends PipeLogic implements ISpecialInventory {
|
public class PipeLogicDiamond extends PipeLogic {
|
||||||
|
|
||||||
private SimpleInventory filters = new SimpleInventory(54, "items", 1);
|
private SimpleInventory filters = new SimpleInventory(54, "Filters", 1);
|
||||||
|
|
||||||
/* PIPE LOGIC */
|
/* PIPE LOGIC */
|
||||||
@Override
|
@Override
|
||||||
|
@ -57,94 +53,7 @@ public class PipeLogicDiamond extends PipeLogic implements ISpecialInventory {
|
||||||
filters.writeToNBT(nbttagcompound);
|
filters.writeToNBT(nbttagcompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ISPECIALINVENTORY */
|
public IInventory getFilters() {
|
||||||
@Override
|
return filters;
|
||||||
public int addItem(ItemStack stack, boolean doAdd, ForgeDirection from) {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack[] extractItem(boolean doRemove, ForgeDirection from, int maxItemCount) {
|
|
||||||
return new ItemStack[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* IINVENTORY IMPLEMENTATION */
|
|
||||||
@Override
|
|
||||||
public int getSizeInventory() {
|
|
||||||
return filters.getSizeInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getStackInSlot(int i) {
|
|
||||||
return filters.getStackInSlot(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getInvName() {
|
|
||||||
return "Filters";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getInventoryStackLimit() {
|
|
||||||
return filters.getInventoryStackLimit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getStackInSlotOnClosing(int i) {
|
|
||||||
return filters.getStackInSlotOnClosing(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onInventoryChanged() {
|
|
||||||
filters.onInventoryChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isUseableByPlayer(EntityPlayer var1) {
|
|
||||||
return worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) == container;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void openChest() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void closeChest() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack decrStackSize(int i, int j) {
|
|
||||||
ItemStack stack = filters.decrStackSize(i, j);
|
|
||||||
|
|
||||||
if (CoreProxy.proxy.isSimulating(worldObj)) {
|
|
||||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
|
||||||
}
|
|
||||||
|
|
||||||
return stack;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
|
||||||
|
|
||||||
filters.setInventorySlotContents(i, itemstack);
|
|
||||||
if (CoreProxy.proxy.isSimulating(worldObj)) {
|
|
||||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isInvNameLocalized()
|
|
||||||
{
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isStackValidForSlot(int i, ItemStack itemstack)
|
|
||||||
{
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue