Engineering table render and item placing working
This commit is contained in:
parent
518643b438
commit
f073591ec8
3 changed files with 368 additions and 53 deletions
|
@ -2,11 +2,14 @@ package resonantinduction.archaic.engineering;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Icon;
|
import net.minecraft.util.Icon;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import resonantinduction.core.prefab.block.BlockRI;
|
import resonantinduction.core.prefab.block.BlockRI;
|
||||||
|
import universalelectricity.api.vector.Vector2;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@ -26,11 +29,67 @@ public class BlockEngineeringTable extends BlockRI
|
||||||
public BlockEngineeringTable()
|
public BlockEngineeringTable()
|
||||||
{
|
{
|
||||||
super("engineeringTable");
|
super("engineeringTable");
|
||||||
|
setTextureName("crafting_table");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int hitSide, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
|
if (hitSide == 1)
|
||||||
|
{
|
||||||
|
if (!world.isRemote)
|
||||||
|
{
|
||||||
|
TileEntity te = world.getBlockTileEntity(x, y, z);
|
||||||
|
|
||||||
|
if (te instanceof TileEngineeringTable)
|
||||||
|
{
|
||||||
|
TileEngineeringTable tile = (TileEngineeringTable) te;
|
||||||
|
|
||||||
|
ItemStack current = player.inventory.getCurrentItem();
|
||||||
|
|
||||||
|
Vector2 hitVector = new Vector2(hitX, hitZ);
|
||||||
|
double regionLength = 1d / 3d;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Crafting Matrix
|
||||||
|
*/
|
||||||
|
matrix:
|
||||||
|
for (int j = 0; j < 3; j++)
|
||||||
|
{
|
||||||
|
for (int k = 0; k < 3; k++)
|
||||||
|
{
|
||||||
|
Vector2 check = new Vector2(j, k).scale(regionLength);
|
||||||
|
|
||||||
|
if (check.distance(hitVector) < regionLength)
|
||||||
|
{
|
||||||
|
int slotID = j * 3 + k;
|
||||||
|
ItemStack checkStack = tile.craftingMatrix[slotID];
|
||||||
|
System.out.println(slotID);
|
||||||
|
if (checkStack != null)
|
||||||
|
{
|
||||||
|
EntityItem entityItem = new EntityItem(world, player.posX, player.posY, player.posZ, checkStack);
|
||||||
|
entityItem.delayBeforeCanPickup = 0;
|
||||||
|
world.spawnEntityInWorld(entityItem);
|
||||||
|
tile.craftingMatrix[slotID] = null;
|
||||||
|
}
|
||||||
|
else if (current != null)
|
||||||
|
{
|
||||||
|
tile.craftingMatrix[slotID] = current;
|
||||||
|
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
break matrix;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tile.onInventoryChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,261 @@
|
||||||
|
package resonantinduction.archaic.engineering;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.client.renderer.entity.RenderItem;
|
||||||
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureCompass;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureManager;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
|
import net.minecraft.entity.item.EntityItem;
|
||||||
|
import net.minecraft.entity.item.EntityItemFrame;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.Direction;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.storage.MapData;
|
||||||
|
import net.minecraftforge.client.ForgeHooksClient;
|
||||||
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import universalelectricity.api.vector.Vector3;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public class RenderEngineeringTable extends TileEntitySpecialRenderer
|
||||||
|
{
|
||||||
|
private final RenderBlocks renderBlocks = new RenderBlocks();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float var8)
|
||||||
|
{
|
||||||
|
Vector3 vec = new Vector3(x, y, z);
|
||||||
|
double distance = vec.distance(new Vector3(0, 0, 0));
|
||||||
|
|
||||||
|
if (tileEntity instanceof TileEngineeringTable)
|
||||||
|
{
|
||||||
|
TileEngineeringTable tile = (TileEngineeringTable) tileEntity;
|
||||||
|
|
||||||
|
RenderItem renderItem = ((RenderItem) RenderManager.instance.getEntityClassRenderObject(EntityItem.class));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the Crafting Matrix
|
||||||
|
*/
|
||||||
|
for (int i = 0; i < tile.craftingMatrix.length; i++)
|
||||||
|
{
|
||||||
|
if (tile.craftingMatrix[i] != null)
|
||||||
|
{
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glTranslated(x + (double) (i / 3) / 3d + (0.5 / 3d), y + 1.1, z + (double) (i % 3) / 3d + (0.5 / 3d));
|
||||||
|
GL11.glScalef(0.7f, 0.7f, 0.7f);
|
||||||
|
this.renderItem(tileEntity.worldObj, ForgeDirection.UP, tile.craftingMatrix[i], new Vector3(), 0, 0);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the Output
|
||||||
|
*/
|
||||||
|
String itemName = "No Output";
|
||||||
|
String amount = "";
|
||||||
|
ItemStack itemStack = tile.getStackInSlot(9);
|
||||||
|
|
||||||
|
if (itemStack != null)
|
||||||
|
{
|
||||||
|
itemName = itemStack.getDisplayName();
|
||||||
|
amount = Integer.toString(itemStack.stackSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int side = 2; side < 6; side++)
|
||||||
|
{
|
||||||
|
ForgeDirection direction = ForgeDirection.getOrientation(side);
|
||||||
|
|
||||||
|
if (tile.worldObj.isBlockSolidOnSide(tile.xCoord + direction.offsetX, tile.yCoord, tile.zCoord + direction.offsetZ, direction.getOpposite()))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setupLight(tile, direction.offsetX, direction.offsetZ);
|
||||||
|
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
|
||||||
|
|
||||||
|
if (itemStack != null)
|
||||||
|
{
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
|
||||||
|
switch (side)
|
||||||
|
{
|
||||||
|
case 2:
|
||||||
|
GL11.glTranslated(x + 0.65, y + 0.9, z - 0.01);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
GL11.glTranslated(x + 0.35, y + 0.9, z + 1.01);
|
||||||
|
GL11.glRotatef(180, 0, 1, 0);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
GL11.glTranslated(x - 0.01, y + 0.9, z + 0.35);
|
||||||
|
GL11.glRotatef(90, 0, 1, 0);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
GL11.glTranslated(x + 1.01, y + 0.9, z + 0.65);
|
||||||
|
GL11.glRotatef(-90, 0, 1, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
float scale = 0.03125F;
|
||||||
|
GL11.glScalef(0.6f * scale, 0.6f * scale, 0);
|
||||||
|
GL11.glRotatef(180, 0, 0, 1);
|
||||||
|
|
||||||
|
TextureManager renderEngine = Minecraft.getMinecraft().renderEngine;
|
||||||
|
|
||||||
|
GL11.glDisable(2896);
|
||||||
|
if (!ForgeHooksClient.renderInventoryItem(this.renderBlocks, renderEngine, itemStack, true, 0.0F, 0.0F, 0.0F))
|
||||||
|
{
|
||||||
|
renderItem.renderItemIntoGUI(this.getFontRenderer(), renderEngine, itemStack, 0, 0);
|
||||||
|
}
|
||||||
|
GL11.glEnable(2896);
|
||||||
|
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.renderText(itemName, side, 0.02f, x, y - 0.35f, z);
|
||||||
|
this.renderText(amount, side, 0.02f, x, y - 0.15f, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupLight(TileEntity tileEntity, int xDifference, int zDifference)
|
||||||
|
{
|
||||||
|
World world = tileEntity.worldObj;
|
||||||
|
|
||||||
|
if (world.isBlockOpaqueCube(tileEntity.xCoord + xDifference, tileEntity.yCoord, tileEntity.zCoord + zDifference))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int br = world.getLightBrightnessForSkyBlocks(tileEntity.xCoord + xDifference, tileEntity.yCoord, tileEntity.zCoord + zDifference, 0);
|
||||||
|
int var11 = br % 65536;
|
||||||
|
int var12 = br / 65536;
|
||||||
|
float scale = 0.6F;
|
||||||
|
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, var11 * scale, var12 * scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderText(String text, int side, float maxScale, double x, double y, double z)
|
||||||
|
{
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
|
||||||
|
GL11.glPolygonOffset(-10, -10);
|
||||||
|
GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
|
||||||
|
|
||||||
|
float displayWidth = 1 - (2 / 16);
|
||||||
|
float displayHeight = 1 - (2 / 16);
|
||||||
|
GL11.glTranslated(x, y, z);
|
||||||
|
|
||||||
|
switch (side)
|
||||||
|
{
|
||||||
|
case 3:
|
||||||
|
GL11.glTranslatef(0, 1, 0);
|
||||||
|
GL11.glRotatef(0, 0, 1, 0);
|
||||||
|
GL11.glRotatef(90, 1, 0, 0);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
GL11.glTranslatef(1, 1, 1);
|
||||||
|
GL11.glRotatef(180, 0, 1, 0);
|
||||||
|
GL11.glRotatef(90, 1, 0, 0);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
GL11.glTranslatef(0, 1, 1);
|
||||||
|
GL11.glRotatef(90, 0, 1, 0);
|
||||||
|
GL11.glRotatef(90, 1, 0, 0);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
GL11.glTranslatef(1, 1, 0);
|
||||||
|
GL11.glRotatef(-90, 0, 1, 0);
|
||||||
|
GL11.glRotatef(90, 1, 0, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find Center
|
||||||
|
GL11.glTranslatef(displayWidth / 2, 1F, displayHeight / 2);
|
||||||
|
GL11.glRotatef(-90, 1, 0, 0);
|
||||||
|
|
||||||
|
FontRenderer fontRenderer = this.getFontRenderer();
|
||||||
|
|
||||||
|
int requiredWidth = Math.max(fontRenderer.getStringWidth(text), 1);
|
||||||
|
int lineHeight = fontRenderer.FONT_HEIGHT + 2;
|
||||||
|
int requiredHeight = lineHeight * 1;
|
||||||
|
float scaler = 0.8f;
|
||||||
|
float scaleX = (displayWidth / requiredWidth);
|
||||||
|
float scaleY = (displayHeight / requiredHeight);
|
||||||
|
float scale = scaleX * scaler;
|
||||||
|
|
||||||
|
if (maxScale > 0)
|
||||||
|
{
|
||||||
|
scale = Math.min(scale, maxScale);
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glScalef(scale, -scale, scale);
|
||||||
|
GL11.glDepthMask(false);
|
||||||
|
|
||||||
|
int offsetX;
|
||||||
|
int offsetY;
|
||||||
|
int realHeight = (int) Math.floor(displayHeight / scale);
|
||||||
|
int realWidth = (int) Math.floor(displayWidth / scale);
|
||||||
|
|
||||||
|
offsetX = (realWidth - requiredWidth) / 2;
|
||||||
|
offsetY = (realHeight - requiredHeight) / 2;
|
||||||
|
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
fontRenderer.drawString("\u00a7f" + text, offsetX - (realWidth / 2), 1 + offsetY - (realHeight / 2), 1);
|
||||||
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
|
GL11.glDepthMask(true);
|
||||||
|
GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL);
|
||||||
|
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderItem(World world, ForgeDirection dir, ItemStack itemStack, Vector3 position, float rotationYaw, int angle)
|
||||||
|
{
|
||||||
|
if (itemStack != null)
|
||||||
|
{
|
||||||
|
EntityItem entityitem = new EntityItem(world, 0.0D, 0.0D, 0.0D, itemStack);
|
||||||
|
entityitem.getEntityItem().stackSize = 1;
|
||||||
|
entityitem.hoverStart = 0.0F;
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glTranslatef(-0.453125F * (float) dir.offsetX, -0.18F, -0.453125F * (float) dir.offsetZ);
|
||||||
|
GL11.glRotatef(180.0F + rotationYaw, 0.0F, 1.0F, 0.0F);
|
||||||
|
GL11.glRotatef((float) (-90 * angle), 0.0F, 0.0F, 1.0F);
|
||||||
|
|
||||||
|
switch (angle)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
GL11.glTranslatef(-0.16F, -0.16F, 0.0F);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
GL11.glTranslatef(0.0F, -0.32F, 0.0F);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
GL11.glTranslatef(0.16F, -0.16F, 0.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
RenderItem.renderInFrame = true;
|
||||||
|
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
|
||||||
|
RenderItem.renderInFrame = false;
|
||||||
|
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
package resonantinduction.archaic.engineering;
|
package resonantinduction.archaic.engineering;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -10,14 +9,13 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.CraftingManager;
|
import net.minecraft.item.crafting.CraftingManager;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraft.network.packet.Packet;
|
||||||
import resonantinduction.api.IArmbot;
|
import resonantinduction.api.IArmbot;
|
||||||
import resonantinduction.api.IArmbotUseable;
|
import resonantinduction.api.IArmbotUseable;
|
||||||
import resonantinduction.api.events.AutoCraftEvent;
|
import resonantinduction.core.ResonantInduction;
|
||||||
import resonantinduction.archaic.imprint.ItemBlockFilter;
|
|
||||||
import resonantinduction.archaic.imprint.TileImprinter;
|
|
||||||
import resonantinduction.electrical.encoder.coding.args.ArgumentData;
|
import resonantinduction.electrical.encoder.coding.args.ArgumentData;
|
||||||
import universalelectricity.api.vector.Vector3;
|
import calclavia.lib.network.IPacketReceiver;
|
||||||
|
import calclavia.lib.network.PacketHandler;
|
||||||
import calclavia.lib.prefab.slot.ISlotPickResult;
|
import calclavia.lib.prefab.slot.ISlotPickResult;
|
||||||
import calclavia.lib.prefab.tile.TileAdvanced;
|
import calclavia.lib.prefab.tile.TileAdvanced;
|
||||||
import calclavia.lib.utility.AutoCraftingManager;
|
import calclavia.lib.utility.AutoCraftingManager;
|
||||||
|
@ -25,8 +23,11 @@ import calclavia.lib.utility.AutoCraftingManager.IAutoCrafter;
|
||||||
import calclavia.lib.utility.LanguageUtility;
|
import calclavia.lib.utility.LanguageUtility;
|
||||||
|
|
||||||
import com.builtbroken.common.Pair;
|
import com.builtbroken.common.Pair;
|
||||||
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
|
|
||||||
public class TileEngineeringTable extends TileAdvanced implements ISidedInventory, IArmbotUseable, ISlotPickResult, IAutoCrafter
|
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||||
|
|
||||||
|
public class TileEngineeringTable extends TileAdvanced implements IPacketReceiver, ISidedInventory, IArmbotUseable, ISlotPickResult, IAutoCrafter
|
||||||
{
|
{
|
||||||
public static final int CRAFTING_MATRIX_END = 9;
|
public static final int CRAFTING_MATRIX_END = 9;
|
||||||
|
|
||||||
|
@ -63,6 +64,27 @@ public class TileEngineeringTable extends TileAdvanced implements ISidedInventor
|
||||||
return craftManager;
|
return craftManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Packet getDescriptionPacket()
|
||||||
|
{
|
||||||
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
|
this.writeToNBT(nbt);
|
||||||
|
return ResonantInduction.PACKET_TILE.getPacket(this, nbt);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReceivePacket(ByteArrayDataInput data, EntityPlayer player, Object... extra)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this.readFromNBT(PacketHandler.readNBTTagCompound(data));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSizeInventory()
|
public int getSizeInventory()
|
||||||
{
|
{
|
||||||
|
@ -236,33 +258,7 @@ public class TileEngineeringTable extends TileAdvanced implements ISidedInventor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
PacketDispatcher.sendPacketToAllPlayers(this.getDescriptionPacket());
|
||||||
if (this.output[imprintInputSlot] != null && !didCraft)
|
|
||||||
{
|
|
||||||
if (this.output[imprintInputSlot].getItem() instanceof ItemBlockFilter)
|
|
||||||
{
|
|
||||||
ArrayList<ItemStack> filters = ItemBlockFilter.getFilters(this.output[0]);
|
|
||||||
|
|
||||||
for (ItemStack outputStack : filters)
|
|
||||||
{
|
|
||||||
if (outputStack != null)
|
|
||||||
{
|
|
||||||
Pair<ItemStack, ItemStack[]> idealRecipe = this.getCraftingManager().getIdealRecipe(outputStack);
|
|
||||||
|
|
||||||
if (idealRecipe != null)
|
|
||||||
{
|
|
||||||
ItemStack recipeOutput = idealRecipe.left();
|
|
||||||
if (recipeOutput != null & recipeOutput.stackSize > 0)
|
|
||||||
{
|
|
||||||
this.output[craftingOutputSlot] = recipeOutput;
|
|
||||||
didCraft = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,20 +285,20 @@ public class TileEngineeringTable extends TileAdvanced implements ISidedInventor
|
||||||
this.onInventoryChanged();
|
this.onInventoryChanged();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (this.imprinterMatrix[craftingOutputSlot] != null)
|
* if (this.imprinterMatrix[craftingOutputSlot] != null)
|
||||||
{
|
* {
|
||||||
AutoCraftEvent.PreCraft event = new AutoCraftEvent.PreCraft(this.worldObj, new Vector3(this), this, this.imprinterMatrix[craftingOutputSlot]);
|
* AutoCraftEvent.PreCraft event = new AutoCraftEvent.PreCraft(this.worldObj, new
|
||||||
MinecraftForge.EVENT_BUS.post(event);
|
* Vector3(this), this, this.imprinterMatrix[craftingOutputSlot]);
|
||||||
|
* MinecraftForge.EVENT_BUS.post(event);
|
||||||
if (!event.isCanceled())
|
* if (!event.isCanceled())
|
||||||
{
|
* {
|
||||||
armbot.grabObject(this.imprinterMatrix[craftingOutputSlot].copy());
|
* armbot.grabObject(this.imprinterMatrix[craftingOutputSlot].copy());
|
||||||
this.onPickUpFromSlot(null, 2, this.imprinterMatrix[craftingOutputSlot]);
|
* this.onPickUpFromSlot(null, 2, this.imprinterMatrix[craftingOutputSlot]);
|
||||||
this.imprinterMatrix[craftingOutputSlot] = null;
|
* this.imprinterMatrix[craftingOutputSlot] = null;
|
||||||
return true;
|
* return true;
|
||||||
}
|
* }
|
||||||
}
|
* }
|
||||||
*/
|
*/
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,11 +318,11 @@ public class TileEngineeringTable extends TileAdvanced implements ISidedInventor
|
||||||
for (int i = 0; i < var2.tagCount(); ++i)
|
for (int i = 0; i < var2.tagCount(); ++i)
|
||||||
{
|
{
|
||||||
NBTTagCompound var4 = (NBTTagCompound) var2.tagAt(i);
|
NBTTagCompound var4 = (NBTTagCompound) var2.tagAt(i);
|
||||||
byte var5 = var4.getByte("Slot");
|
byte id = var4.getByte("Slot");
|
||||||
|
|
||||||
if (var5 >= 0 && var5 < this.getSizeInventory())
|
if (id >= 0 && id < this.getSizeInventory())
|
||||||
{
|
{
|
||||||
this.setInventorySlotContents(var5, ItemStack.loadItemStackFromNBT(var4));
|
this.setInventorySlotContents(id, ItemStack.loadItemStackFromNBT(var4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,7 +349,6 @@ public class TileEngineeringTable extends TileAdvanced implements ISidedInventor
|
||||||
}
|
}
|
||||||
|
|
||||||
nbt.setTag("Items", var2);
|
nbt.setTag("Items", var2);
|
||||||
|
|
||||||
nbt.setBoolean("searchInventories", this.searchInventories);
|
nbt.setBoolean("searchInventories", this.searchInventories);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue