Tooltips on Smeltery Gui, Fix tools not harvesting mod blocks properly and potion effects staying around

master
mDiyo 2013-06-25 07:37:51 -07:00
parent 960dfedb94
commit 5d66e0d739
63 changed files with 2990 additions and 1635 deletions

View File

@ -96,6 +96,7 @@
<entry key="item.oreberry.aluminum.name">Aluminum Oreberry</entry>
<entry key="item.oreberry.silver.name">Silver Oreberry</entry>
<entry key="item.goldenhead.name">Golden Head</entry>
<entry key="item.tconstruct.titleicon.name">Spawn </entry>
<entry key="item.tconstruct.Materials.PaperStack.name">Paper Stack</entry>

View File

@ -442,7 +442,7 @@ Class: Heavy Melee Weapon</text>
- Reinforced: 10% chance per level of not using durability
- Stonebound: The tool mines faster as it wears out, but does less damage
- Spiny: The tool mines does more damage as it wears out, but mines slower
- Spiny: The tool attacks with does more damage as it wears out, but mines slower
- Writable: One extra modifier per piece</text>
</page>

View File

@ -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.3.5", dependencies = "required-after:Forge@[7.7.1.675,)")
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.3.6.2", 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
{
@ -52,6 +52,11 @@ public class TConstruct
/* Proxies for sides, used for graphics processing */
@SidedProxy(clientSide = "mods.tinker.tconstruct.client.TProxyClient", serverSide = "mods.tinker.tconstruct.common.TProxyCommon")
public static TProxyCommon proxy;
public TConstruct()
{
System.out.println("[TConstruct] Preparing to take over the world");
}
@PreInit
public void preInit (FMLPreInitializationEvent evt)

View File

@ -5,23 +5,27 @@ import java.util.List;
import mods.tinker.tconstruct.TConstruct;
import mods.tinker.tconstruct.blocks.logic.GlowstoneAggregator;
import mods.tinker.tconstruct.common.TProxyCommon;
import mods.tinker.tconstruct.crystal.TheftValueTracker;
import mods.tinker.tconstruct.library.TConstructRegistry;
import mods.tinker.tconstruct.library.blocks.InventoryBlock;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class Aggregator extends InventoryBlock
{
public String[] textureNames = { "glowstone_top", "glowstone_top_inactive", "glowstone_side", "glowstone_bottom"};
public String[] textureNames = { "glowstone_top", "glowstone_top_inactive", "glowstone_side", "glowstone_bottom" };
public Icon[] icons;
public Aggregator(int id)
{
super(id, Material.iron);
@ -35,37 +39,33 @@ public class Aggregator extends InventoryBlock
{
return meta;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
public void registerIcons (IconRegister iconRegister)
{
this.icons = new Icon[textureNames.length];
for (int i = 0; i < this.icons.length; ++i)
{
this.icons[i] = iconRegister.registerIcon("tinker:machines/aggregator_"+textureNames[i]);
this.icons[i] = iconRegister.registerIcon("tinker:machines/aggregator_" + textureNames[i]);
}
}
/*@Override
public Icon getBlockTexture(IBlockAccess iblockaccess, int x, int y, int z, int side)
{
if (iblockaccess instanceof World)
@Override
public Icon getBlockTexture (IBlockAccess iblockaccess, int x, int y, int z, int side)
{
if (side == 1)
{
System.out.println("Rawr!");
World world = (World) iblockaccess;
if (world.canBlockSeeTheSky(x, y, z))
{
int level = world.getSavedLightValue(EnumSkyBlock.Sky, x, y, z) - world.skylightSubtracted;
System.out.println("Level: "+level);
if (level < 12)
return icons[1];
}
GlowstoneAggregator logic = (GlowstoneAggregator) iblockaccess.getBlockTileEntity(x, y, z);
if (logic.currentLightLevel >= 12)
return icons[0];
else
return icons[1];
}
return this.getIcon(side, iblockaccess.getBlockMetadata(x, y, z));
}*/
return this.getIcon(side, iblockaccess.getBlockMetadata(x, y, z));
}
@Override
@SideOnly(Side.CLIENT)
public Icon getIcon (int side, int meta)
@ -78,6 +78,21 @@ public class Aggregator extends InventoryBlock
//return icons[meta];
}
@Override
public void onBlockPlacedBy (World world, int x, int y, int z, EntityLiving entityliving, ItemStack stack)
{
super.onBlockPlacedBy(world, x, y, z, entityliving, stack);
if (!world.isRemote)
TheftValueTracker.updateCrystallinity(x, z, world.provider.dimensionId, 4);
}
@Override
public void breakBlock (World world, int x, int y, int z, int par5, int par6)
{
super.breakBlock(world, x, y, z, par5, par6);
TheftValueTracker.updateCrystallinity(x, z, world.provider.dimensionId, -4);
}
@Override
public void getSubBlocks (int id, CreativeTabs tab, List list)
{

View File

@ -7,12 +7,16 @@ import mods.tinker.tconstruct.client.block.CrystalBlockRender;
import mods.tinker.tconstruct.library.TConstructRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
public class LightCrystalBase extends Block
{
String[] textureNames = { "amber_crystal" };
Icon[] icons;
public LightCrystalBase(int id)
{
super(id, Material.glass);
@ -23,8 +27,10 @@ public class LightCrystalBase extends Block
public Icon getIcon (int side, int meta)
{
if (meta < 5)
return Block.cake.getIcon(side, meta);
return Block.sponge.getIcon(side, 1);
return Block.glowStone.getIcon(side, meta);
if (meta < 10)
return Block.blockNetherQuartz.getIcon(side, 1);
return icons[0];
}
@Override
@ -48,9 +54,20 @@ public class LightCrystalBase extends Block
@Override
public void getSubBlocks (int id, CreativeTabs tab, List list)
{
for (int iter = 0; iter < 10; iter++)
for (int iter = 0; iter < 15; iter++)
{
list.add(new ItemStack(id, 1, iter));
}
}
@Override
public void registerIcons (IconRegister iconRegister)
{
this.icons = new Icon[textureNames.length];
for (int i = 0; i < this.icons.length; ++i)
{
this.icons[i] = iconRegister.registerIcon("tinker:" + textureNames[i]);
}
}
}

View File

@ -90,7 +90,6 @@ public class SearedBlock extends InventoryBlock
{
if (!world.isRemote)
{
//System.out.println("Castses");
CastingTableLogic logic = (CastingTableLogic) world.getBlockTileEntity(x, y, z);
if (logic.liquid != null)
return true;
@ -126,7 +125,6 @@ public class SearedBlock extends InventoryBlock
{
if (!world.isRemote)
{
//System.out.println("Castses");
CastingBasinLogic logic = (CastingBasinLogic) world.getBlockTileEntity(x, y, z);
if (logic.liquid != null)
return true;

View File

@ -8,11 +8,14 @@ import mods.tinker.tconstruct.blocks.logic.PatternChestLogic;
import mods.tinker.tconstruct.blocks.logic.StencilTableLogic;
import mods.tinker.tconstruct.blocks.logic.ToolStationLogic;
import mods.tinker.tconstruct.client.block.TableRender;
import mods.tinker.tconstruct.common.TContent;
import mods.tinker.tconstruct.library.TConstructRegistry;
import mods.tinker.tconstruct.library.blocks.InventoryBlock;
import mods.tinker.tconstruct.util.PHConstruct;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@ -22,188 +25,182 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class ToolStationBlock extends InventoryBlock
{
public ToolStationBlock(int id, Material material)
{
super(id, material);
this.setCreativeTab(TConstructRegistry.blockTab);
this.setHardness(2f);
{
public ToolStationBlock(int id, Material material)
{
super(id, material);
this.setCreativeTab(TConstructRegistry.blockTab);
this.setHardness(2f);
this.setStepSound(Block.soundWoodFootstep);
}
}
//Block.hasComparatorInputOverride and Block.getComparatorInputOverride
/* Rendering */
@Override
public String[] getTextureNames()
{
String[] textureNames = {
"toolstation_top",
"toolstation_side",
"toolstation_bottom",
"partbuilder_oak_top",
"partbuilder_oak_side",
"partbuilder_oak_bottom",
"partbuilder_spruce_top",
"partbuilder_spruce_side",
"partbuilder_spruce_bottom",
"partbuilder_birch_top",
"partbuilder_birch_side",
"partbuilder_birch_bottom",
"partbuilder_jungle_top",
"partbuilder_jungle_side",
"partbuilder_jungle_bottom",
"patternchest_top",
"patternchest_side",
"patternchest_bottom",
"stenciltable_oak_top",
"stenciltable_oak_side",
"stenciltable_oak_bottom",
"stenciltable_spruce_top",
"stenciltable_spruce_side",
"stenciltable_spruce_bottom",
"stenciltable_birch_top",
"stenciltable_birch_side",
"stenciltable_birch_bottom",
"stenciltable_jungle_top",
"stenciltable_jungle_side",
"stenciltable_jungle_bottom"};
return textureNames;
}
@Override
public Icon getIcon (int side, int meta)
{
if (meta <= 4)
{
return icons[meta*3+getTextureIndex(side)];
}
else if (meta <= 9)
{
return icons[15+getTextureIndex(side)];
}
else
{
return icons[meta*3+getTextureIndex(side)-12];
}
}
//Block.hasComparatorInputOverride and Block.getComparatorInputOverride
public int getTextureIndex (int side)
{
if (side == 0)
return 2;
if (side == 1)
return 0;
/* Rendering */
@Override
public String[] getTextureNames ()
{
String[] textureNames = { "toolstation_top", "toolstation_side", "toolstation_bottom", "partbuilder_oak_top", "partbuilder_oak_side", "partbuilder_oak_bottom", "partbuilder_spruce_top",
"partbuilder_spruce_side", "partbuilder_spruce_bottom", "partbuilder_birch_top", "partbuilder_birch_side", "partbuilder_birch_bottom", "partbuilder_jungle_top",
"partbuilder_jungle_side", "partbuilder_jungle_bottom", "patternchest_top", "patternchest_side", "patternchest_bottom", "stenciltable_oak_top", "stenciltable_oak_side",
"stenciltable_oak_bottom", "stenciltable_spruce_top", "stenciltable_spruce_side", "stenciltable_spruce_bottom", "stenciltable_birch_top", "stenciltable_birch_side",
"stenciltable_birch_bottom", "stenciltable_jungle_top", "stenciltable_jungle_side", "stenciltable_jungle_bottom" };
return 1;
}
return textureNames;
}
@Override
public boolean renderAsNormalBlock ()
{
return false;
}
@Override
public Icon getIcon (int side, int meta)
{
if (meta <= 4)
{
return icons[meta * 3 + getTextureIndex(side)];
}
else if (meta <= 9)
{
return icons[15 + getTextureIndex(side)];
}
else
{
return icons[meta * 3 + getTextureIndex(side) - 12];
}
}
@Override
public boolean isOpaqueCube ()
{
return false;
}
public int getTextureIndex (int side)
{
if (side == 0)
return 2;
if (side == 1)
return 0;
@Override
public int getRenderType ()
{
return TableRender.tabelModelID;
}
return 1;
}
@Override
public boolean shouldSideBeRendered (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
return true;
}
@Override
public boolean renderAsNormalBlock ()
{
return false;
}
public AxisAlignedBB getSelectedBoundingBoxFromPool (World world, int x, int y, int z)
{
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 5)
return AxisAlignedBB.getAABBPool().getAABB((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY - 0.125, (double) z + this.maxZ);
return AxisAlignedBB.getAABBPool().getAABB((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY, (double) z + this.maxZ);
}
@Override
public boolean isOpaqueCube ()
{
return false;
}
@Override
public TileEntity createTileEntity (World world, int metadata)
{
switch (metadata)
{
case 0:
return new ToolStationLogic();
case 1:
return new PartCrafterLogic();
case 2:
return new PartCrafterLogic();
case 3:
return new PartCrafterLogic();
case 4:
return new PartCrafterLogic();
case 5:
return new PatternChestLogic();
case 6:
return new PatternChestLogic();
case 7:
return new PatternChestLogic();
case 8:
return new PatternChestLogic();
case 9:
return new PatternChestLogic();
case 10:
return new StencilTableLogic();
case 11:
return new StencilTableLogic();
case 12:
return new StencilTableLogic();
case 13:
return new StencilTableLogic();
/*case 14:
return new CastingTableLogic();*/
default:
return null;
}
}
@Override
public int getRenderType ()
{
return TableRender.tabelModelID;
}
@Override
public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer)
{
int md = world.getBlockMetadata(x, y, z);
if (md == 0)
return 0;
else if (md < 5)
return 1;
else if (md < 10)
return 2;
else
return 3;
@Override
public boolean shouldSideBeRendered (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
return true;
}
//return -1;
}
public AxisAlignedBB getSelectedBoundingBoxFromPool (World world, int x, int y, int z)
{
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 5)
return AxisAlignedBB.getAABBPool().getAABB((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY - 0.125,
(double) z + this.maxZ);
return AxisAlignedBB.getAABBPool().getAABB((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY, (double) z + this.maxZ);
}
@Override
public Object getModInstance ()
{
return TConstruct.instance;
}
@Override
public TileEntity createTileEntity (World world, int metadata)
{
switch (metadata)
{
case 0:
return new ToolStationLogic();
case 1:
return new PartCrafterLogic();
case 2:
return new PartCrafterLogic();
case 3:
return new PartCrafterLogic();
case 4:
return new PartCrafterLogic();
case 5:
return new PatternChestLogic();
case 6:
return new PatternChestLogic();
case 7:
return new PatternChestLogic();
case 8:
return new PatternChestLogic();
case 9:
return new PatternChestLogic();
case 10:
return new StencilTableLogic();
case 11:
return new StencilTableLogic();
case 12:
return new StencilTableLogic();
case 13:
return new StencilTableLogic();
/*case 14:
return new CastingTableLogic();*/
default:
return null;
}
}
@Override
public void getSubBlocks (int id, CreativeTabs tab, List list)
{
for (int iter = 0; iter < 6; iter++)
{
list.add(new ItemStack(id, 1, iter));
}
@Override
public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer)
{
int md = world.getBlockMetadata(x, y, z);
if (md == 0)
return 0;
else if (md < 5)
return 1;
else if (md < 10)
return 2;
else
return 3;
for (int iter = 10; iter < 14; iter++)
{
list.add(new ItemStack(id, 1, iter));
}
}
//return -1;
}
@Override
public Object getModInstance ()
{
return TConstruct.instance;
}
@Override
public void getSubBlocks (int id, CreativeTabs tab, List list)
{
for (int iter = 0; iter < 6; iter++)
{
list.add(new ItemStack(id, 1, iter));
}
for (int iter = 10; iter < 14; iter++)
{
list.add(new ItemStack(id, 1, iter));
}
}
//public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving, ItemStack par6ItemStack) {}
@Override
public void onBlockPlacedBy (World world, int x, int y, int z, EntityLiving par5EntityLiving, ItemStack par6ItemStack)
{
if (PHConstruct.freePatterns)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta == 5)
{
PatternChestLogic logic = (PatternChestLogic) world.getBlockTileEntity(x, y, z);
for (int i = 1; i <= 13; i++)
{
logic.setInventorySlotContents(i - 1, new ItemStack(TContent.woodPattern, 1, i));
}
logic.setInventorySlotContents(13, new ItemStack(TContent.woodPattern, 1, 22));
}
}
}
}

View File

@ -194,7 +194,7 @@ public class CastingBasinLogic extends InventoryLogic implements ILiquidTank, IT
@Override
public LiquidStack drain (int maxDrain, boolean doDrain)
{
if (liquid == null || liquid.itemID <= 0) return null;
if (liquid == null || liquid.itemID <= 0 || castingDelay > 0) return null;
if (liquid.amount <= 0) return null;
int used = maxDrain;

View File

@ -194,7 +194,7 @@ public class CastingTableLogic extends InventoryLogic implements ILiquidTank, IT
@Override
public LiquidStack drain (int maxDrain, boolean doDrain)
{
if (liquid == null || liquid.itemID <= 0) return null;
if (liquid == null || liquid.itemID <= 0 || castingDelay > 0) return null;
if (liquid.amount <= 0) return null;
int used = maxDrain;

View File

@ -12,7 +12,7 @@ public class GlowstoneAggregator extends AggregatorLogic
{
short currentTime;
short maxTime = 20 * 60 * 5;
int currentLightLevel;
public int currentLightLevel;
public GlowstoneAggregator()
{

View File

@ -41,6 +41,7 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
int internalTemp;
public int useTime;
public int fuelGague;
public int fuelAmount;
boolean inUse;
ArrayList<CoordTuple> lavaTanks;
@ -374,13 +375,14 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
}
}
void updateFuelGague ()
public void updateFuelDisplay ()
{
if (activeLavaTank == null || useTime > 0)
return;
if (!worldObj.blockExists(activeLavaTank.x, activeLavaTank.y, activeLavaTank.z))
{
fuelAmount = 0;
fuelGague = 0;
return;
}
@ -388,6 +390,45 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
TileEntity tankContainer = worldObj.getBlockTileEntity(activeLavaTank.x, activeLavaTank.y, activeLavaTank.z);
if (tankContainer == null)
{
fuelAmount = 0;
fuelGague = 0;
return;
}
if (tankContainer instanceof ITankContainer)
{
needsUpdate = true;
LiquidStack liquid = ((ITankContainer) tankContainer).drain(ForgeDirection.DOWN, 150, false);
if (liquid != null && liquid.itemID == Block.lavaStill.blockID)
{
ILiquidTank tank = ((ITankContainer) tankContainer).getTank(ForgeDirection.DOWN, liquid);
int capacity = tank.getCapacity();
fuelAmount = liquid.amount;
fuelGague = liquid.amount * 52 / capacity;
}
else
{
fuelAmount = 0;
fuelGague = 0;
}
}
}
void updateFuelGague ()
{
if (activeLavaTank == null || useTime > 0)
return;
if (!worldObj.blockExists(activeLavaTank.x, activeLavaTank.y, activeLavaTank.z))
{
fuelAmount = 0;
fuelGague = 0;
return;
}
TileEntity tankContainer = worldObj.getBlockTileEntity(activeLavaTank.x, activeLavaTank.y, activeLavaTank.z);
if (tankContainer == null)
{
fuelAmount = 0;
fuelGague = 0;
return;
}
@ -404,9 +445,15 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
liquid = tank.getLiquid();
int capacity = tank.getCapacity();
if (liquid != null)
{
fuelAmount = liquid.amount;
fuelGague = liquid.amount * 52 / capacity;
}
else
{
fuelAmount = 0;
fuelGague = 0;
}
}
else
{
@ -431,9 +478,15 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
liquid = newTank.getLiquid();
int capacity = newTank.getCapacity();
if (liquid != null)
{
fuelAmount = liquid.amount;
fuelGague = liquid.amount * 52 / capacity;
}
else
{
fuelAmount = 0;
fuelGague = 0;
}
}
}
iter++;
@ -746,6 +799,11 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
return maxLiquid;
}
public int getTotalLiquid ()
{
return currentLiquid;
}
public LiquidStack drain (int maxDrain, boolean doDrain)
{
if (moltenMetal.size() == 0)

View File

@ -1,27 +0,0 @@
package mods.tinker.tconstruct.client;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
public class BattleaxeRenderer implements IItemRenderer
{
@Override
public boolean handleRenderType (ItemStack item, ItemRenderType type)
{
return false;
}
@Override
public boolean shouldUseRenderHelper (ItemRenderType type, ItemStack item, ItemRendererHelper helper)
{
return true;
}
@Override
public void renderItem (ItemRenderType type, ItemStack item, Object... data)
{
}
}

View File

@ -3,21 +3,19 @@ package mods.tinker.tconstruct.client;
import mods.tinker.tconstruct.TConstruct;
import mods.tinker.tconstruct.client.armor.WingModel;
import mods.tinker.tconstruct.common.TContent;
import mods.tinker.tconstruct.skill.Skill;
import mods.tinker.tconstruct.util.player.TPlayerStats;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.EntityLiving;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.client.event.sound.SoundLoadEvent;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.liquids.LiquidStack;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -74,13 +72,19 @@ public class TClientEvents
@ForgeSubscribe
public void renderHealthbar (RenderGameOverlayEvent.Post event)
{
ScaledResolution scaledresolution = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight);
int scaledWidth = scaledresolution.getScaledWidth();
int scaledHeight = scaledresolution.getScaledHeight();
int xBasePos = scaledWidth / 2 - 91;
int yBasePos = scaledHeight - 39;
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(mc.thePlayer.username);
PotionEffect potion = mc.thePlayer.getActivePotionEffect(Potion.wither);
if (potion != null)
return;
potion = mc.thePlayer.getActivePotionEffect(Potion.poison);
if (potion != null)
return;
if (event.type == RenderGameOverlayEvent.ElementType.HEALTH)
{

View File

@ -238,20 +238,20 @@ public class TProxyClient extends TProxyCommon
//Special Renderers
ClientRegistry.bindTileEntitySpecialRenderer(CastingTableLogic.class, new CastingTableSpecialRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(GolemCoreLogic.class, new GolemCoreSpecialRender());
//ClientRegistry.bindTileEntitySpecialRenderer(GolemCoreLogic.class, new GolemCoreSpecialRender());
ClientRegistry.bindTileEntitySpecialRenderer(CastingBasinLogic.class, new CastingBasinSpecialRender());
//Entities
RenderingRegistry.registerEntityRenderingHandler(FancyEntityItem.class, new FancyItemRender());
RenderingRegistry.registerEntityRenderingHandler(BlueSlime.class, new SlimeRender(new ModelSlime(16), new ModelSlime(0), 0.25F));
RenderingRegistry.registerEntityRenderingHandler(SlimeClone.class, new SlimeCloneRender(new CloneHeadModel(0), new CloneHeadModel(1f), 0.25F));
RenderingRegistry.registerEntityRenderingHandler(GolemBase.class, new GolemRender(0));
//RenderingRegistry.registerEntityRenderingHandler(GolemBase.class, new GolemRender(0));
RenderingRegistry.registerEntityRenderingHandler(CartEntity.class, new CartRender());
RenderingRegistry.registerEntityRenderingHandler(DaggerEntity.class, new DaggerRender());
RenderingRegistry.registerEntityRenderingHandler(Skyla.class, new SkylaRender());
RenderingRegistry.registerEntityRenderingHandler(Crystal.class, new CrystalRender());
RenderingRegistry.registerEntityRenderingHandler(Automaton.class, new RenderBiped(new ModelBiped(), 0));
// RenderingRegistry.registerEntityRenderingHandler(Skyla.class, new SkylaRender());
RenderingRegistry.registerEntityRenderingHandler(Automaton.class, new CrystalGuardianRender());
//RenderingRegistry.registerEntityRenderingHandler(Automaton.class, new RenderBiped(new ModelBiped(), 0));
RenderingRegistry.registerEntityRenderingHandler(LaunchedPotion.class, new LaunchedItemRender(Item.potion, 16384));
//RenderingRegistry.registerEntityRenderingHandler(net.minecraft.entity.player.EntityPlayer.class, new PlayerArmorRender()); // <-- Works, woo!

View File

@ -0,0 +1,188 @@
package mods.tinker.tconstruct.client.entity;
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED;
import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D;
import mods.tinker.tconstruct.entity.Automaton;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
import net.minecraft.entity.EntityLiving;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.src.CrystalGuardianModel;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.MinecraftForgeClient;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class CrystalGuardianRender extends RenderLiving
{
CrystalGuardianModel model;
public CrystalGuardianRender()
{
super(new CrystalGuardianModel(), 0.5F);
this.model = (CrystalGuardianModel)this.mainModel;
}
@Override
protected void renderEquippedItems(EntityLiving par1EntityLiving, float par2)
{
float f1 = 1.0F;
GL11.glColor3f(f1, f1, f1);
super.renderEquippedItems(par1EntityLiving, par2);
ItemStack itemstack = par1EntityLiving.getHeldItem();
ItemStack itemstack1 = par1EntityLiving.getCurrentArmor(3);
float f2;
if (itemstack1 != null)
{
GL11.glPushMatrix();
this.model.head.postRender(0.0625F);
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack1, EQUIPPED);
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack1, BLOCK_3D));
if (itemstack1.getItem() instanceof ItemBlock)
{
if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack1.itemID].getRenderType()))
{
f2 = 0.625F;
GL11.glTranslatef(0.0F, -0.25F, 0.0F);
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(f2, -f2, -f2);
}
this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack1, 0);
}
else if (itemstack1.getItem().itemID == Item.skull.itemID)
{
f2 = 1.0625F;
GL11.glScalef(f2, -f2, -f2);
String s = "";
if (itemstack1.hasTagCompound() && itemstack1.getTagCompound().hasKey("SkullOwner"))
{
s = itemstack1.getTagCompound().getString("SkullOwner");
}
TileEntitySkullRenderer.skullRenderer.func_82393_a(-0.5F, 0.0F, -0.5F, 1, 180.0F, itemstack1.getItemDamage(), s);
}
GL11.glPopMatrix();
}
if (itemstack != null)
{
GL11.glPushMatrix();
if (this.mainModel.isChild)
{
f2 = 0.5F;
GL11.glTranslatef(0.0F, 0.625F, 0.0F);
GL11.glRotatef(-20.0F, -1.0F, 0.0F, 0.0F);
GL11.glScalef(f2, f2, f2);
}
this.model.rightarm.postRender(0.0625F);
GL11.glTranslatef(-0.125F, 1F, 0F);
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED);
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D));
if (itemstack.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())))
{
f2 = 0.5F;
GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
f2 *= 0.75F;
GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(-f2, -f2, f2);
}
else if (itemstack.itemID == Item.bow.itemID)
{
f2 = 0.625F;
GL11.glTranslatef(0.0F, 0.125F, 0.3125F);
GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(f2, -f2, f2);
GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
}
else if (Item.itemsList[itemstack.itemID].isFull3D())
{
f2 = 0.625F;
if (Item.itemsList[itemstack.itemID].shouldRotateAroundWhenRendering())
{
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(0.0F, -0.125F, 0.0F);
}
this.func_82422_c();
GL11.glScalef(f2, -f2, f2);
GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
}
else
{
f2 = 0.375F;
GL11.glTranslatef(0.25F, 0.1875F, -0.1875F);
GL11.glScalef(f2, f2, f2);
GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F);
}
float f6;
float f11;
int j;
float f12;
if (itemstack.getItem().requiresMultipleRenderPasses())
{
for (j = 0; j < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); j++)
{
int k = itemstack.getItem().getColorFromItemStack(itemstack, j);
f12 = (float)(k >> 16 & 255) / 255.0F;
f11 = (float)(k >> 8 & 255) / 255.0F;
f6 = (float)(k & 255) / 255.0F;
GL11.glColor4f(f12, f11, f6, 1.0F);
this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, j);
}
}
else
{
j = itemstack.getItem().getColorFromItemStack(itemstack, 0);
f6 = (float)(j >> 16 & 255) / 255.0F;
f12 = (float)(j >> 8 & 255) / 255.0F;
f11 = (float)(j & 255) / 255.0F;
GL11.glColor4f(f6, f12, f11, 1.0F);
this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, 0);
}
/*this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, 0);
if (itemstack.getItem().requiresMultipleRenderPasses())
{
for (int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++)
{
this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, x);
}
}*/
GL11.glPopMatrix();
}
}
protected void func_82422_c()
{
GL11.glTranslatef(0.0F, 0.1875F, 0.0F);
}
}

