Fixed Output of extractor (#679)
* Add CraftTweaker support for the Compressor * Fix Extractor insertion and extraction * Oops
This commit is contained in:
parent
48cbda6453
commit
166f9a924f
5 changed files with 69 additions and 70 deletions
|
@ -168,7 +168,7 @@ public class GuiHandler implements IGuiHandler
|
||||||
return new ContainerGenerator((TileGenerator) world.getTileEntity(new BlockPos(x, y, z)), player);
|
return new ContainerGenerator((TileGenerator) world.getTileEntity(new BlockPos(x, y, z)), player);
|
||||||
} else if (ID == extractorID)
|
} else if (ID == extractorID)
|
||||||
{
|
{
|
||||||
return new ContainerExtractor((TileExtractor) world.getTileEntity(new BlockPos(x, y, z)), player);
|
container = new ContainerExtractor();
|
||||||
} else if (ID == compressorID)
|
} else if (ID == compressorID)
|
||||||
{
|
{
|
||||||
return new ContainerCompressor((TileCompressor) world.getTileEntity(new BlockPos(x, y, z)), player);
|
return new ContainerCompressor((TileCompressor) world.getTileEntity(new BlockPos(x, y, z)), player);
|
||||||
|
|
|
@ -1,34 +1,48 @@
|
||||||
package techreborn.client.container;
|
package techreborn.client.container;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import reborncore.api.tile.IContainerLayout;
|
||||||
import reborncore.client.gui.BaseSlot;
|
import reborncore.client.gui.BaseSlot;
|
||||||
|
import reborncore.client.gui.SlotInput;
|
||||||
import reborncore.client.gui.SlotOutput;
|
import reborncore.client.gui.SlotOutput;
|
||||||
import techreborn.api.gui.SlotUpgrade;
|
import techreborn.api.gui.SlotUpgrade;
|
||||||
import techreborn.tiles.teir1.TileExtractor;
|
import techreborn.tiles.teir1.TileExtractor;
|
||||||
|
|
||||||
public class ContainerExtractor extends ContainerCrafting
|
public class ContainerExtractor extends ContainerCrafting implements IContainerLayout<TileExtractor>
|
||||||
{
|
{
|
||||||
|
|
||||||
public int connectionStatus;
|
public int connectionStatus;
|
||||||
EntityPlayer player;
|
EntityPlayer player;
|
||||||
TileExtractor tile;
|
TileExtractor tileExtractor;
|
||||||
|
|
||||||
public ContainerExtractor(TileExtractor tileGrinder, EntityPlayer player)
|
|
||||||
|
@Override
|
||||||
|
public boolean canInteractWith(EntityPlayer p_75145_1_)
|
||||||
{
|
{
|
||||||
super(tileGrinder.crafter);
|
return true;
|
||||||
tile = tileGrinder;
|
}
|
||||||
this.player = player;
|
|
||||||
|
@Override
|
||||||
|
public void addInventorySlots() {
|
||||||
|
|
||||||
// input
|
// input
|
||||||
this.addSlotToContainer(new BaseSlot(tileGrinder.inventory, 0, 56, 34));
|
this.addSlotToContainer(new SlotInput(tileExtractor.inventory, 0, 56, 34));
|
||||||
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 1, 116, 34));
|
this.addSlotToContainer(new SlotOutput(tileExtractor.inventory, 1, 116, 34));
|
||||||
|
|
||||||
// upgrades
|
// upgrades
|
||||||
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 2, 152, 8));
|
this.addSlotToContainer(new SlotUpgrade(tileExtractor.inventory, 2, 152, 8));
|
||||||
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 3, 152, 26));
|
this.addSlotToContainer(new SlotUpgrade(tileExtractor.inventory, 3, 152, 26));
|
||||||
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 4, 152, 44));
|
this.addSlotToContainer(new SlotUpgrade(tileExtractor.inventory, 4, 152, 44));
|
||||||
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 5, 152, 62));
|
this.addSlotToContainer(new SlotUpgrade(tileExtractor.inventory, 5, 152, 62));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addPlayerSlots() {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 3; ++i)
|
for (i = 0; i < 3; ++i)
|
||||||
|
@ -46,35 +60,30 @@ public class ContainerExtractor extends ContainerCrafting
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer p_75145_1_)
|
public void setTile(TileExtractor tile) {
|
||||||
{
|
this.tileExtractor = tile;
|
||||||
return true;
|
setCrafter(tile.crafter);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
@Override
|
||||||
// public void addListener(IContainerListener crafting) {
|
public TileExtractor getTile() {
|
||||||
// super.addListener(crafting);
|
return tileExtractor;
|
||||||
// crafting.sendProgressBarUpdate(this, 0, (int) tile.getProgressScaled(0));
|
}
|
||||||
// crafting.sendProgressBarUpdate(this, 2, (int) tile.getEnergy());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @SideOnly(Side.CLIENT)
|
|
||||||
// @Override
|
|
||||||
// public void updateProgressBar(int id, int value) {
|
|
||||||
// if (id == 0) {
|
|
||||||
// this.progress = value;
|
|
||||||
// }
|
|
||||||
// else if (id == 2) {
|
|
||||||
// this.energy = value;
|
|
||||||
// }
|
|
||||||
// this.tile.setEnergy(energy);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @SideOnly(Side.CLIENT)
|
@Override
|
||||||
// @Override
|
public void setPlayer(EntityPlayer player) {
|
||||||
// public void updateProgressBar(int id, int value) {
|
this.player = player;
|
||||||
// if (id == 10) {
|
|
||||||
// this.connectionStatus = value;
|
}
|
||||||
// }
|
|
||||||
// }
|
@Override
|
||||||
|
public EntityPlayer getPlayer() {
|
||||||
|
return player;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public List<Integer> getSlotsForSide(EnumFacing facing) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.text.translation.I18n;
|
import net.minecraft.util.text.translation.I18n;
|
||||||
|
import reborncore.common.container.RebornContainer;
|
||||||
import techreborn.client.container.ContainerExtractor;
|
import techreborn.client.container.ContainerExtractor;
|
||||||
import techreborn.tiles.teir1.TileExtractor;
|
import techreborn.tiles.teir1.TileExtractor;
|
||||||
|
|
||||||
|
@ -14,15 +15,15 @@ public class GuiExtractor extends GuiContainer
|
||||||
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/compressor.png");
|
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/compressor.png");
|
||||||
|
|
||||||
TileExtractor extractor;
|
TileExtractor extractor;
|
||||||
ContainerExtractor containerGrinder;
|
ContainerExtractor containerExtractor;
|
||||||
|
|
||||||
public GuiExtractor(EntityPlayer player, TileExtractor tilegrinder)
|
public GuiExtractor(EntityPlayer player, TileExtractor tileExtractor)
|
||||||
{
|
{
|
||||||
super(new ContainerExtractor(tilegrinder, player));
|
super(RebornContainer.createContainer(ContainerExtractor.class, tileExtractor, player));
|
||||||
this.xSize = 176;
|
this.xSize = 176;
|
||||||
this.ySize = 167;
|
this.ySize = 167;
|
||||||
extractor = tilegrinder;
|
this.extractor = tileExtractor;
|
||||||
containerGrinder = (ContainerExtractor) this.inventorySlots;
|
containerExtractor = (ContainerExtractor) this.inventorySlots;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class GuiGrinder extends GuiContainer
|
||||||
super(RebornContainer.createContainer(ContainerGrinder.class, tilegrinder, player));
|
super(RebornContainer.createContainer(ContainerGrinder.class, tilegrinder, player));
|
||||||
this.xSize = 176;
|
this.xSize = 176;
|
||||||
this.ySize = 167;
|
this.ySize = 167;
|
||||||
grinder = tilegrinder;
|
this.grinder = tilegrinder;
|
||||||
containerGrinder = (ContainerGrinder) this.inventorySlots;
|
containerGrinder = (ContainerGrinder) this.inventorySlots;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package techreborn.tiles.teir1;
|
package techreborn.tiles.teir1;
|
||||||
|
|
||||||
import reborncore.common.IWrenchable;import reborncore.common.IWrenchable;
|
import reborncore.common.IWrenchable;
|
||||||
|
import reborncore.common.container.RebornContainer;
|
||||||
|
import reborncore.common.IWrenchable;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.ISidedInventory;
|
import net.minecraft.inventory.ISidedInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -8,14 +10,17 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||||
|
import reborncore.api.tile.IContainerProvider;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||||
import reborncore.common.recipes.RecipeCrafter;
|
import reborncore.common.recipes.RecipeCrafter;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.api.Reference;
|
import techreborn.api.Reference;
|
||||||
|
import techreborn.client.container.ContainerExtractor;
|
||||||
|
import techreborn.client.container.ContainerGrinder;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
|
|
||||||
public class TileExtractor extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, ISidedInventory, IRecipeCrafterProvider
|
public class TileExtractor extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, IRecipeCrafterProvider, IContainerProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
public Inventory inventory = new Inventory(6, "TileExtractor", 64, this);
|
public Inventory inventory = new Inventory(6, "TileExtractor", 64, this);
|
||||||
|
@ -91,27 +96,6 @@ public class TileExtractor extends TilePowerAcceptor implements IWrenchable,IInv
|
||||||
return tagCompound;
|
return tagCompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ISidedInventory
|
|
||||||
@Override
|
|
||||||
public int[] getSlotsForFace(EnumFacing side)
|
|
||||||
{
|
|
||||||
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2 } : new int[] { 0, 1, 2 };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
|
||||||
{
|
|
||||||
if (slotIndex == 2)
|
|
||||||
return false;
|
|
||||||
return isItemValidForSlot(slotIndex, itemStack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
|
||||||
{
|
|
||||||
return slotIndex == 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getProgressScaled(int scale)
|
public int getProgressScaled(int scale)
|
||||||
{
|
{
|
||||||
if (crafter.currentTickTime != 0)
|
if (crafter.currentTickTime != 0)
|
||||||
|
@ -166,4 +150,9 @@ public class TileExtractor extends TilePowerAcceptor implements IWrenchable,IInv
|
||||||
public RecipeCrafter getRecipeCrafter() {
|
public RecipeCrafter getRecipeCrafter() {
|
||||||
return crafter;
|
return crafter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RebornContainer getContainer() {
|
||||||
|
return RebornContainer.getContainerFromClass(ContainerExtractor.class, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue