shift clicking in wireless transmitter + textures
This commit is contained in:
@@ -1,14 +1,22 @@
|
||||
package storagecraft.block;
|
||||
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
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.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import storagecraft.StorageCraft;
|
||||
import storagecraft.tile.TileWirelessTransmitter;
|
||||
|
||||
public class BlockWirelessTransmitter extends BlockBase implements ITileEntityProvider
|
||||
{
|
||||
private IIcon icon;
|
||||
private IIcon workingIcon;
|
||||
private IIcon sideIcon;
|
||||
private IIcon workingSideIcon;
|
||||
|
||||
public BlockWirelessTransmitter()
|
||||
{
|
||||
super("wirelessTransmitter");
|
||||
@@ -30,4 +38,37 @@ public class BlockWirelessTransmitter extends BlockBase implements ITileEntityPr
|
||||
{
|
||||
return new TileWirelessTransmitter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
icon = register.registerIcon("storagecraft:wirelessTransmitter");
|
||||
workingIcon = register.registerIcon("storagecraft:wirelessTransmitterWorking");
|
||||
sideIcon = register.registerIcon("storagecraft:wirelessTransmitterSide");
|
||||
workingSideIcon = register.registerIcon("storagecraft:wirelessTransmitterSideWorking");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
TileWirelessTransmitter tile = (TileWirelessTransmitter) world.getTileEntity(x, y, z);
|
||||
|
||||
if (side == tile.getDirection().ordinal())
|
||||
{
|
||||
return tile.isWorking() ? workingIcon : icon;
|
||||
}
|
||||
|
||||
return tile.isWorking() ? workingSideIcon : sideIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int damage)
|
||||
{
|
||||
if (side == 3)
|
||||
{
|
||||
return icon;
|
||||
}
|
||||
|
||||
return sideIcon;
|
||||
}
|
||||
}
|
||||
|
@@ -2,6 +2,8 @@ package storagecraft.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import storagecraft.StorageCraftItems;
|
||||
import storagecraft.container.slot.SlotItemFilter;
|
||||
import storagecraft.container.slot.SlotOutput;
|
||||
@@ -13,10 +15,46 @@ public class ContainerWirelessTransmitter extends ContainerBase
|
||||
{
|
||||
super(player);
|
||||
|
||||
addPlayerInventory(8, 55);
|
||||
|
||||
addSlotToContainer(new SlotItemFilter(wirelessTransmitter, 0, 8, 20, Items.ender_pearl));
|
||||
addSlotToContainer(new SlotItemFilter(wirelessTransmitter, 1, 101, 20, StorageCraftItems.WIRELESS_GRID));
|
||||
addSlotToContainer(new SlotOutput(wirelessTransmitter, 2, 152, 20));
|
||||
|
||||
addPlayerInventory(8, 55);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index)
|
||||
{
|
||||
ItemStack stack = null;
|
||||
|
||||
Slot slot = getSlot(index);
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
stack = slot.getStack().copy();
|
||||
|
||||
if (index < 3)
|
||||
{
|
||||
if (!mergeItemStack(stack, 3, inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!mergeItemStack(stack, 0, 3, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (stack.stackSize == 0)
|
||||
{
|
||||
slot.putStack(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ public class TileSolderer extends TileMachine implements IInventory, ISidedInven
|
||||
private InventorySimple inventory = new InventorySimple("solderer", 4);
|
||||
private ISoldererRecipe recipe;
|
||||
private boolean working = false;
|
||||
private int progress;
|
||||
private int progress = 0;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private int duration;
|
||||
|
||||
|
@@ -18,7 +18,7 @@ public class TileWirelessTransmitter extends TileMachine implements IInventory
|
||||
|
||||
private InventorySimple inventory = new InventorySimple("wirelessTransmitter", 3);
|
||||
|
||||
private boolean working;
|
||||
private boolean working = false;
|
||||
private int progress = 0;
|
||||
|
||||
@Override
|
||||
@@ -212,8 +212,15 @@ public class TileWirelessTransmitter extends TileMachine implements IInventory
|
||||
{
|
||||
super.fromBytes(buf);
|
||||
|
||||
boolean lastWorking = working;
|
||||
|
||||
working = buf.readBoolean();
|
||||
progress = buf.readInt();
|
||||
|
||||
if (lastWorking != working)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 382 B |
Binary file not shown.
After Width: | Height: | Size: 326 B |
Binary file not shown.
After Width: | Height: | Size: 324 B |
Binary file not shown.
After Width: | Height: | Size: 380 B |
Reference in New Issue
Block a user