View File

@ -1,164 +0,0 @@
package mods.tinker.tconstruct.client.entity;
import mods.tinker.tconstruct.entity.Crystal;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.EntityLiving;
import net.minecraft.util.MathHelper;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class CrystalRender extends RenderLiving
{
/** The creeper model. */
private ModelBase creeperModel = new SkylaModel();
public CrystalRender()
{
super(new CrystalModel(), 0.5F);
}
/**
* Updates creeper scale in prerender callback
*/
protected void updateCreeperScale(Crystal par1EntityCreeper, float par2)
{
float var4 = par1EntityCreeper.getCreeperFlashIntensity(par2);
float var5 = 1.0F + MathHelper.sin(var4 * 100.0F) * var4 * 0.01F;
if (var4 < 0.0F)
{
var4 = 0.0F;
}
if (var4 > 1.0F)
{
var4 = 1.0F;
}
var4 *= var4;
var4 *= var4;
float var6 = (1.0F + var4 * 0.4F) * var5;
float var7 = (1.0F + var4 * 0.1F) / var5;
GL11.glScalef(var6, var7, var6);
}
/**
* Updates color multiplier based on creeper state called by getColorMultiplier
*/
protected int updateCreeperColorMultiplier(Crystal par1EntityCreeper, float par2, float par3)
{
float var5 = par1EntityCreeper.getCreeperFlashIntensity(par3);
if ((int)(var5 * 10.0F) % 2 == 0)
{
return 0;
}
else
{
int var6 = (int)(var5 * 0.2F * 255.0F);
if (var6 < 0)
{
var6 = 0;
}
if (var6 > 255)
{
var6 = 255;
}
short var7 = 255;
short var8 = 255;
short var9 = 255;
return var6 << 24 | var7 << 16 | var8 << 8 | var9;
}
}
/**
* A method used to render a creeper's powered form as a pass model.
*/
protected int renderCreeperPassModel(Crystal par1EntityCreeper, int par2, float par3)
{
if (par1EntityCreeper.getPowered())
{
if (par1EntityCreeper.isInvisible())
{
GL11.glDepthMask(false);
}
else
{
GL11.glDepthMask(true);
}
if (par2 == 1)
{
float var4 = (float)par1EntityCreeper.ticksExisted + par3;
this.loadTexture("/armor/power.png");
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glLoadIdentity();
float var5 = var4 * 0.01F;
float var6 = var4 * 0.01F;
GL11.glTranslatef(var5, var6, 0.0F);
this.setRenderPassModel(this.creeperModel);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glEnable(GL11.GL_BLEND);
float var7 = 0.5F;
GL11.glColor4f(var7, var7, var7, 1.0F);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
return 1;
}
if (par2 == 2)
{
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glLoadIdentity();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
}
}
return -1;
}
protected int func_77061_b(Crystal par1EntityCreeper, int par2, float par3)
{
return -1;
}
/**
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
* entityLiving, partialTickTime
*/
protected void preRenderCallback(EntityLiving par1EntityLiving, float par2)
{
this.updateCreeperScale((Crystal)par1EntityLiving, par2);
}
/**
* Returns an ARGB int color back. Args: entityLiving, lightBrightness, partialTickTime
*/
protected int getColorMultiplier(EntityLiving par1EntityLiving, float par2, float par3)
{
return this.updateCreeperColorMultiplier((Crystal)par1EntityLiving, par2, par3);
}
/**
* Queries whether should render the specified pass or not.
*/
protected int shouldRenderPass(EntityLiving par1EntityLiving, int par2, float par3)
{
return this.renderCreeperPassModel((Crystal)par1EntityLiving, par2, par3);
}
protected int inheritRenderPass(EntityLiving par1EntityLiving, int par2, float par3)
{
return this.func_77061_b((Crystal)par1EntityLiving, par2, par3);
}
}

View File

