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
|
||||
* http://www.mod-buildcraft.com
|
||||
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
|
||||
* 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package buildcraft.core;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
@ -21,12 +19,11 @@ public class EntityBlock extends Entity {
|
|||
@SideOnly(Side.CLIENT)
|
||||
public Icon texture;
|
||||
public float shadowSize = 0;
|
||||
|
||||
public float rotationX = 0;
|
||||
public float rotationY = 0;
|
||||
public float rotationZ = 0;
|
||||
|
||||
public double iSize, jSize, kSize;
|
||||
private int brightness = -1;
|
||||
|
||||
public EntityBlock(World world) {
|
||||
super(world);
|
||||
|
@ -68,28 +65,31 @@ public class EntityBlock extends Entity {
|
|||
setPosition(posX + d, posY + d1, posZ + d2);
|
||||
}
|
||||
|
||||
public void setBrightness(int brightness) {
|
||||
this.brightness = brightness;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
|
||||
iSize = nbttagcompound.getDouble("iSize");
|
||||
jSize = nbttagcompound.getDouble("jSize");
|
||||
kSize = nbttagcompound.getDouble("kSize");
|
||||
protected void readEntityFromNBT(NBTTagCompound data) {
|
||||
iSize = data.getDouble("iSize");
|
||||
jSize = data.getDouble("jSize");
|
||||
kSize = data.getDouble("kSize");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setDouble("iSize", iSize);
|
||||
nbttagcompound.setDouble("jSize", jSize);
|
||||
nbttagcompound.setDouble("kSize", kSize);
|
||||
protected void writeEntityToNBT(NBTTagCompound data) {
|
||||
data.setDouble("iSize", iSize);
|
||||
data.setDouble("jSize", jSize);
|
||||
data.setDouble("kSize", kSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
block.setBrightness(210);
|
||||
|
||||
world.spawnEntityInWorld(block);
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public class GuiHandler implements IGuiHandler {
|
|||
|
||||
switch (ID) {
|
||||
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:
|
||||
return new ContainerEmeraldPipe(player.inventory, (IInventory) pipe.pipe);
|
||||
|
|
|
@ -32,7 +32,7 @@ public class GuiDiamondPipe extends GuiBuildCraft {
|
|||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ public class GuiEmeraldPipe extends GuiBuildCraft {
|
|||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -322,7 +322,7 @@ public class PacketHandlerTransport implements IPacketHandler {
|
|||
if (!(pipe.pipe.logic instanceof PipeLogicDiamond))
|
||||
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))
|
||||
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.
|
||||
PipeLogicDiamond diamondLogic = (PipeLogicDiamond) logic;
|
||||
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) {
|
||||
foundFilter = true;
|
||||
|
|
|
@ -32,9 +32,9 @@ import buildcraft.transport.BlockGenericPipe;
|
|||
import buildcraft.transport.PipeIconProvider;
|
||||
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;
|
||||
|
||||
protected PipeItemsEmerald(int itemID, PipeTransportItems transport) {
|
||||
|
@ -208,92 +208,8 @@ public class PipeItemsEmerald extends PipeItemsWood implements ISpecialInventory
|
|||
readFromNBT((NBTTagCompound) nbt);
|
||||
}
|
||||
}
|
||||
|
||||
/* ISPECIALINVENTORY */
|
||||
@Override
|
||||
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;
|
||||
|
||||
public IInventory getFilters(){
|
||||
return filters;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,29 +1,25 @@
|
|||
/**
|
||||
* Copyright (c) SpaceToad, 2011
|
||||
* http://www.mod-buildcraft.com
|
||||
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
|
||||
* 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package buildcraft.transport.pipes;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.inventory.ISpecialInventory;
|
||||
import buildcraft.core.GuiIds;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.inventory.SimpleInventory;
|
||||
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 */
|
||||
@Override
|
||||
|
@ -57,94 +53,7 @@ public class PipeLogicDiamond extends PipeLogic implements ISpecialInventory {
|
|||
filters.writeToNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
/* ISPECIALINVENTORY */
|
||||
@Override
|
||||
public int addItem(ItemStack stack, boolean doAdd, ForgeDirection from) {
|
||||
return 0;
|
||||
public IInventory getFilters() {
|
||||
return filters;
|
||||
}
|
||||
|
||||
@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