Minor fixes to the previous commits

This commit is contained in:
malte0811 2017-05-26 17:02:07 +02:00
parent 0dd80c3e56
commit 6c6a72ae03
6 changed files with 21 additions and 13 deletions

View file

@ -70,6 +70,7 @@ public class IndustrialWires {
public Item getTabIconItem() {
return null;
}
@Override
public ItemStack getIconItemStack() {
return new ItemStack(coil, 1, 2);
}
@ -90,7 +91,6 @@ public class IndustrialWires {
panelComponent = new ItemPanelComponent();
key = new ItemKey();
panel = new BlockPanel();
GameRegistry.registerTileEntity(TileEntityIC2ConnectorTin.class, "ic2ConnectorTin");
GameRegistry.registerTileEntity(TileEntityIC2ConnectorCopper.class, "ic2ConnectorCopper");
GameRegistry.registerTileEntity(TileEntityIC2ConnectorGold.class, "ic2ConnectorGold");

View file

@ -37,13 +37,12 @@ import java.util.function.Supplier;
public class ContainerPanelCreator extends Container {
public TileEntityPanelCreator tile;
private IInventory inv;
public ContainerPanelCreator(InventoryPlayer inventoryPlayer, TileEntityPanelCreator tile) {
int slotH = 150;
int slotX = 14;
this.tile = tile;
inv = new SingleSlotInventory((i) -> tile.inv = i, () -> tile.inv, tile::markDirty, this::canInteractWith, "panel_creator");
IInventory inv = new SingleSlotInventory((i) -> tile.inv = i, () -> tile.inv, tile::markDirty, this::canInteractWith, "panel_creator");
addSlotToContainer(new Slot(inv, 0, 7, 37) {
@Override
public int getSlotStackLimit() {
@ -68,7 +67,6 @@ public class ContainerPanelCreator extends Container {
return player.getDistanceSq(tile.getPos()) < 100;
}
@Nonnull
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
Slot clicked = getSlot(index);
@ -77,13 +75,19 @@ public class ContainerPanelCreator extends Container {
if (change) {
clicked.onSlotChanged();
}
if (clicked.getStack().stackSize<=0) {
clicked.putStack(null);
}
} else {
ItemStack inSlot = clicked.getStack();
Slot slot0 = getSlot(0);
ItemStack stack0 = slot0.getStack();
if (inSlot!=null && slot0.isItemValid(inSlot) && stack0!=null && stack0.stackSize < slot0.getSlotStackLimit()) {
if (inSlot!=null && slot0.isItemValid(inSlot) && (stack0==null || stack0.stackSize < slot0.getSlotStackLimit())) {
slot0.putStack(inSlot.splitStack(slot0.getSlotStackLimit()));
clicked.onSlotChanged();
if (clicked.getStack()!=null&&clicked.getStack().stackSize<=0) {
clicked.putStack(null);
}
}
}
return null;

View file

@ -119,6 +119,9 @@ public class LightedButton extends PanelComponent implements IConfigurableCompon
@Override
public void interactWith(Vec3d hitRel, TileEntityPanel tile, EntityPlayerMP player) {
if (!latching && active) {
ticksTillOff = 10;
tile.markDirty();
tile.triggerRenderUpdate();
return;
}
setOut(!active, tile);

View file

@ -64,7 +64,7 @@ public class ItemIC2Coil extends Item implements IWireCoil {
setHasSubtypes(true);
this.setCreativeTab(IndustrialWires.creativeTab);
setMaxStackSize(64);
setRegistryName(new ResourceLocation(IndustrialWires.MODID, "ic2_wire_coil"));
setRegistryName(new ResourceLocation(IndustrialWires.MODID, "ic2WireCoil"));
GameRegistry.register(this);
}

View file

@ -95,8 +95,8 @@ public class ItemPanelComponent extends Item implements INetGUIItem {
}
@Nullable
public static PanelComponent componentFromStack(ItemStack stack) {
if (stack.getItem()!=IndustrialWires.panelComponent) {
public static PanelComponent componentFromStack(@Nullable ItemStack stack) {
if (stack==null||stack.getItem()!=IndustrialWires.panelComponent) {
return null;
}
NBTTagCompound loadFrom = getTagCompound(stack).getCompoundTag("data").copy();

View file

@ -22,11 +22,11 @@ tile.industrialwires.control_panel.rs_wire.name=Redstone Wire Controller
tile.industrialwires.control_panel.dummy.name=Panel Connector
tile.industrialwires.control_panel.creator.name=Control Panel Creator
item.industrialwires.ic2_wire_coil.tin.name=Tin Wire Coil
item.industrialwires.ic2_wire_coil.copper.name=Copper Wire Coil
item.industrialwires.ic2_wire_coil.gold.name=Gold Wire Coil
item.industrialwires.ic2_wire_coil.hv.name=IC2 HV Wire Coil
item.industrialwires.ic2_wire_coil.glass.name=Glass Fiber Wire Coil
item.industrialwires.ic2wireCoil.tin.name=Tin Wire Coil
item.industrialwires.ic2wireCoil.copper.name=Copper Wire Coil
item.industrialwires.ic2wireCoil.gold.name=Gold Wire Coil
item.industrialwires.ic2wireCoil.hv.name=IC2 HV Wire Coil
item.industrialwires.ic2wireCoil.glass.name=Glass Fiber Wire Coil
item.industrialwires.panel_component.lighted_button.name=Lighted Button
item.industrialwires.panel_component.label.name=Label
@ -53,6 +53,7 @@ industrialwires.desc.latching_info=Does this button stay on indefinitely?
industrialwires.desc.latching_info=Does this button stay on indefinitely?
industrialwires.desc.disassemble=Disassemble the panel
industrialwires.desc.rsid_info=The ID of the redstone wire controller to output a signal to
industrialwires.desc.rschannel_info=The color of the redstone channel to output a signal to
industrialwires.desc.label_text=The text in this label
industrialwires.desc.red=Red
industrialwires.desc.green=Green