@ -55,7 +55,7 @@ public class SlimeCloneRender extends RenderLiving
*/
protected void scaleSlime(SlimeClone slimeClone, float par2)
{
float f1 = 2;
float f1 = slimeClone.getSlimeSize();
float f2 = (slimeClone.sizeHeight + (slimeClone.sizeFactor - slimeClone.sizeHeight) * par2) / (f1 * 0.5F + 1.0F);
float f3 = 1.0F / (f2 + 1.0F);
GL11.glScalef(f3 * f1, 1.0F / f3 * f1, f3 * f1);

View File

@ -1,35 +1,34 @@
package mods.tinker.tconstruct.client.gui;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import mods.tinker.tconstruct.blocks.logic.SmelteryLogic;
import mods.tinker.tconstruct.inventory.ActiveContainer;
import mods.tinker.tconstruct.inventory.SmelteryContainer;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.liquids.LiquidDictionary;
import net.minecraftforge.liquids.LiquidStack;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import cpw.mods.fml.common.network.PacketDispatcher;
public class SmelteryGui extends NewContainerGui
{
public SmelteryLogic logic;
@ -46,6 +45,7 @@ public class SmelteryGui extends NewContainerGui
logic = smeltery;
username = inventoryplayer.player.username;
xSize = 248;
smeltery.updateFuelDisplay();
}
public void drawScreen (int mouseX, int mouseY, float par3)
@ -104,13 +104,62 @@ public class SmelteryGui extends NewContainerGui
}
}
protected void drawGuiContainerForegroundLayer (int par1, int par2)
protected void drawGuiContainerForegroundLayer (int mouseX, int mouseY)
{
fontRenderer.drawString(StatCollector.translateToLocal("crafters.Smeltery"), 86, 5, 0x404040);
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 90, (ySize - 96) + 2, 0x404040);
int base = 0;
int cornerX = (width - xSize) / 2 + 36;
int cornerY = (height - ySize) / 2;
for (LiquidStack liquid : logic.moltenMetal)
{
int basePos = 54;
int initialLiquidSize = 0;
int liquidSize = 0;//liquid.amount * 52 / liquidLayers;
if (logic.getCapacity() > 0)
{
int total = logic.getTotalLiquid();
int liquidLayers = (total / 20000 + 1) * 20000;
liquidSize = liquid.amount * 52 / liquidLayers;
base += liquidSize;
}
int leftX = cornerX + basePos;
int topY = (cornerY + 68) - base;
int sizeX = 52;
int sizeY = liquidSize;
if (mouseX >= leftX && mouseX <= leftX + sizeX && mouseY >= topY && mouseY < topY + sizeY)
{
drawLiquidStackTooltip(liquid, mouseX - cornerX + 36, mouseY - cornerY);
}
}
if (logic.fuelGague > 0)
{
int leftX = cornerX + 117;
int topY = (cornerY + 68) - logic.getScaledFuelGague(52);
int sizeX = 12;
int sizeY = logic.getScaledFuelGague(52);
if (mouseX >= leftX && mouseX <= leftX + sizeX && mouseY >= topY && mouseY < topY + sizeY)
{
drawLiquidStackTooltip(new LiquidStack(Block.lavaStill.blockID, logic.fuelAmount, 0), mouseX - cornerX + 36, mouseY - cornerY);
}
/*this.mc.renderEngine.bindTexture("/terrain.png");
Icon lavaIcon = Block.lavaStill.getIcon(0, 0);
int fuel = logic.getScaledFuelGague(52);
int count = 0;
while (fuel > 0)
{
int size = fuel >= 16 ? 16 : fuel;
fuel -= size;
drawTexturedModelRectFromIcon(cornerX + 117, (cornerY + 68) - size - 16 * count, lavaIcon, 12, size);
count++;
}*/
}
}
protected void drawGuiContainerBackgroundLayer (float f, int i, int j)
protected void drawGuiContainerBackgroundLayer (float f, int mouseX, int mouseY)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture("/mods/tinker/textures/gui/smeltery.png");
@ -153,13 +202,15 @@ public class SmelteryGui extends NewContainerGui
renderIndex = liquidItem.getIconFromDamage(liquid.itemMeta);
}
int basePos = 54;
if (logic.getCapacity() > 0)
{
int liquidSize = liquid.amount * 52 / logic.getCapacity();
int total = logic.getTotalLiquid();
int liquidLayers = (total / 20000 + 1) * 20000;
int liquidSize = liquid.amount * 52 / liquidLayers;
while (liquidSize > 0)
{
int size = liquidSize >= 16 ? 16 : liquidSize;
int basePos = 54;
drawTexturedModelRectFromIcon(cornerX + basePos, (cornerY + 68) - size - base, renderIndex, 16, size);
drawTexturedModelRectFromIcon(cornerX + basePos + 16, (cornerY + 68) - size - base, renderIndex, 16, size);
drawTexturedModelRectFromIcon(cornerX + basePos + 32, (cornerY + 68) - size - base, renderIndex, 16, size);
@ -168,6 +219,15 @@ public class SmelteryGui extends NewContainerGui
base += size;
}
}
/*int leftX = cornerX + basePos;
int topY = (cornerY + 68) - base;
int sizeX = 52;
int sizeY = base;
if (mouseX >= leftX && mouseX <= leftX + sizeX && mouseY >= topY && mouseY <= topY + sizeY)
{
drawLiquidStackTooltip(liquid, mouseX, mouseY);
}*/
}
//Liquid gague
@ -212,10 +272,121 @@ public class SmelteryGui extends NewContainerGui
drawTexturedModalRect(cornerX - 38 + (iter % 3 * 22), cornerY + 8 + (iter / 3 * 18) + 16 - size, 98, 15 + 16 - size, 5, size);
}
}
}
protected void drawLiquidStackTooltip (LiquidStack par1ItemStack, int par2, int par3)
{
this.zLevel = 100;
List list = getLiquidTooltip(par1ItemStack, this.mc.gameSettings.advancedItemTooltips);
//fontRenderer.drawString("slotPos: "+slotPos, 140, 2, 0xFFFFFF);
/*fontRenderer.drawString("Scrolling: "+isScrolling, 140, 12, 0xFFFFFF);
fontRenderer.drawString("Scroll: "+currentScroll, 140, 22, 0xFFFFFF);*/
for (int k = 0; k < list.size(); ++k)
{
list.set(k, EnumChatFormatting.GRAY + (String) list.get(k));
}
this.drawToolTip(list, par2, par3);
this.zLevel = 0;
}
public List getLiquidTooltip(LiquidStack liquid, boolean par2)
{
ArrayList list = new ArrayList();
if (liquid.itemID == Block.lavaStill.blockID)
{
list.add("\u00A7fFuel");
int mB = liquid.amount;
if (mB > 0)
list.add("mB: "+mB);
}
else
{
list.add("\u00A7f"+LiquidDictionary.findLiquidName(liquid));
int ingots = liquid.amount / 144;
if (ingots > 0)
list.add("Ingots: "+ingots);
int mB = liquid.amount % 144;
if (mB > 0)
list.add("mB: "+mB);
}
return list;
}
protected void drawToolTip (List par1List, int par2, int par3)
{
if (!par1List.isEmpty())
{
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
int k = 0;
Iterator iterator = par1List.iterator();
while (iterator.hasNext())
{
String s = (String) iterator.next();
int l = this.fontRenderer.getStringWidth(s);
if (l > k)
{
k = l;
}
}
int i1 = par2 + 12;
int j1 = par3 - 12;
int k1 = 8;
if (par1List.size() > 1)
{
k1 += 2 + (par1List.size() - 1) * 10;
}
if (i1 + k > this.width)
{
i1 -= 28 + k;
}
if (j1 + k1 + 6 > this.height)
{
j1 = this.height - k1 - 6;
}
this.zLevel = 300.0F;
itemRenderer.zLevel = 300.0F;
int l1 = -267386864;
this.drawGradientRect(i1 - 3, j1 - 4, i1 + k + 3, j1 - 3, l1, l1);
this.drawGradientRect(i1 - 3, j1 + k1 + 3, i1 + k + 3, j1 + k1 + 4, l1, l1);
this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 + k1 + 3, l1, l1);
this.drawGradientRect(i1 - 4, j1 - 3, i1 - 3, j1 + k1 + 3, l1, l1);
this.drawGradientRect(i1 + k + 3, j1 - 3, i1 + k + 4, j1 + k1 + 3, l1, l1);
int i2 = 1347420415;
int j2 = (i2 & 16711422) >> 1 | i2 & -16777216;
this.drawGradientRect(i1 - 3, j1 - 3 + 1, i1 - 3 + 1, j1 + k1 + 3 - 1, i2, j2);
this.drawGradientRect(i1 + k + 2, j1 - 3 + 1, i1 + k + 3, j1 + k1 + 3 - 1, i2, j2);
this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 - 3 + 1, i2, i2);
this.drawGradientRect(i1 - 3, j1 + k1 + 2, i1 + k + 3, j1 + k1 + 3, j2, j2);
for (int k2 = 0; k2 < par1List.size(); ++k2)
{
String s1 = (String) par1List.get(k2);
this.fontRenderer.drawStringWithShadow(s1, i1, j1, -1);
if (k2 == 0)
{
j1 += 2;
}
j1 += 10;
}
this.zLevel = 0.0F;
itemRenderer.zLevel = 0.0F;
/*GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
RenderHelper.enableStandardItemLighting();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);*/
}
}
public void drawLiquidRect(int par1, int par2, Icon par3Icon, int par4, int par5)

View File

@ -104,19 +104,7 @@ public class StencilTableGui extends GuiContainer
}
else if (meta == 1)
{
if (button.id == 0)
{
patternIndex++;
if (patternIndex > TContent.patternOutputs.length-1)
patternIndex = 0;
}
else if (button.id == 1)
{
patternIndex--;
if (patternIndex < 0)
patternIndex = TContent.patternOutputs.length-1;
}
ItemStack stack = new ItemStack(TContent.metalPattern, 1, patternIndex);
ItemStack stack = new ItemStack(TContent.metalPattern, 1, 0);
logic.setInventorySlotContents(1, stack);
updateServer(stack);
}

View File

@ -24,9 +24,11 @@ import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialLiquid;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.item.Item;
import net.minecraft.item.ItemAppleGold;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeDictionary;
@ -186,6 +188,7 @@ public class TContent implements IFuelHandler
public static Item knapsack;
public static Item heartCanister;
public static Item goldHead;
//Chest hooks
public static ChestGenHooks tinkerHouseChest;
@ -206,12 +209,12 @@ public class TContent implements IFuelHandler
EntityRegistry.registerModEntity(FancyEntityItem.class, "Fancy Item", 0, TConstruct.instance, 32, 5, true);
EntityRegistry.registerModEntity(DaggerEntity.class, "Dagger", 1, TConstruct.instance, 32, 5, true);
//EntityRegistry.registerModEntity(Crystal.class, "Crystal", 2, TConstruct.instance, 32, 5, true);
//EntityRegistry.registerModEntity(SlimeClone.class, "SlimeClone", 2, TConstruct.instance, 32, 5, true);
//EntityRegistry.registerModEntity(LaunchedPotion.class, "Launched Potion", 1, TConstruct.instance, 32, 3, true);
//EntityRegistry.registerModEntity(CartEntity.class, "Small Wagon", 1, TConstruct.instance, 32, 5, true);
//EntityRegistry.registerModEntity(Skyla.class, "Skyla", 10, TConstruct.instance, 32, 5, true);
EntityRegistry.registerModEntity(Automaton.class, "Automaton", 11, TConstruct.instance, 64, 5, true);
EntityRegistry.registerModEntity(SlimeClone.class, "SlimeClone", 10, TConstruct.instance, 32, 3, true);
EntityRegistry.registerModEntity(Automaton.class, "Automaton", 11, TConstruct.instance, 64, 3, true);
EntityRegistry.registerModEntity(BlueSlime.class, "EdibleSlime", 12, TConstruct.instance, 64, 5, true);
//EntityRegistry.registerModEntity(MetalSlime.class, "MetalSlime", 13, TConstruct.instance, 64, 5, true);
@ -507,6 +510,8 @@ public class TContent implements IFuelHandler
public static Item heavyPants;
public static Item heavyBoots;*/
goldHead = new GoldenHead(PHConstruct.goldHead, 4, 1.2F, false).setAlwaysEdible().setPotionEffect(Potion.regeneration.id, 10, 0, 1.0F).setUnlocalizedName("goldenhead");
String[] materialStrings = { "paperStack", "greenSlimeCrystal", "searedBrick", "ingotCobalt", "ingotArdite", "ingotManyullyn", "mossBall", "lavaCrystal", "necroticBone", "ingotCopper",
"ingotTin", "ingotAluminum", "rawAluminum", "ingotBronze", "ingotAluminumBrass", "ingotAlumite", "ingotSteel", "blueSlimeCrystal", "ingotObsidian", "nuggetIron", "nuggetCopper",
"nuggetTin", "nuggetAluminum", "nuggetSilver", "nuggetAluminumBrass", "silkyCloth", "silkyJewel" };
@ -778,7 +783,7 @@ public class TContent implements IFuelHandler
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 5), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 5), bucket, true, 10); //cobalt
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 6), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 6), bucket, true, 10); //ardite
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 7), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 7), bucket, true, 10); //bronze
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 8), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 8), bucket, true, 10); //albrass
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 8), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 8), bucket, true, 10); //alubrass
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 9), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 9), bucket, true, 10); //manyullyn
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 10), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 10), bucket, true, 10); //alumite
tableCasting.addCastingRecipe(new ItemStack(buckets, 1, 11), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 11), bucket, true, 10);// obsidian
@ -792,6 +797,12 @@ public class TContent implements IFuelHandler
for (int iter = 0; iter < patternOutputs.length; iter++)
{
ItemStack cast = new ItemStack(metalPattern, 1, iter + 1);
tableCasting.addCastingRecipe(cast, new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 8), new ItemStack(woodPattern, 1, iter+1), true, 50);
tableCasting.addCastingRecipe(cast, new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue*2, 1), new ItemStack(woodPattern, 1, iter+1), true, 50);
tableCasting.addCastingRecipe(cast, new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 8), new ItemStack(patternOutputs[iter], 1, Short.MAX_VALUE), false, 50);
tableCasting.addCastingRecipe(cast, new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue*2, 1), new ItemStack(patternOutputs[iter], 1, Short.MAX_VALUE), false, 50);
for (int iterTwo = 0; iterTwo < liquids.length; iterTwo++)
{
ItemStack metalCast = new ItemStack(patternOutputs[iter], 1, liquidDamage[iterTwo]);
@ -799,6 +810,12 @@ public class TContent implements IFuelHandler
liquids[iterTwo].itemMeta), cast, 50);
}
}
ItemStack fullguardCast = new ItemStack(metalPattern, 1, 22);
tableCasting.addCastingRecipe(fullguardCast, new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 8), new ItemStack(woodPattern, 1, 22), true, 50);
tableCasting.addCastingRecipe(fullguardCast, new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue*2, 1), new ItemStack(woodPattern, 1, 22), true, 50);
tableCasting.addCastingRecipe(fullguardCast, new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 8), new ItemStack(fullGuard, 1, Short.MAX_VALUE), false, 50);
tableCasting.addCastingRecipe(fullguardCast, new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue*2, 1), new ItemStack(fullGuard, 1, Short.MAX_VALUE), false, 50);
LiquidCasting basinCasting = TConstructRegistry.getBasinCasting();
basinCasting.addCastingRecipe(new ItemStack(Block.blockIron), new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 0), null, true, 100); //Iron
@ -1068,6 +1085,24 @@ public class TContent implements IFuelHandler
RecipeRemover.removeShapedRecipe(new ItemStack(Block.blockIron));
RecipeRemover.removeShapedRecipe(new ItemStack(Block.blockGold));
}
//Ultra hardcore recipes
String[] surround = { "###", "#m#", "###" };
if (PHConstruct.goldAppleRecipe)
{
RecipeRemover.removeShapedRecipe(new ItemStack(Item.appleGold));
RecipeRemover.removeShapedRecipe(new ItemStack(Item.goldenCarrot));
RecipeRemover.removeShapelessRecipe(new ItemStack(Item.speckledMelon));
GameRegistry.addRecipe(new ItemStack(Item.appleGold), surround, '#', new ItemStack(Item.ingotGold), 'm', new ItemStack(Item.appleRed));
GameRegistry.addRecipe(new ItemStack(Item.goldenCarrot), surround, '#', new ItemStack(Item.ingotGold), 'm', new ItemStack(Item.carrot));
GameRegistry.addRecipe(new ItemStack(goldHead), surround, '#', new ItemStack(Item.ingotGold), 'm', new ItemStack(Item.skull, 1, 3));
GameRegistry.addShapelessRecipe(new ItemStack(Item.speckledMelon), new ItemStack(Block.blockGold), new ItemStack(Item.melon));
}
else
{
GameRegistry.addRecipe(new ItemStack(goldHead), surround, '#', new ItemStack(Item.goldNugget), 'm', new ItemStack(Item.skull, 1, 3));
}
}
void setupToolTabs ()
@ -1163,7 +1198,7 @@ public class TContent implements IFuelHandler
OreDictionary.registerOre("nuggetSilver", new ItemStack(materials, 1, 23));
OreDictionary.registerOre("nuggetAluminumBrass", new ItemStack(materials, 1, 24));
String[] names = new String[] { "Iron", "Gold", "Copper", "Tin", "Aluminum", "Cobalt", "Ardite", "Bronze", "Brass", "Manyullyn", "Alumite", "Obsidian", "Steel" };
String[] names = new String[] { "Iron", "Gold", "Copper", "Tin", "Aluminum", "Cobalt", "Ardite", "Bronze", "Aluminum Brass", "Manyullyn", "Alumite", "Obsidian", "Steel" };
liquidIcons = new LiquidStack[names.length];
liquidNames = new String[names.length];
for (int iter = 0; iter < names.length; iter++)

