mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-27 23:45:48 +00:00
Reorganize folders for modules
This commit is contained in:
1 parent
2c14f315de
commit
e2f0558b6f
370 files changed
+4274
-4788
No files matched your search
@@ -0,0 +1,93 @@
|
||||
package tconstruct.mechworks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
|
||||
import tconstruct.armor.TinkerArmor;
|
||||
import tconstruct.blocks.SlabBase;
|
||||
import tconstruct.blocks.logic.DryingRackLogic;
|
||||
import tconstruct.blocks.slime.SlimeFluid;
|
||||
import tconstruct.blocks.slime.SlimeGel;
|
||||
import tconstruct.blocks.slime.SlimeGrass;
|
||||
import tconstruct.blocks.slime.SlimeLeaves;
|
||||
import tconstruct.blocks.slime.SlimeSapling;
|
||||
import tconstruct.blocks.slime.SlimeTallGrass;
|
||||
import tconstruct.blocks.traps.BarricadeBlock;
|
||||
import tconstruct.blocks.traps.Punji;
|
||||
import tconstruct.client.StepSoundSlime;
|
||||
import tconstruct.common.itemblocks.MetadataItemBlock;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.mechworks.blocks.BlockLandmine;
|
||||
import tconstruct.mechworks.itemblocks.ItemBlockLandmine;
|
||||
import tconstruct.mechworks.logic.TileEntityLandmine;
|
||||
import tconstruct.smeltery.TinkerSmeltery;
|
||||
import tconstruct.smeltery.blocks.MetalOre;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.tools.blocks.MultiBrick;
|
||||
import tconstruct.tools.blocks.MultiBrickFancy;
|
||||
import tconstruct.tools.itemblocks.MultiBrickFancyItem;
|
||||
import tconstruct.tools.itemblocks.MultiBrickItem;
|
||||
import tconstruct.world.TinkerWorld;
|
||||
import tconstruct.world.blocks.ConveyorBase;
|
||||
import tconstruct.world.blocks.GravelOre;
|
||||
import tconstruct.world.blocks.MeatBlock;
|
||||
import tconstruct.world.blocks.OreberryBush;
|
||||
import tconstruct.world.blocks.OreberryBushEssence;
|
||||
import tconstruct.world.blocks.SlimeExplosive;
|
||||
import tconstruct.world.blocks.SlimePad;
|
||||
import tconstruct.world.blocks.StoneLadder;
|
||||
import tconstruct.world.blocks.StoneTorch;
|
||||
import tconstruct.world.blocks.WoodRail;
|
||||
import tconstruct.world.itemblocks.BarricadeItem;
|
||||
import tconstruct.world.itemblocks.GravelOreItem;
|
||||
import tconstruct.world.itemblocks.HamboneItemBlock;
|
||||
import tconstruct.world.itemblocks.MetalOreItemBlock;
|
||||
import tconstruct.world.itemblocks.OreberryBushItem;
|
||||
import tconstruct.world.itemblocks.OreberryBushSecondItem;
|
||||
import tconstruct.world.itemblocks.SlimeGelItemBlock;
|
||||
import tconstruct.world.itemblocks.SlimeGrassItemBlock;
|
||||
import tconstruct.world.itemblocks.SlimeLeavesItemBlock;
|
||||
import tconstruct.world.itemblocks.SlimeSaplingItemBlock;
|
||||
import tconstruct.world.itemblocks.SlimeTallGrassItem;
|
||||
import tconstruct.world.itemblocks.WoolSlab1Item;
|
||||
import tconstruct.world.itemblocks.WoolSlab2Item;
|
||||
import tconstruct.world.items.OreBerries;
|
||||
import tconstruct.world.items.StrangeFood;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
@Mod(modid = "TinkerMechworks", name = "TinkerMechworks", version = "${tinkermechworksversion}")
|
||||
public class TinkerMechworks
|
||||
{
|
||||
|
||||
@EventHandler
|
||||
public void preInit (FMLPreInitializationEvent event)
|
||||
{
|
||||
// Traps
|
||||
GameRegistry.registerBlock(TinkerWorld.landmine, ItemBlockLandmine.class, "Redstone.Landmine");
|
||||
GameRegistry.registerTileEntity(TileEntityLandmine.class, "Landmine");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init (FMLInitializationEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void postInit (FMLPostInitializationEvent evt)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,689 @@
|
||||
package tconstruct.mechworks.blocks;
|
||||
|
||||
import static net.minecraftforge.common.util.ForgeDirection.DOWN;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.EAST;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.NORTH;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.SOUTH;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.UP;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.WEST;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import mantle.blocks.BlockUtils;
|
||||
import mantle.world.WorldHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.BlockPressurePlate.Sensitivity;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.EntityTNTPrimed;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.common.TProxyCommon;
|
||||
import tconstruct.mechworks.landmine.Helper;
|
||||
import tconstruct.mechworks.logic.LandmineExplodeLogic;
|
||||
import tconstruct.mechworks.logic.TileEntityLandmine;
|
||||
import tconstruct.world.model.RenderLandmine;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*/
|
||||
public class BlockLandmine extends BlockContainer
|
||||
{
|
||||
|
||||
// Should explode when broken instead of dropping items(may not actually
|
||||
// work
|
||||
boolean explodeOnBroken = false;
|
||||
|
||||
public BlockLandmine()
|
||||
{
|
||||
super(Material.tnt);
|
||||
this.setTickRandomly(true);
|
||||
this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 1.0F - 0.0625F, 0.0625F, 1.0F - 0.0625F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
if (world.getBlock(x, y, z) == (Block) this && world.getTileEntity(x, y, z) instanceof TileEntityLandmine)
|
||||
{
|
||||
TileEntityLandmine te = (TileEntityLandmine) world.getTileEntity(x, y, z);
|
||||
|
||||
if (te != null)
|
||||
{
|
||||
if (te.getStackInSlot(3) != null && te.getStackInSlot(3).getItem() instanceof ItemBlock)
|
||||
{
|
||||
return (BlockUtils.getBlockFromItem(te.getStackInSlot(3).getItem())).getLightValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.getLightValue(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int tickRate (World par1World)
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
TileEntityLandmine te = (TileEntityLandmine) par1IBlockAccess.getTileEntity(par2, par3, par4);
|
||||
|
||||
ItemStack camo = te.getStackInSlot(3);
|
||||
if (camo != null)
|
||||
{
|
||||
return BlockUtils.getBlockFromItem(camo.getItem()).getIcon(par5, camo.getItemDamage());
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.getIcon(par5, par1IBlockAccess.getBlockMetadata(par2, par3, par4));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
return RenderLandmine.model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockClicked (World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer)
|
||||
{
|
||||
super.onBlockClicked(par1World, par2, par3, par4, par5EntityPlayer);
|
||||
|
||||
if (this.explodeOnBroken)
|
||||
{
|
||||
checkExplosion(par1World, par2, par3, par4, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons (IIconRegister par1IconRegister)
|
||||
{
|
||||
this.blockIcon = par1IconRegister.registerIcon("tinker:Landmine");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated (World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
|
||||
{
|
||||
par5EntityPlayer.openGui(TConstruct.instance, TProxyCommon.landmineID, par1World, par2, par3, par4);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock (World par1World, int par2, int par3, int par4, Block par5Block, int par6)
|
||||
{
|
||||
TileEntityLandmine tileentity = (TileEntityLandmine) par1World.getTileEntity(par2, par3, par4);
|
||||
|
||||
int metadata = par1World.getBlockMetadata(par2, par3, par4);
|
||||
|
||||
if (tileentity != null && (!explodeOnBroken || !hasItems(par1World, par2, par3, par4)) && par6 != 193 && !tileentity.isExploding)
|
||||
{
|
||||
if (this != null)
|
||||
{
|
||||
ItemStack is = new ItemStack(this, 1, damageDropped(tileentity.triggerType));
|
||||
if (tileentity.hasCustomInventoryName())
|
||||
{
|
||||
is.setStackDisplayName(tileentity.getInventoryName());
|
||||
}
|
||||
dropBlockAsItem(par1World, par2, par3, par4, new ItemStack(this, 1, damageDropped(tileentity.triggerType)));
|
||||
}
|
||||
|
||||
for (int j1 = 0; j1 < tileentity.getSizeInventory(); ++j1)
|
||||
{
|
||||
ItemStack itemstack = tileentity.getStackInSlot(j1);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
while (itemstack.stackSize > 0)
|
||||
{
|
||||
|
||||
int ss = itemstack.stackSize;
|
||||
itemstack.stackSize -= ss;
|
||||
EntityItem entityitem = new EntityItem(par1World, (double) ((float) par2), (double) ((float) par3), (double) ((float) par4), new ItemStack(itemstack.getItem(), ss,
|
||||
itemstack.getItemDamage()));
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
{
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (double) (f3);
|
||||
entityitem.motionY = (double) (f3 + 0.2F);
|
||||
entityitem.motionZ = (double) (f3);
|
||||
par1World.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WorldHelper.setBlockToAir(par1World, par2, par3, par4);
|
||||
}
|
||||
else if (explodeOnBroken)
|
||||
{
|
||||
checkExplosion(par1World, par2, par3, par4, true);
|
||||
}
|
||||
|
||||
super.breakBlock(par1World, par2, par3, par4, par5Block, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks (Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, 0));
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
par3List.add(new ItemStack(par1, 1, 2));
|
||||
par3List.add(new ItemStack(par1, 1, 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBlocksMovement (IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockOnSide (World par1World, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(par5);
|
||||
return (dir == DOWN && par1World.isSideSolid(par2, par3 + 1, par4, DOWN)) || (dir == UP && par1World.isSideSolid(par2, par3 - 1, par4, UP))
|
||||
|| (dir == NORTH && par1World.isSideSolid(par2, par3, par4 + 1, NORTH)) || (dir == SOUTH && par1World.isSideSolid(par2, par3, par4 - 1, SOUTH))
|
||||
|| (dir == WEST && par1World.isSideSolid(par2 + 1, par3, par4, WEST)) || (dir == EAST && par1World.isSideSolid(par2 - 1, par3, par4, EAST));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt (World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
return par1World.isSideSolid(par2 - 1, par3, par4, EAST) || par1World.isSideSolid(par2 + 1, par3, par4, WEST) || par1World.isSideSolid(par2, par3, par4 - 1, SOUTH)
|
||||
|| par1World.isSideSolid(par2, par3, par4 + 1, NORTH) || par1World.isSideSolid(par2, par3 - 1, par4, UP) || par1World.isSideSolid(par2, par3 + 1, par4, DOWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onBlockPlaced (World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9)
|
||||
{
|
||||
int j1 = par9 & 8;
|
||||
int k1 = par9 & 7;
|
||||
byte b0 = -1;
|
||||
|
||||
if (par5 == 0 && par1World.isSideSolid(par2, par3 + 1, par4, DOWN))
|
||||
{
|
||||
b0 = 0;
|
||||
}
|
||||
|
||||
if (par5 == 1 && par1World.isSideSolid(par2, par3 - 1, par4, UP))
|
||||
{
|
||||
b0 = 5;
|
||||
}
|
||||
|
||||
if (par5 == 2 && par1World.isSideSolid(par2, par3, par4 + 1, NORTH))
|
||||
{
|
||||
b0 = 4;
|
||||
}
|
||||
|
||||
if (par5 == 3 && par1World.isSideSolid(par2, par3, par4 - 1, SOUTH))
|
||||
{
|
||||
b0 = 3;
|
||||
}
|
||||
|
||||
if (par5 == 4 && par1World.isSideSolid(par2 + 1, par3, par4, WEST))
|
||||
{
|
||||
b0 = 2;
|
||||
}
|
||||
|
||||
if (par5 == 5 && par1World.isSideSolid(par2 - 1, par3, par4, EAST))
|
||||
{
|
||||
b0 = 1;
|
||||
}
|
||||
|
||||
return b0 + j1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy (World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack)
|
||||
{
|
||||
int l = par1World.getBlockMetadata(par2, par3, par4);
|
||||
int i1 = l & 7;
|
||||
int j1 = l & 8;
|
||||
|
||||
if (i1 == invertMetadata(1))
|
||||
{
|
||||
if ((MathHelper.floor_double((double) (par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 1) == 0)
|
||||
{
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, 5 | j1, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, 6 | j1, 2);
|
||||
}
|
||||
}
|
||||
else if (i1 == invertMetadata(0))
|
||||
{
|
||||
if ((MathHelper.floor_double((double) (par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 1) == 0)
|
||||
{
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, 7 | j1, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, 0 | j1, 2);
|
||||
}
|
||||
}
|
||||
|
||||
if (par6ItemStack.hasDisplayName())
|
||||
{
|
||||
((TileEntityLandmine) par1World.getTileEntity(par2, par3, par4)).setGuiDisplayName(par6ItemStack.getDisplayName());
|
||||
}
|
||||
}
|
||||
|
||||
public static int invertMetadata (int par0)
|
||||
{
|
||||
switch (par0)
|
||||
{
|
||||
case 0:
|
||||
return 0;
|
||||
case 1:
|
||||
return 5;
|
||||
case 2:
|
||||
return 4;
|
||||
case 3:
|
||||
return 3;
|
||||
case 4:
|
||||
return 2;
|
||||
case 5:
|
||||
return 1;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange (World par1World, int par2, int par3, int par4, Block par5Block)
|
||||
{
|
||||
checkPlacement(par1World, par2, par3, par4, par5Block);
|
||||
|
||||
checkExplosion(par1World, par2, par3, par4, false);
|
||||
}
|
||||
|
||||
public void checkPlacement (World par1World, int par2, int par3, int par4, Block par5Block)
|
||||
{
|
||||
if (this.checkIfAttachedToBlock(par1World, par2, par3, par4))
|
||||
{
|
||||
int i1 = par1World.getBlockMetadata(par2, par3, par4) & 7;
|
||||
boolean flag = false;
|
||||
|
||||
if (!par1World.isSideSolid(par2 - 1, par3, par4, EAST) && i1 == 1)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!par1World.isSideSolid(par2 + 1, par3, par4, WEST) && i1 == 2)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!par1World.isSideSolid(par2, par3, par4 - 1, SOUTH) && i1 == 3)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!par1World.isSideSolid(par2, par3, par4 + 1, NORTH) && i1 == 4)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!par1World.isSideSolid(par2, par3 - 1, par4, UP) && i1 == 5)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!par1World.isSideSolid(par2, par3 - 1, par4, UP) && i1 == 6)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!par1World.isSideSolid(par2, par3 + 1, par4, DOWN) && i1 == 0)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!par1World.isSideSolid(par2, par3 + 1, par4, DOWN) && i1 == 7)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
|
||||
WorldHelper.setBlockToAir(par1World, par2, par3, par4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkIfAttachedToBlock (World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
if (!this.canPlaceBlockAt(par1World, par2, par3, par4))
|
||||
{
|
||||
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
|
||||
WorldHelper.setBlockToAir(par1World, par2, par3, par4);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick (World par1World, int par2, int par3, int par4, Random par5Random)
|
||||
{
|
||||
if (!par1World.isRemote)
|
||||
{
|
||||
checkExplosion(par1World, par2, par3, par4, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock (World par1World, int par2, int par3, int par4, Entity par5Entity)
|
||||
{
|
||||
if (!par1World.isRemote)
|
||||
{
|
||||
this.checkExplosion(par1World, par2, par3, par4, false);
|
||||
}
|
||||
}
|
||||
|
||||
public void checkExplosion (World par1World, int par2, int par3, int par4, boolean skipCheck)
|
||||
{
|
||||
if (skipCheck || getMineState(par1World, par2, par3, par4) > 0)
|
||||
{
|
||||
if (hasItems(par1World, par2, par3, par4))
|
||||
{
|
||||
TileEntityLandmine te = (TileEntityLandmine) par1World.getTileEntity(par2, par3, par4);
|
||||
if (te.soundcountything <= 0)
|
||||
{
|
||||
par1World.playSoundEffect((double) par2 + 0.5D, (double) par3 + 0.1D, (double) par4 + 0.5D, "random.click", 0.3F, 0.6F);
|
||||
te.setSoundPlayed();
|
||||
}
|
||||
new LandmineExplodeLogic(par1World, par2, par3, par4, getMineTriggerer(par1World, par2, par3, par4)).explode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool (World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean hasItems (World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
TileEntityLandmine te = (TileEntityLandmine) par1World.getTileEntity(par2, par3, par4);
|
||||
if (te != null && te.getStackInSlot(0) != null || te.getStackInSlot(1) != null || te.getStackInSlot(2) != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected int getMineState (World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
TileEntityLandmine te = (TileEntityLandmine) par1World.getTileEntity(par2, par3, par4);
|
||||
|
||||
Sensitivity triggerType;
|
||||
|
||||
// Change to return 1 if you want the landmine to blow up when the block
|
||||
// holding it is broken
|
||||
if (te == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
switch (te.triggerType)
|
||||
{
|
||||
case 0:
|
||||
triggerType = Sensitivity.everything;
|
||||
break;
|
||||
case 1:
|
||||
triggerType = Sensitivity.mobs;
|
||||
break;
|
||||
case 2:
|
||||
triggerType = Sensitivity.players;
|
||||
break;
|
||||
default:
|
||||
triggerType = null;
|
||||
break;
|
||||
}
|
||||
|
||||
if (triggerType != null)
|
||||
{
|
||||
List list = null;
|
||||
|
||||
if (triggerType == Sensitivity.everything)
|
||||
{
|
||||
list = par1World.getEntitiesWithinAABBExcludingEntity((Entity) null, getSensitiveAABB(par1World, par2, par3, par4));
|
||||
}
|
||||
|
||||
if (triggerType == Sensitivity.mobs)
|
||||
{
|
||||
list = par1World.getEntitiesWithinAABB(EntityLivingBase.class, getSensitiveAABB(par1World, par2, par3, par4));
|
||||
}
|
||||
|
||||
if (triggerType == Sensitivity.players)
|
||||
{
|
||||
list = par1World.getEntitiesWithinAABB(EntityPlayer.class, this.getSensitiveAABB(par1World, par2, par3, par4));
|
||||
}
|
||||
|
||||
if (list != null && !list.isEmpty())
|
||||
{
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
if (!entity.doesEntityNotTriggerPressurePlate())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return par1World.isBlockIndirectlyGettingPowered(par2, par3, par4) ? 1 : 0;
|
||||
}
|
||||
|
||||
protected AxisAlignedBB getSensitiveAABB (World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
float f = 0.125F;
|
||||
// return AxisAlignedBB.getAABBPool().getAABB((double)((float)par1 + f),
|
||||
// (double)par2, (double)((float)par3 + f), (double)((float)(par1 + 1) -
|
||||
// f), (double)par2 + 0.25D, (double)((float)(par3 + 1) - f));
|
||||
|
||||
int l = par1World.getBlockMetadata(par2, par3, par4);
|
||||
int i1 = l & 7;
|
||||
boolean flag = (l & 8) > 0;
|
||||
|
||||
float minX = par2 + f, minY = par3, minZ = par4 + f, maxX = par2 + 1 - f, maxY = par3 + 0.25F, maxZ = par4 + 1 - f;
|
||||
|
||||
ForgeDirection dir = Helper.convertMetaToForgeOrientation(i1);
|
||||
switch (dir)
|
||||
{
|
||||
case DOWN:
|
||||
break;
|
||||
case UP:
|
||||
minY = par3 + 0.75F;
|
||||
maxY = par3 + 1;
|
||||
break;
|
||||
default:
|
||||
minX = par2;
|
||||
minY = par3;
|
||||
minZ = par4;
|
||||
maxX = par2 + 1;
|
||||
maxY = par3 + 1;
|
||||
maxZ = par4 + 1;
|
||||
}
|
||||
return AxisAlignedBB.getAABBPool().getAABB(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
}
|
||||
|
||||
public Entity getMineTriggerer (World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
|
||||
TileEntityLandmine te = (TileEntityLandmine) par1World.getTileEntity(par2, par3, par4);
|
||||
|
||||
Sensitivity triggerType;
|
||||
|
||||
// Change to return 1 if you want the landmine to blow up when the
|
||||
// block holding it is broken
|
||||
if (te == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
switch (te.triggerType)
|
||||
{
|
||||
case 0:
|
||||
triggerType = Sensitivity.everything;
|
||||
break;
|
||||
case 1:
|
||||
triggerType = Sensitivity.mobs;
|
||||
break;
|
||||
case 2:
|
||||
triggerType = Sensitivity.players;
|
||||
break;
|
||||
default:
|
||||
triggerType = null;
|
||||
break;
|
||||
}
|
||||
|
||||
if (triggerType != null)
|
||||
{
|
||||
List list = null;
|
||||
|
||||
if (triggerType == Sensitivity.everything)
|
||||
{
|
||||
list = par1World.getEntitiesWithinAABBExcludingEntity((Entity) null, AxisAlignedBB.getAABBPool().getAABB(par2 + 0D, par3 + 0D, par4 + 0D, par2 + 1D, par3 + 1D, par4 + 1D));
|
||||
}
|
||||
|
||||
if (triggerType == Sensitivity.mobs)
|
||||
{
|
||||
list = par1World.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getAABBPool().getAABB(par2 + 0D, par3 + 0D, par4 + 0D, par2 + 1D, par3 + 1D, par4 + 1D));
|
||||
}
|
||||
|
||||
if (triggerType == Sensitivity.players)
|
||||
{
|
||||
list = par1World.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getAABBPool().getAABB(par2 + 0D, par3 + 0D, par4 + 0D, par2 + 1D, par3 + 1D, par4 + 1D));
|
||||
}
|
||||
|
||||
if (list != null && !list.isEmpty())
|
||||
{
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
if (!entity.doesEntityNotTriggerPressurePlate())
|
||||
{
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new EntityTNTPrimed(par1World, par2, par3, par4, (EntityLivingBase) null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDropFromExplosion (Explosion par1Explosion)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState (IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
|
||||
{
|
||||
int l = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
|
||||
int i1 = l & 7;
|
||||
boolean flag = (l & 8) > 0;
|
||||
|
||||
ForgeDirection dir = Helper.convertMetaToForgeOrientation(i1);
|
||||
switch (dir)
|
||||
{
|
||||
case DOWN:
|
||||
this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 1.0F - 0.0625F, 0.0625F, 1.0F - 0.0625F);
|
||||
break;
|
||||
case UP:
|
||||
this.setBlockBounds(0.0625F, 1.0F - 0.0625F, 0.0625F, 1.0F - 0.0625F, 1.0F, 1.0F - 0.0625F);
|
||||
break;
|
||||
case NORTH:
|
||||
this.setBlockBounds(0.0625F, 0.0625F, 0.0F, 1.0F - 0.0625F, 1.0F - 0.0625F, 0.0625F);
|
||||
break;
|
||||
case SOUTH:
|
||||
this.setBlockBounds(0.0625F, 0.0625F, 1.0F - 0.0625F, 1.0F - 0.0625F, 1.0F - 0.0625F, 1.0F);
|
||||
break;
|
||||
case EAST:
|
||||
this.setBlockBounds(1.0F - 0.0625F, 0.0625F, 0.0625F, 1.0F, 1.0F - 0.0625F, 1.0F - 0.0625F);
|
||||
break;
|
||||
case WEST:
|
||||
this.setBlockBounds(0.0F, 0.0625F, 0.0625F, 0.0625F, 1.0F - 0.0625F, 1.0F - 0.0625F);
|
||||
break;
|
||||
default:
|
||||
this.setBlockBounds(0, 0, 0, 1, 1, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped (int par1)
|
||||
{
|
||||
return par1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped (int par1, Random par2Random, int par3)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity (World world, int meta)
|
||||
{
|
||||
return new TileEntityLandmine();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
package tconstruct.mechworks.entity.item;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.util.DamageSourceFireworkExplode;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class EntityLandmineFirework extends Entity
|
||||
{
|
||||
/** The age of the firework in ticks. */
|
||||
private int fireworkAge;
|
||||
|
||||
/**
|
||||
* The lifetime of the firework in ticks. When the age reaches the lifetime
|
||||
* the firework explodes.
|
||||
*/
|
||||
private int lifetime;
|
||||
|
||||
private Entity rider;
|
||||
|
||||
private int moveDirection = 0;
|
||||
|
||||
public EntityLandmineFirework(World par1World)
|
||||
{
|
||||
super(par1World);
|
||||
this.setSize(0.25F, 0.25F);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit ()
|
||||
{
|
||||
this.dataWatcher.addObjectByDataType(8, 5);
|
||||
}
|
||||
|
||||
public EntityLandmineFirework setRider (Entity entity)
|
||||
{
|
||||
rider = entity;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
/**
|
||||
* Checks if the entity is in range to render by using the past in distance and comparing it to its average edge
|
||||
* length * 64 * renderDistanceWeight Args: distance
|
||||
*/
|
||||
public boolean isInRangeToRenderDist (double par1)
|
||||
{
|
||||
return par1 < 4096.0D;
|
||||
}
|
||||
|
||||
public EntityLandmineFirework(World par1World, double par2, double par4, double par6, ItemStack par8ItemStack, int moveDirection)
|
||||
{
|
||||
super(par1World);
|
||||
this.fireworkAge = 0;
|
||||
this.setSize(0.25F, 0.25F);
|
||||
this.setPosition(par2, par4, par6);
|
||||
this.yOffset = 0.0F;
|
||||
int i = 1;
|
||||
|
||||
if (par8ItemStack != null && par8ItemStack.hasTagCompound())
|
||||
{
|
||||
this.dataWatcher.updateObject(8, par8ItemStack);
|
||||
NBTTagCompound nbttagcompound = par8ItemStack.getTagCompound();
|
||||
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Fireworks");
|
||||
|
||||
if (nbttagcompound1 != null)
|
||||
{
|
||||
i += nbttagcompound1.getByte("Flight");
|
||||
}
|
||||
}
|
||||
|
||||
this.motionX = this.rand.nextGaussian() * 0.001D;
|
||||
this.motionZ = this.rand.nextGaussian() * 0.001D;
|
||||
this.motionY = 0.05D;
|
||||
this.lifetime = 10 * i + this.rand.nextInt(6) + this.rand.nextInt(7);
|
||||
this.moveDirection = moveDirection;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
/**
|
||||
* Sets the velocity to the args. Args: x, y, z
|
||||
*/
|
||||
public void setVelocity (double par1, double par3, double par5)
|
||||
{
|
||||
this.motionX = par1;
|
||||
this.motionY = par3;
|
||||
this.motionZ = par5;
|
||||
|
||||
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
|
||||
{
|
||||
float f = MathHelper.sqrt_double(par1 * par1 + par5 * par5);
|
||||
this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(par3, (double) f) * 180.0D / Math.PI);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
@Override
|
||||
public void onUpdate ()
|
||||
{
|
||||
if (this.riddenByEntity == null && this.rider != null)
|
||||
{
|
||||
this.rider.mountEntity(this);
|
||||
}
|
||||
|
||||
this.lastTickPosX = this.posX;
|
||||
this.lastTickPosY = this.posY;
|
||||
this.lastTickPosZ = this.posZ;
|
||||
super.onUpdate();
|
||||
this.motionX *= 1.15D;
|
||||
this.motionZ *= 1.15D;
|
||||
this.motionY += 0.04D;
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
|
||||
|
||||
for (this.rotationPitch = (float) (Math.atan2(this.motionY, (double) f) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
while (this.rotationPitch - this.prevRotationPitch >= 180.0F)
|
||||
{
|
||||
this.prevRotationPitch += 360.0F;
|
||||
}
|
||||
|
||||
while (this.rotationYaw - this.prevRotationYaw < -180.0F)
|
||||
{
|
||||
this.prevRotationYaw -= 360.0F;
|
||||
}
|
||||
|
||||
while (this.rotationYaw - this.prevRotationYaw >= 180.0F)
|
||||
{
|
||||
this.prevRotationYaw += 360.0F;
|
||||
}
|
||||
|
||||
this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
|
||||
this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
|
||||
|
||||
if (this.fireworkAge == 0)
|
||||
{
|
||||
this.worldObj.playSoundAtEntity(this, "fireworks.launch", 3.0F, 1.0F);
|
||||
}
|
||||
|
||||
++this.fireworkAge;
|
||||
|
||||
if (this.worldObj.isRemote && this.fireworkAge % 2 < 2)
|
||||
{
|
||||
this.worldObj.spawnParticle("fireworksSpark", this.posX, this.posY - 0.3D, this.posZ, this.rand.nextGaussian() * 0.05D, -this.motionY * 0.5D, this.rand.nextGaussian() * 0.05D);
|
||||
}
|
||||
|
||||
if (!this.worldObj.isRemote && this.fireworkAge > this.lifetime)
|
||||
{
|
||||
this.worldObj.setEntityState(this, (byte) 17);
|
||||
this.rider.attackEntityFrom(new DamageSourceFireworkExplode("FireworkExplode"), 200F);
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void handleHealthUpdate (byte par1)
|
||||
{
|
||||
if (par1 == 17 && this.worldObj.isRemote)
|
||||
{
|
||||
ItemStack itemstack = this.dataWatcher.getWatchableObjectItemStack(8);
|
||||
NBTTagCompound nbttagcompound = null;
|
||||
|
||||
if (itemstack != null && itemstack.hasTagCompound())
|
||||
{
|
||||
nbttagcompound = itemstack.getTagCompound().getCompoundTag("Fireworks");
|
||||
}
|
||||
|
||||
this.worldObj.makeFireworks(this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ, nbttagcompound);
|
||||
}
|
||||
|
||||
super.handleHealthUpdate(par1);
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to write subclass entity data to NBT.
|
||||
*/
|
||||
@Override
|
||||
public void writeEntityToNBT (NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
par1NBTTagCompound.setInteger("Life", this.fireworkAge);
|
||||
par1NBTTagCompound.setInteger("LifeTime", this.lifetime);
|
||||
ItemStack itemstack = this.dataWatcher.getWatchableObjectItemStack(8);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
itemstack.writeToNBT(nbttagcompound1);
|
||||
par1NBTTagCompound.setTag("FireworksItem", nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to read subclass entity data from NBT.
|
||||
*/
|
||||
@Override
|
||||
public void readEntityFromNBT (NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
this.fireworkAge = par1NBTTagCompound.getInteger("Life");
|
||||
this.lifetime = par1NBTTagCompound.getInteger("LifeTime");
|
||||
NBTTagCompound nbttagcompound1 = par1NBTTagCompound.getCompoundTag("FireworksItem");
|
||||
|
||||
if (nbttagcompound1 != null)
|
||||
{
|
||||
ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
this.dataWatcher.updateObject(8, itemstack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getShadowSize ()
|
||||
{
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets how bright this entity is.
|
||||
*/
|
||||
@Override
|
||||
public float getBrightness (float par1)
|
||||
{
|
||||
return super.getBrightness(par1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBrightnessForRender (float par1)
|
||||
{
|
||||
return super.getBrightnessForRender(par1);
|
||||
}
|
||||
|
||||
/**
|
||||
* If returns false, the item will not inflict any damage against entities.
|
||||
*/
|
||||
@Override
|
||||
public boolean canAttackWithItem ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
package tconstruct.mechworks.entity.item;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.util.MiningExplosion;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ExplosivePrimed extends Entity
|
||||
{
|
||||
/** How long the fuse is */
|
||||
public Block block;
|
||||
public int metadata;
|
||||
public int fuse;
|
||||
private EntityLivingBase tntPlacedBy;
|
||||
|
||||
public ExplosivePrimed(World par1World)
|
||||
{
|
||||
super(par1World);
|
||||
this.preventEntitySpawning = true;
|
||||
this.setSize(0.98F, 0.98F);
|
||||
this.yOffset = this.height / 2.0F;
|
||||
}
|
||||
|
||||
public ExplosivePrimed(World par1World, double par2, double par4, double par6, EntityLivingBase par8EntityLivingBase)
|
||||
{
|
||||
this(par1World);
|
||||
this.setPosition(par2, par4, par6);
|
||||
float f = (float) (Math.random() * Math.PI * 2.0D);
|
||||
this.motionX = (double) (-((float) Math.sin((double) f)) * 0.02F);
|
||||
this.motionY = 0.20000000298023224D;
|
||||
this.motionZ = (double) (-((float) Math.cos((double) f)) * 0.02F);
|
||||
this.fuse = 80;
|
||||
this.prevPosX = par2;
|
||||
this.prevPosY = par4;
|
||||
this.prevPosZ = par6;
|
||||
this.tntPlacedBy = par8EntityLivingBase;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit ()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* returns if this entity triggers Block.onEntityWalking on the blocks they
|
||||
* walk on. used for spiders and wolves to prevent them from trampling crops
|
||||
*/
|
||||
@Override
|
||||
protected boolean canTriggerWalking ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if other Entities should be prevented from moving through
|
||||
* this Entity.
|
||||
*/
|
||||
@Override
|
||||
public boolean canBeCollidedWith ()
|
||||
{
|
||||
return !this.isDead;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
@Override
|
||||
public void onUpdate ()
|
||||
{
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
this.motionY -= 0.03999999910593033D;
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
this.motionX *= 0.9800000190734863D;
|
||||
this.motionY *= 0.9800000190734863D;
|
||||
this.motionZ *= 0.9800000190734863D;
|
||||
|
||||
if (this.onGround)
|
||||
{
|
||||
this.motionX *= 0.699999988079071D;
|
||||
this.motionZ *= 0.699999988079071D;
|
||||
this.motionY *= -0.5D;
|
||||
}
|
||||
|
||||
if (this.fuse-- <= 0)
|
||||
{
|
||||
this.setDead();
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
this.explode();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
private void explode ()
|
||||
{
|
||||
float f = 5.0F;
|
||||
this.createExplosion(worldObj, this, this.posX, this.posY, this.posZ, f);
|
||||
}
|
||||
|
||||
public void createExplosion (World world, Entity par1Entity, double par2, double par4, double par6, float par8)
|
||||
{
|
||||
Explosion explosion = new MiningExplosion(world, par1Entity, par2, par4, par6, par8);
|
||||
explosion.isFlaming = false;
|
||||
explosion.isSmoking = true;
|
||||
explosion.doExplosionA();
|
||||
explosion.doExplosionB(true);
|
||||
// return explosion;
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to write subclass entity data to NBT.
|
||||
*/
|
||||
@Override
|
||||
protected void writeEntityToNBT (NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
par1NBTTagCompound.setByte("Fuse", (byte) this.fuse);
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to read subclass entity data from NBT.
|
||||
*/
|
||||
@Override
|
||||
protected void readEntityFromNBT (NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
this.fuse = par1NBTTagCompound.getByte("Fuse");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getShadowSize ()
|
||||
{
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns null or the entityliving it was placed or ignited by
|
||||
*/
|
||||
public EntityLivingBase getTntPlacedBy ()
|
||||
{
|
||||
return this.tntPlacedBy;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,515 @@
|
||||
package tconstruct.mechworks.inventory;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.armor.inventory.SlotBehavedOnly;
|
||||
import tconstruct.armor.inventory.SlotOpaqueBlocksOnly;
|
||||
import tconstruct.mechworks.logic.TileEntityLandmine;
|
||||
import tconstruct.world.TinkerWorld;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*/
|
||||
public class ContainerLandmine extends Container
|
||||
{
|
||||
|
||||
public TileEntityLandmine te;
|
||||
public EntityPlayer entityPlayer;
|
||||
private int field_94536_g;
|
||||
private int field_94535_f = -1;
|
||||
private final Set field_94537_h = new HashSet();
|
||||
|
||||
public ContainerLandmine(EntityPlayer player, TileEntityLandmine te)
|
||||
{
|
||||
this.te = te;
|
||||
this.entityPlayer = player;
|
||||
addInventorySlots(te);
|
||||
bindPlayerInventory(player.inventory);
|
||||
}
|
||||
|
||||
public void addInventorySlots (TileEntityLandmine inv)
|
||||
{
|
||||
addSlotToContainer(new SlotBehavedOnly(inv, 0, 35, 53));
|
||||
addSlotToContainer(new SlotBehavedOnly(inv, 1, 80, 53));
|
||||
addSlotToContainer(new SlotBehavedOnly(inv, 2, 125, 53));
|
||||
addSlotToContainer(new SlotOpaqueBlocksOnly(inv, 3, 80, 21));
|
||||
}
|
||||
|
||||
public void bindPlayerInventory (InventoryPlayer inventory)
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
for (int j = 0; j < 9; j++)
|
||||
{
|
||||
addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith (EntityPlayer entityplayer)
|
||||
{
|
||||
Block block = te.getWorldObj().getBlock(te.xCoord, te.yCoord, te.zCoord);
|
||||
if (block != TinkerWorld.landmine)
|
||||
return false;
|
||||
return te.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot (EntityPlayer par1EntityPlayer, int par2)
|
||||
{
|
||||
// This code actually works perfectly, but does not respect the global
|
||||
// TileEntity stack limit, shift clicking ability disabled.
|
||||
/*
|
||||
* ItemStack itemstack = null; Slot slot = (Slot)
|
||||
* this.inventorySlots.get(par2);
|
||||
*
|
||||
* if (slot != null && slot.getHasStack()) { ItemStack itemstack1 =
|
||||
* slot.getStack(); itemstack = itemstack1.copy();
|
||||
*
|
||||
* if (par2 == 2) { if (!this.mergeItemStack(itemstack1, 3, 39, true)) {
|
||||
* return null; }
|
||||
*
|
||||
* slot.onSlotChange(itemstack1, itemstack); } else if (par2 != 1 &&
|
||||
* par2 != 0) { if (!this.mergeItemStack(itemstack1, 0, 1, false)) { if
|
||||
* (!this.mergeItemStack(itemstack1, 1, 2, false)) { if
|
||||
* (!this.mergeItemStack(itemstack1, 30, 39, false)) { return null; }
|
||||
* else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(itemstack1,
|
||||
* 3, 30, false)) { return null; } } } } else if
|
||||
* (!this.mergeItemStack(itemstack1, 3, 39, false)) { return null; }
|
||||
*
|
||||
* if (itemstack1.stackSize == 0) { slot.putStack((ItemStack) null); }
|
||||
* else { slot.onSlotChanged(); }
|
||||
*
|
||||
* if (itemstack1.stackSize == itemstack.stackSize) { return null; }
|
||||
*
|
||||
* slot.onPickupFromSlot(par1EntityPlayer, itemstack1); }
|
||||
*
|
||||
* return itemstack;
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
|
||||
/* Disabled for another(less buggy and sticky) system */
|
||||
@Override
|
||||
public ItemStack slotClick (int par1, int par2, int par3, EntityPlayer par4EntityPlayer)
|
||||
{
|
||||
ItemStack itemstack = null;
|
||||
InventoryPlayer inventoryplayer = par4EntityPlayer.inventory;
|
||||
int l;
|
||||
ItemStack itemstack1;
|
||||
|
||||
if (par3 == 5)
|
||||
{
|
||||
int i1 = this.field_94536_g;
|
||||
this.field_94536_g = func_94532_c(par2);
|
||||
|
||||
if ((i1 != 1 || this.field_94536_g != 2) && i1 != this.field_94536_g)
|
||||
{
|
||||
this.func_94533_d();
|
||||
}
|
||||
else if (inventoryplayer.getItemStack() == null)
|
||||
{
|
||||
this.func_94533_d();
|
||||
}
|
||||
else if (this.field_94536_g == 0)
|
||||
{
|
||||
this.field_94535_f = func_94529_b(par2);
|
||||
|
||||
if (func_94528_d(this.field_94535_f))
|
||||
{
|
||||
this.field_94536_g = 1;
|
||||
this.field_94537_h.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.func_94533_d();
|
||||
}
|
||||
}
|
||||
else if (this.field_94536_g == 1)
|
||||
{
|
||||
Slot slot = (Slot) this.inventorySlots.get(par1);
|
||||
|
||||
if (slot != null && func_94527_a(slot, inventoryplayer.getItemStack(), true) && slot.isItemValid(inventoryplayer.getItemStack())
|
||||
&& inventoryplayer.getItemStack().stackSize > this.field_94537_h.size() && this.canDragIntoSlot(slot))
|
||||
{
|
||||
this.field_94537_h.add(slot);
|
||||
}
|
||||
}
|
||||
else if (this.field_94536_g == 2)
|
||||
{
|
||||
if (!this.field_94537_h.isEmpty())
|
||||
{
|
||||
itemstack1 = inventoryplayer.getItemStack().copy();
|
||||
l = inventoryplayer.getItemStack().stackSize;
|
||||
Iterator iterator = this.field_94537_h.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
Slot slot1 = (Slot) iterator.next();
|
||||
|
||||
if (slot1 != null && func_94527_a(slot1, inventoryplayer.getItemStack(), true) && slot1.isItemValid(inventoryplayer.getItemStack())
|
||||
&& inventoryplayer.getItemStack().stackSize >= this.field_94537_h.size() && this.canDragIntoSlot(slot1))
|
||||
{
|
||||
ItemStack itemstack2 = itemstack1.copy();
|
||||
int j1 = slot1.getHasStack() ? slot1.getStack().stackSize : 0;
|
||||
func_94525_a(this.field_94537_h, this.field_94535_f, itemstack2, j1);
|
||||
|
||||
if (itemstack2.stackSize > itemstack2.getMaxStackSize())
|
||||
{
|
||||
itemstack2.stackSize = itemstack2.getMaxStackSize();
|
||||
}
|
||||
|
||||
if (itemstack2.stackSize > slot1.getSlotStackLimit())
|
||||
{
|
||||
itemstack2.stackSize = slot1.getSlotStackLimit();
|
||||
}
|
||||
|
||||
l -= itemstack2.stackSize - j1;
|
||||
slot1.putStack(itemstack2);
|
||||
}
|
||||
}
|
||||
|
||||
itemstack1.stackSize = l;
|
||||
|
||||
if (itemstack1.stackSize <= 0)
|
||||
{
|
||||
itemstack1 = null;
|
||||
}
|
||||
|
||||
inventoryplayer.setItemStack(itemstack1);
|
||||
}
|
||||
|
||||
this.func_94533_d();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.func_94533_d();
|
||||
}
|
||||
}
|
||||
else if (this.field_94536_g != 0)
|
||||
{
|
||||
this.func_94533_d();
|
||||
}
|
||||
else
|
||||
{
|
||||
Slot slot2;
|
||||
int k1;
|
||||
ItemStack itemstack3;
|
||||
|
||||
if ((par3 == 0 || par3 == 1) && (par2 == 0 || par2 == 1))
|
||||
{
|
||||
if (par1 == -999)
|
||||
{
|
||||
if (inventoryplayer.getItemStack() != null && par1 == -999)
|
||||
{
|
||||
if (par2 == 0)
|
||||
{
|
||||
par4EntityPlayer.dropPlayerItemWithRandomChoice(inventoryplayer.getItemStack(), false);
|
||||
inventoryplayer.setItemStack((ItemStack) null);
|
||||
}
|
||||
|
||||
if (par2 == 1)
|
||||
{
|
||||
par4EntityPlayer.dropPlayerItemWithRandomChoice(inventoryplayer.getItemStack().splitStack(1), false);
|
||||
|
||||
if (inventoryplayer.getItemStack().stackSize == 0)
|
||||
{
|
||||
inventoryplayer.setItemStack((ItemStack) null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (par3 == 1)
|
||||
{
|
||||
if (par1 < 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Object localObject2;
|
||||
|
||||
slot2 = (Slot) this.inventorySlots.get(par1);
|
||||
|
||||
if (slot2 != null && slot2.canTakeStack(par4EntityPlayer))
|
||||
{
|
||||
itemstack1 = this.transferStackInSlot(par4EntityPlayer, par1);
|
||||
|
||||
if (itemstack1 != null)
|
||||
{
|
||||
localObject2 = ((ItemStack) itemstack1).getItem();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if (slot2 != null && slot2.getStack() != null && slot2.getStack().getItem() == localObject2)
|
||||
{
|
||||
this.retrySlotClick(par1, par2, true, par4EntityPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (par1 < 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
slot2 = (Slot) this.inventorySlots.get(par1);
|
||||
|
||||
boolean shouldDoStuff = true;
|
||||
|
||||
if ((!(slot2 instanceof SlotBehavedOnly)))
|
||||
{
|
||||
shouldDoStuff = false;
|
||||
}
|
||||
|
||||
if (slot2 != null)
|
||||
{
|
||||
itemstack1 = slot2.getStack();
|
||||
ItemStack itemstack4 = inventoryplayer.getItemStack();
|
||||
|
||||
if (itemstack1 != null)
|
||||
{
|
||||
itemstack = itemstack1.copy();
|
||||
}
|
||||
|
||||
if (itemstack1 == null)
|
||||
{
|
||||
if (itemstack4 != null && slot2.isItemValid(itemstack4))
|
||||
{
|
||||
k1 = par2 == 0 ? itemstack4.stackSize : 1;
|
||||
|
||||
if (k1 > slot2.getSlotStackLimit())
|
||||
{
|
||||
k1 = slot2.getSlotStackLimit();
|
||||
}
|
||||
|
||||
if (itemstack4.stackSize >= k1)
|
||||
{
|
||||
slot2.putStack(itemstack4.splitStack(k1));
|
||||
}
|
||||
|
||||
if (itemstack4.stackSize == 0)
|
||||
{
|
||||
inventoryplayer.setItemStack((ItemStack) null);
|
||||
}
|
||||
}
|
||||
else if (shouldDoStuff && slot2 instanceof SlotBehavedOnly && itemstack4 != null && slot2.isItemValid(new ItemStack(itemstack4.getItem(), 1, itemstack4.getItemDamage())))
|
||||
{
|
||||
k1 = par2 == 0 ? 1 : 1;
|
||||
|
||||
if (k1 > slot2.getSlotStackLimit())
|
||||
{
|
||||
k1 = slot2.getSlotStackLimit();
|
||||
}
|
||||
|
||||
if (itemstack4.stackSize >= k1)
|
||||
{
|
||||
slot2.putStack(itemstack4.splitStack(k1));
|
||||
}
|
||||
|
||||
if (itemstack4.stackSize == 0)
|
||||
{
|
||||
inventoryplayer.setItemStack((ItemStack) null);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (slot2.canTakeStack(par4EntityPlayer))
|
||||
{
|
||||
if (itemstack4 == null)
|
||||
{
|
||||
k1 = par2 == 0 ? itemstack1.stackSize : (itemstack1.stackSize + 1) / 2;
|
||||
itemstack3 = slot2.decrStackSize(k1);
|
||||
inventoryplayer.setItemStack(itemstack3);
|
||||
|
||||
if (itemstack1.stackSize == 0)
|
||||
{
|
||||
slot2.putStack((ItemStack) null);
|
||||
}
|
||||
|
||||
slot2.onPickupFromSlot(par4EntityPlayer, inventoryplayer.getItemStack());
|
||||
}
|
||||
else if (slot2.isItemValid(itemstack4))
|
||||
{
|
||||
if (ItemStack.areItemStacksEqual(itemstack1, itemstack4))
|
||||
{
|
||||
k1 = par2 == 0 ? itemstack4.stackSize : 1;
|
||||
|
||||
if (k1 > slot2.getSlotStackLimit() - itemstack1.stackSize)
|
||||
{
|
||||
k1 = slot2.getSlotStackLimit() - itemstack1.stackSize;
|
||||
}
|
||||
|
||||
if (k1 > itemstack4.getMaxStackSize() - itemstack1.stackSize)
|
||||
{
|
||||
k1 = itemstack4.getMaxStackSize() - itemstack1.stackSize;
|
||||
}
|
||||
|
||||
itemstack4.splitStack(k1);
|
||||
|
||||
if (itemstack4.stackSize == 0)
|
||||
{
|
||||
inventoryplayer.setItemStack((ItemStack) null);
|
||||
}
|
||||
|
||||
itemstack1.stackSize += k1;
|
||||
}
|
||||
else if (itemstack4.stackSize <= slot2.getSlotStackLimit())
|
||||
{
|
||||
slot2.putStack(itemstack4);
|
||||
inventoryplayer.setItemStack(itemstack1);
|
||||
}
|
||||
}
|
||||
else if (ItemStack.areItemStacksEqual(itemstack1, itemstack4))
|
||||
{
|
||||
k1 = itemstack1.stackSize;
|
||||
|
||||
if (k1 > 0 && k1 + itemstack4.stackSize <= itemstack4.getMaxStackSize())
|
||||
{
|
||||
itemstack4.stackSize += k1;
|
||||
itemstack1 = slot2.decrStackSize(k1);
|
||||
|
||||
if (itemstack1.stackSize == 0)
|
||||
{
|
||||
slot2.putStack((ItemStack) null);
|
||||
}
|
||||
|
||||
slot2.onPickupFromSlot(par4EntityPlayer, inventoryplayer.getItemStack());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
slot2.onSlotChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (par3 == 2 && par2 >= 0 && par2 < 9)
|
||||
{
|
||||
slot2 = (Slot) this.inventorySlots.get(par1);
|
||||
|
||||
if (slot2.canTakeStack(par4EntityPlayer))
|
||||
{
|
||||
itemstack1 = inventoryplayer.getStackInSlot(par2);
|
||||
boolean flag = itemstack1 == null || slot2.inventory == inventoryplayer && slot2.isItemValid(itemstack1);
|
||||
k1 = -1;
|
||||
|
||||
if (!flag)
|
||||
{
|
||||
k1 = inventoryplayer.getFirstEmptyStack();
|
||||
flag |= k1 > -1;
|
||||
}
|
||||
|
||||
if (slot2.getHasStack() && flag)
|
||||
{
|
||||
itemstack3 = slot2.getStack();
|
||||
inventoryplayer.setInventorySlotContents(par2, itemstack3.copy());
|
||||
|
||||
if ((slot2.inventory != inventoryplayer || !slot2.isItemValid(itemstack1)) && itemstack1 != null)
|
||||
{
|
||||
if (k1 > -1)
|
||||
{
|
||||
inventoryplayer.addItemStackToInventory(itemstack1);
|
||||
slot2.decrStackSize(itemstack3.stackSize);
|
||||
slot2.putStack((ItemStack) null);
|
||||
slot2.onPickupFromSlot(par4EntityPlayer, itemstack3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
slot2.decrStackSize(itemstack3.stackSize);
|
||||
slot2.putStack(itemstack1);
|
||||
slot2.onPickupFromSlot(par4EntityPlayer, itemstack3);
|
||||
}
|
||||
}
|
||||
else if (!slot2.getHasStack() && itemstack1 != null && slot2.isItemValid(itemstack1))
|
||||
{
|
||||
inventoryplayer.setInventorySlotContents(par2, (ItemStack) null);
|
||||
slot2.putStack(itemstack1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (par3 == 3 && par4EntityPlayer.capabilities.isCreativeMode && inventoryplayer.getItemStack() == null && par1 >= 0)
|
||||
{
|
||||
slot2 = (Slot) this.inventorySlots.get(par1);
|
||||
|
||||
if (slot2 != null && slot2.getHasStack())
|
||||
{
|
||||
itemstack1 = slot2.getStack().copy();
|
||||
itemstack1.stackSize = itemstack1.getMaxStackSize();
|
||||
inventoryplayer.setItemStack(itemstack1);
|
||||
}
|
||||
}
|
||||
else if (par3 == 4 && inventoryplayer.getItemStack() == null && par1 >= 0)
|
||||
{
|
||||
slot2 = (Slot) this.inventorySlots.get(par1);
|
||||
|
||||
if (slot2 != null && slot2.getHasStack() && slot2.canTakeStack(par4EntityPlayer))
|
||||
{
|
||||
itemstack1 = slot2.decrStackSize(par2 == 0 ? 1 : slot2.getStack().stackSize);
|
||||
slot2.onPickupFromSlot(par4EntityPlayer, itemstack1);
|
||||
par4EntityPlayer.dropPlayerItemWithRandomChoice(itemstack1, false);
|
||||
}
|
||||
}
|
||||
else if (par3 == 6 && par1 >= 0)
|
||||
{
|
||||
slot2 = (Slot) this.inventorySlots.get(par1);
|
||||
itemstack1 = inventoryplayer.getItemStack();
|
||||
|
||||
if (itemstack1 != null && (slot2 == null || !slot2.getHasStack() || !slot2.canTakeStack(par4EntityPlayer)))
|
||||
{
|
||||
l = par2 == 0 ? 0 : this.inventorySlots.size() - 1;
|
||||
k1 = par2 == 0 ? 1 : -1;
|
||||
|
||||
for (int l1 = 0; l1 < 2; ++l1)
|
||||
{
|
||||
for (int i2 = l; i2 >= 0 && i2 < this.inventorySlots.size() && itemstack1.stackSize < itemstack1.getMaxStackSize(); i2 += k1)
|
||||
{
|
||||
Slot slot3 = (Slot) this.inventorySlots.get(i2);
|
||||
|
||||
if (slot3.getHasStack() && func_94527_a(slot3, itemstack1, true) && slot3.canTakeStack(par4EntityPlayer) && this.func_94530_a(itemstack1, slot3)
|
||||
&& (l1 != 0 || slot3.getStack().stackSize != slot3.getStack().getMaxStackSize()))
|
||||
{
|
||||
int j2 = Math.min(itemstack1.getMaxStackSize() - itemstack1.stackSize, slot3.getStack().stackSize);
|
||||
ItemStack itemstack5 = slot3.decrStackSize(j2);
|
||||
itemstack1.stackSize += j2;
|
||||
|
||||
if (itemstack5.stackSize <= 0)
|
||||
{
|
||||
slot3.putStack((ItemStack) null);
|
||||
}
|
||||
|
||||
slot3.onPickupFromSlot(par4EntityPlayer, itemstack5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDragIntoSlot (Slot par1Slot)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package tconstruct.mechworks.itemblocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.mechworks.logic.TileEntityLandmine;
|
||||
import tconstruct.world.TinkerWorld;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*/
|
||||
public class ItemBlockLandmine extends ItemBlock
|
||||
{
|
||||
|
||||
public ItemBlockLandmine(Block b)
|
||||
{
|
||||
super(b);
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation (ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
String interaction = null;
|
||||
|
||||
switch (par1ItemStack.getItemDamage())
|
||||
{
|
||||
case 0:
|
||||
interaction = StatCollector.translateToLocal("landmine1.tooltip");
|
||||
break;
|
||||
case 1:
|
||||
interaction = StatCollector.translateToLocal("landmine2.tooltip");
|
||||
break;
|
||||
case 2:
|
||||
interaction = StatCollector.translateToLocal("landmine3.tooltip");
|
||||
break;
|
||||
default:
|
||||
interaction = StatCollector.translateToLocal("landmine4.tooltip");
|
||||
break;
|
||||
}
|
||||
|
||||
par3List.add(StatCollector.translateToLocal("landmine5.tooltip") + interaction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata (int par1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata)
|
||||
{
|
||||
if (!world.setBlock(x, y, z, TinkerWorld.landmine, metadata, 3))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (world.getBlock(x, y, z) == TinkerWorld.landmine)
|
||||
{
|
||||
TinkerWorld.landmine.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
|
||||
TileEntityLandmine te = (TileEntityLandmine) world.getTileEntity(x, y, z);
|
||||
if (te == null)
|
||||
{
|
||||
te = (TileEntityLandmine) TinkerWorld.landmine.createTileEntity(world, metadata);
|
||||
}
|
||||
|
||||
te.triggerType = stack.getItemDamage();
|
||||
world.setTileEntity(x, y, z, te);
|
||||
|
||||
TinkerWorld.landmine.onPostBlockPlaced(world, x, y, z, metadata);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static Random getRandom ()
|
||||
{
|
||||
return itemRand;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package tconstruct.mechworks.landmine;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*/
|
||||
public class Helper
|
||||
{
|
||||
|
||||
public static ForgeDirection convertMetaToForgeOrientation (int metadata)
|
||||
{
|
||||
switch (metadata)
|
||||
{
|
||||
case 6:
|
||||
return ForgeDirection.DOWN;
|
||||
case 7:
|
||||
return ForgeDirection.UP;
|
||||
case 1:
|
||||
return ForgeDirection.WEST;
|
||||
case 3:
|
||||
return ForgeDirection.NORTH;
|
||||
case 2:
|
||||
return ForgeDirection.EAST;
|
||||
case 4:
|
||||
return ForgeDirection.SOUTH;
|
||||
case 5:
|
||||
return ForgeDirection.DOWN;
|
||||
case 0:
|
||||
return ForgeDirection.UP;
|
||||
}
|
||||
|
||||
return ForgeDirection.UNKNOWN;
|
||||
}
|
||||
|
||||
public static void renderInventoryCube (Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
renderer.renderFaceYPos(block, 0, 0, 0, renderer.getBlockIconFromSideAndMetadata(block, 1, metadata));
|
||||
tessellator.draw();
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, -1.0F, 0.0F);
|
||||
renderer.renderFaceYNeg(block, 0, 0, 0, renderer.getBlockIconFromSideAndMetadata(block, 0, metadata));
|
||||
tessellator.draw();
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
renderer.renderFaceXPos(block, 0, 0, 0, renderer.getBlockIconFromSideAndMetadata(block, 2, metadata));
|
||||
tessellator.draw();
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1.0F, 0.0F, 0.0F);
|
||||
renderer.renderFaceXNeg(block, 0, 0, 0, renderer.getBlockIconFromSideAndMetadata(block, 3, metadata));
|
||||
tessellator.draw();
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
renderer.renderFaceZPos(block, 0, 0, 0, renderer.getBlockIconFromSideAndMetadata(block, 4, metadata));
|
||||
tessellator.draw();
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, -1.0F);
|
||||
renderer.renderFaceZNeg(block, 0, 0, 0, renderer.getBlockIconFromSideAndMetadata(block, 5, metadata));
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package tconstruct.mechworks.landmine;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class LandmineStack
|
||||
{
|
||||
|
||||
public final boolean isBlock;
|
||||
public final Block block;
|
||||
public final Item item;
|
||||
public final int meta;
|
||||
|
||||
public LandmineStack(Block block)
|
||||
{
|
||||
this(block, -314159265);
|
||||
}
|
||||
|
||||
public LandmineStack(Item item)
|
||||
{
|
||||
this(item, -314159265);
|
||||
}
|
||||
|
||||
public LandmineStack(Block block, int meta)
|
||||
{
|
||||
isBlock = true;
|
||||
this.block = block;
|
||||
this.item = null;
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
public LandmineStack(Item item, int meta)
|
||||
{
|
||||
isBlock = false;
|
||||
this.block = null;
|
||||
this.item = item;
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals (Object o)
|
||||
{
|
||||
// Comparing landmine stacks
|
||||
if (o instanceof LandmineStack)
|
||||
{
|
||||
LandmineStack stack = (LandmineStack) o;
|
||||
if (isBlock)
|
||||
{
|
||||
return block == stack.block && (meta == stack.meta || meta == -314159265);
|
||||
}
|
||||
else
|
||||
{
|
||||
return item == stack.item && (meta == stack.meta || meta == -314159265);
|
||||
}
|
||||
// Comparing landmine stacks with item stacks
|
||||
}
|
||||
else if (o instanceof ItemStack)
|
||||
{
|
||||
ItemStack stack = (ItemStack) o;
|
||||
if (isBlock && stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
return block == ((ItemBlock) stack.getItem()).field_150939_a && (meta == stack.getItemDamage() || meta == -314159265);
|
||||
}
|
||||
else if (!isBlock)
|
||||
{
|
||||
return item == stack.getItem() && (meta == stack.getItemDamage() || meta == -314159265);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,249 @@
|
||||
package tconstruct.mechworks.landmine.behavior;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import tconstruct.mechworks.landmine.Helper;
|
||||
import tconstruct.mechworks.landmine.LandmineStack;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*/
|
||||
public abstract class Behavior
|
||||
{
|
||||
|
||||
public static HashMap<LandmineStack, Behavior> behaviorsListItems = new HashMap<LandmineStack, Behavior>();
|
||||
public static HashMap<LandmineStack, Behavior> behaviorsListBlocks = new HashMap<LandmineStack, Behavior>();
|
||||
protected static Behavior defaultBehavior;
|
||||
|
||||
public static Behavior dummy = new BehaviorDummy();
|
||||
public static Behavior utilityMode = new BehaviorPreventExplode();
|
||||
public static Behavior explosive = new BehaviorExplosive();
|
||||
public static Behavior firework = new BehaviorFirework();
|
||||
public static Behavior blockThrow = new BehaviorBlockThrow();
|
||||
public static Behavior potion = new BehaviorPotion();
|
||||
public static Behavior fireball = new BehaviorFirecharge();
|
||||
public static Behavior spawn = new BehaviorSpawnEgg();
|
||||
public static Behavior shoot = new BehaviorProjectile();
|
||||
public static Behavior shear = new BehaviorShears();
|
||||
|
||||
public static void registerBuiltInBehaviors ()
|
||||
{
|
||||
defaultBehavior = new BehaviorDefault();
|
||||
|
||||
addBehavior(new LandmineStack(Items.stick), dummy);
|
||||
addBehavior(new LandmineStack(Items.redstone), utilityMode);
|
||||
addBehavior(new LandmineStack(Blocks.torch), blockThrow);
|
||||
addBehavior(new LandmineStack(Items.gunpowder), explosive);
|
||||
addBehavior(new LandmineStack(Blocks.tnt), explosive);
|
||||
addBehavior(new LandmineStack(Items.fireworks), firework);
|
||||
addBehavior(new LandmineStack(Items.potionitem), potion);
|
||||
addBehavior(new LandmineStack(Items.fire_charge), fireball);
|
||||
addBehavior(new LandmineStack(Items.spawn_egg), spawn);
|
||||
addBehavior(new LandmineStack(Items.arrow), shoot);
|
||||
addBehavior(new LandmineStack(Items.snowball), shoot);
|
||||
addBehavior(new LandmineStack(Items.ender_pearl), shoot);
|
||||
addBehavior(new LandmineStack(Items.shears), shear);
|
||||
|
||||
// Make sure the part below this comment is executed last(to avoid
|
||||
// conflicts)
|
||||
Iterator i1 = Block.blockRegistry.iterator();
|
||||
while (i1.hasNext())
|
||||
{
|
||||
Object ob = i1.next();
|
||||
if (ob != null && ob instanceof Block)
|
||||
{
|
||||
Block b = (Block) ob;
|
||||
if (b.getMaterial().isOpaque() && b.renderAsNormalBlock() && !b.canProvidePower() && !(b instanceof ITileEntityProvider) && !behaviorsListBlocks.containsKey(new ItemStack(b)))
|
||||
{
|
||||
addBehavior(new LandmineStack(b), blockThrow);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Behavior getBehaviorFromStack (ItemStack par1ItemStack)
|
||||
{
|
||||
if (par1ItemStack == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (par1ItemStack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
if (!behaviorsListBlocks.isEmpty())
|
||||
{
|
||||
for (int i = 0; i < behaviorsListBlocks.size(); i++)
|
||||
{
|
||||
LandmineStack st = (LandmineStack) behaviorsListBlocks.keySet().toArray()[i];
|
||||
if (st.equals(par1ItemStack))
|
||||
{
|
||||
return (Behavior) behaviorsListBlocks.values().toArray()[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!behaviorsListItems.isEmpty())
|
||||
{
|
||||
for (int i = 0; i < behaviorsListItems.size(); i++)
|
||||
{
|
||||
LandmineStack st = (LandmineStack) behaviorsListItems.keySet().toArray()[i];
|
||||
if (st.equals(par1ItemStack))
|
||||
{
|
||||
return (Behavior) behaviorsListItems.values().toArray()[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Behavior getDefaulBehavior ()
|
||||
{
|
||||
return defaultBehavior;
|
||||
}
|
||||
|
||||
public static void addBehavior (LandmineStack par1LandmineStack, Behavior par2Behavior)
|
||||
{
|
||||
if (par1LandmineStack.isBlock)
|
||||
{
|
||||
if (!behaviorsListBlocks.containsKey(par1LandmineStack))
|
||||
{
|
||||
behaviorsListBlocks.put(par1LandmineStack, par2Behavior);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!behaviorsListItems.containsKey(par1LandmineStack))
|
||||
{
|
||||
behaviorsListItems.put(par1LandmineStack, par2Behavior);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void executeLogic (World par1World, int par2, int par3, int par4, ItemStack par5ItemStack, Entity triggerer, boolean willBlockBeRemoved);
|
||||
|
||||
public int getStackLimit (ItemStack par1ItemStack)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void getInformation (ItemStack par1ItemStack, List par2List)
|
||||
{
|
||||
}
|
||||
|
||||
// Will return false if the effect does not stack among the slots
|
||||
public boolean effectStacks ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public EnumFacing getFacing (World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
ForgeDirection dir = Helper.convertMetaToForgeOrientation(par1World.getBlockMetadata(par2, par3, par4));
|
||||
|
||||
switch (dir)
|
||||
{
|
||||
case DOWN:
|
||||
return EnumFacing.UP;
|
||||
case UP:
|
||||
return EnumFacing.DOWN;
|
||||
case WEST:
|
||||
return EnumFacing.WEST;
|
||||
case EAST:
|
||||
return EnumFacing.EAST;
|
||||
case SOUTH:
|
||||
return EnumFacing.NORTH;
|
||||
case NORTH:
|
||||
return EnumFacing.SOUTH;
|
||||
default:
|
||||
return EnumFacing.UP;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean doesBehaviorPreventRemovalOfBlock (ItemStack par1ItemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isOffensive (ItemStack par1ItemStack)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isBehaviorExchangableWithOffensive (ItemStack par1ItemStack)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean shouldItemBeRemoved (ItemStack par1ItemStack, boolean willBlockGetRemoved)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public static final int arrayIndexOfStack (ArrayList<ItemStack> stacks, ItemStack item)
|
||||
{
|
||||
Iterator<ItemStack> i1 = stacks.iterator();
|
||||
|
||||
int index = 0;
|
||||
|
||||
while (i1.hasNext())
|
||||
{
|
||||
ItemStack stack = i1.next();
|
||||
if (stack.isItemEqual(item))
|
||||
{
|
||||
return index;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static final boolean arrayContainsEqualStack (ArrayList<ItemStack> stacks, ItemStack item)
|
||||
{
|
||||
Iterator<ItemStack> i1 = stacks.iterator();
|
||||
|
||||
while (i1.hasNext())
|
||||
{
|
||||
ItemStack stack = i1.next();
|
||||
if (stack.isItemEqual(item))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean overridesDefault ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package tconstruct.mechworks.landmine.behavior;
|
||||
|
||||
import mantle.blocks.BlockUtils;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityFallingBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*/
|
||||
public class BehaviorBlockThrow extends Behavior
|
||||
{
|
||||
|
||||
@Override
|
||||
public void executeLogic (World par1World, int par2, int par3, int par4, ItemStack par5ItemStack, Entity triggerer, boolean willBlockBeRemoved)
|
||||
{
|
||||
for (int i = 0; i < par5ItemStack.stackSize; i++)
|
||||
{
|
||||
int direction = par1World.rand.nextInt(8);
|
||||
double speed = 2D * Math.random() + 0.01D;
|
||||
double upVecReduction = 0.25D;
|
||||
double randomnessFactor = 0.5D;
|
||||
double vec0 = 0, vec1 = par1World.rand.nextDouble() * upVecReduction, vec2 = 0;
|
||||
switch (direction)
|
||||
{
|
||||
case 0:
|
||||
vec0 = speed + par1World.rand.nextDouble() * randomnessFactor;
|
||||
// vec2 = par1World.rand.nextDouble() * randomnessFactor;
|
||||
break;
|
||||
case 1:
|
||||
vec0 = -speed + par1World.rand.nextDouble() * randomnessFactor;
|
||||
// vec2 = par1World.rand.nextDouble() * randomnessFactor;
|
||||
break;
|
||||
case 2:
|
||||
vec2 = speed + par1World.rand.nextDouble() * randomnessFactor;
|
||||
// vec0 = par1World.rand.nextDouble() * randomnessFactor;
|
||||
break;
|
||||
case 3:
|
||||
vec2 = -speed + par1World.rand.nextDouble() * randomnessFactor;
|
||||
// vec0 = par1World.rand.nextDouble() * randomnessFactor;
|
||||
break;
|
||||
case 4:
|
||||
vec0 = speed + par1World.rand.nextDouble() * randomnessFactor;
|
||||
vec2 = speed + par1World.rand.nextDouble() * randomnessFactor;
|
||||
break;
|
||||
case 5:
|
||||
vec0 = speed + par1World.rand.nextDouble() * randomnessFactor;
|
||||
vec2 = -speed + par1World.rand.nextDouble() * randomnessFactor;
|
||||
break;
|
||||
case 6:
|
||||
vec0 = -speed + par1World.rand.nextDouble() * randomnessFactor;
|
||||
vec2 = speed + par1World.rand.nextDouble() * randomnessFactor;
|
||||
break;
|
||||
case 7:
|
||||
vec0 = -speed;
|
||||
vec2 = -speed;
|
||||
break;
|
||||
default:
|
||||
vec0 = speed;
|
||||
break;
|
||||
}
|
||||
|
||||
EntityFallingBlock entityfallingsand = new EntityFallingBlock(par1World, (double) ((float) par2 + 0.5F), (double) ((float) par3 + 2F), (double) ((float) par4 + 0.5F),
|
||||
BlockUtils.getBlockFromItemStack(par5ItemStack), par5ItemStack.getItemDamage());
|
||||
entityfallingsand.preventEntitySpawning = false;
|
||||
entityfallingsand.ticksExisted = 2;
|
||||
entityfallingsand.setVelocity(vec0, vec1, vec2);
|
||||
par1World.spawnEntityInWorld(entityfallingsand);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOffensive (ItemStack par1ItemStack)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackLimit (ItemStack par1ItemStack)
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package tconstruct.mechworks.landmine.behavior;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.util.DamageSourceLandmine;
|
||||
|
||||
public class BehaviorDefault extends Behavior
|
||||
{
|
||||
|
||||
@Override
|
||||
public void executeLogic (World par1World, int par2, int par3, int par4, ItemStack par5ItemStack, Entity triggerer, boolean willBlockBeRemoved)
|
||||
{
|
||||
if (triggerer != null)
|
||||
{
|
||||
triggerer.attackEntityFrom(new DamageSourceLandmine("Landmine"), 5F);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package tconstruct.mechworks.landmine.behavior;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*/
|
||||
public class BehaviorDummy extends Behavior
|
||||
{
|
||||
|
||||
@Override
|
||||
public void executeLogic (World par1World, int par2, int par3, int par4, ItemStack par5ItemStack, Entity triggerer, boolean willBlockBeRemoved)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package tconstruct.mechworks.landmine.behavior;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityTNTPrimed;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*/
|
||||
public class BehaviorExplosive extends Behavior
|
||||
{
|
||||
|
||||
@Override
|
||||
public void executeLogic (World par1World, int par2, int par3, int par4, ItemStack par5ItemStack, Entity triggerer, boolean willBlockBeRemoved)
|
||||
{
|
||||
float explodeStrenght = 0;
|
||||
if (par5ItemStack.getItem() == Item.getItemFromBlock(Blocks.tnt))
|
||||
{
|
||||
explodeStrenght = 4.0F * par5ItemStack.stackSize;
|
||||
}
|
||||
else if (par5ItemStack.getItem() == Items.gunpowder)
|
||||
{
|
||||
explodeStrenght = 0.8F * par5ItemStack.stackSize;
|
||||
}
|
||||
|
||||
par1World.createExplosion(new EntityTNTPrimed(par1World, par2, par3, par4, (EntityLivingBase) null), par2, par3, par4, explodeStrenght, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getInformation (ItemStack par1ItemStack, List par2List)
|
||||
{
|
||||
String str = "UNDEFINED";
|
||||
if (par1ItemStack.getItem() == Item.getItemFromBlock(Blocks.tnt))
|
||||
{
|
||||
str = "medium";
|
||||
}
|
||||
else if (par1ItemStack.getItem() == Items.gunpowder)
|
||||
{
|
||||
str = "small";
|
||||
}
|
||||
|
||||
// par2List.add("This item explodes with " + str +
|
||||
// " power when the landmine is triggered.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOffensive (ItemStack par1ItemStack)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
// Change this to false to greatly decrease the maximum potential of
|
||||
// explosions but at the same time, make them launch the player much
|
||||
// higher(I mean the explosions with 2 or more TNT
|
||||
public boolean effectStacks ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package tconstruct.mechworks.landmine.behavior;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.projectile.EntitySmallFireball;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.mechworks.itemblocks.ItemBlockLandmine;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*/
|
||||
public class BehaviorFirecharge extends Behavior
|
||||
{
|
||||
|
||||
@Override
|
||||
public void executeLogic (World par1World, int par2, int par3, int par4, ItemStack par5ItemStack, Entity triggerer, boolean willBlockBeRemoved)
|
||||
{
|
||||
EnumFacing face = getFacing(par1World, par2, par3, par4);
|
||||
|
||||
for (int n = 0; n < par5ItemStack.stackSize; n++)
|
||||
{
|
||||
triggerer.attackEntityFrom(DamageSource.generic, 9F);
|
||||
triggerer.setFire(4);
|
||||
double d0 = par2 + (double) ((float) face.getFrontOffsetX() * 0.3F);
|
||||
double d1 = par3 + (double) ((float) face.getFrontOffsetX() * 0.3F);
|
||||
double d2 = par4 + (double) ((float) face.getFrontOffsetZ() * 0.3F);
|
||||
Random random = par1World.rand;
|
||||
double d3 = random.nextGaussian() * 0.05D + (double) face.getFrontOffsetX();
|
||||
double d4 = random.nextGaussian() * 0.05D + (double) face.getFrontOffsetY();
|
||||
double d5 = random.nextGaussian() * 0.05D + (double) face.getFrontOffsetZ();
|
||||
par1World.spawnEntityInWorld(new EntitySmallFireball(par1World, d0, d1, d2, d3, d4, d5));
|
||||
|
||||
for (int i = par2 - 2; i <= (par2 + 2); i++)
|
||||
{
|
||||
for (int j = par4 - 2; j <= (par4 + 2); j++)
|
||||
{
|
||||
if ((par1World.getBlock(i, par3, j) == null || (par1World.getBlock(i, par3, j) != null && par1World.getBlock(i, par3, j).isReplaceable(par1World, i, par3, j)))
|
||||
&& ItemBlockLandmine.getRandom().nextInt(5) == 0 && Blocks.fire.canPlaceBlockAt(par1World, i, par3, j))
|
||||
{
|
||||
par1World.setBlock(i, par3, j, Blocks.fire);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOffensive (ItemStack par1ItemStack)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package tconstruct.mechworks.landmine.behavior;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.mechworks.entity.item.EntityLandmineFirework;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*/
|
||||
public class BehaviorFirework extends Behavior
|
||||
{
|
||||
|
||||
@Override
|
||||
public void executeLogic (World par1World, int par2, int par3, int par4, ItemStack par5ItemStack, Entity triggerer, boolean willBlockBeRemoved)
|
||||
{
|
||||
EnumFacing facing = getFacing(par1World, par2, par3, par4);
|
||||
|
||||
for (int i = 0; i < par5ItemStack.stackSize; i++)
|
||||
{
|
||||
// TODO entity registration and stuffs
|
||||
EntityLandmineFirework entityfireworkrocket = new EntityLandmineFirework(par1World, (double) par2, (double) par3, (double) par4, par5ItemStack, facing.ordinal())
|
||||
.setRider(i == 0 ? triggerer : null);
|
||||
par1World.spawnEntityInWorld(entityfireworkrocket);
|
||||
|
||||
boolean shouldRun = true;
|
||||
if (triggerer instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) triggerer;
|
||||
if (player.capabilities.isCreativeMode)
|
||||
{
|
||||
// Remove the bellow comment to make the player in creative
|
||||
// mode not get launched
|
||||
// shouldRun = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldRun)
|
||||
{
|
||||
triggerer.mountEntity(entityfireworkrocket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOffensive (ItemStack par1ItemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean overridesDefault ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package tconstruct.mechworks.landmine.behavior;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityPotion;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemPotion;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.mechworks.itemblocks.ItemBlockLandmine;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*/
|
||||
public class BehaviorPotion extends Behavior
|
||||
{
|
||||
|
||||
@Override
|
||||
public void executeLogic (World par1World, int par2, int par3, int par4, ItemStack par5ItemStack, Entity triggerer, boolean willBlockBeRemoved)
|
||||
{
|
||||
if (ItemPotion.isSplash(par5ItemStack.getItemDamage()))
|
||||
{
|
||||
par1World.playSoundAtEntity(triggerer, "random.bow", 0.5F, 0.4F / (ItemBlockLandmine.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
|
||||
if (!par1World.isRemote)
|
||||
{
|
||||
if (triggerer instanceof EntityLivingBase)
|
||||
{
|
||||
par1World.spawnEntityInWorld(new EntityPotion(par1World, (EntityLivingBase) triggerer, par5ItemStack));
|
||||
}
|
||||
else
|
||||
{
|
||||
par1World.spawnEntityInWorld(new EntityPotion(par1World, par2, par3, par4, par5ItemStack));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (triggerer instanceof EntityPlayer)
|
||||
{
|
||||
Items.potionitem.onEaten(par5ItemStack, par1World, (EntityPlayer) triggerer);
|
||||
}
|
||||
else if (triggerer instanceof EntityLivingBase)
|
||||
{
|
||||
if (!par1World.isRemote)
|
||||
{
|
||||
List list = Items.potionitem.getEffects(par5ItemStack);
|
||||
|
||||
if (list != null)
|
||||
{
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
PotionEffect potioneffect = (PotionEffect) iterator.next();
|
||||
((EntityLivingBase) triggerer).addPotionEffect(new PotionEffect(potioneffect));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOffensive (ItemStack par1ItemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package tconstruct.mechworks.landmine.behavior;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BehaviorPreventExplode extends Behavior
|
||||
{
|
||||
|
||||
@Override
|
||||
public void executeLogic (World par1World, int par2, int par3, int par4, ItemStack par5ItemStack, Entity triggerer, boolean willBlockBeRemoved)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBehaviorExchangableWithOffensive (ItemStack par1ItemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesBehaviorPreventRemovalOfBlock (ItemStack par1ItemStack)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldItemBeRemoved (ItemStack par1ItemStack, boolean willBlockBeRemoved)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOffensive (ItemStack par1ItemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package tconstruct.mechworks.landmine.behavior;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.IProjectile;
|
||||
import net.minecraft.entity.item.EntityEnderPearl;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.entity.projectile.EntitySnowball;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*/
|
||||
public class BehaviorProjectile extends Behavior
|
||||
{
|
||||
|
||||
@Override
|
||||
public void executeLogic (World par1World, int par2, int par3, int par4, ItemStack par5ItemStack, Entity triggerer, boolean willBlockBeRemoved)
|
||||
{
|
||||
IProjectile entity = null;
|
||||
|
||||
EnumFacing enumfacing = getFacing(par1World, par2, par3, par4);
|
||||
|
||||
if (par5ItemStack.getItem() == Items.arrow)
|
||||
{
|
||||
entity = new EntityArrow(par1World, par2, par3, par4);
|
||||
((EntityArrow) entity).canBePickedUp = 1;
|
||||
}
|
||||
else if (par5ItemStack.getItem() == Items.snowball)
|
||||
{
|
||||
entity = new EntitySnowball(par1World, par2, par3, par4);
|
||||
}
|
||||
else if (par5ItemStack.getItem() == Items.ender_pearl)
|
||||
{
|
||||
if (triggerer instanceof EntityLivingBase)
|
||||
{
|
||||
entity = new EntityEnderPearl(par1World, (EntityLivingBase) triggerer);
|
||||
((EntityEnderPearl) entity).setPosition(par2, par3, par4);
|
||||
}
|
||||
else
|
||||
{
|
||||
entity = new EntityEnderPearl(par1World, par2, par3, par4);
|
||||
}
|
||||
}
|
||||
|
||||
if (entity == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entity.setThrowableHeading((double) enumfacing.getFrontOffsetX(), (double) ((float) enumfacing.getFrontOffsetY() + 0.1F), (double) enumfacing.getFrontOffsetZ(), 1.1F, 6.0F);
|
||||
par1World.spawnEntityInWorld((Entity) entity);
|
||||
par1World.playAuxSFX(1002, par2, par3, par4, 0);
|
||||
}
|
||||
|
||||
// Projectiles: snowballs, arrows
|
||||
|
||||
@Override
|
||||
public boolean isOffensive (ItemStack par1ItemStack)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package tconstruct.mechworks.landmine.behavior;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IShearable;
|
||||
import tconstruct.mechworks.itemblocks.ItemBlockLandmine;
|
||||
|
||||
//TODO Add a block that is similar to landmine, but only triggers by redstone, does not hurt the player, and does not disappear when used(also does not do anything that can deal damage)
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*/
|
||||
public class BehaviorShears extends Behavior
|
||||
{
|
||||
|
||||
@Override
|
||||
public void executeLogic (World par1World, int par2, int par3, int par4, ItemStack par5ItemStack, Entity triggerer, boolean willBlockBeRemoved)
|
||||
{
|
||||
Random rand = ItemBlockLandmine.getRandom();
|
||||
|
||||
List<IShearable> sheeps = par1World.getEntitiesWithinAABB(IShearable.class, AxisAlignedBB.getAABBPool().getAABB(par2 - 2, par3 - 2, par4 - 2, par2 + 2, par3 + 2, par4 + 2));
|
||||
|
||||
if (sheeps != null && !sheeps.isEmpty())
|
||||
{
|
||||
Iterator<IShearable> i1 = sheeps.iterator();
|
||||
IShearable sheep;
|
||||
while (i1.hasNext())
|
||||
{
|
||||
sheep = i1.next();
|
||||
if (sheep.isShearable(par5ItemStack, par1World, par2, par3, par4))
|
||||
{
|
||||
if (rand.nextInt(2) == 0)
|
||||
{
|
||||
ArrayList<ItemStack> drops = sheep.onSheared(par5ItemStack, par1World, par2, par3, par4, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, par5ItemStack));
|
||||
if (sheep instanceof EntityLivingBase)
|
||||
{
|
||||
par5ItemStack.damageItem(1, (EntityLivingBase) sheep);
|
||||
}
|
||||
Iterator<ItemStack> i2 = drops.iterator();
|
||||
while (i2.hasNext())
|
||||
{
|
||||
if (sheep instanceof Entity)
|
||||
{
|
||||
Entity ent = (Entity) sheep;
|
||||
dropItem(par1World, (int) ent.posX, (int) ent.posY, (int) ent.posZ, i2.next());
|
||||
}
|
||||
else
|
||||
{
|
||||
dropItem(par1World, par2, par3, par4, i2.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (willBlockBeRemoved)
|
||||
{
|
||||
dropItem(par1World, par2, par3, par4, par5ItemStack);
|
||||
}
|
||||
}
|
||||
|
||||
protected void dropItem (World par1World, int par2, int par3, int par4, ItemStack par5ItemStack)
|
||||
{
|
||||
if (!par1World.isRemote && par1World.getGameRules().getGameRuleBooleanValue("doTileDrops"))
|
||||
{
|
||||
float f = 0.7F;
|
||||
double d0 = (double) (par1World.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
double d1 = (double) (par1World.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
double d2 = (double) (par1World.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
EntityItem entityitem = new EntityItem(par1World, (double) par2 + d0, (double) par3 + d1, (double) par4 + d2, par5ItemStack);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
par1World.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
|
||||
// Shear some sheep around a small area
|
||||
|
||||
@Override
|
||||
public boolean shouldItemBeRemoved (ItemStack par1ItemStack, boolean willBlockBeRemoved)
|
||||
{
|
||||
return willBlockBeRemoved;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOffensive (ItemStack par1ItemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean effectStacks ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package tconstruct.mechworks.landmine.behavior;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemMonsterPlacer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*/
|
||||
public class BehaviorSpawnEgg extends Behavior
|
||||
{
|
||||
|
||||
@Override
|
||||
public void executeLogic (World par1World, int par2, int par3, int par4, ItemStack par5ItemStack, Entity triggerer, boolean willBlockBeRemoved)
|
||||
{
|
||||
EnumFacing enumfacing = getFacing(par1World, par2, par3, par4);
|
||||
double d0 = par2 + Math.random() + (double) enumfacing.getFrontOffsetX();
|
||||
double d1 = (double) ((float) par3 + 0.2F);
|
||||
double d2 = par4 + Math.random() + (double) enumfacing.getFrontOffsetZ();
|
||||
Entity entity = ItemMonsterPlacer.spawnCreature(par1World, par5ItemStack.getItemDamage(), d0, d1, d2);
|
||||
|
||||
if (entity instanceof EntityLivingBase && par5ItemStack.hasDisplayName())
|
||||
{
|
||||
((EntityLiving) entity).setCustomNameTag(par5ItemStack.getDisplayName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean effectStacks ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOffensive (ItemStack par1ItemStack)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
package tconstruct.mechworks.landmine.behavior.stackCombo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import tconstruct.mechworks.landmine.Helper;
|
||||
import tconstruct.mechworks.landmine.behavior.Behavior;
|
||||
import tconstruct.mechworks.logic.TileEntityLandmine;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*/
|
||||
public abstract class SpecialStackHandler
|
||||
{
|
||||
|
||||
public static ArrayList<SpecialStackHandler> handlers = new ArrayList<SpecialStackHandler>();
|
||||
|
||||
public static void registerBuiltInStackHandlers ()
|
||||
{
|
||||
addSpecialBehavior(new SpecialStackHandlerRocketFireball());
|
||||
}
|
||||
|
||||
public static void addSpecialBehavior (SpecialStackHandler handler)
|
||||
{
|
||||
if (!handlers.contains(handler))
|
||||
{
|
||||
handlers.add(handler);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void checkStack (World par1World, int par2, int par3, int par4, Entity triggerer, ArrayList<ItemStack> stacks);
|
||||
|
||||
public EnumFacing getFacing (World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
ForgeDirection dir = Helper.convertMetaToForgeOrientation(par1World.getBlockMetadata(par2, par3, par4));
|
||||
|
||||
switch (dir)
|
||||
{
|
||||
case DOWN:
|
||||
return EnumFacing.UP;
|
||||
case UP:
|
||||
return EnumFacing.DOWN;
|
||||
case WEST:
|
||||
return EnumFacing.WEST;
|
||||
case EAST:
|
||||
return EnumFacing.EAST;
|
||||
case SOUTH:
|
||||
return EnumFacing.NORTH;
|
||||
case NORTH:
|
||||
return EnumFacing.SOUTH;
|
||||
default:
|
||||
return EnumFacing.UP;
|
||||
}
|
||||
}
|
||||
|
||||
public final void removeItemFromInventory (World par1World, int x, int y, int z, ItemStack item)
|
||||
{
|
||||
if (item == null || item.stackSize <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntityLandmine tileEntity = (TileEntityLandmine) par1World.getTileEntity(x, y, z);
|
||||
|
||||
while (item.stackSize > 0)
|
||||
{
|
||||
boolean hasRemovedThisIteration = false;
|
||||
for (int i = 0; i < tileEntity.getSizeTriggerInventory(); i++)
|
||||
{
|
||||
if (!hasRemovedThisIteration && tileEntity.getStackInSlot(i) != null)
|
||||
{
|
||||
if (tileEntity.getStackInSlot(i).isItemEqual(item))
|
||||
{
|
||||
tileEntity.decrStackSize(i, 1);
|
||||
item.stackSize--;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasRemovedThisIteration && i == tileEntity.getSizeTriggerInventory() - 1)
|
||||
{
|
||||
item.stackSize--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final int arrayIndexOfStack (ArrayList<ItemStack> stacks, ItemStack item)
|
||||
{
|
||||
return Behavior.arrayIndexOfStack(stacks, item);
|
||||
}
|
||||
|
||||
public static final boolean arrayContainsEqualStack (ArrayList<ItemStack> stacks, ItemStack item)
|
||||
{
|
||||
return Behavior.arrayContainsEqualStack(stacks, item);
|
||||
}
|
||||
|
||||
public boolean isOffensive (ArrayList<ItemStack> par1ArrayList)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package tconstruct.mechworks.landmine.behavior.stackCombo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityFireball;
|
||||
import net.minecraft.entity.projectile.EntityLargeFireball;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class SpecialStackHandlerRocketFireball extends SpecialStackHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public void checkStack (World par1World, int par2, int par3, int par4, Entity triggerer, ArrayList<ItemStack> stacks)
|
||||
{
|
||||
if (stacks.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.arrayContainsEqualStack(stacks, new ItemStack(Items.fireworks)) && this.arrayContainsEqualStack(stacks, new ItemStack(Items.fire_charge)))
|
||||
{
|
||||
int index0 = this.arrayIndexOfStack(stacks, new ItemStack(Items.fireworks));
|
||||
int index1 = this.arrayIndexOfStack(stacks, new ItemStack(Items.fire_charge));
|
||||
EnumFacing face = getFacing(par1World, par2, par3, par4);
|
||||
|
||||
while (stacks.get(index0).stackSize > 0 && stacks.get(index1).stackSize > 0)
|
||||
{
|
||||
double d0 = par2 + (double) ((float) face.getFrontOffsetX() * 0.3F);
|
||||
double d1 = par3 + (double) ((float) face.getFrontOffsetX() * 0.3F);
|
||||
double d2 = par4 + (double) ((float) face.getFrontOffsetZ() * 0.3F);
|
||||
Random random = par1World.rand;
|
||||
double d3 = random.nextGaussian() * 0.05D + (double) face.getFrontOffsetX();
|
||||
double d4 = random.nextGaussian() * 0.05D + (double) face.getFrontOffsetY();
|
||||
double d5 = random.nextGaussian() * 0.05D + (double) face.getFrontOffsetZ();
|
||||
EntityFireball fireball = new EntityLargeFireball(par1World, d0, d1, d2, d3, d4, d5);
|
||||
par1World.spawnEntityInWorld(fireball);
|
||||
|
||||
if (triggerer instanceof EntityLivingBase)
|
||||
{
|
||||
boolean shouldRun = true;
|
||||
if (triggerer instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) triggerer;
|
||||
if (player.capabilities.isCreativeMode)
|
||||
{
|
||||
// Remove the bellow comment to make the player in
|
||||
// creative mode not get launched
|
||||
// shouldRun = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldRun)
|
||||
{
|
||||
triggerer.mountEntity(fireball);
|
||||
}
|
||||
}
|
||||
|
||||
this.removeItemFromInventory(par1World, par2, par3, par4, new ItemStack(Items.fireworks, 1));
|
||||
stacks.get(index0).stackSize--;
|
||||
this.removeItemFromInventory(par1World, par2, par3, par4, new ItemStack(Items.fire_charge, 1));
|
||||
stacks.get(index1).stackSize--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package tconstruct.mechworks.logic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import mantle.world.WorldHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.mechworks.landmine.behavior.Behavior;
|
||||
|
||||
/**
|
||||
* This logic is designed only for blocks having TileEntityLandmine as their
|
||||
* tileEntity(otherwise ClassCastException will be awarded)
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*/
|
||||
public class LandmineExplodeLogic
|
||||
{
|
||||
|
||||
private final World worldObj;
|
||||
private final Entity triggerer;
|
||||
private final TileEntityLandmine tileEntity;
|
||||
private final int x, y, z;
|
||||
|
||||
public LandmineExplodeLogic(World par1World, int par2, int par3, int par4, Entity entity)
|
||||
{
|
||||
worldObj = par1World;
|
||||
this.tileEntity = (TileEntityLandmine) par1World.getTileEntity(par2, par3, par4);
|
||||
this.x = par2;
|
||||
this.y = par3;
|
||||
this.z = par4;
|
||||
this.triggerer = entity;
|
||||
}
|
||||
|
||||
public void explode ()
|
||||
{
|
||||
if (triggerer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
boolean preventExplode = false;
|
||||
boolean isOffensive = true;
|
||||
boolean cancelDefault = false;
|
||||
|
||||
ArrayList<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
boolean hasExploded = false;
|
||||
|
||||
if (tileEntity == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
tileEntity.isExploding = true;
|
||||
|
||||
for (int i = 0; i < tileEntity.getSizeTriggerInventory(); i++)
|
||||
{
|
||||
ItemStack currentStack = tileEntity.getStackInSlot(i);
|
||||
Behavior b = Behavior.getBehaviorFromStack(currentStack);
|
||||
if (b != null)
|
||||
{
|
||||
|
||||
if (b.doesBehaviorPreventRemovalOfBlock(currentStack))
|
||||
{
|
||||
preventExplode = true;
|
||||
}
|
||||
|
||||
if (!b.isBehaviorExchangableWithOffensive(currentStack))
|
||||
{
|
||||
isOffensive = false;
|
||||
}
|
||||
|
||||
if (b.overridesDefault())
|
||||
{
|
||||
cancelDefault = true;
|
||||
}
|
||||
|
||||
if (!stacks.isEmpty() && Behavior.arrayContainsEqualStack(stacks, currentStack) && b.effectStacks())
|
||||
{
|
||||
stacks.get(Behavior.arrayIndexOfStack(stacks, currentStack)).stackSize += currentStack.stackSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
stacks.add(currentStack.copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LandmineSpecialStackLogic specialStacks = new LandmineSpecialStackLogic(worldObj, x, y, z, triggerer, isOffensive, stacks);
|
||||
specialStacks.handleSpecialStacks();
|
||||
|
||||
Iterator<ItemStack> i1 = stacks.iterator();
|
||||
while (i1.hasNext())
|
||||
{
|
||||
ItemStack currentStack = i1.next();
|
||||
Behavior b = Behavior.getBehaviorFromStack(currentStack);
|
||||
if (b != null)
|
||||
{
|
||||
if (isOffensive || !b.isOffensive(currentStack))
|
||||
{
|
||||
b.executeLogic(worldObj, x, y, z, currentStack, triggerer, !preventExplode);
|
||||
if (b.shouldItemBeRemoved(currentStack, !preventExplode))
|
||||
{
|
||||
if (b.effectStacks())
|
||||
{
|
||||
for (int i = 0; i < tileEntity.getSizeTriggerInventory(); i++)
|
||||
{
|
||||
if (tileEntity.getStackInSlot(i) != null)
|
||||
{
|
||||
if (tileEntity.getStackInSlot(i).isItemEqual(currentStack))
|
||||
{
|
||||
tileEntity.setInventorySlotContents(i, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean hasRemoved = false;
|
||||
|
||||
for (int i = 0; i < tileEntity.getSizeTriggerInventory() && !hasRemoved; i++)
|
||||
{
|
||||
if (tileEntity.getStackInSlot(i) != null)
|
||||
{
|
||||
if (tileEntity.getStackInSlot(i).isItemEqual(currentStack))
|
||||
{
|
||||
tileEntity.setInventorySlotContents(i, null);
|
||||
hasRemoved = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Behavior defBeh = Behavior.getDefaulBehavior();
|
||||
if (defBeh != null && isOffensive && !cancelDefault)
|
||||
{
|
||||
defBeh.executeLogic(worldObj, x, y, z, null, triggerer, !preventExplode);
|
||||
}
|
||||
|
||||
if (hasExploded || defBeh != null && !preventExplode)
|
||||
{
|
||||
worldObj.removeTileEntity(x, y, z);
|
||||
WorldHelper.setBlockToAir(worldObj, x, y, z);
|
||||
}
|
||||
else
|
||||
{
|
||||
tileEntity.isExploding = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package tconstruct.mechworks.logic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.mechworks.landmine.behavior.stackCombo.SpecialStackHandler;
|
||||
|
||||
public class LandmineSpecialStackLogic
|
||||
{
|
||||
|
||||
private final World worldObj;
|
||||
private final Entity triggerer;
|
||||
private final TileEntityLandmine tileEntity;
|
||||
private final int x, y, z;
|
||||
private final boolean isOffensive;
|
||||
private final ArrayList<ItemStack> stackEffects;
|
||||
|
||||
public LandmineSpecialStackLogic(World par1World, int par2, int par3, int par4, Entity entity, boolean mayHurtPlayer, ArrayList<ItemStack> items)
|
||||
{
|
||||
worldObj = par1World;
|
||||
this.tileEntity = (TileEntityLandmine) par1World.getTileEntity(par2, par3, par4);
|
||||
this.x = par2;
|
||||
this.y = par3;
|
||||
this.z = par4;
|
||||
this.triggerer = entity;
|
||||
this.isOffensive = mayHurtPlayer;
|
||||
this.stackEffects = items;
|
||||
}
|
||||
|
||||
public void handleSpecialStacks ()
|
||||
{
|
||||
Iterator<SpecialStackHandler> i1 = SpecialStackHandler.handlers.iterator();
|
||||
|
||||
while (i1.hasNext())
|
||||
{
|
||||
SpecialStackHandler h = i1.next();
|
||||
if (isOffensive || !h.isOffensive(stackEffects))
|
||||
{
|
||||
h.checkStack(worldObj, x, y, z, triggerer, stackEffects);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,269 @@
|
||||
package tconstruct.mechworks.logic;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*/
|
||||
public class TileEntityLandmine extends TileEntity implements IInventory
|
||||
{
|
||||
|
||||
private ItemStack[] inventory = new ItemStack[getSizeInventory()];
|
||||
private String containerName;
|
||||
|
||||
public int soundcountythingmax = 10;
|
||||
public int soundcountything = 0;
|
||||
|
||||
private boolean shouldUpdateLogic = true;
|
||||
|
||||
public int triggerType;
|
||||
public boolean isExploding = false;
|
||||
|
||||
public int getSizeTriggerInventory ()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory ()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT (NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < this.inventory.length; ++i)
|
||||
{
|
||||
if (this.inventory[i] != null)
|
||||
{
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
nbttagcompound1.setByte("Slot", (byte) i);
|
||||
this.inventory[i].writeToNBT(nbttagcompound1);
|
||||
nbttaglist.appendTag(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
par1NBTTagCompound.setTag("Items", nbttaglist);
|
||||
|
||||
par1NBTTagCompound.setInteger("triggerType", triggerType);
|
||||
|
||||
if (this.hasCustomInventoryName())
|
||||
{
|
||||
par1NBTTagCompound.setString("CustomName", this.containerName);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT (NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Items", 10);
|
||||
this.inventory = new ItemStack[this.getSizeInventory()];
|
||||
|
||||
for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
||||
{
|
||||
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.getCompoundTagAt(i);
|
||||
byte b0 = nbttagcompound1.getByte("Slot");
|
||||
|
||||
if (b0 >= 0 && b0 < this.inventory.length)
|
||||
{
|
||||
this.inventory[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
triggerType = par1NBTTagCompound.getInteger("triggerType");
|
||||
|
||||
if (par1NBTTagCompound.hasKey("CustomName"))
|
||||
{
|
||||
this.containerName = par1NBTTagCompound.getString("CustomName");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket ()
|
||||
{
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
writeToNBT(nbt);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
|
||||
{
|
||||
readFromNBT(packet.func_148857_g());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot (int i)
|
||||
{
|
||||
if (i < inventory.length)
|
||||
{
|
||||
return inventory[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize (int par1, int par2)
|
||||
{
|
||||
if (par1 < inventory.length)
|
||||
{
|
||||
if (inventory[par1] != null)
|
||||
{
|
||||
ItemStack itemstack;
|
||||
|
||||
if (inventory[par1].stackSize <= par2)
|
||||
{
|
||||
itemstack = inventory[par1];
|
||||
inventory[par1] = null;
|
||||
return itemstack;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemstack = inventory[par1].splitStack(par2);
|
||||
|
||||
if (inventory[par1].stackSize == 0)
|
||||
{
|
||||
inventory[par1] = null;
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing (int i)
|
||||
{
|
||||
if (i < inventory.length && this.inventory[i] != null)
|
||||
{
|
||||
ItemStack itemstack = this.inventory[i];
|
||||
this.inventory[i] = null;
|
||||
return itemstack;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents (int i, ItemStack itemstack)
|
||||
{
|
||||
if (i < inventory.length)
|
||||
{
|
||||
inventory[i] = itemstack;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName ()
|
||||
{
|
||||
return this.hasCustomInventoryName() ? this.containerName : "Landmine";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName ()
|
||||
{
|
||||
return containerName != null && containerName.length() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit ()
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
|
||||
public void setGuiDisplayName (String par1Str)
|
||||
{
|
||||
this.containerName = par1Str;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer (EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : par1EntityPlayer.getDistanceSq((double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D,
|
||||
(double) this.zCoord + 0.5D) <= 64.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory ()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory ()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty ()
|
||||
{
|
||||
super.markDirty();
|
||||
this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot (int i, ItemStack itemstack)
|
||||
{
|
||||
// Should automatic camo insertion be allowed.
|
||||
if (i == 3)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Here for mDiyo to decide if he wants automation for
|
||||
// insertion/extraction of the items to be an option.
|
||||
// Would be useful for building automated mine laying machines.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void setSoundPlayed ()
|
||||
{
|
||||
soundcountythingmax = 35;
|
||||
soundcountything = soundcountythingmax;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity ()
|
||||
{
|
||||
if (shouldUpdateLogic)
|
||||
{
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
shouldUpdateLogic = false;
|
||||
}
|
||||
if (soundcountything > 0)
|
||||
{
|
||||
soundcountything--;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package tconstruct.mechworks.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.world.entity.CartEntity;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class CartRender extends Render
|
||||
{
|
||||
protected ModelBase modelCart;
|
||||
RenderBlocks renderblocks;
|
||||
|
||||
public CartRender()
|
||||
{
|
||||
this.shadowSize = 0.5F;
|
||||
this.modelCart = new ModelPullcart();
|
||||
renderblocks = new RenderBlocks();
|
||||
}
|
||||
|
||||
public void renderPullcart (CartEntity cart, double posX, double posY, double posZ, float par8, float par9)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
long var10 = (long) cart.hashCode() * 493286711L;
|
||||
var10 = var10 * var10 * 4392167121L + var10 * 98761L;
|
||||
float var12 = (((float) (var10 >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
|
||||
float var13 = (((float) (var10 >> 20 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
|
||||
float var14 = (((float) (var10 >> 24 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
|
||||
GL11.glTranslatef(var12, var13, var14);
|
||||
double var15 = cart.lastTickPosX + (cart.posX - cart.lastTickPosX) * (double) par9;
|
||||
double var17 = cart.lastTickPosY + (cart.posY - cart.lastTickPosY) * (double) par9;
|
||||
double var19 = cart.lastTickPosZ + (cart.posZ - cart.lastTickPosZ) * (double) par9;
|
||||
double var21 = 0.30000001192092896D;
|
||||
Vec3 var23 = cart.func_70489_a(var15, var17, var19);
|
||||
float var24 = cart.prevRotationPitch + (cart.rotationPitch - cart.prevRotationPitch) * par9;
|
||||
|
||||
if (var23 != null)
|
||||
{
|
||||
Vec3 var25 = cart.func_70495_a(var15, var17, var19, var21);
|
||||
Vec3 var26 = cart.func_70495_a(var15, var17, var19, -var21);
|
||||
|
||||
if (var25 == null)
|
||||
{
|
||||
var25 = var23;
|
||||
}
|
||||
|
||||
if (var26 == null)
|
||||
{
|
||||
var26 = var23;
|
||||
}
|
||||
|
||||
posX += var23.xCoord - var15;
|
||||
posY += (var25.yCoord + var26.yCoord) / 2.0D - var17;
|
||||
posZ += var23.zCoord - var19;
|
||||
Vec3 var27 = var26.addVector(-var25.xCoord, -var25.yCoord, -var25.zCoord);
|
||||
|
||||
if (var27.lengthVector() != 0.0D)
|
||||
{
|
||||
var27 = var27.normalize();
|
||||
par8 = (float) (Math.atan2(var27.zCoord, var27.xCoord) * 180.0D / Math.PI);
|
||||
var24 = (float) (Math.atan(var27.yCoord) * 73.0D);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glTranslatef((float) posX, (float) posY + 0.3125f, (float) posZ);
|
||||
GL11.glRotatef(180.0F - par8, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-var24, 0.0F, 0.0F, 1.0F);
|
||||
float var28 = (float) cart.getRollingAmplitude() - par9;
|
||||
float var30 = (float) cart.getDamage() - par9;
|
||||
|
||||
if (var30 < 0.0F)
|
||||
{
|
||||
var30 = 0.0F;
|
||||
}
|
||||
|
||||
if (var28 > 0.0F)
|
||||
{
|
||||
GL11.glRotatef(MathHelper.sin(var28) * var28 * var30 / 10.0F * (float) cart.getRollingDirection(), 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
if (cart.getCartType() != 0)
|
||||
{
|
||||
// this.loadTexture("/terrain.png");
|
||||
float var29 = 0.75F;
|
||||
GL11.glScalef(var29, var29, var29);
|
||||
|
||||
if (cart.getCartType() == 1)
|
||||
{
|
||||
GL11.glTranslatef(0.0F, 0.5F, 0.0F);
|
||||
renderblocks.renderBlockAsItem(Blocks.chest, 0, cart.getBrightness(par9));
|
||||
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glTranslatef(0.5F, 0.0F, -0.5F);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
else if (cart.getCartType() == 2)
|
||||
{
|
||||
GL11.glTranslatef(0.0F, 0.3125F, 0.0F);
|
||||
renderblocks.renderBlockAsItem(Blocks.furnace, 0, cart.getBrightness(par9));
|
||||
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, -0.3125F, 0.0F);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
// GL11.glScalef(1.0F / var29, 1.0F / var29, 1.0F / var29);
|
||||
}
|
||||
|
||||
// this.loadTexture("/tinkertextures/entity/pullcart.png");
|
||||
GL11.glScalef(-1.0F, -1.0F, 1.0F);
|
||||
this.modelCart.render(cart, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
/**
|
||||
* Actually renders the given argument. This is a synthetic bridge method,
|
||||
* always casting down its argument and then handing it off to a worker
|
||||
* function which does the actual work. In all probabilty, the class Render
|
||||
* is generic (Render<T extends Entity) and this method has signature public
|
||||
* void doRender(T entity, double d, double d1, double d2, float f, float
|
||||
* f1). But JAD is pre 1.5 so doesn't do that.
|
||||
*/
|
||||
@Override
|
||||
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
this.renderPullcart((CartEntity) par1Entity, par2, par4, par6, par8, par9);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture (Entity par1Entity)
|
||||
{
|
||||
return texture;
|
||||
}
|
||||
|
||||
static final ResourceLocation texture = new ResourceLocation("assets/tinker/textures/mob/pullcart.png");
|
||||
}
|
||||
@@ -0,0 +1,283 @@
|
||||
package tconstruct.mechworks.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelPullcart extends ModelBase
|
||||
{
|
||||
ModelRenderer BackPanel;
|
||||
ModelRenderer FrontPanel;
|
||||
ModelRenderer RightPanel;
|
||||
ModelRenderer LeftPanel;
|
||||
ModelRenderer BottomPanel;
|
||||
ModelRenderer RightHandle;
|
||||
ModelRenderer LeftHandle;
|
||||
ModelRenderer RightSpokeUp;
|
||||
ModelRenderer RightSpokeRight;
|
||||
ModelRenderer RightSpokeDown;
|
||||
ModelRenderer RightSpokeLeft;
|
||||
ModelRenderer RightAxle;
|
||||
ModelRenderer WheelRight1;
|
||||
ModelRenderer WheelRight2;
|
||||
ModelRenderer WheelRight3;
|
||||
ModelRenderer WheelRight4;
|
||||
ModelRenderer WheelRight5;
|
||||
ModelRenderer WheelRight6;
|
||||
ModelRenderer WheelRight7;
|
||||
ModelRenderer WheelRight8;
|
||||
ModelRenderer WheelRight9;
|
||||
ModelRenderer WheelRight10;
|
||||
ModelRenderer WheelRight11;
|
||||
ModelRenderer WheelRight12;
|
||||
ModelRenderer LeftSpokeRight;
|
||||
ModelRenderer LeftSpokeLeft;
|
||||
ModelRenderer LeftSpokeDown;
|
||||
ModelRenderer LeftSpokeUp;
|
||||
ModelRenderer LeftAxle;
|
||||
ModelRenderer WheelLeft1;
|
||||
ModelRenderer WheelLeft2;
|
||||
ModelRenderer WheelLeft3;
|
||||
ModelRenderer WheelLeft4;
|
||||
ModelRenderer WheelLeft5;
|
||||
ModelRenderer WheelLeft6;
|
||||
ModelRenderer WheelLeft7;
|
||||
ModelRenderer WheelLeft8;
|
||||
ModelRenderer WheelLeft9;
|
||||
ModelRenderer WheelLeft10;
|
||||
ModelRenderer WheelLeft11;
|
||||
ModelRenderer WheelLeft12;
|
||||
|
||||
public ModelPullcart()
|
||||
{
|
||||
textureWidth = 128;
|
||||
textureHeight = 64;
|
||||
|
||||
BackPanel = new ModelRenderer(this, 0, 12);
|
||||
BackPanel.addBox(-10F, 0F, 0F, 20, 10, 2);
|
||||
BackPanel.setRotationPoint(0F, -8F, 8F);
|
||||
setRotation(BackPanel, 0F, 0F, 0F);
|
||||
FrontPanel = new ModelRenderer(this, 0, 0);
|
||||
FrontPanel.addBox(-10F, 0F, 0F, 20, 10, 2);
|
||||
FrontPanel.setRotationPoint(0F, -8F, -10F);
|
||||
setRotation(FrontPanel, 0F, 0F, 0F);
|
||||
RightPanel = new ModelRenderer(this, 0, 35);
|
||||
RightPanel.addBox(0F, 0F, -10F, 2, 8, 20);
|
||||
RightPanel.setRotationPoint(-12F, -6F, 0F);
|
||||
setRotation(RightPanel, 0F, 0F, 0F);
|
||||
LeftPanel = new ModelRenderer(this, 24, 15);
|
||||
LeftPanel.addBox(0F, 0F, -10F, 2, 8, 20);
|
||||
LeftPanel.setRotationPoint(10F, -6F, 0F);
|
||||
setRotation(LeftPanel, 0F, 0F, 0F);
|
||||
BottomPanel = new ModelRenderer(this, 40, 43);
|
||||
BottomPanel.addBox(-12F, 0F, -10F, 24, 1, 20);
|
||||
BottomPanel.setRotationPoint(0F, 2F, 0F);
|
||||
setRotation(BottomPanel, 0F, 0F, 0F);
|
||||
RightHandle = new ModelRenderer(this, 92, 33);
|
||||
RightHandle.addBox(0F, 0F, 0F, 16, 2, 2);
|
||||
RightHandle.setRotationPoint(-28F, 0F, -7F);
|
||||
setRotation(RightHandle, 0F, 0F, 0F);
|
||||
LeftHandle = new ModelRenderer(this, 92, 38);
|
||||
LeftHandle.addBox(0F, 0F, 0F, 16, 2, 2);
|
||||
LeftHandle.setRotationPoint(-28F, 0F, 5F);
|
||||
setRotation(LeftHandle, 0F, 0F, 0F);
|
||||
RightSpokeUp = new ModelRenderer(this, 99, 3);
|
||||
RightSpokeUp.addBox(-2F, -8F, 0F, 4, 6, 1);
|
||||
RightSpokeUp.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(RightSpokeUp, 0F, 0F, 0F);
|
||||
RightSpokeRight = new ModelRenderer(this, 112, 15);
|
||||
RightSpokeRight.addBox(2F, -2F, 0F, 6, 4, 1);
|
||||
RightSpokeRight.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(RightSpokeRight, 0F, 0F, 0F);
|
||||
RightSpokeDown = new ModelRenderer(this, 99, 25);
|
||||
RightSpokeDown.addBox(-2F, 2F, 0F, 4, 6, 1);
|
||||
RightSpokeDown.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(RightSpokeDown, 0F, 0F, 0F);
|
||||
RightSpokeLeft = new ModelRenderer(this, 82, 15);
|
||||
RightSpokeLeft.addBox(-8F, -2F, 0F, 6, 4, 1);
|
||||
RightSpokeLeft.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(RightSpokeLeft, 0F, 0F, 0F);
|
||||
RightAxle = new ModelRenderer(this, 98, 14);
|
||||
RightAxle.addBox(-2F, -2F, 0F, 4, 4, 2);
|
||||
RightAxle.setRotationPoint(0F, 3F, -12F);
|
||||
setRotation(RightAxle, 0F, 0F, 0F);
|
||||
WheelRight1 = new ModelRenderer(this, 110, 3);
|
||||
WheelRight1.addBox(2F, -7F, 0F, 2, 2, 1);
|
||||
WheelRight1.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(WheelRight1, 0F, 0F, 0F);
|
||||
WheelRight2 = new ModelRenderer(this, 117, 5);
|
||||
WheelRight2.addBox(4F, -6F, 0F, 2, 2, 1);
|
||||
WheelRight2.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(WheelRight2, 0F, 0F, 0F);
|
||||
WheelRight3 = new ModelRenderer(this, 122, 9);
|
||||
WheelRight3.addBox(5F, -4F, 0F, 2, 2, 1);
|
||||
WheelRight3.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(WheelRight3, 0F, 0F, 0F);
|
||||
WheelRight4 = new ModelRenderer(this, 122, 23);
|
||||
WheelRight4.addBox(5F, 2F, 0F, 2, 2, 1);
|
||||
WheelRight4.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(WheelRight4, 0F, 0F, 0F);
|
||||
WheelRight5 = new ModelRenderer(this, 117, 27);
|
||||
WheelRight5.addBox(4F, 4F, 0F, 2, 2, 1);
|
||||
WheelRight5.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(WheelRight5, 0F, 0F, 0F);
|
||||
WheelRight6 = new ModelRenderer(this, 110, 29);
|
||||
WheelRight6.addBox(2F, 5F, 0F, 2, 2, 1);
|
||||
WheelRight6.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(WheelRight6, 0F, 0F, 0F);
|
||||
WheelRight7 = new ModelRenderer(this, 92, 29);
|
||||
WheelRight7.addBox(-4F, 5F, 0F, 2, 2, 1);
|
||||
WheelRight7.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(WheelRight7, 0F, 0F, 0F);
|
||||
WheelRight8 = new ModelRenderer(this, 85, 27);
|
||||
WheelRight8.addBox(-6F, 4F, 0F, 2, 2, 1);
|
||||
WheelRight8.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(WheelRight8, 0F, 0F, 0F);
|
||||
WheelRight9 = new ModelRenderer(this, 80, 23);
|
||||
WheelRight9.addBox(-7F, 2F, 0F, 2, 2, 1);
|
||||
WheelRight9.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(WheelRight9, 0F, 0F, 0F);
|
||||
WheelRight10 = new ModelRenderer(this, 80, 9);
|
||||
WheelRight10.addBox(-7F, -4F, 0F, 2, 2, 1);
|
||||
WheelRight10.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(WheelRight10, 0F, 0F, 0F);
|
||||
WheelRight11 = new ModelRenderer(this, 85, 5);
|
||||
WheelRight11.addBox(-6F, -6F, 0F, 2, 2, 1);
|
||||
WheelRight11.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(WheelRight11, 0F, 0F, 0F);
|
||||
WheelRight12 = new ModelRenderer(this, 92, 3);
|
||||
WheelRight12.addBox(-4F, -7F, 0F, 2, 2, 1);
|
||||
WheelRight12.setRotationPoint(0F, 3F, -11F);
|
||||
setRotation(WheelRight12, 0F, 0F, 0F);
|
||||
LeftSpokeRight = new ModelRenderer(this, 82, 15);
|
||||
LeftSpokeRight.addBox(-8F, -2F, 0F, 6, 4, 1);
|
||||
LeftSpokeRight.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(LeftSpokeRight, 0F, 0F, 0F);
|
||||
LeftSpokeLeft = new ModelRenderer(this, 112, 15);
|
||||
LeftSpokeLeft.addBox(2F, -2F, 0F, 6, 4, 1);
|
||||
LeftSpokeLeft.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(LeftSpokeLeft, 0F, 0F, 0F);
|
||||
LeftSpokeDown = new ModelRenderer(this, 99, 25);
|
||||
LeftSpokeDown.addBox(-2F, 2F, 0F, 4, 6, 1);
|
||||
LeftSpokeDown.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(LeftSpokeDown, 0F, 0F, 0F);
|
||||
LeftSpokeUp = new ModelRenderer(this, 99, 3);
|
||||
LeftSpokeUp.addBox(-2F, -8F, 0F, 4, 6, 1);
|
||||
LeftSpokeUp.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(LeftSpokeUp, 0F, 0F, 0F);
|
||||
LeftAxle = new ModelRenderer(this, 98, 14);
|
||||
LeftAxle.addBox(-2F, -2F, 0F, 4, 4, 2);
|
||||
LeftAxle.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(LeftAxle, 0F, 0F, 0F);
|
||||
WheelLeft1 = new ModelRenderer(this, 92, 3);
|
||||
WheelLeft1.addBox(-4F, -7F, 0F, 2, 2, 1);
|
||||
WheelLeft1.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(WheelLeft1, 0F, 0F, 0F);
|
||||
WheelLeft2 = new ModelRenderer(this, 117, 5);
|
||||
WheelLeft2.addBox(-6F, -6F, 0F, 2, 2, 1);
|
||||
WheelLeft2.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(WheelLeft2, 0F, 0F, 0F);
|
||||
WheelLeft3 = new ModelRenderer(this, 80, 9);
|
||||
WheelLeft3.addBox(-7F, -4F, 0F, 2, 2, 1);
|
||||
WheelLeft3.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(WheelLeft3, 0F, 0F, 0F);
|
||||
WheelLeft4 = new ModelRenderer(this, 80, 23);
|
||||
WheelLeft4.addBox(-7F, 2F, 0F, 2, 2, 1);
|
||||
WheelLeft4.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(WheelLeft4, 0F, 0F, 0F);
|
||||
WheelLeft5 = new ModelRenderer(this, 117, 27);
|
||||
WheelLeft5.addBox(-6F, 4F, 0F, 2, 2, 1);
|
||||
WheelLeft5.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(WheelLeft5, 0F, 0F, 0F);
|
||||
WheelLeft6 = new ModelRenderer(this, 110, 29);
|
||||
WheelLeft6.addBox(-4F, 5F, 0F, 2, 2, 1);
|
||||
WheelLeft6.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(WheelLeft6, 0F, 0F, 0F);
|
||||
WheelLeft7 = new ModelRenderer(this, 92, 29);
|
||||
WheelLeft7.addBox(2F, 5F, 0F, 2, 2, 1);
|
||||
WheelLeft7.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(WheelLeft7, 0F, 0F, 0F);
|
||||
WheelLeft8 = new ModelRenderer(this, 85, 27);
|
||||
WheelLeft8.addBox(4F, 4F, 0F, 2, 2, 1);
|
||||
WheelLeft8.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(WheelLeft8, 0F, 0F, 0F);
|
||||
WheelLeft9 = new ModelRenderer(this, 122, 23);
|
||||
WheelLeft9.addBox(5F, 2F, 0F, 2, 2, 1);
|
||||
WheelLeft9.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(WheelLeft9, 0F, 0F, 0F);
|
||||
WheelLeft10 = new ModelRenderer(this, 122, 9);
|
||||
WheelLeft10.addBox(5F, -4F, 0F, 2, 2, 1);
|
||||
WheelLeft10.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(WheelLeft10, 0F, 0F, 0F);
|
||||
WheelLeft11 = new ModelRenderer(this, 85, 5);
|
||||
WheelLeft11.addBox(4F, -6F, 0F, 2, 2, 1);
|
||||
WheelLeft11.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(WheelLeft11, 0F, 0F, 0F);
|
||||
WheelLeft12 = new ModelRenderer(this, 110, 3);
|
||||
WheelLeft12.addBox(2F, -7F, 0F, 2, 2, 1);
|
||||
WheelLeft12.setRotationPoint(0F, 3F, 10F);
|
||||
setRotation(WheelLeft12, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render (Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
BackPanel.render(f5);
|
||||
FrontPanel.render(f5);
|
||||
RightPanel.render(f5);
|
||||
LeftPanel.render(f5);
|
||||
BottomPanel.render(f5);
|
||||
RightHandle.render(f5);
|
||||
LeftHandle.render(f5);
|
||||
RightSpokeUp.render(f5);
|
||||
RightSpokeRight.render(f5);
|
||||
RightSpokeDown.render(f5);
|
||||
RightSpokeLeft.render(f5);
|
||||
RightAxle.render(f5);
|
||||
WheelRight1.render(f5);
|
||||
WheelRight2.render(f5);
|
||||
WheelRight3.render(f5);
|
||||
WheelRight4.render(f5);
|
||||
WheelRight5.render(f5);
|
||||
WheelRight6.render(f5);
|
||||
WheelRight7.render(f5);
|
||||
WheelRight8.render(f5);
|
||||
WheelRight9.render(f5);
|
||||
WheelRight10.render(f5);
|
||||
WheelRight11.render(f5);
|
||||
WheelRight12.render(f5);
|
||||
LeftSpokeRight.render(f5);
|
||||
LeftSpokeLeft.render(f5);
|
||||
LeftSpokeDown.render(f5);
|
||||
LeftSpokeUp.render(f5);
|
||||
LeftAxle.render(f5);
|
||||
WheelLeft1.render(f5);
|
||||
WheelLeft2.render(f5);
|
||||
WheelLeft3.render(f5);
|
||||
WheelLeft4.render(f5);
|
||||
WheelLeft5.render(f5);
|
||||
WheelLeft6.render(f5);
|
||||
WheelLeft7.render(f5);
|
||||
WheelLeft8.render(f5);
|
||||
WheelLeft9.render(f5);
|
||||
WheelLeft10.render(f5);
|
||||
WheelLeft11.render(f5);
|
||||
WheelLeft12.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation (ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles (float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
|
||||
{
|
||||
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,458 @@
|
||||
package tconstruct.mechworks.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelWagon extends ModelBase
|
||||
{
|
||||
ModelRenderer Bottom;
|
||||
ModelRenderer Left;
|
||||
ModelRenderer Right;
|
||||
ModelRenderer Back;
|
||||
ModelRenderer Front;
|
||||
ModelRenderer Leftpull;
|
||||
ModelRenderer Rightpull;
|
||||
ModelRenderer LeftWheelAxle;
|
||||
ModelRenderer LeftWCenterHbeam;
|
||||
ModelRenderer LeftWCenterVtop;
|
||||
ModelRenderer LeftWCenterVbottom;
|
||||
ModelRenderer LeftWnwH;
|
||||
ModelRenderer LeftWnwM;
|
||||
ModelRenderer LeftWnwV;
|
||||
ModelRenderer LeftWnwEye;
|
||||
ModelRenderer LeftWneH;
|
||||
ModelRenderer LeftWneM;
|
||||
ModelRenderer LeftWneV;
|
||||
ModelRenderer LeftWneEye;
|
||||
ModelRenderer LeftWswH;
|
||||
ModelRenderer LeftWswM;
|
||||
ModelRenderer LeftWswV;
|
||||
ModelRenderer LeftWswEye;
|
||||
ModelRenderer LeftWseH;
|
||||
ModelRenderer LeftWseM;
|
||||
ModelRenderer LeftWseV;
|
||||
ModelRenderer LeftWseEye;
|
||||
ModelRenderer RightWheelAxle;
|
||||
ModelRenderer RightWCenterHbeam;
|
||||
ModelRenderer RightWCenterVtop;
|
||||
ModelRenderer RightWCenterVbottom;
|
||||
ModelRenderer RightWnwH;
|
||||
ModelRenderer RightWnwM;
|
||||
ModelRenderer RightWnwV;
|
||||
ModelRenderer RightWnwEye;
|
||||
ModelRenderer RoghtWneH;
|
||||
ModelRenderer RightWneM;
|
||||
ModelRenderer RightWneV;
|
||||
ModelRenderer RightWneEye;
|
||||
ModelRenderer RightWswH;
|
||||
ModelRenderer RightWswM;
|
||||
ModelRenderer RightWswV;
|
||||
ModelRenderer RightWswEye;
|
||||
ModelRenderer RightWseH;
|
||||
ModelRenderer RightWseM;
|
||||
ModelRenderer RightWseV;
|
||||
public ModelRenderer RightWseEye;
|
||||
ModelRenderer HandBrakeMain;
|
||||
ModelRenderer HandbrakeJamb;
|
||||
ModelRenderer StandCenterBar;
|
||||
ModelRenderer StandLeft;
|
||||
ModelRenderer StandRight;
|
||||
|
||||
public ModelWagon()
|
||||
{
|
||||
this.textureWidth = 128;
|
||||
this.textureHeight = 64;
|
||||
this.Bottom = new ModelRenderer(this, 26, 46);
|
||||
this.Bottom.addBox(0.0F, 0.0F, 0.0F, 20, 2, 16);
|
||||
this.Bottom.setRotationPoint(-10.0F, 4.0F, -8.0F);
|
||||
this.Bottom.setTextureSize(64, 32);
|
||||
this.Bottom.mirror = true;
|
||||
this.setRotation(this.Bottom, 0.0F, 0.0F, 0.0F);
|
||||
this.Left = new ModelRenderer(this, 0, 35);
|
||||
this.Left.addBox(0.0F, 0.0F, 0.0F, 20, 8, 2);
|
||||
this.Left.setRotationPoint(-10.0F, -4.0F, -8.0F);
|
||||
this.Left.setTextureSize(64, 32);
|
||||
this.Left.mirror = true;
|
||||
this.setRotation(this.Left, 0.0F, 0.0F, 0.0F);
|
||||
this.Right = new ModelRenderer(this, 83, 35);
|
||||
this.Right.addBox(0.0F, 0.0F, 0.0F, 20, 8, 2);
|
||||
this.Right.setRotationPoint(-10.0F, -4.0F, 6.0F);
|
||||
this.Right.setTextureSize(64, 32);
|
||||
this.Right.mirror = true;
|
||||
this.setRotation(this.Right, 0.0F, 0.0F, 0.0F);
|
||||
this.Back = new ModelRenderer(this, 99, 46);
|
||||
this.Back.addBox(-2.0F, -5.0F, 0.0F, 2, 5, 12);
|
||||
this.Back.setRotationPoint(10.0F, 4.0F, -6.0F);
|
||||
this.Back.setTextureSize(64, 32);
|
||||
this.Back.mirror = true;
|
||||
this.setRotation(this.Back, 0.0F, 0.0F, 0.0F);
|
||||
this.Front = new ModelRenderer(this, 50, 1);
|
||||
this.Front.addBox(0.0F, 0.0F, 0.0F, 2, 8, 12);
|
||||
this.Front.setRotationPoint(-10.0F, -4.0F, -6.0F);
|
||||
this.Front.setTextureSize(64, 32);
|
||||
this.Front.mirror = true;
|
||||
this.setRotation(this.Front, 0.0F, 0.0F, 0.0F);
|
||||
this.Leftpull = new ModelRenderer(this, 0, 30);
|
||||
this.Leftpull.addBox(0.0F, 0.0F, 0.0F, 16, 2, 2);
|
||||
this.Leftpull.setRotationPoint(-26.0F, 2.0F, -6.0F);
|
||||
this.Leftpull.setTextureSize(64, 32);
|
||||
this.Leftpull.mirror = true;
|
||||
this.setRotation(this.Leftpull, 0.0F, 0.0F, 0.0F);
|
||||
this.Rightpull = new ModelRenderer(this, 91, 30);
|
||||
this.Rightpull.addBox(0.0F, 0.0F, 0.0F, 16, 2, 2);
|
||||
this.Rightpull.setRotationPoint(-26.0F, 2.0F, 4.0F);
|
||||
this.Rightpull.setTextureSize(64, 32);
|
||||
this.Rightpull.mirror = true;
|
||||
this.setRotation(this.Rightpull, 0.0F, 0.0F, 0.0F);
|
||||
this.HandBrakeMain = new ModelRenderer(this, 1, 59);
|
||||
this.HandBrakeMain.addBox(-6.0F, 0.0F, 0.0F, 11, 1, 1);
|
||||
this.HandBrakeMain.setRotationPoint(-9.0F, -3.0F, -9.0F);
|
||||
this.HandBrakeMain.setTextureSize(64, 32);
|
||||
this.HandBrakeMain.mirror = true;
|
||||
this.setRotation(this.HandBrakeMain, 0.0F, 0.0F, 0.0F);
|
||||
this.HandbrakeJamb = new ModelRenderer(this, 10, 62);
|
||||
this.HandbrakeJamb.addBox(3.0F, 1.0F, 0.0F, 2, 1, 1);
|
||||
this.HandbrakeJamb.setRotationPoint(-9.0F, -3.0F, -9.0F);
|
||||
this.HandbrakeJamb.setTextureSize(64, 32);
|
||||
this.HandbrakeJamb.mirror = true;
|
||||
this.setRotation(this.HandbrakeJamb, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWheelAxle = new ModelRenderer(this, 0, 12);
|
||||
this.LeftWheelAxle.addBox(-1.0F, -1.0F, -1.0F, 2, 2, 3);
|
||||
this.LeftWheelAxle.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWheelAxle.setTextureSize(64, 32);
|
||||
this.LeftWheelAxle.mirror = true;
|
||||
this.setRotation(this.LeftWheelAxle, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWCenterHbeam = new ModelRenderer(this, 12, 12);
|
||||
this.LeftWCenterHbeam.addBox(-8.0F, -2.0F, 0.0F, 16, 4, 1);
|
||||
this.LeftWCenterHbeam.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWCenterHbeam.setTextureSize(64, 32);
|
||||
this.LeftWCenterHbeam.mirror = true;
|
||||
this.setRotation(this.LeftWCenterHbeam, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWCenterVtop = new ModelRenderer(this, 18, 0);
|
||||
this.LeftWCenterVtop.addBox(-2.0F, -8.0F, 0.0F, 4, 6, 1);
|
||||
this.LeftWCenterVtop.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWCenterVtop.setTextureSize(64, 32);
|
||||
this.LeftWCenterVtop.mirror = true;
|
||||
this.setRotation(this.LeftWCenterVtop, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWCenterVbottom = new ModelRenderer(this, 18, 22);
|
||||
this.LeftWCenterVbottom.addBox(-2.0F, 2.0F, 0.0F, 4, 6, 1);
|
||||
this.LeftWCenterVbottom.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWCenterVbottom.setTextureSize(64, 32);
|
||||
this.LeftWCenterVbottom.mirror = true;
|
||||
this.setRotation(this.LeftWCenterVbottom, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWnwH = new ModelRenderer(this, 0, 7);
|
||||
this.LeftWnwH.addBox(-7.0F, -4.0F, 0.0F, 3, 2, 1);
|
||||
this.LeftWnwH.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWnwH.setTextureSize(64, 32);
|
||||
this.LeftWnwH.mirror = true;
|
||||
this.setRotation(this.LeftWnwH, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWnwM = new ModelRenderer(this, 4, 3);
|
||||
this.LeftWnwM.addBox(-6.0F, -6.0F, 0.0F, 2, 2, 1);
|
||||
this.LeftWnwM.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWnwM.setTextureSize(64, 32);
|
||||
this.LeftWnwM.mirror = true;
|
||||
this.setRotation(this.LeftWnwM, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWnwV = new ModelRenderer(this, 11, 1);
|
||||
this.LeftWnwV.addBox(-4.0F, -7.0F, 0.0F, 2, 3, 1);
|
||||
this.LeftWnwV.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWnwV.setTextureSize(64, 32);
|
||||
this.LeftWnwV.mirror = true;
|
||||
this.setRotation(this.LeftWnwV, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWnwEye = new ModelRenderer(this, 10, 7);
|
||||
this.LeftWnwEye.addBox(-4.0F, -4.0F, 0.0F, 1, 1, 1);
|
||||
this.LeftWnwEye.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWnwEye.setTextureSize(64, 32);
|
||||
this.LeftWnwEye.mirror = true;
|
||||
this.setRotation(this.LeftWnwEye, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWneH = new ModelRenderer(this, 40, 7);
|
||||
this.LeftWneH.addBox(4.0F, -4.0F, 0.0F, 3, 2, 1);
|
||||
this.LeftWneH.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWneH.setTextureSize(64, 32);
|
||||
this.LeftWneH.mirror = true;
|
||||
this.setRotation(this.LeftWneH, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWneM = new ModelRenderer(this, 37, 3);
|
||||
this.LeftWneM.addBox(4.0F, -6.0F, 0.0F, 2, 2, 1);
|
||||
this.LeftWneM.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWneM.setTextureSize(64, 32);
|
||||
this.LeftWneM.mirror = true;
|
||||
this.setRotation(this.LeftWneM, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWneV = new ModelRenderer(this, 29, 1);
|
||||
this.LeftWneV.addBox(2.0F, -7.0F, 0.0F, 2, 3, 1);
|
||||
this.LeftWneV.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWneV.setTextureSize(64, 32);
|
||||
this.LeftWneV.mirror = true;
|
||||
this.setRotation(this.LeftWneV, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWneEye = new ModelRenderer(this, 33, 7);
|
||||
this.LeftWneEye.addBox(3.0F, -4.0F, 0.0F, 1, 1, 1);
|
||||
this.LeftWneEye.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWneEye.setTextureSize(64, 32);
|
||||
this.LeftWneEye.mirror = true;
|
||||
this.setRotation(this.LeftWneEye, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWswH = new ModelRenderer(this, 0, 19);
|
||||
this.LeftWswH.addBox(-7.0F, 2.0F, 0.0F, 3, 2, 1);
|
||||
this.LeftWswH.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWswH.setTextureSize(64, 32);
|
||||
this.LeftWswH.mirror = true;
|
||||
this.setRotation(this.LeftWswH, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWswM = new ModelRenderer(this, 4, 23);
|
||||
this.LeftWswM.addBox(-6.0F, 4.0F, 0.0F, 2, 2, 1);
|
||||
this.LeftWswM.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWswM.setTextureSize(64, 32);
|
||||
this.LeftWswM.mirror = true;
|
||||
this.setRotation(this.LeftWswM, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWswV = new ModelRenderer(this, 11, 24);
|
||||
this.LeftWswV.addBox(-4.0F, 4.0F, 0.0F, 2, 3, 1);
|
||||
this.LeftWswV.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWswV.setTextureSize(64, 32);
|
||||
this.LeftWswV.mirror = true;
|
||||
this.setRotation(this.LeftWswV, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWswEye = new ModelRenderer(this, 10, 20);
|
||||
this.LeftWswEye.addBox(-4.0F, 3.0F, 0.0F, 1, 1, 1);
|
||||
this.LeftWswEye.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWswEye.setTextureSize(64, 32);
|
||||
this.LeftWswEye.mirror = true;
|
||||
this.setRotation(this.LeftWswEye, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWseH = new ModelRenderer(this, 40, 19);
|
||||
this.LeftWseH.addBox(4.0F, 2.0F, 0.0F, 3, 2, 1);
|
||||
this.LeftWseH.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWseH.setTextureSize(64, 32);
|
||||
this.LeftWseH.mirror = true;
|
||||
this.setRotation(this.LeftWseH, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWseM = new ModelRenderer(this, 37, 23);
|
||||
this.LeftWseM.addBox(4.0F, 4.0F, 0.0F, 2, 2, 1);
|
||||
this.LeftWseM.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWseM.setTextureSize(64, 32);
|
||||
this.LeftWseM.mirror = true;
|
||||
this.setRotation(this.LeftWseM, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWseV = new ModelRenderer(this, 29, 24);
|
||||
this.LeftWseV.addBox(2.0F, 4.0F, 0.0F, 2, 3, 1);
|
||||
this.LeftWseV.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWseV.setTextureSize(64, 32);
|
||||
this.LeftWseV.mirror = true;
|
||||
this.setRotation(this.LeftWseV, 0.0F, 0.0F, 0.0F);
|
||||
this.LeftWseEye = new ModelRenderer(this, 33, 20);
|
||||
this.LeftWseEye.addBox(3.0F, 3.0F, 0.0F, 1, 1, 1);
|
||||
this.LeftWseEye.setRotationPoint(0.0F, 5.0F, -10.0F);
|
||||
this.LeftWseEye.setTextureSize(64, 32);
|
||||
this.LeftWseEye.mirror = true;
|
||||
this.setRotation(this.LeftWseEye, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWheelAxle = new ModelRenderer(this, 117, 12);
|
||||
this.RightWheelAxle.addBox(-1.0F, -1.0F, -1.0F, 2, 2, 3);
|
||||
this.RightWheelAxle.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWheelAxle.setTextureSize(64, 32);
|
||||
this.RightWheelAxle.mirror = true;
|
||||
this.setRotation(this.RightWheelAxle, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWCenterHbeam = new ModelRenderer(this, 80, 12);
|
||||
this.RightWCenterHbeam.addBox(-8.0F, -2.0F, 0.0F, 16, 4, 1);
|
||||
this.RightWCenterHbeam.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWCenterHbeam.setTextureSize(64, 32);
|
||||
this.RightWCenterHbeam.mirror = true;
|
||||
this.setRotation(this.RightWCenterHbeam, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWCenterVtop = new ModelRenderer(this, 98, 0);
|
||||
this.RightWCenterVtop.addBox(-2.0F, -8.0F, 0.0F, 4, 6, 1);
|
||||
this.RightWCenterVtop.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWCenterVtop.setTextureSize(64, 32);
|
||||
this.RightWCenterVtop.mirror = true;
|
||||
this.setRotation(this.RightWCenterVtop, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWCenterVbottom = new ModelRenderer(this, 98, 22);
|
||||
this.RightWCenterVbottom.addBox(-2.0F, 2.0F, 0.0F, 4, 6, 1);
|
||||
this.RightWCenterVbottom.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWCenterVbottom.setTextureSize(64, 32);
|
||||
this.RightWCenterVbottom.mirror = true;
|
||||
this.setRotation(this.RightWCenterVbottom, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWnwH = new ModelRenderer(this, 79, 7);
|
||||
this.RightWnwH.addBox(4.0F, -4.0F, 0.0F, 3, 2, 1);
|
||||
this.RightWnwH.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWnwH.setTextureSize(64, 32);
|
||||
this.RightWnwH.mirror = true;
|
||||
this.setRotation(this.RightWnwH, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWnwM = new ModelRenderer(this, 84, 3);
|
||||
this.RightWnwM.addBox(4.0F, -6.0F, 0.0F, 2, 2, 1);
|
||||
this.RightWnwM.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWnwM.setTextureSize(64, 32);
|
||||
this.RightWnwM.mirror = true;
|
||||
this.setRotation(this.RightWnwM, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWnwV = new ModelRenderer(this, 91, 1);
|
||||
this.RightWnwV.addBox(2.0F, -7.0F, 0.0F, 2, 3, 1);
|
||||
this.RightWnwV.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWnwV.setTextureSize(64, 32);
|
||||
this.RightWnwV.mirror = true;
|
||||
this.setRotation(this.RightWnwV, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWnwEye = new ModelRenderer(this, 90, 7);
|
||||
this.RightWnwEye.addBox(3.0F, -4.0F, 0.0F, 1, 1, 1);
|
||||
this.RightWnwEye.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWnwEye.setTextureSize(64, 32);
|
||||
this.RightWnwEye.mirror = true;
|
||||
this.setRotation(this.RightWnwEye, 0.0F, 0.0F, 0.0F);
|
||||
this.RoghtWneH = new ModelRenderer(this, 119, 7);
|
||||
this.RoghtWneH.addBox(-7.0F, -4.0F, 0.0F, 3, 2, 1);
|
||||
this.RoghtWneH.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RoghtWneH.setTextureSize(64, 32);
|
||||
this.RoghtWneH.mirror = true;
|
||||
this.setRotation(this.RoghtWneH, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWneM = new ModelRenderer(this, 116, 3);
|
||||
this.RightWneM.addBox(-6.0F, -6.0F, 0.0F, 2, 2, 1);
|
||||
this.RightWneM.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWneM.setTextureSize(64, 32);
|
||||
this.RightWneM.mirror = true;
|
||||
this.setRotation(this.RightWneM, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWneV = new ModelRenderer(this, 109, 1);
|
||||
this.RightWneV.addBox(-4.0F, -7.0F, 0.0F, 2, 3, 1);
|
||||
this.RightWneV.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWneV.setTextureSize(64, 32);
|
||||
this.RightWneV.mirror = true;
|
||||
this.setRotation(this.RightWneV, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWneEye = new ModelRenderer(this, 113, 7);
|
||||
this.RightWneEye.addBox(-4.0F, -4.0F, 0.0F, 1, 1, 1);
|
||||
this.RightWneEye.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWneEye.setTextureSize(64, 32);
|
||||
this.RightWneEye.mirror = true;
|
||||
this.setRotation(this.RightWneEye, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWswH = new ModelRenderer(this, 79, 19);
|
||||
this.RightWswH.addBox(4.0F, 2.0F, 0.0F, 3, 2, 1);
|
||||
this.RightWswH.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWswH.setTextureSize(64, 32);
|
||||
this.RightWswH.mirror = true;
|
||||
this.setRotation(this.RightWswH, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWswM = new ModelRenderer(this, 84, 23);
|
||||
this.RightWswM.addBox(4.0F, 4.0F, 0.0F, 2, 2, 1);
|
||||
this.RightWswM.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWswM.setTextureSize(64, 32);
|
||||
this.RightWswM.mirror = true;
|
||||
this.setRotation(this.RightWswM, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWswV = new ModelRenderer(this, 91, 24);
|
||||
this.RightWswV.addBox(2.0F, 4.0F, 0.0F, 2, 3, 1);
|
||||
this.RightWswV.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWswV.setTextureSize(64, 32);
|
||||
this.RightWswV.mirror = true;
|
||||
this.setRotation(this.RightWswV, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWswEye = new ModelRenderer(this, 90, 20);
|
||||
this.RightWswEye.addBox(3.0F, 3.0F, 0.0F, 1, 1, 1);
|
||||
this.RightWswEye.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWswEye.setTextureSize(64, 32);
|
||||
this.RightWswEye.mirror = true;
|
||||
this.setRotation(this.RightWswEye, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWseH = new ModelRenderer(this, 119, 19);
|
||||
this.RightWseH.addBox(-7.0F, 2.0F, 0.0F, 3, 2, 1);
|
||||
this.RightWseH.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWseH.setTextureSize(64, 32);
|
||||
this.RightWseH.mirror = true;
|
||||
this.setRotation(this.RightWseH, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWseM = new ModelRenderer(this, 116, 23);
|
||||
this.RightWseM.addBox(-6.0F, 4.0F, 0.0F, 2, 2, 1);
|
||||
this.RightWseM.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWseM.setTextureSize(64, 32);
|
||||
this.RightWseM.mirror = true;
|
||||
this.setRotation(this.RightWseM, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWseV = new ModelRenderer(this, 109, 24);
|
||||
this.RightWseV.addBox(-4.0F, 4.0F, 0.0F, 2, 3, 1);
|
||||
this.RightWseV.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWseV.setTextureSize(64, 32);
|
||||
this.RightWseV.mirror = true;
|
||||
this.setRotation(this.RightWseV, 0.0F, 0.0F, 0.0F);
|
||||
this.RightWseEye = new ModelRenderer(this, 113, 20);
|
||||
this.RightWseEye.addBox(-4.0F, 3.0F, 0.0F, 1, 1, 1);
|
||||
this.RightWseEye.setRotationPoint(0.0F, 5.0F, 9.0F);
|
||||
this.RightWseEye.setTextureSize(64, 32);
|
||||
this.RightWseEye.mirror = true;
|
||||
this.setRotation(this.RightWseEye, 0.0F, 0.0F, 0.0F);
|
||||
this.StandCenterBar = new ModelRenderer(this, 47, 27);
|
||||
this.StandCenterBar.addBox(-1.0F, 0.0F, -8.0F, 1, 2, 16);
|
||||
this.StandCenterBar.setRotationPoint(-9.0F, 6.0F, 0.0F);
|
||||
this.StandCenterBar.setTextureSize(64, 32);
|
||||
this.StandCenterBar.mirror = true;
|
||||
this.setRotation(this.StandCenterBar, 0.0F, 0.0F, 0.0F);
|
||||
this.StandLeft = new ModelRenderer(this, 37, 27);
|
||||
this.StandLeft.addBox(-1.0F, 2.0F, -8.0F, 1, 5, 2);
|
||||
this.StandLeft.setRotationPoint(-9.0F, 6.0F, 0.0F);
|
||||
this.StandLeft.setTextureSize(64, 32);
|
||||
this.StandLeft.mirror = true;
|
||||
this.setRotation(this.StandLeft, 0.0F, 0.0F, 0.0F);
|
||||
this.StandRight = new ModelRenderer(this, 84, 27);
|
||||
this.StandRight.addBox(-1.0F, 2.0F, 6.0F, 1, 5, 2);
|
||||
this.StandRight.setRotationPoint(-9.0F, 6.0F, 0.0F);
|
||||
this.StandRight.setTextureSize(64, 32);
|
||||
this.StandRight.mirror = true;
|
||||
this.setRotation(this.StandRight, 0.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the models various rotation angles then renders the model.
|
||||
*/
|
||||
@Override
|
||||
public void render (Entity var1, float var2, float var3, float var4, float var5, float var6, float var7)
|
||||
{
|
||||
super.render(var1, var2, var3, var4, var5, var6, var7);
|
||||
this.setRotationAngles(var2, var3, var4, var5, var6, var7, var1);
|
||||
this.LeftWheelAxle.rotateAngleZ = this.LeftWCenterHbeam.rotateAngleZ = this.LeftWCenterVtop.rotateAngleZ = this.LeftWCenterVbottom.rotateAngleZ = this.LeftWnwH.rotateAngleZ = this.LeftWnwM.rotateAngleZ = this.LeftWnwV.rotateAngleZ = this.LeftWnwEye.rotateAngleZ = this.LeftWneH.rotateAngleZ = this.LeftWneM.rotateAngleZ = this.LeftWneV.rotateAngleZ = this.LeftWneEye.rotateAngleZ = this.LeftWswH.rotateAngleZ = this.LeftWswM.rotateAngleZ = this.LeftWswV.rotateAngleZ = this.LeftWswEye.rotateAngleZ = this.LeftWseH.rotateAngleZ = this.LeftWseM.rotateAngleZ = this.LeftWseV.rotateAngleZ = this.LeftWseEye.rotateAngleZ = this.RightWheelAxle.rotateAngleZ = this.RightWCenterHbeam.rotateAngleZ = this.RightWCenterVtop.rotateAngleZ = this.RightWCenterVbottom.rotateAngleZ = this.RightWnwH.rotateAngleZ = this.RightWnwM.rotateAngleZ = this.RightWnwV.rotateAngleZ = this.RightWnwEye.rotateAngleZ = this.RoghtWneH.rotateAngleZ = this.RightWneM.rotateAngleZ = this.RightWneV.rotateAngleZ = this.RightWneEye.rotateAngleZ = this.RightWswH.rotateAngleZ = this.RightWswM.rotateAngleZ = this.RightWswV.rotateAngleZ = this.RightWswEye.rotateAngleZ = this.RightWseH.rotateAngleZ = this.RightWseM.rotateAngleZ = this.RightWseV.rotateAngleZ = this.RightWseEye.rotateAngleZ;
|
||||
this.Bottom.render(var7);
|
||||
this.Left.render(var7);
|
||||
this.Right.render(var7);
|
||||
this.Back.render(var7);
|
||||
this.Front.render(var7);
|
||||
this.Leftpull.render(var7);
|
||||
this.Rightpull.render(var7);
|
||||
this.HandBrakeMain.render(var7);
|
||||
this.HandbrakeJamb.render(var7);
|
||||
this.LeftWheelAxle.render(var7);
|
||||
this.LeftWCenterHbeam.render(var7);
|
||||
this.LeftWCenterVtop.render(var7);
|
||||
this.LeftWCenterVbottom.render(var7);
|
||||
this.LeftWnwH.render(var7);
|
||||
this.LeftWnwM.render(var7);
|
||||
this.LeftWnwV.render(var7);
|
||||
this.LeftWnwEye.render(var7);
|
||||
this.LeftWneH.render(var7);
|
||||
this.LeftWneM.render(var7);
|
||||
this.LeftWneV.render(var7);
|
||||
this.LeftWneEye.render(var7);
|
||||
this.LeftWswH.render(var7);
|
||||
this.LeftWswM.render(var7);
|
||||
this.LeftWswV.render(var7);
|
||||
this.LeftWswEye.render(var7);
|
||||
this.LeftWseH.render(var7);
|
||||
this.LeftWseM.render(var7);
|
||||
this.LeftWseV.render(var7);
|
||||
this.LeftWseEye.render(var7);
|
||||
this.RightWheelAxle.render(var7);
|
||||
this.RightWCenterHbeam.render(var7);
|
||||
this.RightWCenterVtop.render(var7);
|
||||
this.RightWCenterVbottom.render(var7);
|
||||
this.RightWnwH.render(var7);
|
||||
this.RightWnwM.render(var7);
|
||||
this.RightWnwV.render(var7);
|
||||
this.RightWnwEye.render(var7);
|
||||
this.RoghtWneH.render(var7);
|
||||
this.RightWneM.render(var7);
|
||||
this.RightWneV.render(var7);
|
||||
this.RightWneEye.render(var7);
|
||||
this.RightWswH.render(var7);
|
||||
this.RightWswM.render(var7);
|
||||
this.RightWswV.render(var7);
|
||||
this.RightWswEye.render(var7);
|
||||
this.RightWseH.render(var7);
|
||||
this.RightWseM.render(var7);
|
||||
this.RightWseV.render(var7);
|
||||
this.RightWseEye.render(var7);
|
||||
this.StandCenterBar.render(var7);
|
||||
this.StandLeft.render(var7);
|
||||
this.StandRight.render(var7);
|
||||
}
|
||||
|
||||
private void setRotation (ModelRenderer var1, float var2, float var3, float var4)
|
||||
{
|
||||
var1.rotateAngleX = var2;
|
||||
var1.rotateAngleY = var3;
|
||||
var1.rotateAngleZ = var4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the models various rotation angles.
|
||||
*/
|
||||
@Override
|
||||
public void setRotationAngles (float var1, float var2, float var3, float var4, float var5, float var6, Entity par7Entity)
|
||||
{
|
||||
super.setRotationAngles(var1, var2, var3, var4, var5, var6, par7Entity);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user