mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-25 14:34:22 +00:00
Drawbridge, Igniter, and minor bugfixes
This commit is contained in:
1 parent
6af76e516e
commit
0b7b2fa63c
18 files changed
+281
-191
No files matched your search
@@ -38,7 +38,7 @@ import cpw.mods.fml.common.registry.VillagerRegistry;
|
||||
* @dependencies: IC2 API, MFR API
|
||||
*/
|
||||
|
||||
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.4.dev.16", dependencies = "required-after:Forge@[7.7.1.675,)")
|
||||
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.4.dev.18", dependencies = "required-after:Forge@[7.7.1.675,)")
|
||||
@NetworkMod(serverSideRequired = false, clientSideRequired = true, channels = { "TConstruct" }, packetHandler = mods.tinker.tconstruct.util.network.TPacketHandler.class)
|
||||
public class TConstruct
|
||||
{
|
||||
|
||||
@@ -197,7 +197,7 @@ public class RedstoneMachine extends InventoryBlock
|
||||
/* Redstone */
|
||||
public boolean canConnectRedstone (IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange (World world, int x, int y, int z, int neighborBlockID)
|
||||
|
||||
@@ -140,7 +140,7 @@ public class DrawbridgeLogic extends InventoryLogic implements IFacingLogic, IAc
|
||||
ticks = 0;
|
||||
if (active) //Placement
|
||||
{
|
||||
if (inventory[0] != null && inventory[0].stackSize > 1 && extension < 16)
|
||||
if (inventory[0] != null && inventory[0].stackSize > 1 && extension < 15)
|
||||
{
|
||||
extension++;
|
||||
int xPos = xCoord;
|
||||
@@ -173,7 +173,18 @@ public class DrawbridgeLogic extends InventoryLogic implements IFacingLogic, IAc
|
||||
if (block == null || block.isAirBlock(worldObj, xPos, yPos, zPos) || block.isBlockReplaceable(worldObj, xPos, yPos, zPos))
|
||||
{
|
||||
//tryExtend(worldObj, xPos, yPos, zPos, direction);
|
||||
worldObj.setBlock(xPos, yPos, zPos, inventory[0].itemID, inventory[0].getItemDamage(), 3);
|
||||
int blockToItem = TConstructRegistry.blockToItemMapping[inventory[0].itemID];
|
||||
if (blockToItem == 0)
|
||||
{
|
||||
if (inventory[0].itemID >= 4096 || Block.blocksList[inventory[0].itemID] == null)
|
||||
return;
|
||||
|
||||
worldObj.setBlock(xPos, yPos, zPos, inventory[0].itemID, inventory[0].getItemDamage(), 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
worldObj.setBlock(xPos, yPos, zPos, blockToItem, inventory[0].getItemDamage(), 3);
|
||||
}
|
||||
worldObj.playSoundEffect((double) xPos + 0.5D, (double) yPos + 0.5D, (double) zPos + 0.5D, "tile.piston.out", 0.25F, worldObj.rand.nextFloat() * 0.25F + 0.6F);
|
||||
inventory[0].stackSize--;
|
||||
}
|
||||
@@ -251,7 +262,14 @@ public class DrawbridgeLogic extends InventoryLogic implements IFacingLogic, IAc
|
||||
int type = TConstructRegistry.interchangableBlockMapping[block.blockID];
|
||||
if (type != 0)
|
||||
{
|
||||
return block.blockID == inventory[0].itemID || type == inventory[0].itemID;
|
||||
if (type == inventory[0].itemID)
|
||||
return true;
|
||||
}
|
||||
int blockToItem = TConstructRegistry.blockToItemMapping[block.blockID];
|
||||
if (blockToItem != 0)
|
||||
{
|
||||
if (blockToItem == inventory[0].itemID)
|
||||
return true;
|
||||
}
|
||||
return block.blockID == inventory[0].itemID;
|
||||
}
|
||||
@@ -285,145 +303,7 @@ public class DrawbridgeLogic extends InventoryLogic implements IFacingLogic, IAc
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean tryExtend (World par1World, int x, int y, int z, int side)
|
||||
{
|
||||
int posX = x + Facing.offsetsXForSide[side];
|
||||
int posY = y + Facing.offsetsYForSide[side];
|
||||
int posZ = z + Facing.offsetsZForSide[side];
|
||||
int newX = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
int blockID;
|
||||
|
||||
if (newX < 13)
|
||||
{
|
||||
if (posY <= 0 || posY >= par1World.getHeight() - 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
blockID = par1World.getBlockId(posX, posY, posZ);
|
||||
|
||||
if (blockID != 0)
|
||||
{
|
||||
if (!canPushBlock(blockID, par1World, posX, posY, posZ, true))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Block.blocksList[blockID].getMobilityFlag() != 1)
|
||||
{
|
||||
if (newX == 12)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
posX += Facing.offsetsXForSide[side];
|
||||
posY += Facing.offsetsYForSide[side];
|
||||
posZ += Facing.offsetsZForSide[side];
|
||||
++newX;
|
||||
continue;
|
||||
}
|
||||
|
||||
//With our change to how snowballs are dropped this needs to dissallow to mimic vanilla behavior.
|
||||
float chance = (Block.blocksList[blockID] instanceof BlockSnow ? -1.0f : 1.0f);
|
||||
Block.blocksList[blockID].dropBlockAsItemWithChance(par1World, posX, posY, posZ, par1World.getBlockMetadata(posX, posY, posZ), chance, 0);
|
||||
par1World.setBlockToAir(posX, posY, posZ);
|
||||
}
|
||||
}
|
||||
|
||||
newX = posX;
|
||||
blockID = posY;
|
||||
int newZ = posZ;
|
||||
int k2 = 0;
|
||||
int[] aint;
|
||||
int l2;
|
||||
int i3;
|
||||
int j3;
|
||||
|
||||
for (aint = new int[13]; posX != x || posY != y || posZ != z; posZ = j3)
|
||||
{
|
||||
l2 = posX - Facing.offsetsXForSide[side];
|
||||
i3 = posY - Facing.offsetsYForSide[side];
|
||||
j3 = posZ - Facing.offsetsZForSide[side];
|
||||
int k3 = par1World.getBlockId(l2, i3, j3);
|
||||
int l3 = par1World.getBlockMetadata(l2, i3, j3);
|
||||
|
||||
if (k3 == TContent.redstoneMachine.blockID && l2 == x && i3 == y && j3 == z)
|
||||
{
|
||||
par1World.setBlock(posX, posY, posZ, Block.pistonMoving.blockID, side | 0, 4);
|
||||
par1World.setBlockTileEntity(posX, posY, posZ, BlockPistonMoving.getTileEntity(Block.pistonExtension.blockID, side | 0, side, true, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
par1World.setBlock(posX, posY, posZ, Block.pistonMoving.blockID, l3, 4);
|
||||
par1World.setBlockTileEntity(posX, posY, posZ, BlockPistonMoving.getTileEntity(k3, l3, side, true, false));
|
||||
}
|
||||
|
||||
aint[k2++] = k3;
|
||||
posX = l2;
|
||||
posY = i3;
|
||||
}
|
||||
|
||||
posX = newX;
|
||||
posY = blockID;
|
||||
posZ = newZ;
|
||||
|
||||
for (k2 = 0; posX != x || posY != y || posZ != z; posZ = j3)
|
||||
{
|
||||
l2 = posX - Facing.offsetsXForSide[side];
|
||||
i3 = posY - Facing.offsetsYForSide[side];
|
||||
j3 = posZ - Facing.offsetsZForSide[side];
|
||||
par1World.notifyBlocksOfNeighborChange(l2, i3, j3, aint[k2++]);
|
||||
posX = l2;
|
||||
posY = i3;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean canPushBlock (int par0, World par1World, int par2, int par3, int par4, boolean par5)
|
||||
{
|
||||
if (par0 == Block.obsidian.blockID)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (par0 != Block.pistonBase.blockID && par0 != Block.pistonStickyBase.blockID)
|
||||
{
|
||||
if (Block.blocksList[par0].getBlockHardness(par1World, par2, par3, par4) == -1.0F)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Block.blocksList[par0].getMobilityFlag() == 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Block.blocksList[par0].getMobilityFlag() == 1)
|
||||
{
|
||||
if (!par5)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/*else if (isExtended(par1World.getBlockMetadata(par2, par3, par4)))
|
||||
{
|
||||
return false;
|
||||
}*/
|
||||
|
||||
return !par1World.blockHasTileEntity(par2, par3, par4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void readFromNBT (NBTTagCompound tags)
|
||||
{
|
||||
@@ -469,4 +349,9 @@ public class DrawbridgeLogic extends InventoryLogic implements IFacingLogic, IAc
|
||||
readFromNBT(packet.customParam1);
|
||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
public boolean hasExtended ()
|
||||
{
|
||||
return extension != 0;
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,8 @@ import net.minecraftforge.common.ForgeDirection;
|
||||
public class FirestarterLogic extends TileEntity implements IFacingLogic, IActiveLogic
|
||||
{
|
||||
boolean active;
|
||||
boolean putOut;
|
||||
//boolean putOut;
|
||||
boolean shouldActivate;
|
||||
byte direction;
|
||||
|
||||
@Override
|
||||
@@ -28,10 +29,14 @@ public class FirestarterLogic extends TileEntity implements IFacingLogic, IActiv
|
||||
@Override
|
||||
public void setActive (boolean flag)
|
||||
{
|
||||
if (active && !flag)
|
||||
/*if (active && !flag)
|
||||
{
|
||||
putOut = true;
|
||||
}*/
|
||||
|
||||
active = flag;
|
||||
setFire();
|
||||
shouldActivate = true;
|
||||
//setFire();
|
||||
}
|
||||
|
||||
void setFire ()
|
||||
@@ -65,6 +70,7 @@ public class FirestarterLogic extends TileEntity implements IFacingLogic, IActiv
|
||||
Block block = Block.blocksList[worldObj.getBlockId(xPos, yPos, zPos)];
|
||||
if (active)
|
||||
{
|
||||
System.out.println("Setting fire");
|
||||
if (block == null || block.isAirBlock(worldObj, xPos, yPos, zPos))
|
||||
{
|
||||
worldObj.playSoundEffect((double) xPos + 0.5D, (double) yPos + 0.5D, (double) zPos + 0.5D, "fire.ignite", 1.0F, AbilityHelper.random.nextFloat() * 0.4F + 0.8F);
|
||||
@@ -73,17 +79,26 @@ public class FirestarterLogic extends TileEntity implements IFacingLogic, IActiv
|
||||
}
|
||||
else
|
||||
{
|
||||
//System.out.println("Stopping fire "+putOut);
|
||||
if (block == Block.fire)
|
||||
{
|
||||
if (putOut)
|
||||
{
|
||||
worldObj.playSoundEffect((double) xPos + 0.5D, (double) yPos + 0.5D, (double) zPos + 0.5D, "random.fizz", 1.0F, AbilityHelper.random.nextFloat() * 0.4F + 0.8F);
|
||||
putOut = false;
|
||||
}
|
||||
//worldObj.playSoundEffect((double) xPos + 0.5D, (double) yPos + 0.5D, (double) zPos + 0.5D, "random.fizz", 1.0F, AbilityHelper.random.nextFloat() * 0.4F + 0.8F);
|
||||
worldObj.playSoundEffect((double) xPos + 0.5D, (double) yPos + 0.5D, (double) zPos + 0.5D, "fire.ignite", 1.0F, AbilityHelper.random.nextFloat() * 0.4F + 0.8F);
|
||||
worldObj.setBlock(xPos, yPos, zPos, 0, 0, 3);
|
||||
//putOut = false;
|
||||
shouldActivate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateEntity ()
|
||||
{
|
||||
if (shouldActivate)
|
||||
{
|
||||
shouldActivate = false;
|
||||
setFire();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getRenderDirection ()
|
||||
|
||||
@@ -320,11 +320,11 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
EntityLiving living = (EntityLiving) o;
|
||||
if (living.attackEntityFrom(new SmelteryDamageSource(), 1))
|
||||
{
|
||||
if (currentLiquid + 8 < maxLiquid)
|
||||
/*if (currentLiquid + 8 < maxLiquid)
|
||||
{
|
||||
int amount = living.isChild() ? 2 : 8;
|
||||
this.addMoltenMetal(new LiquidStack(TContent.liquidMetalStill.blockID, amount, 16), false);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
/*boolean itemAdded = false;
|
||||
|
||||
@@ -52,12 +52,18 @@ public class CustomBowRenderer implements IItemRenderer
|
||||
block = Block.blocksList[stack.itemID];
|
||||
}
|
||||
|
||||
Icon icon = living.getItemIcon(stack, renderPass);
|
||||
Icon icon = null; //living.getItemIcon(stack, renderPass);
|
||||
if (living instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) living;
|
||||
if (player.getItemInUse() != null)
|
||||
icon = stack.getItem().getIcon(stack, renderPass, player, player.getItemInUse(), player.getItemInUseCount());
|
||||
else
|
||||
icon = living.getItemIcon(stack, renderPass);
|
||||
}
|
||||
else
|
||||
{
|
||||
icon = living.getItemIcon(stack, renderPass);
|
||||
}
|
||||
|
||||
if (icon == null)
|
||||
@@ -84,14 +90,6 @@ public class CustomBowRenderer implements IItemRenderer
|
||||
GL11.glRotatef(180.0F, 0F, 0F, 1.0F);
|
||||
GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.75F);
|
||||
GL11.glTranslatef(-0.6F, -0.25F, 1.0F);
|
||||
//GL11.glRotatef(-90.0F, 0F, 1.0F, -1.0F);
|
||||
|
||||
//GL11.glRotatef(90.0F, 0F, 1.0F, 1.0F);
|
||||
//GL11.glRotatef(90.0F, 1.0F, 0F, 1.0F);
|
||||
//GL11.glRotatef(90.0F, 0F, 1.0F, 0.5F);
|
||||
|
||||
//GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
|
||||
//GL11.glRotatef(59.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glScalef(1.75F, 1.75F, 1.75F);
|
||||
}
|
||||
|
||||
@@ -111,7 +109,7 @@ public class CustomBowRenderer implements IItemRenderer
|
||||
GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F);
|
||||
ItemRenderer.renderItemIn2D(tessellator, f1, f2, f, f3, icon.getSheetWidth(), icon.getSheetHeight(), 0.0625F);
|
||||
|
||||
if (stack != null && stack.hasEffect() && renderPass == 0)
|
||||
/*if (stack != null && stack.hasEffect() && renderPass == 0)
|
||||
{
|
||||
GL11.glDepthFunc(GL11.GL_EQUAL);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
@@ -140,7 +138,7 @@ public class CustomBowRenderer implements IItemRenderer
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||
}
|
||||
}*/
|
||||
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import mods.tinker.tconstruct.client.pages.*;
|
||||
import mods.tinker.tconstruct.common.*;
|
||||
import mods.tinker.tconstruct.entity.*;
|
||||
import mods.tinker.tconstruct.entity.projectile.*;
|
||||
import mods.tinker.tconstruct.inventory.MiniGardyContainer;
|
||||
import mods.tinker.tconstruct.library.*;
|
||||
import mods.tinker.tconstruct.library.client.*;
|
||||
import mods.tinker.tconstruct.library.crafting.*;
|
||||
@@ -60,6 +61,7 @@ import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -131,6 +133,18 @@ public class TProxyClient extends TProxyCommon
|
||||
TProxyClient.knapsack.init(Minecraft.getMinecraft().thePlayer);
|
||||
return new KnapsackGui(player.inventory, TProxyClient.knapsack);
|
||||
}
|
||||
if (ID == miniGardyGui)
|
||||
{
|
||||
for (Object o : world.loadedEntityList)
|
||||
{
|
||||
Entity entity = (Entity) o;
|
||||
if (entity.entityId == x)
|
||||
{
|
||||
return new MiniGardyGui(player.inventory, (MiniGardy) entity);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,12 +32,5 @@ public class DrawbridgeGui extends GuiContainer
|
||||
int cornerX = (width - xSize) / 2;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);
|
||||
/*if (logic.fuel > 0)
|
||||
{
|
||||
int fuel = logic.gaugeFuelScaled(12);
|
||||
drawTexturedModalRect(cornerX + 27, (cornerY + 40) - fuel, 176, 12 - fuel, 14, fuel + 2);
|
||||
}
|
||||
int fuelgague = logic.gaugeProgressScaled(24);
|
||||
drawTexturedModalRect(cornerX + 140, cornerY + 8, 176, 14, fuelgague, 16);*/
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package mods.tinker.tconstruct.client.gui;
|
||||
|
||||
import mods.tinker.tconstruct.entity.MiniGardy;
|
||||
import mods.tinker.tconstruct.inventory.MiniGardyContainer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class MiniGardyGui extends GuiContainer
|
||||
{
|
||||
public MiniGardy gardy;
|
||||
|
||||
public MiniGardyGui(InventoryPlayer inventoryplayer, MiniGardy gardy)
|
||||
{
|
||||
super(new MiniGardyContainer(inventoryplayer, gardy));
|
||||
this.gardy = gardy;
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer (int par1, int par2)
|
||||
{
|
||||
fontRenderer.drawString(gardy.getEntityName(), 8, 6, 0x404040);
|
||||
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 4, 0x404040);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerBackgroundLayer (float f, int i, int j)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture("/mods/tinker/textures/gui/googirl.png");
|
||||
int cornerX = (width - xSize) / 2;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);
|
||||
}
|
||||
}
|
||||
@@ -151,10 +151,10 @@ public class TContent implements IFuelHandler
|
||||
//InfiBlocks
|
||||
public static Block speedBlock;
|
||||
public static Block glass;
|
||||
public static Block stainedGlass;
|
||||
//public static Block stainedGlass;
|
||||
public static Block stainedGlassClear;
|
||||
public static Block glassPane;
|
||||
public static Block stainedGlassPane;
|
||||
//public static Block stainedGlassPane;
|
||||
public static Block stainedGlassClearPane;
|
||||
public static Block glassMagicSlab;
|
||||
public static Block stainedGlassMagicSlab;
|
||||
@@ -947,6 +947,15 @@ public class TContent implements IFuelHandler
|
||||
Smeltery.addMelting(Block.glass, 0, 625, new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 13));
|
||||
Smeltery.addMelting(Block.stone, 0, 800, new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue / 18, 14));
|
||||
Smeltery.addMelting(Block.cobblestone, 0, 800, new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue / 18, 14));
|
||||
|
||||
Smeltery.addMelting(glass, 0, 500, new LiquidStack(liquidMetalStill.blockID, 1000, 13));
|
||||
Smeltery.addMelting(glassPane, 0, 350, new LiquidStack(liquidMetalStill.blockID, 250, 13));
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
Smeltery.addMelting(stainedGlassClear, i, 500, new LiquidStack(liquidMetalStill.blockID, 1000, 13));
|
||||
Smeltery.addMelting(stainedGlassClearPane, i, 350, new LiquidStack(liquidMetalStill.blockID, 250, 13));
|
||||
}
|
||||
|
||||
//Alloys
|
||||
Smeltery.addAlloyMixing(new LiquidStack(liquidMetalStill.blockID, 16, 7), new LiquidStack(liquidMetalStill.blockID, 24, 2), new LiquidStack(liquidMetalStill.blockID, 8, 3)); //Bronze
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
package mods.tinker.tconstruct.common;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import mods.tinker.tconstruct.TConstruct;
|
||||
import mods.tinker.tconstruct.inventory.ArmorExtendedContainer;
|
||||
import mods.tinker.tconstruct.inventory.KnapsackContainer;
|
||||
import mods.tinker.tconstruct.entity.MiniGardy;
|
||||
import mods.tinker.tconstruct.inventory.*;
|
||||
import mods.tinker.tconstruct.library.blocks.InventoryLogic;
|
||||
import mods.tinker.tconstruct.util.player.TPlayerStats;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
import cpw.mods.fml.common.registry.TickRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
/**
|
||||
* Common proxy class for InfiTools
|
||||
@@ -34,6 +31,8 @@ public class TProxyCommon implements IGuiHandler
|
||||
public static int inventoryGui = 100;
|
||||
public static int armorGuiID = 101;
|
||||
public static int knapsackGuiID = 102;
|
||||
|
||||
public static int miniGardyGui = 131;
|
||||
|
||||
public static int manualGuiID = -1;
|
||||
|
||||
@@ -68,6 +67,18 @@ public class TProxyCommon implements IGuiHandler
|
||||
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username);
|
||||
return new KnapsackContainer(player.inventory, stats.knapsack);
|
||||
}
|
||||
if (ID == miniGardyGui)
|
||||
{
|
||||
for (Object o : world.loadedEntityList)
|
||||
{
|
||||
Entity entity = (Entity) o;
|
||||
if (entity.entityId == x)
|
||||
{
|
||||
return new MiniGardyContainer(player.inventory, (MiniGardy) entity);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package mods.tinker.tconstruct.entity;
|
||||
|
||||
import mods.tinker.tconstruct.entity.ai.*;
|
||||
import mods.tinker.tconstruct.TConstruct;
|
||||
import mods.tinker.tconstruct.common.TProxyCommon;
|
||||
import mods.tinker.tconstruct.entity.ai.GAIFellTree;
|
||||
import mods.tinker.tconstruct.entity.ai.GAIFollowOwner;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
@@ -32,21 +35,35 @@ public class MiniGardy extends GolemBase
|
||||
|
||||
public boolean interact (EntityPlayer player)
|
||||
{
|
||||
ItemStack stack = this.getHeldItem();
|
||||
if (stack == null)
|
||||
if (player.isSneaking())
|
||||
{
|
||||
this.setCurrentItemOrArmor(0, player.getCurrentEquippedItem().copy());
|
||||
player.destroyCurrentEquippedItem();
|
||||
if (!worldObj.isRemote)
|
||||
player.openGui(TConstruct.instance, TProxyCommon.miniGardyGui, this.worldObj, this.entityId, 0, 0);
|
||||
return true;
|
||||
//return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player.inventory.addItemStackToInventory(stack.copy()))
|
||||
ItemStack stack = this.getHeldItem();
|
||||
if (stack == null)
|
||||
{
|
||||
//this.worldObj.playSoundAtEntity(this, par1Str, par2, par3);
|
||||
this.worldObj.playSoundAtEntity(player, "random.pop", 0.3F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
this.setCurrentItemOrArmor(0, null);
|
||||
ItemStack playerStack = player.getCurrentEquippedItem();
|
||||
if (playerStack != null)
|
||||
{
|
||||
this.setCurrentItemOrArmor(0, playerStack.copy());
|
||||
player.destroyCurrentEquippedItem();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player.inventory.addItemStackToInventory(stack.copy()))
|
||||
{
|
||||
//this.worldObj.playSoundAtEntity(this, par1Str, par2, par3);
|
||||
this.worldObj.playSoundAtEntity(player, "random.pop", 0.3F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
this.setCurrentItemOrArmor(0, null);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ public class DrawbridgeContainer extends Container
|
||||
{
|
||||
this.logic = logic;
|
||||
|
||||
this.addSlotToContainer(new Slot(logic, 0, 80, 36));
|
||||
this.addSlotToContainer(new DrawbridgeSlot(logic, 0, 80, 36, logic));
|
||||
this.addSlotToContainer(new Slot(logic, 1, 35, 36));
|
||||
|
||||
/* Player inventory */
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package mods.tinker.tconstruct.inventory;
|
||||
|
||||
import mods.tinker.tconstruct.blocks.logic.DrawbridgeLogic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class DrawbridgeSlot extends Slot
|
||||
{
|
||||
DrawbridgeLogic logic;
|
||||
public DrawbridgeSlot(IInventory iinventory, int par2, int par3, int par4, DrawbridgeLogic logic)
|
||||
{
|
||||
super(iinventory, par2, par3, par4);
|
||||
this.logic = logic;
|
||||
}
|
||||
|
||||
public boolean isItemValid(ItemStack par1ItemStack)
|
||||
{
|
||||
return !logic.hasExtended();
|
||||
}
|
||||
|
||||
|
||||
public boolean canTakeStack(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
return !logic.hasExtended();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package mods.tinker.tconstruct.inventory;
|
||||
|
||||
import mods.tinker.tconstruct.entity.MiniGardy;
|
||||
import mods.tinker.tconstruct.library.util.IPattern;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class MiniGardyContainer extends Container
|
||||
{
|
||||
public MiniGardy gardy;
|
||||
|
||||
public MiniGardyContainer(InventoryPlayer inventoryplayer, MiniGardy entity)
|
||||
{
|
||||
gardy = entity;
|
||||
for (int column = 0; column < 2; column++)
|
||||
{
|
||||
for (int row = 0; row < 7; row++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(entity, row + column * 7, 44 + row * 18, 36 + column * 18));
|
||||
}
|
||||
}
|
||||
|
||||
/* Player inventory */
|
||||
for (int column = 0; column < 3; column++)
|
||||
{
|
||||
for (int row = 0; row < 9; row++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(inventoryplayer, row + column * 9 + 9, 8 + row * 18, 86 + column * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int column = 0; column < 9; column++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(inventoryplayer, column, 8 + column * 18, 144));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith (EntityPlayer entityplayer)
|
||||
{
|
||||
return gardy.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot (EntityPlayer player, int slotID)
|
||||
{
|
||||
ItemStack stack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(slotID);
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
ItemStack slotStack = slot.getStack();
|
||||
stack = slotStack.copy();
|
||||
|
||||
if (slotID < gardy.getSizeInventory())
|
||||
{
|
||||
if (!this.mergeItemStack(slotStack, gardy.getSizeInventory(), this.inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(slotStack, 0, gardy.getSizeInventory(), false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (slotStack.stackSize == 0)
|
||||
{
|
||||
slot.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
@@ -498,6 +498,7 @@ public class TConstructRegistry
|
||||
* 3: Has rotational metadata
|
||||
* 4: Rails
|
||||
* 5: Has rotational TileEntity data
|
||||
* 6: Custom placement logic
|
||||
*/
|
||||
public static int[] drawbridgeState = new int[Block.blocksList.length];
|
||||
/** Blocks that are interchangable with each other. Ex: Still and flowing water */
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -38,6 +38,7 @@ public class XinStick extends Item
|
||||
//clearInventoryExeptHotbar(player);
|
||||
MiniGardy entity = new MiniGardy(world);
|
||||
entity.setOwner(player);
|
||||
//entity.func_94058_c("Cutie");
|
||||
//entity.username = "NekoGloop";
|
||||
spawnEntity(player.posX, player.posY + 1, player.posZ, entity, world, player);
|
||||
//healPlayer(player);
|
||||
|
||||
Reference in new issue
Block a user