View File

@ -0,0 +1,22 @@
package mods.tinker.tconstruct.crystal;
import java.util.ArrayList;
import java.util.HashMap;
import mods.tinker.tconstruct.library.util.ChunkCoordTuple;
public class TheftValueTracker
{
public static HashMap<ChunkCoordTuple, ArrayList> chunkMap = new HashMap<ChunkCoordTuple, ArrayList>();
//public static HashMap<ChunkCoordTuple, Integer> crystallinity = new HashMap<ChunkCoordTuple, Integer>();
public static HashMap<Integer, HashMap<ChunkCoordTuple, Integer>> crystallinity = new HashMap<Integer, HashMap<ChunkCoordTuple, Integer>>();
public static void updateCrystallinity(int posX, int posZ, int world, int value)
{
ChunkCoordTuple tuple = new ChunkCoordTuple((int)Math.floor(posX/16), (int)Math.floor(posZ/16));
HashMap<ChunkCoordTuple, Integer> dimensionMap = crystallinity.get(world);
int level = dimensionMap.get(tuple);
level += value;
dimensionMap.put(tuple, level);
}
}

View File

@ -1,46 +1,71 @@
package mods.tinker.tconstruct.entity;
import java.util.*;
import mods.tinker.tconstruct.entity.ai.*;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.world.World;
public class Automaton extends GolemBase
{
int state;
TaskBase currentTask;
HashMap<String, TaskBase> taskList = new HashMap<String, TaskBase>();
/*TaskBase currentTask;
HashMap<String, TaskBase> taskList = new HashMap<String, TaskBase>();*/
public Automaton(World world)
{
super(world);
this.texture = "/mods/tinker/textures/mob/automaton.png";
this.setSize(0.9F, 2.42F);
this.texture = "/mods/tinker/textures/mob/crystalguardamber.png";
this.tasks.addTask(1, new GAIAttackTarget(this));
this.tasks.addTask(2, new GAIFindTarget(this));
this.tasks.addTask(3, new GAIFollowOwner(this));
taskList.put("wait", new TaskWait(this));
/*taskList.put("wait", new TaskWait(this));
TaskBase task = new TaskClearcut(this);
taskList.put("clearcut", task);
currentTask = task;
currentTask = task;*/
}
@Override
public void initCreature ()
{
baseAttack = 5;
maxHealth = 30;
maxHealth = 50;
}
@Override
/*@Override
public void updateAITick()
{
if (!currentTask.update())
{
currentTask.finishTask();
}
}
}*/
@Override
protected boolean isAIEnabled()
protected String getHurtSound()
{
return "mob.irongolem.hit";
}
/**
* Returns the sound this mob makes on death.
*/
protected String getDeathSound()
{
return "mob.irongolem.death";
}
/**
* Plays step sound at given x, y, z for the entity
*/
protected void playStepSound(int par1, int par2, int par3, int par4)
{
this.playSound("mob.irongolem.walk", 1.0F, 1.0F);
}
public boolean interact(EntityPlayer par1EntityPlayer)
{
this.setCurrentItemOrArmor(0, par1EntityPlayer.getCurrentEquippedItem().copy());
return true;
}
}

View File

@ -1,21 +0,0 @@
package mods.tinker.tconstruct.entity;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.world.World;
public class Crystal extends EntityCreeper
{
public Crystal(World par1World)
{
super(par1World);
this.texture = "/mods/tinker/textures/mob/crystalwater.png";
}
@Override
public int getMaxHealth ()
{
return 100;
}
}

View File

@ -0,0 +1,21 @@
package mods.tinker.tconstruct.entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.world.World;
public class CrystalGuardian extends EntityLiving
{
public CrystalGuardian(World par1World)
{
super(par1World);
this.texture = "/mods/tinker/textures/mob/crystalguardamber.png";
}
@Override
public int getMaxHealth ()
{
return 100;
}
}

View File

@ -1,30 +1,52 @@
package mods.tinker.tconstruct.entity;
import java.util.ArrayList;
import java.lang.ref.WeakReference;
import java.util.Random;
import mods.tinker.tconstruct.library.tools.AbilityHelper;
import mods.tinker.tconstruct.library.tools.ToolCore;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.EnchantmentThorns;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.IEntityMultiPart;
import net.minecraft.entity.boss.EntityDragonPart;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.potion.Potion;
import net.minecraft.util.DamageSource;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class GolemBase extends EntityCreature
public class GolemBase extends EntityCreature implements IInventory
{
public String creator;
public WeakReference<EntityLiving> leader; //Monster
public String ownerName = ""; //Player
public int maxHealth = 20;
public int baseAttack;
public boolean paused;
float bodyHeight;
float bodyWidth;
int movementType;
public int swings;
public int targetBlock[];
int useTime;
protected static Random rand = new Random();
public Entity escort;
public ItemStack[] inventory;
public GolemBase(World world)
{
super(world);
//setInitialStats();
setupInventory();
}
public void setupInventory ()
{
inventory = new ItemStack[0];
}
@Override
@ -33,234 +55,391 @@ public class GolemBase extends EntityCreature
//Workaround for dying on spawn
if (maxHealth == 0)
return 20;
return maxHealth;
}
@Override
public void initCreature ()
{
//maxHealth = 20;
baseAttack = 3;
paused = false;
}
public EntityLiving getOwner ()
{
if (leader == null || leader.get() == null)
return this.worldObj.getPlayerEntityByName(ownerName);
return leader.get();
}
public void setOwner (EntityLiving living)
{
if (living instanceof EntityPlayer)
ownerName = ((EntityPlayer) living).username;
else
leader = new WeakReference(living);
}
public boolean isOwner (Entity entity)
{
if (entity == null)
{
return false;
}
if (entity instanceof EntityPlayer)
{
EntityPlayer entityplayer = (EntityPlayer) entity;
return entityplayer.username.equalsIgnoreCase(ownerName);
}
return false;
}
public float getSpeed ()
{
return 0.25f;
}
/* AI */
@Override
protected boolean isAIEnabled ()
{
return true;
}
protected void updateWanderPath ()
{
if (!paused)
super.updateWanderPath();
}
public boolean following ()
{
return false;
}
public boolean patrolling ()
{
return true;
}
public void attackEntityAsGolem (Entity target)
{
ItemStack stack = getHeldItem();
if (stack == null)
target.attackEntityFrom(DamageSource.causeMobDamage(this), baseAttack);
if (stack.getItem() instanceof ToolCore)
{
if (stack.hasTagCompound())
{
AbilityHelper.onLeftClickEntity(stack, this, target, (ToolCore) stack.getItem(), baseAttack);
}
else
target.attackEntityFrom(DamageSource.causeMobDamage(this), baseAttack);
}
else
{
if (target.canAttackWithItem())
{
if (!target.func_85031_j(this))
{
int i = stack.getDamageVsEntity(target) + baseAttack;
if (this.isPotionActive(Potion.damageBoost))
{
i += 3 << this.getActivePotionEffect(Potion.damageBoost).getAmplifier();
}
if (this.isPotionActive(Potion.weakness))
{
i -= 2 << this.getActivePotionEffect(Potion.weakness).getAmplifier();
}
int j = 0;
int k = 0;
if (target instanceof EntityLiving)
{
k = EnchantmentHelper.getEnchantmentModifierLiving(this, (EntityLiving) target);
j += EnchantmentHelper.getKnockbackModifier(this, (EntityLiving) target);
}
if (this.isSprinting())
{
++j;
}
if (i > 0 || k > 0)
{
boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.isOnLadder() && !this.isInWater() && !this.isPotionActive(Potion.blindness) && this.ridingEntity == null
&& target instanceof EntityLiving;
if (flag && i > 0)
{
i += this.rand.nextInt(i / 2 + 2);
}
i += k;
boolean flag1 = false;
int l = EnchantmentHelper.getFireAspectModifier(this);
if (target instanceof EntityLiving && l > 0 && !target.isBurning())
{
flag1 = true;
target.setFire(1);
}
boolean flag2 = target.attackEntityFrom(DamageSource.causeMobDamage(this), i);
if (flag2)
{
if (j > 0)
{
target.addVelocity((double) (-MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F) * (float) j * 0.5F), 0.1D,
(double) (MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F) * (float) j * 0.5F));
this.motionX *= 0.6D;
this.motionZ *= 0.6D;
this.setSprinting(false);
}
/*if (flag)
{
this.onCriticalHit(target);
}
if (k > 0)
{
this.onEnchantmentCritical(target);
}
if (i >= 18)
{
this.triggerAchievement(AchievementList.overkill);
}*/
this.setLastAttackingEntity(target);
if (target instanceof EntityLiving)
{
EnchantmentThorns.func_92096_a(this, (EntityLiving) target, this.rand);
}
}
//ItemStack stack = this.getCurrentEquippedItem();
Object object = target;
if (target instanceof EntityDragonPart)
{
IEntityMultiPart ientitymultipart = ((EntityDragonPart) target).entityDragonObj;
if (ientitymultipart != null && ientitymultipart instanceof EntityLiving)
{
object = (EntityLiving) ientitymultipart;
}
}
if (stack != null && object instanceof EntityLiving)
{
//stack.hitEntity((EntityLiving)object, this);
Item.itemsList[stack.itemID].hitEntity(stack, (EntityLiving) object, this);
if (stack.stackSize <= 0)
{
this.destroyCurrentEquippedItem();
}
}
if (target instanceof EntityLiving)
{
/*if (target.isEntityAlive())
{
this.alertWolves((EntityLiving)target, true);
}
this.addStat(StatList.damageDealtStat, i);*/
if (l > 0 && flag2)
{
target.setFire(l * 4);
}
else if (flag1)
{
target.extinguish();
}
}
//this.addExhaustion(0.3F);
}
}
}
}
}
public void destroyCurrentEquippedItem ()
{
worldObj.playSoundAtEntity(this, "random.break", 0.5F, (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F);
this.setCurrentItemOrArmor(0, null);
}
/* Other */
protected boolean canDespawn ()
{
return false;
}
/* Effects */
public void sparkle ()
@Override
@SideOnly(Side.CLIENT)
public Icon getItemIcon (ItemStack par1ItemStack, int par2)
{
Random random = worldObj.rand;
double d = (double) ((float) posX + random.nextFloat() * 2.0F) - 1.0D;
double d1 = (float) posY + random.nextFloat() * (float) bodyHeight;
double d2 = (double) ((float) posZ + random.nextFloat() * 2.0F) - 1.0D;
double d3 = (double) ((float) posX + random.nextFloat() * 2.0F) - 1.0D;
double d4 = (float) posY + random.nextFloat() * (float) bodyHeight;
double d5 = (double) ((float) posZ + random.nextFloat() * 2.0F) - 1.0D;
switch (0)
//(state)
Icon icon = super.getItemIcon(par1ItemStack, par2);
if (par1ItemStack.getItem().requiresMultipleRenderPasses())
{
case 0:
worldObj.spawnParticle("reddust", d, d1, d2, 0.0D, 1.0D, 0.0D);
worldObj.spawnParticle("reddust", d3, d4, d5, 0.0D, 1.0D, 0.0D);
break;
return par1ItemStack.getItem().getIcon(par1ItemStack, par2);
}
case 1:
worldObj.spawnParticle("reddust", d, d1, d2, -1D, 0.0D, 1.0D);
worldObj.spawnParticle("reddust", d3, d4, d5, -1D, 0.0D, 1.0D);
break;
return icon;
}
case 2:
worldObj.spawnParticle("reddust", d, d1, d2, 1.0D, 0.0D, 0.0D);
worldObj.spawnParticle("reddust", d3, d4, d5, 1.0D, 0.0D, 0.0D);
break;
@Override
public ItemStack getStackInSlot (int slot)
{
if (slot < 0 || slot >= inventory.length)
return null;
return inventory[slot];
}
case 3:
worldObj.spawnParticle("reddust", d, d1, d2, 1.0D, 1.0D, 1.0D);
worldObj.spawnParticle("reddust", d3, d4, d5, 1.0D, 1.0D, 1.0D);
break;
public boolean isStackInSlot (int slot)
{
if (slot < 0 || slot >= inventory.length)
return false;
return inventory[slot] != null;
}
case 4:
worldObj.spawnParticle("reddust", d, d1, d2, 0.46000000000000002D, 0.28999999999999998D, 0.19D);
worldObj.spawnParticle("reddust", d3, d4, d5, 0.46000000000000002D, 0.28999999999999998D, 0.19D);
break;
@Override
public int getSizeInventory ()
{
return inventory.length;
}
@Override
public int getInventoryStackLimit ()
{
return 64;
}
@Override
public void setInventorySlotContents (int slot, ItemStack itemstack)
{
inventory[slot] = itemstack;
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit())
{
itemstack.stackSize = getInventoryStackLimit();
}
}
public void sparkle (double d, double d1, double d2)
@Override
public ItemStack decrStackSize (int slot, int quantity)
{
Random random = worldObj.rand;
double d3 = (double) ((float) posX + random.nextFloat() * 2.0F) - 1.0D;
double d4 = (float) posY + random.nextFloat() * (float) bodyHeight;
double d5 = (double) ((float) posZ + random.nextFloat() * 2.0F) - 1.0D;
double d6 = (double) ((float) posX + random.nextFloat() * 2.0F) - 1.0D;
double d7 = (float) posY + random.nextFloat() * (float) bodyHeight;
double d8 = (double) ((float) posZ + random.nextFloat() * 2.0F) - 1.0D;
worldObj.spawnParticle("reddust", d3, d4, d5, d, d1, d2);
worldObj.spawnParticle("reddust", d6, d7, d8, d, d1, d2);
}
public void shineRadius (float f, double d, double d1, double d2)
{
shineRadius(f, d, d1, d2, 2, "reddust");
}
public void shineRadius (float f, double d, double d1, double d2, int i, String s)
{
d++;
Random random = new Random();
float f1 = 0.7F;
float f2 = bodyHeight / 5;
for (int j = 1; j <= 2; j++)
if (inventory[slot] != null)
{
float f3 = f / (float) j;
for (double d3 = 0.0D; d3 < 1.5707963D; d3 += 0.10000000000000001D)
if (inventory[slot].stackSize <= quantity)
{
float f4 = (float) ((double) f3 * Math.cos(d3));
float f5 = (float) ((double) f3 * Math.sin(d3));
for (int k = 0; k < i; k++)
{
worldObj.spawnParticle(s, ((float) posX + f4 + random.nextFloat() * f1) - 0.5F, (float) posY + f2, ((float) posZ + f5 + random.nextFloat() * f1) - 0.5F, d, d1, d2);
}
for (int l = 0; l < i; l++)
{
worldObj.spawnParticle(s, (((float) posX - f4) + random.nextFloat() * f1) - 0.5F, (float) posY + f2, ((float) posZ + f5 + random.nextFloat() * f1) - 0.5F, d, d1, d2);
}
for (int i1 = 0; i1 < i; i1++)
{
worldObj.spawnParticle(s, ((float) posX + f4 + random.nextFloat() * f1) - 0.5F, (float) posY + f2, (((float) posZ - f5) + random.nextFloat() * f1) - 0.5F, d, d1, d2);
}
for (int j1 = 0; j1 < i; j1++)
{
worldObj.spawnParticle(s, (((float) posX - f4) + random.nextFloat() * f1) - 0.5F, (float) posY + f2, (((float) posZ - f5) + random.nextFloat() * f1) - 0.5F, d, d1, d2);
}
ItemStack stack = inventory[slot];
inventory[slot] = null;
return stack;
}
}
}
public void shineRadius (float f, double d, double d1, double d2, boolean flag)
{
d--;
Random random = new Random();
float f1 = 0.7F;
float f2 = f;
String s = "reddust";
float f3 = (float) bodyHeight / 5F;
for (double d3 = 0.0D; d3 < 1.5707963D; d3 += 0.20000000000000001D)
{
float f4 = (float) Math.sin(d3);
float f5 = (float) Math.cos(d3);
float f6 = f2 * f4;
for (double d4 = 0.0D; d4 < 1.5707963D; d4 += 0.20000000000000001D)
ItemStack split = inventory[slot].splitStack(quantity);
if (inventory[slot].stackSize == 0)
{
float f7 = (float) Math.sin(d4);
float f8 = (float) Math.cos(d4);
float f9 = f2 * f8 * f5;
float f10 = f2 * f7 * f5;
worldObj.spawnParticle(s, ((float) posX + f9 + random.nextFloat() * f1) - 0.5F, (float) posY + f3 + f6 + random.nextFloat() * f1,
((float) posZ + f10 + random.nextFloat() * f1) - 0.5F, d, d1, d2);
worldObj.spawnParticle(s, (((float) posX - f9) + random.nextFloat() * f1) - 0.5F, (float) posY + f3 + f6 + random.nextFloat() * f1,
((float) posZ + f10 + random.nextFloat() * f1) - 0.5F, d, d1, d2);
worldObj.spawnParticle(s, ((float) posX + f9 + random.nextFloat() * f1) - 0.5F, (float) posY + f3 + f6 + random.nextFloat() * f1,
(((float) posZ - f10) + random.nextFloat() * f1) - 0.5F, d, d1, d2);
worldObj.spawnParticle(s, (((float) posX - f9) + random.nextFloat() * f1) - 0.5F, (float) posY + f3 + f6 + random.nextFloat() * f1,
(((float) posZ - f10) + random.nextFloat() * f1) - 0.5F, d, d1, d2);
inventory[slot] = null;
}
}
}
public ArrayList findNearbyBlock(int i, int j)
{
return findNearbyBlock(i, j, false);
}
public ArrayList findNearbyBlock(int i, int j, boolean flag)
{
ArrayList arraylist = new ArrayList();
int k = j;
int l = (int)posX;
int i1 = (int)posY;
int j1 = (int)posZ;
for (int k1 = 2; k1 >= -1; k1--)
{
for (int l1 = 0; l1 <= k; l1 = l1 <= 0 ? Math.abs(l1) + 1 : -l1)
{
for (int i2 = 0; i2 <= k; i2 = i2 <= 0 ? Math.abs(i2) + 1 : -i2)
{
int j2 = worldObj.getBlockId(l + l1, i1 + k1, j1 + i2);
if (j2 != 0 && j2 == i)
{
int ai[] = new int[3];
ai[0] = l + l1;
ai[1] = i1 + k1;
ai[2] = j1 + i2;
arraylist.add(ai);
}
}
}
}
return arraylist.size() == 0 ? null : arraylist;
}
public boolean checkNeighbor(int ai[], int i)
{
int j = ai[0] + 1;
int l = ai[1] + 0;
int j1 = ai[2] + 0;
if (worldObj.getBlockId(j, l, j1) == i)
{
return true;
}
j = ai[0] + 0;
l = ai[1] + 1;
j1 = ai[2] + 0;
if (worldObj.getBlockId(j, l, j1) == i)
{
return true;
}
j = ai[0] + 0;
l = ai[1] + 0;
j1 = ai[2] + 1;
if (worldObj.getBlockId(j, l, j1) == i)
{
return true;
}
j = ai[0] - 1;
l = ai[1] + 0;
j1 = ai[2] + 0;
if (worldObj.getBlockId(j, l, j1) == i)
{
return true;
}
j = ai[0] + 0;
l = ai[1] - 1;
j1 = ai[2] + 0;
if (worldObj.getBlockId(j, l, j1) == i)
{
return true;
return split;
}
else
{
int k = ai[0] + 0;
int i1 = ai[1] + 0;
int k1 = ai[2] - 1;
return worldObj.getBlockId(k, i1, k1) == i;
return null;
}
}
@Override
public String getInvName ()
{
return "tconstruct.knapsack";
}
@Override
public boolean isInvNameLocalized ()
{
return false;
}
@Override
public void onInventoryChanged ()
{
}
public ItemStack getStackInSlotOnClosing (int slot)
{
return null;
}
public void openChest ()
{
}
public void closeChest ()
{
}
@Override
public boolean isStackValidForSlot (int i, ItemStack itemstack)
{
return true;
}
@Override
public boolean isUseableByPlayer (EntityPlayer entityplayer)
{
return true;
}
public void writeEntityToNBT (NBTTagCompound tags)
{
super.writeEntityToNBT(tags);
tags.setString("OwnerName", ownerName);
NBTTagList nbttaglist = new NBTTagList();
for (int iter = 0; iter < inventory.length; iter++)
{
if (inventory[iter] != null)
{
NBTTagCompound tagList = new NBTTagCompound();
tagList.setByte("Slot", (byte) iter);
inventory[iter].writeToNBT(tagList);
nbttaglist.appendTag(tagList);
}
}
tags.setTag("Items", nbttaglist);
}
public void readEntityFromNBT (NBTTagCompound tags)
{
super.readEntityFromNBT(tags);
ownerName = tags.getString("OwnerName");
NBTTagList nbttaglist = tags.getTagList("Items");
inventory = new ItemStack[getSizeInventory()];
for (int iter = 0; iter < nbttaglist.tagCount(); iter++)
{
NBTTagCompound tagList = (NBTTagCompound) nbttaglist.tagAt(iter);
byte slotID = tagList.getByte("Slot");
if (slotID >= 0 && slotID < inventory.length)
{
inventory[slotID] = ItemStack.loadItemStackFromNBT(tagList);
}
}
}
}

