shift clicking in wireless transmitter + textures
This commit is contained in:
@@ -1,14 +1,22 @@
|
|||||||
package storagecraft.block;
|
package storagecraft.block;
|
||||||
|
|
||||||
import net.minecraft.block.ITileEntityProvider;
|
import net.minecraft.block.ITileEntityProvider;
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import storagecraft.StorageCraft;
|
import storagecraft.StorageCraft;
|
||||||
import storagecraft.tile.TileWirelessTransmitter;
|
import storagecraft.tile.TileWirelessTransmitter;
|
||||||
|
|
||||||
public class BlockWirelessTransmitter extends BlockBase implements ITileEntityProvider
|
public class BlockWirelessTransmitter extends BlockBase implements ITileEntityProvider
|
||||||
{
|
{
|
||||||
|
private IIcon icon;
|
||||||
|
private IIcon workingIcon;
|
||||||
|
private IIcon sideIcon;
|
||||||
|
private IIcon workingSideIcon;
|
||||||
|
|
||||||
public BlockWirelessTransmitter()
|
public BlockWirelessTransmitter()
|
||||||
{
|
{
|
||||||
super("wirelessTransmitter");
|
super("wirelessTransmitter");
|
||||||
@@ -30,4 +38,37 @@ public class BlockWirelessTransmitter extends BlockBase implements ITileEntityPr
|
|||||||
{
|
{
|
||||||
return new TileWirelessTransmitter();
|
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.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import storagecraft.StorageCraftItems;
|
import storagecraft.StorageCraftItems;
|
||||||
import storagecraft.container.slot.SlotItemFilter;
|
import storagecraft.container.slot.SlotItemFilter;
|
||||||
import storagecraft.container.slot.SlotOutput;
|
import storagecraft.container.slot.SlotOutput;
|
||||||
@@ -13,10 +15,46 @@ public class ContainerWirelessTransmitter extends ContainerBase
|
|||||||
{
|
{
|
||||||
super(player);
|
super(player);
|
||||||
|
|
||||||
addPlayerInventory(8, 55);
|
|
||||||
|
|
||||||
addSlotToContainer(new SlotItemFilter(wirelessTransmitter, 0, 8, 20, Items.ender_pearl));
|
addSlotToContainer(new SlotItemFilter(wirelessTransmitter, 0, 8, 20, Items.ender_pearl));
|
||||||
addSlotToContainer(new SlotItemFilter(wirelessTransmitter, 1, 101, 20, StorageCraftItems.WIRELESS_GRID));
|
addSlotToContainer(new SlotItemFilter(wirelessTransmitter, 1, 101, 20, StorageCraftItems.WIRELESS_GRID));
|
||||||
addSlotToContainer(new SlotOutput(wirelessTransmitter, 2, 152, 20));
|
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 InventorySimple inventory = new InventorySimple("solderer", 4);
|
||||||
private ISoldererRecipe recipe;
|
private ISoldererRecipe recipe;
|
||||||
private boolean working = false;
|
private boolean working = false;
|
||||||
private int progress;
|
private int progress = 0;
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private int duration;
|
private int duration;
|
||||||
|
|
||||||
|
@@ -18,7 +18,7 @@ public class TileWirelessTransmitter extends TileMachine implements IInventory
|
|||||||
|
|
||||||
private InventorySimple inventory = new InventorySimple("wirelessTransmitter", 3);
|
private InventorySimple inventory = new InventorySimple("wirelessTransmitter", 3);
|
||||||
|
|
||||||
private boolean working;
|
private boolean working = false;
|
||||||
private int progress = 0;
|
private int progress = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -212,8 +212,15 @@ public class TileWirelessTransmitter extends TileMachine implements IInventory
|
|||||||
{
|
{
|
||||||
super.fromBytes(buf);
|
super.fromBytes(buf);
|
||||||
|
|
||||||
|
boolean lastWorking = working;
|
||||||
|
|
||||||
working = buf.readBoolean();
|
working = buf.readBoolean();
|
||||||
progress = buf.readInt();
|
progress = buf.readInt();
|
||||||
|
|
||||||
|
if (lastWorking != working)
|
||||||
|
{
|
||||||
|
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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