View File

@ -3,6 +3,7 @@ package mods.tinker.tconstruct.entity;
import mods.tinker.tconstruct.TConstruct;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.potion.Potion;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
@ -52,7 +53,7 @@ public class SlimeClone extends GolemBase
this.sizeHeight = this.sizeFactor;
boolean flag = this.onGround;
super.onUpdate();
int i;
float i;
if (this.onGround && !flag)
{
@ -128,9 +129,9 @@ public class SlimeClone extends GolemBase
return "blueslime";
}
public int getSlimeSize ()
public float getSlimeSize ()
{
return 2;
return 1.5f;
}
/**
@ -149,6 +150,18 @@ public class SlimeClone extends GolemBase
return this.getSlimeSize() > 2;
}
public void writeEntityToNBT (NBTTagCompound tags)
{
super.writeEntityToNBT(tags);
tags.setString("Username", username);
}
public void readEntityFromNBT (NBTTagCompound tags)
{
super.readEntityFromNBT(tags);
username = tags.getString("Username");
}
@Override
public void writeSpawnData (ByteArrayDataOutput data)
{

View File

@ -0,0 +1,142 @@
package mods.tinker.tconstruct.entity.ai;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import mods.tinker.tconstruct.entity.GolemBase;
import mods.touhou_alice_dolls.DollRegistry;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
import net.minecraft.pathfinding.PathNavigate;
import net.minecraft.util.DamageSource;
public class GAIAttackTarget extends GolemAIBase
{
private PathNavigate pathfinder;
private EntityLiving theTarget;
private float speed;
private int counter;
private boolean avoidsWater = true;
//public static String targetEntityRegex;
public GAIAttackTarget(GolemBase doll)
{
super(doll);
this.speed = doll.getSpeed();
this.pathfinder = doll.getNavigator();
this.setMutexBits(3);
}
@Override
public boolean shouldExecute ()
{
if (golem.paused)
{
return false;
}
/*if (golem.isStandbyMode() || golem.isRideonMode())
{
return false;
}
if (golem.getDollID() != DollRegistry.getDollID("Shanghai"))
{
return false;
}*/
theTarget = golem.getAttackTarget();
if (theTarget == null)
{
return false;
}
String name = EntityList.getEntityString(theTarget);
if (name == null)
{
return false;
}
/*Pattern targetPattern = Pattern.compile(targetEntityRegex);
Matcher targetMatcher = targetPattern.matcher(name);
if (!targetMatcher.find())
{
return false;
}*/
return true;
}
@Override
public void startExecuting ()
{
counter = 0;
this.avoidsWater = this.golem.getNavigator().getAvoidsWater();
this.golem.getNavigator().setAvoidsWater(true);
}
@Override
public boolean continueExecuting ()
{
/* if (!golem.isEnable())
{
return false;
}
if (golem.isStandbyMode() || golem.isRideonMode())
{
return false;
}*/
if (this.pathfinder.noPath())
{
return false;
}
if (this.theTarget == null)
{
return false;
}
if (!this.theTarget.isEntityAlive())
{
return false;
}
return true;
}
@Override
public void resetTask ()
{
this.theTarget = null;
this.pathfinder.clearPathEntity();
this.golem.getNavigator().setAvoidsWater(this.avoidsWater);
}
@Override
public void updateTask ()
{
if (!this.pathfinder.noPath())
{
this.golem.getLookHelper().setLookPositionWithEntity(this.theTarget, 10.0F, (float) this.golem.getVerticalFaceSpeed());
}
if (--this.counter <= 0)
{
this.counter = 20;
this.pathfinder.tryMoveToEntityLiving(this.theTarget, this.speed);
if (this.golem.getDistanceSqToEntity(this.theTarget) < 9f && this.golem.getEntitySenses().canSee(this.theTarget))
{
if (this.golem.getHeldItem() != null)
{
this.golem.swingItem();
}
//theTarget.attackEntityFrom(DamageSource.causeMobDamage(golem), attackStrength);
golem.attackEntityAsGolem(theTarget);
/*if (golem.getOwner() != null)
{
theTarget.attackEntityFrom(DamageSource.causePlayerDamage(golem.getOwner()), attackStrength);
}
else
{*/
//}
}
}
}
}

View File

@ -0,0 +1,195 @@
package mods.tinker.tconstruct.entity.ai;
import java.util.List;
import mods.tinker.tconstruct.entity.GolemBase;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.monster.EntityIronGolem;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.passive.EntityChicken;
import net.minecraft.entity.passive.EntityMooshroom;
import net.minecraft.entity.passive.EntitySheep;
public class GAIFindTarget extends GolemAIBase
{
private int counter;
public static double searchRange = 16;
public static double searchHeight = 4;
public static String searchEntityRegex;
public static String targetEntityRegex;
public GAIFindTarget(GolemBase golem)
{
super(golem);
this.setMutexBits(8);
}
public boolean shouldExecute ()
{
if (golem.paused)
{
return false;
}
return true;
}
public void startExecuting ()
{
counter = 0;
}
public boolean continueExecuting ()
{
return !golem.paused;
}
public void updateTask ()
{
if (counter == 0)
{
List<EntityLiving> targetList = (List<EntityLiving>) (world.getEntitiesWithinAABB(EntityLiving.class, golem.boundingBox.expand(searchRange, searchHeight, searchRange)));
/*Pattern searchPattern = Pattern.compile(searchEntityRegex);
Pattern targetPattern = Pattern.compile(targetEntityRegex);
Matcher searchMatcher, targetMatcher;
TreeMap<String, Integer> entityCount = new TreeMap<String, Integer>();*/
EntityLiving theTarget = null;
EntityLiving stealTarget = null;
theTarget = null;
for (EntityLiving e : targetList)
{
/*String name = EntityList.getEntityString(e);
if (name == null)
{
continue;
}
searchMatcher = searchPattern.matcher(name);
if (searchMatcher.find())
{
if (entityCount.containsKey(name))
{
int c = entityCount.get(name).intValue() + 1;
entityCount.put(name, new Integer(c));
}
else
{
entityCount.put(name, new Integer(1));
}
}*/
//System.out.println("Entity: "+e);
if (golem.patrolling())
{
//targetMatcher = targetPattern.matcher(name);
//if (targetMatcher.find())
if (e instanceof IMob)
{
if (theTarget == null)
{
theTarget = e;
}
else
{
if (golem.getDistanceSqToEntity(theTarget) > golem.getDistanceSqToEntity(e))
{
theTarget = e;
}
}
}
}
if (golem.following())
{
Entity tt = null;
if (e instanceof EntityCreature)
{
tt = ((EntityCreature) e).getEntityToAttack();
}
else
{
tt = e.getAttackTarget();
}
if (golem.isOwner(tt))
{
if (theTarget == null)
{
theTarget = e;
}
else
{
if (golem.getDistanceSqToEntity(theTarget) > golem.getDistanceSqToEntity(e))
{
theTarget = e;
}
}
}
}
if (golem.patrolling())
{
if (e instanceof EntitySheep)
{
EntitySheep sheep = (EntitySheep) e;
if (!sheep.getSheared() && !sheep.isChild())
{
if (stealTarget == null)
{
stealTarget = e;
}
else
{
if (golem.getDistanceSqToEntity(stealTarget) > golem.getDistanceSqToEntity(e))
{
stealTarget = e;
}
}
}
}
else if (e instanceof EntityChicken || e instanceof EntityMooshroom || e instanceof EntityIronGolem)
{
if (stealTarget == null)
{
stealTarget = e;
}
else
{
if (golem.getDistanceSqToEntity(stealTarget) > golem.getDistanceSqToEntity(e))
{
stealTarget = e;
}
}
}
}
}
/*StringBuffer msg = new StringBuffer(golem.getDollName() + " : ");
if (entityCount.isEmpty())
{
msg.append("No target");
golem.chatMessage(msg.toString(), 2);
}
else
{
Iterator it = entityCount.keySet().iterator();
while (it.hasNext())
{
String s = (String) it.next();
int v = entityCount.get(s).intValue();
msg.append(s);
msg.append("[");
msg.append(v);
msg.append("] ");
}
golem.chatMessage(msg.toString(), 1);
}*/
golem.setAttackTarget(theTarget == null ? stealTarget : theTarget);
}
counter = (counter + 1) % 20;
}
}

View File

@ -0,0 +1,114 @@
package mods.tinker.tconstruct.entity.ai;
import mods.tinker.tconstruct.entity.GolemBase;
import net.minecraft.entity.EntityLiving;
import net.minecraft.pathfinding.PathNavigate;
import net.minecraft.util.MathHelper;
public class GAIFollowOwner extends GolemAIBase
{
private EntityLiving leader;
private float speed;
private float maxDist;
private float minDist;
private PathNavigate pathfinder;
private boolean avoidsWater;
private int counter;
public GAIFollowOwner(GolemBase golem)
{
super(golem);
this.speed = golem.getSpeed();
this.minDist = 4.0f;
this.maxDist = 2.5f;
this.pathfinder = golem.getNavigator();
this.setMutexBits(3);
}
public boolean shouldExecute ()
{
EntityLiving owner = this.golem.getOwner();
if (owner == null)
{
return false;
}
/*if (!this.golem.isFollowMode())
{
return false;
}*/
if (this.golem.getDistanceSqToEntity(owner) < (double) (this.minDist * this.minDist))
{
return false;
}
this.leader = owner;
return true;
}
public boolean continueExecuting ()
{
if (this.pathfinder.noPath())
{
return false;
}
if (this.golem.getDistanceSqToEntity(this.leader) < (double) (this.maxDist * this.maxDist))
{
return false;
}
/*if (!this.golem.isFollowMode())
{
return false;
}*/
return true;
}
public void startExecuting ()
{
this.counter = 0;
this.avoidsWater = this.golem.getNavigator().getAvoidsWater();
this.golem.getNavigator().setAvoidsWater(false);
}
public void resetTask ()
{
this.leader = null;
this.pathfinder.clearPathEntity();
this.golem.getNavigator().setAvoidsWater(this.avoidsWater);
}
public void updateTask ()
{
this.golem.getLookHelper().setLookPositionWithEntity(this.leader, 10.0F, (float) this.golem.getVerticalFaceSpeed());
if (--this.counter <= 0)
{
this.counter = 10;
if (!this.pathfinder.tryMoveToEntityLiving(this.leader, this.speed))
{
if (this.golem.getDistanceSqToEntity(this.leader) >= 144.0D)
{
int var1 = MathHelper.floor_double(this.leader.posX) - 2;
int var2 = MathHelper.floor_double(this.leader.posZ) - 2;
int var3 = MathHelper.floor_double(this.leader.boundingBox.minY);
for (int var4 = 0; var4 <= 4; ++var4)
{
for (int var5 = 0; var5 <= 4; ++var5)
{
if ((var4 < 1 || var5 < 1 || var4 > 3 || var5 > 3) && this.world.doesBlockHaveSolidTopSurface(var1 + var4, var3 - 1, var2 + var5)
&& !this.world.isBlockNormalCube(var1 + var4, var3, var2 + var5) && !this.world.isBlockNormalCube(var1 + var4, var3 + 1, var2 + var5))
{
this.golem.setLocationAndAngles((double) ((float) (var1 + var4) + 0.5F), (double) var3, (double) ((float) (var2 + var5) + 0.5F), this.golem.rotationYaw,
this.golem.rotationPitch);
this.pathfinder.clearPathEntity();
return;
}
}
}
}
}
}
}
}

View File

@ -0,0 +1,23 @@
package mods.tinker.tconstruct.entity.ai;
import mods.tinker.tconstruct.entity.GolemBase;
import net.minecraft.entity.ai.EntityAIBase;
import net.minecraft.world.World;
public class GolemAIBase extends EntityAIBase
{
protected GolemBase golem;
protected World world;
public GolemAIBase(GolemBase entity)
{
golem = entity;
world = entity.worldObj;
}
@Override
public boolean shouldExecute()
{
return false;
}
}

View File

@ -1,40 +0,0 @@
package mods.tinker.tconstruct.entity.ai;
import java.util.List;
import mods.tinker.tconstruct.entity.GolemBase;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.ai.EntityAITasks;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public abstract class TaskBase
{
public final GolemBase owner;
public TaskBase(GolemBase golem)
{
this.owner = golem;
}
public void init() {}
public void saveTask(NBTTagCompound var1) {}
public void loadTask(NBTTagCompound var1) {}
public abstract boolean update();
public void finishTask() {}
public int getPriority()
{
return 0;
}
}

View File

@ -1,52 +0,0 @@
package mods.tinker.tconstruct.entity.ai;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import mods.tinker.tconstruct.entity.GolemBase;
import mods.tinker.tconstruct.library.util.CoordTuple;
public class TaskClearcut extends TaskBase
{
boolean moving;
boolean searching;
List<CoordTuple> blocks = new ArrayList<CoordTuple>();
public TaskClearcut(GolemBase golem)
{
super(golem);
}
public boolean update ()
{
if (searching)
{
searchForBlocks();
}
return true;
}
void searchForBlocks()
{
for (int x = -7; x <= 7; x++)
{
for (int z = -7; z <= 7; z++)
{
for (int y = -1; y <= 1; y++)
{
Block block = Block.blocksList[owner.worldObj.getBlockId((int)owner.posX+x, (int)owner.posY+y, (int)owner.posZ+z)];
if (block != null && block.isWood(owner.worldObj, (int)owner.posX+x, (int)owner.posY+y, (int)owner.posZ+z))
{
blocks.add(new CoordTuple((int)owner.posX+x, (int)owner.posY+y, (int)owner.posZ+z));
}
}
}
}
}
public void finishTask()
{
moving = false;
}
}

View File

@ -1,17 +0,0 @@
package mods.tinker.tconstruct.entity.ai;
import mods.tinker.tconstruct.entity.GolemBase;
public class TaskWait extends TaskBase
{
public TaskWait(GolemBase golem)
{
super(golem);
}
@Override
public boolean update ()
{
return true;
}
}

View File

@ -32,7 +32,8 @@ public class CraftingItem extends Item
@SideOnly(Side.CLIENT)
public Icon getIconFromDamage(int meta)
{
return icons[meta];
int arr = MathHelper.clamp_int(meta, 0, unlocalizedNames.length);
return icons[arr];
}
@SideOnly(Side.CLIENT)

View File

@ -0,0 +1,83 @@
package mods.tinker.tconstruct.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class GoldenHead extends ItemFood
{
public GoldenHead(int par1, int par2, float par3, boolean par4)
{
super(par1, par2, par3, par4);
this.setHasSubtypes(true);
}
@SideOnly(Side.CLIENT)
public boolean hasEffect(ItemStack par1ItemStack)
{
return par1ItemStack.getItemDamage() > 0;
}
@SideOnly(Side.CLIENT)
/**
* Return an item rarity from EnumRarity
*/
public EnumRarity getRarity(ItemStack par1ItemStack)
{
return par1ItemStack.getItemDamage() == 0 ? EnumRarity.rare : EnumRarity.epic;
}
protected void onFoodEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (par1ItemStack.getItemDamage() > 0)
{
if (!par2World.isRemote)
{
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.regeneration.id, 600, 3));
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.resistance.id, 6000, 0));
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 6000, 0));
}
}
else
{
super.onFoodEaten(par1ItemStack, par2World, par3EntityPlayer);
}
}
@SideOnly(Side.CLIENT)
/**
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
*/
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
par3List.add(new ItemStack(par1, 1, 0));
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("tinker:skull_char_gold");
/*this.icons = new Icon[textureNames.length];
for (int i = 0; i < this.icons.length; ++i)
{
this.icons[i] = iconRegister.registerIcon("tinker:"+textureNames[i]);
}*/
}
}

View File

@ -267,12 +267,20 @@ public class Battleaxe extends HarvestTool
if (block != null && block.blockMaterial == Material.wood)
{
meta = world.getBlockMetadata(x, yPos, z);
world.setBlockToAir(x, yPos, z);
/*world.setBlockToAir(x, yPos, z);
if (!player.capabilities.isCreativeMode)
{
Block.blocksList[blockID].harvestBlock(world, player, x, yPos, z, meta);
onBlockDestroyed(stack, world, blockID, x, yPos, z, player);
}*/
if (!player.capabilities.isCreativeMode)
{
block.harvestBlock(world, player, x, yPos, z, meta);
block.onBlockHarvested(world, x, y, z, meta, player);
onBlockDestroyed(stack, world, localblockID, x, yPos, z, player);
}
world.setBlockToAir(x, yPos, z);
blockID = localblockID;
}
}
}

View File

@ -145,6 +145,9 @@ public class Excavator extends HarvestTool
Block block = Block.blocksList[blockID];
if (!stack.hasTagCompound())
return false;
if (block == null)
return super.onBlockStartBreak(stack, x, y, z, player);
boolean validStart = false;
for (int iter = 0; iter < materials.length; iter++)
@ -209,12 +212,20 @@ public class Excavator extends HarvestTool
{
if (materials[iter] == block.blockMaterial)
{
world.setBlockToAir(xPos, yPos, zPos);
/*world.setBlockToAir(xPos, yPos, zPos);
if (!player.capabilities.isCreativeMode)
{
block.harvestBlock(world, player, xPos, yPos, zPos, meta);
onBlockDestroyed(stack, world, localblockID, xPos, yPos, zPos, player);
}
blockID = localblockID;*/
if (!player.capabilities.isCreativeMode)
{
block.harvestBlock(world, player, xPos, yPos, zPos, meta);
block.onBlockHarvested(world, x, y, z, meta, player);
onBlockDestroyed(stack, world, localblockID, xPos, yPos, zPos, player);
}
world.setBlockToAir(xPos, yPos, zPos);
blockID = localblockID;
}
}
@ -231,6 +242,55 @@ public class Excavator extends HarvestTool
}
@Override
public float getStrVsBlock (ItemStack stack, Block block, int meta)
{
if (!stack.hasTagCompound())
return 1.0f;
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
if (tags.getBoolean("Broken"))
return 0.1f;
Material[] materials = getEffectiveMaterials();
for (int i = 0; i < materials.length; i++)
{
if (materials[i] == block.blockMaterial)
{
float mineSpeed = tags.getInteger("MiningSpeed");
int heads = 1;
if (tags.hasKey("MiningSpeed2"))
{
mineSpeed += tags.getInteger("MiningSpeed2");
heads++;
}
if (tags.hasKey("MiningSpeedHandle"))
{
mineSpeed += tags.getInteger("MiningSpeedHandle");
heads++;
}
if (tags.hasKey("MiningSpeedExtra"))
{
mineSpeed += tags.getInteger("MiningSpeedExtra");
heads++;
}
float trueSpeed = mineSpeed / (heads * 300f);
int hlvl = MinecraftForge.getBlockHarvestLevel(block, meta, getHarvestType());
int durability = tags.getInteger("Damage");
float stonebound = tags.getFloat("Shoddy");
float bonusLog = (float) Math.log(durability / 72f + 1) * 2 * stonebound;
trueSpeed += bonusLog;
if (hlvl <= tags.getInteger("HarvestLevel"))
return trueSpeed;
return 0.1f;
}
}
return super.getStrVsBlock(stack, block, meta);
}
/*@Override
public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
{
super.onUpdate(stack, world, entity, par4, par5);
@ -243,5 +303,5 @@ public class Excavator extends HarvestTool
player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 1, 1));
}
}
}
}*/
}

View File

@ -208,105 +208,6 @@ public class Hammer extends HarvestTool
ArrayList<int[]> coords = new ArrayList<int[]>();
/*@Override
public boolean onBlockDestroyed (ItemStack stack, World world, int blockID, int x, int y, int z, EntityLiving entity)
{
System.out.println("Rawr!");
//return AbilityHelper.onBlockChanged(stack, world, blockID, x, y, z, player, random);
int localID = blockID;
int meta = world.getBlockMetadata(x, y, z);
Block block = Block.blocksList[blockID];
if (!stack.hasTagCompound())
return false;
boolean validStart = false;
for (int iter = 0; iter < materials.length; iter++)
{
if (materials[iter] == block.blockMaterial)
{
validStart = true;
break;
}
}
MovingObjectPosition mop = AbilityHelper.raytraceFromEntity(world, entity, true, 6);
if (mop == null || !validStart)
return AbilityHelper.onBlockChanged(stack, world, blockID, x, y, z, entity, random);
int xRange = 1;
int yRange = 1;
int zRange = 1;
switch (mop.sideHit)
{
case 0:
case 1:
yRange = 0;
break;
case 2:
case 3:
zRange = 0;
break;
case 4:
case 5:
xRange = 0;
break;
}
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
for (int xPos = x - xRange; xPos <= x + xRange; xPos++)
{
for (int yPos = y - yRange; yPos <= y + yRange; yPos++)
{
for (int zPos = z - zRange; zPos <= z + zRange; zPos++)
{
if (!(tags.getBoolean("Broken")))
{
int localblockID = world.getBlockId(xPos, yPos, zPos);
block = Block.blocksList[localblockID];
meta = world.getBlockMetadata(xPos, yPos, zPos);
int hlvl = MinecraftForge.getBlockHarvestLevel(block, meta, getHarvestType());
if (hlvl <= tags.getInteger("HarvestLevel"))
{
boolean cancelHarvest = false;
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
{
if (mod.beforeBlockBreak(this, stack, xPos, yPos, zPos, entity))
cancelHarvest = true;
}
if (!cancelHarvest)
{
if (block != null && !(block.blockHardness < 0))
{
for (int iter = 0; iter < materials.length; iter++)
{
if (materials[iter] == block.blockMaterial)
{
world.setBlockToAir(xPos, yPos, zPos);
if (entity instanceof EntityPlayer)
{
if (!((EntityPlayer) entity).capabilities.isCreativeMode)
{
block.harvestBlock(world, (EntityPlayer) entity, xPos, yPos, zPos, meta);
AbilityHelper.onBlockChanged(stack, world, blockID, x, y, z, entity, random);
}
}
localID = localblockID;
}
}
}
}
}
}
}
}
}
AbilityHelper.onBlockChanged(stack, world, blockID, x, y, z, entity, random);
if (!world.isRemote)
world.playAuxSFX(2001, x, y, z, localID + (meta << 12));
return true;
}*/
@Override
public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player)
{
@ -317,6 +218,9 @@ public class Hammer extends HarvestTool
if (!stack.hasTagCompound())
return false;
if (block == null)
return super.onBlockStartBreak(stack, x, y, z, player);
boolean validStart = false;
for (int iter = 0; iter < materials.length; iter++)
{
@ -380,12 +284,13 @@ public class Hammer extends HarvestTool
{
if (materials[iter] == block.blockMaterial)
{
world.setBlockToAir(xPos, yPos, zPos);
if (!player.capabilities.isCreativeMode)
{
block.harvestBlock(world, player, xPos, yPos, zPos, meta);
block.onBlockHarvested(world, x, y, z, meta, player);
onBlockDestroyed(stack, world, localblockID, xPos, yPos, zPos, player);
}
world.setBlockToAir(xPos, yPos, zPos);
blockID = localblockID;
}
}
@ -400,8 +305,58 @@ public class Hammer extends HarvestTool
world.playAuxSFX(2001, x, y, z, blockID + (meta << 12));
return true;
}
@Override
public float getStrVsBlock (ItemStack stack, Block block, int meta)
{
if (!stack.hasTagCompound())
return 1.0f;
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
if (tags.getBoolean("Broken"))
return 0.1f;
Material[] materials = getEffectiveMaterials();
for (int i = 0; i < materials.length; i++)
{
if (materials[i] == block.blockMaterial)
{
float mineSpeed = tags.getInteger("MiningSpeed");
int heads = 1;
if (tags.hasKey("MiningSpeed2"))
{
mineSpeed += tags.getInteger("MiningSpeed2");
heads++;
}
if (tags.hasKey("MiningSpeedHandle"))
{
mineSpeed += tags.getInteger("MiningSpeedHandle");
heads++;
}
if (tags.hasKey("MiningSpeedExtra"))
{
mineSpeed += tags.getInteger("MiningSpeedExtra");
heads++;
}
float trueSpeed = mineSpeed / (heads * 300f);
int hlvl = MinecraftForge.getBlockHarvestLevel(block, meta, getHarvestType());
int durability = tags.getInteger("Damage");
float stonebound = tags.getFloat("Shoddy");
float bonusLog = (float) Math.log(durability / 72f + 1) * 2 * stonebound;
trueSpeed += bonusLog;
if (hlvl <= tags.getInteger("HarvestLevel"))
return trueSpeed;
return 0.1f;
}
}
return super.getStrVsBlock(stack, block, meta);
}
/*@Override
public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
{
super.onUpdate(stack, world, entity, par4, par5);
@ -414,7 +369,7 @@ public class Hammer extends HarvestTool
player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 1, 1));
}
}
}
}*/
@Override
public String[] toolCategories ()

View File

@ -74,7 +74,7 @@ public class LumberAxe extends HarvestTool
/* Lumber axe specific */
@Override
/*@Override
public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
{
super.onUpdate(stack, world, entity, par4, par5);
@ -87,6 +87,56 @@ public class LumberAxe extends HarvestTool
player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 1, 1));
}
}
}*/
@Override
public float getStrVsBlock (ItemStack stack, Block block, int meta)
{
if (!stack.hasTagCompound())
return 1.0f;
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
if (tags.getBoolean("Broken"))
return 0.1f;
Material[] materials = getEffectiveMaterials();
for (int i = 0; i < materials.length; i++)
{
if (materials[i] == block.blockMaterial)
{
float mineSpeed = tags.getInteger("MiningSpeed");
int heads = 1;
if (tags.hasKey("MiningSpeed2"))
{
mineSpeed += tags.getInteger("MiningSpeed2");
heads++;
}
if (tags.hasKey("MiningSpeedHandle"))
{
mineSpeed += tags.getInteger("MiningSpeedHandle");
heads++;
}
if (tags.hasKey("MiningSpeedExtra"))
{
mineSpeed += tags.getInteger("MiningSpeedExtra");
heads++;
}
float trueSpeed = mineSpeed / (heads * 300f);
int hlvl = MinecraftForge.getBlockHarvestLevel(block, meta, getHarvestType());
int durability = tags.getInteger("Damage");
float stonebound = tags.getFloat("Shoddy");
float bonusLog = (float) Math.log(durability / 72f + 1) * 2 * stonebound;
trueSpeed += bonusLog;
if (hlvl <= tags.getInteger("HarvestLevel"))
return trueSpeed;
return 0.1f;
}
}
return super.getStrVsBlock(stack, block, meta);
}
@Override
@ -173,12 +223,19 @@ public class LumberAxe extends HarvestTool
{
if (localblockID == bID && world.getBlockMetadata(xPos, yPos, zPos) % 4 == meta % 4)
{
world.setBlock(xPos, yPos, zPos, 0, 0, 4);
/* world.setBlock(xPos, yPos, zPos, 0, 0, 3);
if (!player.capabilities.isCreativeMode)
{
Block.blocksList[bID].harvestBlock(world, player, xPos, yPos, zPos, meta);
onBlockDestroyed(stack, world, bID, xPos, yPos, zPos, player);
}*/
if (!player.capabilities.isCreativeMode)
{
block.harvestBlock(world, player, xPos, yPos, zPos, meta);
block.onBlockHarvested(world, x, y, z, meta, player);
onBlockDestroyed(stack, world, localblockID, xPos, yPos, zPos, player);
}
world.setBlockToAir(xPos, yPos, zPos);
breakTree(world, xPos, yPos, zPos, stack, tags, bID, meta, player);
}
/*else

View File

@ -182,12 +182,20 @@ public class Scythe extends Weapon
if (materials[iter] == block.blockMaterial)
{
meta = world.getBlockMetadata(xPos, yPos, zPos);
world.setBlockToAir(xPos, yPos, zPos);
/*world.setBlockToAir(xPos, yPos, zPos);
if (!player.capabilities.isCreativeMode)
{
block.harvestBlock(world, player, xPos, yPos, zPos, meta);
onBlockDestroyed(stack, world, localblockID, xPos, yPos, zPos, player);
}
blockID = localblockID;*/
if (!player.capabilities.isCreativeMode)
{
block.harvestBlock(world, player, xPos, yPos, zPos, meta);
block.onBlockHarvested(world, x, y, z, meta, player);
onBlockDestroyed(stack, world, localblockID, xPos, yPos, zPos, player);
}
world.setBlockToAir(xPos, yPos, zPos);
blockID = localblockID;
}
}

View File

@ -29,18 +29,18 @@ public class ActiveToolMod
/* Attacking */
public int baseAttackDamage(int earlyModDamage, int damage, ToolCore tool, NBTTagCompound tags, NBTTagCompound toolTags, ItemStack stack, EntityPlayer player, Entity entity)
public int baseAttackDamage(int earlyModDamage, int damage, ToolCore tool, NBTTagCompound tags, NBTTagCompound toolTags, ItemStack stack, EntityLiving player, Entity entity)
{
return 0;
}
//Calculated after sprinting and enchant bonuses
public float knockback(float modKnockback, float currentKnockback, ToolCore tool, NBTTagCompound tags, NBTTagCompound toolTags, ItemStack stack, EntityPlayer player, Entity entity)
public float knockback(float modKnockback, float currentKnockback, ToolCore tool, NBTTagCompound tags, NBTTagCompound toolTags, ItemStack stack, EntityLiving player, Entity entity)
{
return 0f;
}
public int attackDamage(int modDamage, int currentDamage, ToolCore tool, NBTTagCompound tags, NBTTagCompound toolTags, ItemStack stack, EntityPlayer player, Entity entity)
public int attackDamage(int modDamage, int currentDamage, ToolCore tool, NBTTagCompound tags, NBTTagCompound toolTags, ItemStack stack, EntityLiving player, Entity entity)
{
return 0;
}

View File

@ -56,7 +56,7 @@ public class TConstructRegistry
public static void addItemToDirectory(String name, Item itemstack)
{
Item add = itemDirectory.get(name);
if (add == null)
if (add != null)
System.out.println("[TCon API] "+name+" is already present in the Item directory");
itemDirectory.put(name, itemstack);
@ -102,7 +102,7 @@ public class TConstructRegistry
public static void addItemStackToDirectory(String name, ItemStack itemstack)
{
ItemStack add = itemstackDirectory.get(name);
if (add == null)
if (add != null)
System.out.println("[TCon API] "+name+" is already present in the ItemStack directory");
itemstackDirectory.put(name, itemstack);

View File

@ -55,7 +55,7 @@ public abstract class InventoryBlock extends BlockContainer
/* Inventory */
@Override
public void breakBlock (World par1World, int x, int y, int z, int par5, int par6)
public void breakBlock (World par1World, int x, int y, int z, int par5, int meta)
{
TileEntity te = par1World.getBlockTileEntity(x, y, z);
@ -100,7 +100,7 @@ public abstract class InventoryBlock extends BlockContainer
}
}
super.breakBlock(par1World, x, y, z, par5, par6);
super.breakBlock(par1World, x, y, z, par5, meta);
}
/* Placement */

View File

@ -20,9 +20,9 @@ public class CastingRecipe
coolTime = delay;
}
public boolean matches(LiquidStack metal, ItemStack cast)
public boolean matches(LiquidStack metal, ItemStack inputCast)
{
if (castingMetal.isLiquidEqual(metal) && ItemStack.areItemStacksEqual(this.cast, cast))
if (castingMetal.isLiquidEqual(metal) && ((cast != null && cast.itemDamage == Short.MAX_VALUE && inputCast.getItem() == cast.getItem()) || ItemStack.areItemStacksEqual(this.cast, inputCast)) )
return true;
else
return false;

View File

@ -49,6 +49,11 @@ public class LiquidCasting
{
addCastingRecipe(output, metal, null, false, delay);
}
public void addCustomCastingRecipe(CastingRecipe recipe)
{
casts.add(recipe);
}
public int getCastingDelay (LiquidStack metal, ItemStack cast)
{

File diff suppressed because it is too large Load Diff

View File

@ -501,7 +501,7 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox
}
//Used for sounds and the like
public void onEntityDamaged (World world, EntityPlayer player, Entity entity)
public void onEntityDamaged (World world, EntityLiving player, Entity entity)
{
}
@ -594,7 +594,7 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox
@Override
public boolean onLeftClickEntity (ItemStack stack, EntityPlayer player, Entity entity)
{
AbilityHelper.onLeftClickEntity(stack, player, entity, this);
AbilityHelper.onLeftClickEntity(stack, player, entity, this, 0);
return true;
}
@ -877,56 +877,11 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox
}
/* Proper stack damage */
public int getItemDamageFromStack (ItemStack stack)
{
if (stack.itemDamage == Short.MAX_VALUE )
return Short.MAX_VALUE;
NBTTagCompound tags = stack.getTagCompound();
if (tags == null)
{
//System.out.println("Tool item is uninitalized! This method should never be called with a default item");
//Exception e = new NullPointerException();
//e.printStackTrace();
return 0;
}
if (tags.hasKey("charge"))
{
int charge = tags.getInteger("charge");
if (charge > 0)
return getMaxCharge(stack) - charge;
}
return tags.getCompoundTag("InfiTool").getInteger("Damage");
}
public int getItemDamageFromStackForDisplay (ItemStack stack)
{
NBTTagCompound tags = stack.getTagCompound();
if (tags == null)
{
//System.out.println("Tool item is uninitalized! This method should never be called with a default item");
//Exception e = new NullPointerException();
//e.printStackTrace();
return 0;
}
if (tags.hasKey("charge"))
{
int charge = tags.getInteger("charge");
if (charge > 0)
return getMaxCharge(stack) - charge;
}
return tags.getCompoundTag("InfiTool").getInteger("Damage");
}
public int getItemMaxDamageFromStack (ItemStack stack)
{
NBTTagCompound tags = stack.getTagCompound();
if (tags == null)
{
//System.out.println("Tool item is uninitalized! This method should never be called with a default item");
//Exception e = new NullPointerException();
//e.printStackTrace();
return 0;
}
@ -938,5 +893,22 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox
}
return tags.getCompoundTag("InfiTool").getInteger("TotalDurability");
}
public int getItemDamageFromStackForDisplay (ItemStack stack)
{
NBTTagCompound tags = stack.getTagCompound();
if (tags == null)
{
return 0;
}
if (tags.hasKey("charge"))
{
int charge = tags.getInteger("charge");
if (charge > 0)
return getMaxCharge(stack) - charge;
}
return tags.getCompoundTag("InfiTool").getInteger("Damage");
}
}

View File

@ -0,0 +1,51 @@
package mods.tinker.tconstruct.library.util;
public class ChunkCoordTuple
{
public final int x;
public final int z;
public ChunkCoordTuple(int posX, int posZ)
{
x = posX;
z = posZ;
}
public boolean equalCoords (int posX, int posZ)
{
if (this.x == posX && this.z == posZ)
return true;
else
return false;
}
@Override
public boolean equals(Object obj)
{
if (obj == null)
return false;
if(getClass() == obj.getClass())
{
ChunkCoordTuple coord = (ChunkCoordTuple)obj;
if(this.x == coord.x && this.z == coord.z)
return true;
}
return false;
}
@Override
public int hashCode ()
{
final int prime = 37;
int result = 1;
result = prime * result + x;
result = prime * result + z;
return result;
}
public String toString ()
{
return "ChunkX: " + x + ", ChunkZ: " + z;
}
}

View File

@ -149,7 +149,7 @@ public class TActiveOmniMod extends ActiveToolMod
/* Attacking */
@Override
public int baseAttackDamage (int earlyModDamage, int damage, ToolCore tool, NBTTagCompound tags, NBTTagCompound toolTags, ItemStack stack, EntityPlayer player, Entity entity)
public int baseAttackDamage (int earlyModDamage, int damage, ToolCore tool, NBTTagCompound tags, NBTTagCompound toolTags, ItemStack stack, EntityLiving player, Entity entity)
{
if (tool instanceof Weapon)
TContent.modL.midStreamModify(stack);
@ -157,7 +157,7 @@ public class TActiveOmniMod extends ActiveToolMod
}
@Override
public int attackDamage (int modDamage, int currentDamage, ToolCore tool, NBTTagCompound tags, NBTTagCompound toolTags, ItemStack stack, EntityPlayer player, Entity entity)
public int attackDamage (int modDamage, int currentDamage, ToolCore tool, NBTTagCompound tags, NBTTagCompound toolTags, ItemStack stack, EntityLiving player, Entity entity)
{
int bonus = 0;
if (entity instanceof EntityLiving)
@ -191,7 +191,7 @@ public class TActiveOmniMod extends ActiveToolMod
}
@Override
public float knockback (float modKnockback, float currentKnockback, ToolCore tool, NBTTagCompound tags, NBTTagCompound toolTags, ItemStack stack, EntityPlayer player, Entity entity)
public float knockback (float modKnockback, float currentKnockback, ToolCore tool, NBTTagCompound tags, NBTTagCompound toolTags, ItemStack stack, EntityLiving player, Entity entity)
{
float bonus = 0f;
if (toolTags.hasKey("Knockback"))

View File

@ -172,6 +172,7 @@ public class PHConstruct
heavyBoots = config.getItem("Equipables", "Heavy Boots", 14110).getInt(14110);
glove = config.getItem("Equipables", "Gloves", 14111).getInt(14111);
knapsack = config.getItem("Equipables", "Knapsack", 14112).getInt(14112);
goldHead = config.getItem("Patterns and Misc", "Golden Head", 14113).getInt(14113);
boolean ic2 = true;
boolean xycraft = true;
@ -252,9 +253,26 @@ public class PHConstruct
aluminumBushMaxY = config.get("Worldgen", "Aluminum Bush Max Y", 60).getInt(60);
seaLevel = config.get("general", "Sea level", 64).getInt(64);
enableHealthRegen = config.get("Ultra Hardcore Changes", "Passive Health Regen", true).getBoolean(true); //Check
goldAppleRecipe = config.get("Ultra Hardcore Changes", "Change Crafting Recipes", false).getBoolean(false); //Check
dropPlayerHeads = config.get("Ultra Hardcore Changes", "Players drop heads on death", false).getBoolean(false); //Check
uhcGhastDrops = config.get("Ultra Hardcore Changes", "Change Ghast drops to Gold Ingots", false).getBoolean(false); //Check
worldBorder = config.get("Ultra Hardcore Changes", "Add World Border", false).getBoolean(false);
worldBorderSize = config.get("Ultra Hardcore Changes", "World Border Radius", 1000).getInt(1000);
freePatterns = config.get("Ultra Hardcore Changes", "Add Patterns to Pattern Chests", false).getBoolean(false); //Check
/* Save the configuration file */
config.save();
File gt = new File(TConstruct.proxy.getLocation() + "/config/GregTech");
if (gt.exists())
{
File gtDyn = new File(TConstruct.proxy.getLocation() + "/config/GregTech/DynamicConfig.cfg");
Configuration gtConfig = new Configuration(gtDyn);
gtConfig.load();
gregtech = gtConfig.get("smelting", "tile.anvil.slightlyDamaged", false).getBoolean(false);
}
}
//Blocks
@ -472,7 +490,19 @@ public class PHConstruct
public static boolean craftMetalTools;
public static boolean vanillaMetalBlocks;
//Ultra Hardcore modifiers
public static boolean enableHealthRegen;
public static boolean goldAppleRecipe;
public static boolean dropPlayerHeads;
public static boolean uhcGhastDrops;
public static boolean worldBorder;
public static int worldBorderSize;
public static boolean freePatterns;
public static int goldHead;
//Superfun
public static boolean superfunWorld;
public static boolean beginnerBook;
public static boolean gregtech;
}

View File

@ -6,6 +6,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes;
public class RecipeRemover
{
@ -33,4 +34,23 @@ public class RecipeRemover
}
}
}
public static void removeShapelessRecipe (ItemStack resultItem)
{
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
for (int i = 0; i < recipes.size(); i++)
{
IRecipe tmpRecipe = recipes.get(i);
if (tmpRecipe instanceof ShapelessRecipes)
{
ShapelessRecipes recipe = (ShapelessRecipes) tmpRecipe;
ItemStack recipeResult = recipe.getRecipeOutput();
if (ItemStack.areItemStacksEqual(resultItem, recipeResult))
{
recipes.remove(i--);
}
}
}
}
}

View File

@ -1,16 +1,19 @@
package mods.tinker.tconstruct.util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;
import mods.tinker.tconstruct.TConstruct;
import mods.tinker.tconstruct.blocks.logic.LiquidTextureLogic;
import mods.tinker.tconstruct.common.TContent;
import mods.tinker.tconstruct.crystal.TheftValueTracker;
import mods.tinker.tconstruct.library.crafting.PatternBuilder;
import mods.tinker.tconstruct.library.crafting.Smeltery;
import mods.tinker.tconstruct.library.crafting.ToolBuilder;
import mods.tinker.tconstruct.library.event.ToolCraftEvent;
import mods.tinker.tconstruct.library.tools.ToolCore;
import mods.tinker.tconstruct.library.util.ChunkCoordTuple;
import mods.tinker.tconstruct.modifiers.ModAttack;
import mods.tinker.tconstruct.util.player.TPlayerStats;
import net.minecraft.entity.Entity;
@ -36,6 +39,8 @@ import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import net.minecraftforge.event.entity.player.FillBucketEvent;
import net.minecraftforge.event.world.ChunkDataEvent;
import net.minecraftforge.event.world.ChunkEvent;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent;
@ -48,11 +53,6 @@ public class TEventHandler
@ForgeSubscribe
public void craftTool (ToolCraftEvent event)
{
/*if (event.tool == TContent.hammer)
{
event.toolTag.setIntArray("Smite", new int[] { 20, 20, 1});
}*/
/*if (event.tool == TContent.cleaver)
{
event.toolTag.getCompoundTag("InfiTool").setInteger("Beheading", 2);
@ -75,25 +75,26 @@ public class TEventHandler
}
}*/
/* Damage */
/*@ForgeSubscribe
public void onHurt (LivingHurtEvent event)
{*/
/*if (event.entityLiving instanceof EntityPlayer)
/*if (event.entityLiving instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) event.entityLiving;
ItemStack stack = player.getItemInUse();
if (stack != null && stack.getItem() == TContent.cutlass)
{
EntityPlayer player = (EntityPlayer) event.entityLiving;
ItemStack stack = player.getItemInUse();
if (stack != null && stack.getItem() == TContent.cutlass)
{
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 3*20, 1));
}
}*/
/*if (event.source instanceof EntityDamageSource && event.source.damageType.equals("explosion.player") && ((EntityDamageSource) event.source).getEntity() instanceof NitroCreeper)
{
if (event.entityLiving.worldObj.difficultySetting == 3)
event.ammount /= 2.3;
else
event.ammount /= 1.5;
}*/
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 3*20, 1));
}
}*/
/*if (event.source instanceof EntityDamageSource && event.source.damageType.equals("explosion.player") && ((EntityDamageSource) event.source).getEntity() instanceof NitroCreeper)
{
if (event.entityLiving.worldObj.difficultySetting == 3)
event.ammount /= 2.3;
else
event.ammount /= 1.5;
}*/
//}
/* Drops */
@ -118,115 +119,136 @@ public class TEventHandler
//if (event.entityLiving.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot"))
//{
if (!event.entityLiving.isChild())
if (!event.entityLiving.isChild())
{
if (event.entityLiving.getClass() == EntityCow.class)
{
if (event.entityLiving.getClass() == EntityCow.class)
int amount = random.nextInt(3) + random.nextInt(1 + event.lootingLevel) + random.nextInt(3) + random.nextInt(1 + event.lootingLevel) + 1;
for (int iter = 0; iter < amount; ++iter)
{
int amount = random.nextInt(3) + random.nextInt(1 + event.lootingLevel) + random.nextInt(3) + random.nextInt(1 + event.lootingLevel) + 1;
for (int iter = 0; iter < amount; ++iter)
{
addDrops(event, new ItemStack(Item.leather, 1));
}
}
else if (event.entityLiving.getClass() == EntityChicken.class)
{
int amount = random.nextInt(3) + random.nextInt(1 + event.lootingLevel) + random.nextInt(3) + random.nextInt(1 + event.lootingLevel) + 1;
for (int iter = 0; iter < amount; ++iter)
{
addDrops(event, new ItemStack(Item.feather, 1));
}
addDrops(event, new ItemStack(Item.leather, 1));
}
}
if (event.recentlyHit)
else if (event.entityLiving.getClass() == EntityChicken.class)
{
if (event.entityLiving.getClass() == EntitySkeleton.class)
{
EntitySkeleton enemy = (EntitySkeleton) event.entityLiving;
int amount = random.nextInt(3) + random.nextInt(1 + event.lootingLevel) + random.nextInt(3) + random.nextInt(1 + event.lootingLevel) + 1;
if (event.source.damageType.equals("player"))
for (int iter = 0; iter < amount; ++iter)
{
addDrops(event, new ItemStack(Item.feather, 1));
}
}
}
if (event.recentlyHit)
{
if (event.entityLiving.getClass() == EntitySkeleton.class)
{
EntitySkeleton enemy = (EntitySkeleton) event.entityLiving;
if (event.source.damageType.equals("player"))
{
EntityPlayer player = (EntityPlayer) event.source.getEntity();
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null && stack.hasTagCompound() && stack.getItem() instanceof ToolCore)
{
EntityPlayer player = (EntityPlayer) event.source.getEntity();
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null && stack.hasTagCompound() && stack.getItem() instanceof ToolCore)
int beheading = stack.getTagCompound().getCompoundTag("InfiTool").getInteger("Beheading");
if (stack.getItem() == TContent.cleaver)
beheading += 2;
if (beheading > 0 && random.nextInt(100) < beheading * 10)
{
int beheading = stack.getTagCompound().getCompoundTag("InfiTool").getInteger("Beheading");
if (stack.getItem() == TContent.cleaver)
beheading += 2;
if (beheading > 0 && random.nextInt(100) < beheading * 10)
{
addDrops(event, new ItemStack(Item.skull.itemID, 1, enemy.getSkeletonType()));
}
addDrops(event, new ItemStack(Item.skull.itemID, 1, enemy.getSkeletonType()));
}
}
if (enemy.getSkeletonType() == 1 && random.nextInt(Math.max(1, 5 - event.lootingLevel)) == 0)
{
addDrops(event, new ItemStack(TContent.materials, 1, 8));
}
}
if (event.entityLiving.getClass() == EntityZombie.class)
if (enemy.getSkeletonType() == 1 && random.nextInt(Math.max(1, 5 - event.lootingLevel)) == 0)
{
EntityZombie enemy = (EntityZombie) event.entityLiving;
addDrops(event, new ItemStack(TContent.materials, 1, 8));
}
}
if (event.source.damageType.equals("player"))
if (event.entityLiving.getClass() == EntityZombie.class)
{
EntityZombie enemy = (EntityZombie) event.entityLiving;
if (event.source.damageType.equals("player"))
{
EntityPlayer player = (EntityPlayer) event.source.getEntity();
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null && stack.hasTagCompound() && stack.getItem() instanceof ToolCore)
{
EntityPlayer player = (EntityPlayer) event.source.getEntity();
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null && stack.hasTagCompound() && stack.getItem() instanceof ToolCore)
{
int beheading = stack.getTagCompound().getCompoundTag("InfiTool").getInteger("Beheading");
if (stack.getItem() == TContent.cleaver)
beheading += 2;
if (beheading > 0 && random.nextInt(100) < beheading * 10)
{
addDrops(event, new ItemStack(Item.skull.itemID, 1, 2));
}
}
/*if (stack.getItem() == TContent.breakerBlade && random.nextInt(100) < 10) //Swap out for real beheading
int beheading = stack.getTagCompound().getCompoundTag("InfiTool").getInteger("Beheading");
if (stack.getItem() == TContent.cleaver)
beheading += 2;
if (beheading > 0 && random.nextInt(100) < beheading * 10)
{
addDrops(event, new ItemStack(Item.skull.itemID, 1, 2));
}*/
}
}
}
if (event.entityLiving.getClass() == EntityCreeper.class)
{
EntityCreeper enemy = (EntityCreeper) event.entityLiving;
if (event.source.damageType.equals("player"))
/*if (stack.getItem() == TContent.breakerBlade && random.nextInt(100) < 10) //Swap out for real beheading
{
EntityPlayer player = (EntityPlayer) event.source.getEntity();
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null && stack.hasTagCompound() && stack.getItem() instanceof ToolCore)
addDrops(event, new ItemStack(Item.skull.itemID, 1, 2));
}*/
}
}
if (event.entityLiving.getClass() == EntityCreeper.class)
{
EntityCreeper enemy = (EntityCreeper) event.entityLiving;
if (event.source.damageType.equals("player"))
{
EntityPlayer player = (EntityPlayer) event.source.getEntity();
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null && stack.hasTagCompound() && stack.getItem() instanceof ToolCore)
{
int beheading = stack.getTagCompound().getCompoundTag("InfiTool").getInteger("Beheading");
if (stack.getItem() == TContent.cleaver)
beheading += 2;
if (beheading > 0 && random.nextInt(100) < beheading * 5)
{
int beheading = stack.getTagCompound().getCompoundTag("InfiTool").getInteger("Beheading");
if (stack.getItem() == TContent.cleaver)
beheading += 2;
if (beheading > 0 && random.nextInt(100) < beheading * 5)
{
addDrops(event, new ItemStack(Item.skull.itemID, 1, 4));
}
addDrops(event, new ItemStack(Item.skull.itemID, 1, 4));
}
}
}
}
}
else if (event.entityLiving.getClass() == EntityGhast.class)
if (event.entityLiving.getClass() == EntityGhast.class)
{
if (PHConstruct.uhcGhastDrops)
{
for (EntityItem o : event.drops)
{
if (o.getEntityItem().itemID == Item.ghastTear.itemID)
{
o.setEntityItemStack(new ItemStack(Item.ingotGold, 1));
}
}
}
else
{
addDrops(event, new ItemStack(Item.ghastTear, 1));
}
}
//}
if (event.entityLiving instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) event.entityLiving;
if (event.source.damageType.equals("player"))
if (PHConstruct.dropPlayerHeads)
{
ItemStack dropStack = new ItemStack(Item.skull.itemID, 1, 3);
NBTTagCompound nametag = new NBTTagCompound();
nametag.setString("SkullOwner", player.username);
addDrops(event, dropStack);
}
else if (event.source.damageType.equals("player"))
{
EntityPlayer source = (EntityPlayer) event.source.getEntity();
ItemStack stack = source.getCurrentEquippedItem();
@ -291,6 +313,41 @@ public class TEventHandler
}
}
/* Chunks */
/*@ForgeSubscribe
public void chunkDataLoad (ChunkDataEvent.Load event)
{
ChunkCoordTuple coord = new ChunkCoordTuple(event.getChunk().xPosition, event.getChunk().zPosition);
int worldID = event.getChunk().worldObj.provider.dimensionId;
int crystal = event.getData().getInteger("TConstruct.Crystallinity");
HashMap<ChunkCoordTuple, Integer> crystalMap = TheftValueTracker.crystallinity.get(worldID);
if (crystalMap == null)
{
crystalMap = new HashMap<ChunkCoordTuple, Integer>();
TheftValueTracker.crystallinity.put(worldID, crystalMap);
}
crystalMap.put(coord, crystal);
}
@ForgeSubscribe
public void chunkDataSave (ChunkDataEvent.Save event)
{
ChunkCoordTuple coord = new ChunkCoordTuple(event.getChunk().xPosition, event.getChunk().zPosition);
int worldID = event.getChunk().worldObj.provider.dimensionId;
HashMap<ChunkCoordTuple, Integer> crystalMap = TheftValueTracker.crystallinity.get(worldID);
if (crystalMap.containsKey(coord))
{
int crystal = crystalMap.get(coord);
event.getData().setInteger("TConstruct.Crystallinity", crystal);
if (!event.getChunk().isChunkLoaded)
{
TheftValueTracker.crystallinity.remove(worldID);
}
}
}*/
/* Ore Dictionary */
@ForgeSubscribe
public void registerOre (OreRegisterEvent evt)

View File

@ -1,6 +1,6 @@
package mods.tinker.tconstruct.util.player;
import mods.tinker.tconstruct.TConstruct;
import mods.tinker.tconstruct.util.PHConstruct;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemFood;
import net.minecraft.nbt.NBTTagCompound;
@ -63,7 +63,7 @@ public class TFoodStats extends FoodStats
}
}
if (this.foodLevel >= 12 + 2*difficulty && player.shouldHeal())
if (this.foodLevel >= 12 + 2*difficulty && player.shouldHeal() && PHConstruct.enableHealthRegen)
{
++this.foodTimer;

View File

@ -79,6 +79,13 @@ public class TPlayerHandler implements IPlayerTracker
//stats.armor.recalculateSkills(entityplayer, stats);
playerStats.put(entityplayer.username, stats);
if (PHConstruct.gregtech)
{
PHConstruct.gregtech = false;
entityplayer.addChatMessage("Warning: GregTech Exploit Present!");
entityplayer.addChatMessage("Please disable all Reverse Smelting recipes from GregTech.");
}
//sendSkills(entityplayer, stats);
}

View File

@ -1,8 +1,11 @@
package mods.tinker.tconstruct.worldgen;
import java.util.HashMap;
import java.util.Random;
import mods.tinker.tconstruct.common.TContent;
import mods.tinker.tconstruct.crystal.TheftValueTracker;
import mods.tinker.tconstruct.library.util.ChunkCoordTuple;
import mods.tinker.tconstruct.library.util.CoordTuple;
import mods.tinker.tconstruct.util.PHConstruct;
import net.minecraft.block.Block;
@ -42,6 +45,8 @@ public class TBaseWorldGenerator implements IWorldGenerator
@Override
public void generate (Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
initializeChunkData(chunkX, chunkZ, world.provider.dimensionId);
if (world.provider.isHellWorld)
{
generateNether(random, chunkX * 16, chunkZ * 16, world);
@ -57,6 +62,24 @@ public class TBaseWorldGenerator implements IWorldGenerator
{
superfunGenerate(random, chunkX * 16, chunkZ * 16, world);
}
if (PHConstruct.worldBorder)
{
generateChunkBorder(random, chunkX * 16, chunkZ * 16, world);
}
}
void initializeChunkData(int chunkX, int chunkZ, int worldID)
{
ChunkCoordTuple coord = new ChunkCoordTuple(chunkX, chunkZ);
int crystal = 0;
HashMap<ChunkCoordTuple, Integer> crystalMap = TheftValueTracker.crystallinity.get(worldID);
if (crystalMap == null)
{
crystalMap = new HashMap<ChunkCoordTuple, Integer>();
TheftValueTracker.crystallinity.put(worldID, crystalMap);
}
crystalMap.put(coord, crystal);
}
void generateSurface (Random random, int xChunk, int zChunk, World world)
@ -343,6 +366,23 @@ public class TBaseWorldGenerator implements IWorldGenerator
}
}
void generateChunkBorder (Random random, int chunkX, int chunkZ, World world)
{
for (int x = 0; x < 16; x++)
{
for (int z = 0; z < 16; z++)
{
if (x + chunkX == PHConstruct.worldBorderSize || x + chunkX == -PHConstruct.worldBorderSize || z + chunkZ == PHConstruct.worldBorderSize || z + chunkZ == -PHConstruct.worldBorderSize)
{
for (int y = 0; y < 256; y++)
{
world.setBlock(x + chunkX, y, z + chunkZ, Block.bedrock.blockID, 0, 0);
}
}
}
}
}
WorldGenMinable copper;
WorldGenMinable tin;
WorldGenMinable aluminum;

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

View File

@ -1,2 +1,3 @@
Original creeper texture by John Smith
http://www.minecraftforum.net/topic/26727-johnsmith-texture-pack-v97-32x-142/
http://www.minecraftforum.net/topic/26727-johnsmith-texture-pack-v97-32x-142/
Crystal Guardians by Axolotine

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

75
sparrow/ISparrow.java Normal file
View File

@ -0,0 +1,75 @@
package sparrow;
import net.minecraft.entity.Entity;
/** A comprehensive class for
*
* @author RaustBlackDragon, mDiyo
*/
public interface ISparrow
{
/**Is this thing like a creeper, in that engaging it in combat has unexpected consequences?
* Would this entity and its allies be better off not fighting it at all?
* Set this to true if the attacker's combat abilities are basically a non-factor in what will happen to it if it fights this.
*/
public boolean isStupidToAttack ();
/**When a mod triggers an event that would set an entity to be dead with no reference to damage, should this entity be spared?*/
public boolean doNotVaporize ();
/**Does this entity attack non-player entities on sight?*/
public boolean isPredator ();
/**Does this entity attack the player on sight?*/
public boolean isHostile ();
/**Is this entity incapable of combat?*/
public boolean isPeaceful ();
/**Is this entity viable prey for a predator?*/
public boolean isPrey ();
/**Will this entity attack, but only when provoked?*/
public boolean isNeutral ();
/**Is this entity incapable of taking damage, and thus pointless to attack?*/
public boolean isUnkillable ();
/**Should this entity be considered a threat to par1entity?*/
public boolean isThreatTo (Entity par1entity);
/**Should this entity be considered a friend of par1entity?*/
public boolean isFriendOf (Entity par1entity);
/**Is this entity what people would generally consider to be an NPC?*/
public boolean isNPC ();
/**Is this a pet? 0 if not, 1 if it can be but isn't currently, 2 if it is.*/
public int isPet ();
/**Who is this pet's owner?*/
public Entity getPetOwner ();
/**What is the name of this individual entity?*/
public String getName ();
/**What is this entity currently targeting with intent to kill? Used to differentiate between the attack method monsters use and the attack method used for breeding and following*/
public Entity getAttackingTarget ();
/**What is the size of this entity? Multiply its two dimensions (X and Z are considered the same) in terms of blocks and put in the result ( a chicken would be .3 * .7, which is roughly .2)*/
public float getSize ();
/**What should this entity be referred to as? (Dog, Cat, Human, Enderman, etc.)*/
public String getSpecies ();
/**What is this entity's gender? 1 for male, 2 for female, 0 for neither*/
public int getGender ();
/**This is for mod-specific features. A mod can search for a response to a custom string, and you can add in whether or not they'll respond to it here, and what the response will be.*/
public String customStringAndResponse (String s);
/**Have this return the string you store your simplyID in. Use the function SimplyID.getNextSimplyID(this) to assign a simplyID to your entities that implement Sparrow.*/
public String getSimplyID ();
}

View File

@ -35,7 +35,10 @@ public class XinStick extends Item
//if (!world.isRemote)
//MinecraftServer.getServer().getConfigurationManager().transferPlayerToDimension((EntityPlayerMP) player, -7);
//player.travelToDimension(-7);
spawnEntity(player.posX, player.posY+1, player.posZ, new Automaton(world), world, player);
Automaton entity = new Automaton(world);
entity.setOwner(player);
//entity.username = "NekoGloop";
spawnEntity(player.posX, player.posY+1, player.posZ, entity, world, player);
//healPlayer(player);
//removeChunk(world, player.posX, player.posZ);
return stack;