mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-25 14:34:22 +00:00
Fix merge conflicts
This commit is contained in:
commit
145f7b9724
37 files changed
+3017
-776
No files matched your search
@@ -66,18 +66,21 @@ public class TConstruct
|
||||
|
||||
public static final int liquidUpdateAmount = 6;
|
||||
|
||||
// the entire mod
|
||||
public static final String modID = "TConstruct";
|
||||
|
||||
// Shared mod logger
|
||||
public static final Logger logger = LogManager.getLogger("TConstruct");
|
||||
public static final Logger logger = LogManager.getLogger(modID);
|
||||
|
||||
/* Instance of this mod, used for grabbing prototype fields */
|
||||
@Instance("TConstruct")
|
||||
@Instance(modID)
|
||||
public static TConstruct instance;
|
||||
/* Proxies for sides, used for graphics processing */
|
||||
@SidedProxy(clientSide = "tconstruct.client.TProxyClient", serverSide = "tconstruct.common.TProxyCommon")
|
||||
public static TProxyCommon proxy;
|
||||
|
||||
// Module loader
|
||||
public static final ModuleController moduleLoader = new ModuleController("TDynstruct.cfg", "TConstruct");
|
||||
public static final ModuleController moduleLoader = new ModuleController("TDynstruct.cfg", modID);
|
||||
|
||||
// The packet pipeline
|
||||
public static final PacketPipeline packetPipeline = new PacketPipeline();
|
||||
@@ -159,7 +162,7 @@ public class TConstruct
|
||||
packetPipeline.initalise();
|
||||
if (event.getSide() == Side.CLIENT)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(new EventCloakRender());
|
||||
//MinecraftForge.EVENT_BUS.register(new EventCloakRender());
|
||||
}
|
||||
|
||||
DimensionBlacklist.getBadBimensions();
|
||||
|
||||
@@ -153,7 +153,7 @@ public class ArmorProxyClient extends ArmorProxyCommon
|
||||
{
|
||||
updateCounter++;
|
||||
|
||||
ScaledResolution scaledresolution = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight);
|
||||
ScaledResolution scaledresolution = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight);
|
||||
int scaledWidth = scaledresolution.getScaledWidth();
|
||||
int scaledHeight = scaledresolution.getScaledHeight();
|
||||
int xBasePos = scaledWidth / 2 - 91;
|
||||
|
||||
@@ -159,7 +159,7 @@ public class DryingRack extends InventoryBlock
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
}
|
||||
return AxisAlignedBB.getAABBPool().getAABB((double) x + xMin, (double) y + yMin, (double) z + zMin, (double) x + xMax, (double) y + yMax, (double) z + zMax);
|
||||
return AxisAlignedBB.getBoundingBox((double) x + xMin, (double) y + yMin, (double) z + zMin, (double) x + xMax, (double) y + yMax, (double) z + zMax);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -296,7 +296,7 @@ public class DryingRack extends InventoryBlock
|
||||
/*
|
||||
* @Override public AxisAlignedBB getCollisionBoundingBoxFromPool (World
|
||||
* world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z);
|
||||
* if (meta != 1) { return AxisAlignedBB.getAABBPool().getAABB(x, y, z, x +
|
||||
* if (meta != 1) { return AxisAlignedBB.getBoundingBox(x, y, z, x +
|
||||
* 1, y + 1, z + 1); } else { FaucetLogic logic = (FaucetLogic)
|
||||
* world.getBlockTileEntity(x, y, z); if (logic != null) { float xMin =
|
||||
* 0.25F; float xMax = 0.75F; float zMin = 0.25F; float zMax = 0.75F;
|
||||
@@ -305,7 +305,7 @@ public class DryingRack extends InventoryBlock
|
||||
* break; case 3: zMax = 0.375F; zMin = 0F; break; case 4: xMin = 0.625F;
|
||||
* xMax = 1.0F; break; case 5: xMax = 0.375F; xMin = 0F; break; }
|
||||
*
|
||||
* return AxisAlignedBB.getAABBPool().getAABB((double) ((float) x + xMin),
|
||||
* return AxisAlignedBB.getBoundingBox((double) ((float) x + xMin),
|
||||
* (double) y + 0.25, (double) ((float) z + zMin), (double) ((float) x +
|
||||
* xMax), (double) y + 0.625, (double) ((float) z + zMax)); } }
|
||||
*
|
||||
|
||||
@@ -122,7 +122,7 @@ public class DryingRackLogic extends InventoryLogic
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AxisAlignedBB getRenderBoundingBox ()
|
||||
{
|
||||
AxisAlignedBB cbb = AxisAlignedBB.getAABBPool().getAABB(xCoord, yCoord - 1, zCoord, xCoord + 1, yCoord + 1, zCoord + 1);
|
||||
AxisAlignedBB cbb = AxisAlignedBB.getBoundingBox(xCoord, yCoord - 1, zCoord, xCoord + 1, yCoord + 1, zCoord + 1);
|
||||
return cbb;
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ public class Landmine extends MantleBlock
|
||||
{
|
||||
var8 = world.getEntitiesWithinAABBExcludingEntity(
|
||||
(Entity) null,
|
||||
AxisAlignedBB.getAABBPool().getAABB((double) ((float) posX + var7), (double) posY, (double) ((float) posZ + var7), (double) ((float) (posX + 1) - var7), (double) posY + 0.25D,
|
||||
AxisAlignedBB.getBoundingBox((double) ((float) posX + var7), (double) posY, (double) ((float) posZ + var7), (double) ((float) (posX + 1) - var7), (double) posY + 0.25D,
|
||||
(double) ((float) (posZ + 1) - var7)));
|
||||
}
|
||||
|
||||
@@ -192,14 +192,14 @@ public class Landmine extends MantleBlock
|
||||
{
|
||||
var8 = world.getEntitiesWithinAABB(
|
||||
EntityLiving.class,
|
||||
AxisAlignedBB.getAABBPool().getAABB((double) ((float) posX + var7), (double) posY, (double) ((float) posZ + var7), (double) ((float) (posX + 1) - var7), (double) posY + 0.25D,
|
||||
AxisAlignedBB.getBoundingBox((double) ((float) posX + var7), (double) posY, (double) ((float) posZ + var7), (double) ((float) (posX + 1) - var7), (double) posY + 0.25D,
|
||||
(double) ((float) (posZ + 1) - var7)));
|
||||
}
|
||||
|
||||
/*
|
||||
* if (this.triggerMobType == EnumCreatureType.players) { var8 =
|
||||
* world.getEntitiesWithinAABB( EntityPlayer.class,
|
||||
* AxisAlignedBB.getAABBPool().getAABB((double) ((float) posX + var7),
|
||||
* AxisAlignedBB.getBoundingBox((double) ((float) posX + var7),
|
||||
* (double) posY, (double) ((float) posZ + var7), (double) ((float)
|
||||
* (posX + 1) - var7), (double) posY + 0.25D, (double) ((float) (posZ +
|
||||
* 1) - var7))); }
|
||||
|
||||
@@ -62,9 +62,9 @@ public class EventCloakRender
|
||||
|
||||
capePlayers.add(abstractClientPlayer);
|
||||
|
||||
abstractClientPlayer.getTextureCape().textureUploaded = false;
|
||||
new Thread(new CloakThread(abstractClientPlayer, cloakURL)).start();
|
||||
event.renderCape = true;
|
||||
//abstractClientPlayer.getTextureCape().textureUploaded = false;
|
||||
//new Thread(new CloakThread(abstractClientPlayer, cloakURL)).start();
|
||||
//event.renderCape = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,9 +132,9 @@ public class EventCloakRender
|
||||
try
|
||||
{
|
||||
Image cape = new ImageIcon(new URL(cloakURL)).getImage();
|
||||
BufferedImage bo = new BufferedImage(cape.getWidth(null), cape.getHeight(null), BufferedImage.TYPE_INT_ARGB);
|
||||
bo.getGraphics().drawImage(cape, 0, 0, null);
|
||||
abstractClientPlayer.getTextureCape().setBufferedImage(bo);
|
||||
//BufferedImage bo = new BufferedImage(cape.getWidth(null), cape.getHeight(null), BufferedImage.TYPE_INT_ARGB);
|
||||
//bo.getGraphics().drawImage(cape, 0, 0, null);
|
||||
//abstractClientPlayer.getTextureCape().setBufferedImage(bo);
|
||||
}
|
||||
catch (MalformedURLException e)
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,285 @@
|
||||
package tconstruct.common;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor.ArmorMaterial;
|
||||
import net.minecraftforge.common.ChestGenHooks;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import tconstruct.*;
|
||||
import tconstruct.blocks.slime.*;
|
||||
import tconstruct.library.tools.*;
|
||||
import tconstruct.tools.modifiers.*;
|
||||
import tconstruct.world.blocks.*;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.ObjectHolder;
|
||||
|
||||
@ObjectHolder(TConstruct.modID)
|
||||
public class TRepo
|
||||
{
|
||||
// Supresses console spam when iguana's tweaks remove stuff
|
||||
public static boolean supressMissingToolLogs = false;
|
||||
|
||||
// Patterns and other materials
|
||||
public static Item blankPattern;
|
||||
public static Item materials;
|
||||
public static Item toolRod;
|
||||
public static Item toolShard;
|
||||
public static Item woodPattern;
|
||||
public static Item metalPattern;
|
||||
// public static Item armorPattern;
|
||||
|
||||
public static Item manualBook;
|
||||
public static Item buckets;
|
||||
public static Item titleIcon;
|
||||
|
||||
public static Item strangeFood;
|
||||
public static Item diamondApple;
|
||||
public static Item jerky;
|
||||
// public static Item stonePattern;
|
||||
// public static Item netherPattern;
|
||||
|
||||
// Tools
|
||||
public static ToolCore pickaxe;
|
||||
public static ToolCore shovel;
|
||||
public static ToolCore hatchet;
|
||||
public static ToolCore broadsword;
|
||||
public static ToolCore longsword;
|
||||
public static ToolCore rapier;
|
||||
public static ToolCore dagger;
|
||||
public static ToolCore cutlass;
|
||||
|
||||
public static ToolCore frypan;
|
||||
public static ToolCore battlesign;
|
||||
public static ToolCore chisel;
|
||||
public static ToolCore mattock;
|
||||
|
||||
public static ToolCore scythe;
|
||||
public static ToolCore lumberaxe;
|
||||
public static ToolCore cleaver;
|
||||
public static ToolCore excavator;
|
||||
public static ToolCore hammer;
|
||||
public static ToolCore battleaxe;
|
||||
|
||||
public static ToolCore shortbow;
|
||||
public static ToolCore arrow;
|
||||
|
||||
public static Item potionLauncher;
|
||||
|
||||
// Tool parts
|
||||
public static Item binding;
|
||||
public static Item toughBinding;
|
||||
public static Item toughRod;
|
||||
public static Item largePlate;
|
||||
|
||||
public static Item pickaxeHead;
|
||||
public static Item shovelHead;
|
||||
public static Item hatchetHead;
|
||||
public static Item frypanHead;
|
||||
public static Item signHead;
|
||||
public static Item chiselHead;
|
||||
public static Item scytheBlade;
|
||||
public static Item broadAxeHead;
|
||||
public static Item excavatorHead;
|
||||
public static Item hammerHead;
|
||||
|
||||
public static Item swordBlade;
|
||||
public static Item largeSwordBlade;
|
||||
public static Item knifeBlade;
|
||||
|
||||
public static Item wideGuard;
|
||||
public static Item handGuard;
|
||||
public static Item crossbar;
|
||||
public static Item fullGuard;
|
||||
|
||||
public static Item bowstring;
|
||||
public static Item arrowhead;
|
||||
public static Item fletching;
|
||||
|
||||
// Crafting blocks
|
||||
public static Block toolStationWood;
|
||||
public static Block toolStationStone;
|
||||
public static Block toolForge;
|
||||
public static Block craftingStationWood;
|
||||
public static Block craftingSlabWood;
|
||||
public static Block furnaceSlab;
|
||||
|
||||
public static Block heldItemBlock;
|
||||
public static Block battlesignBlock;
|
||||
public static Block craftedSoil;
|
||||
|
||||
public static Block smeltery;
|
||||
public static Block lavaTank;
|
||||
public static Block searedBlock;
|
||||
public static Block castingChannel;
|
||||
public static Block metalBlock;
|
||||
public static Block tankAir;
|
||||
public static Block smelteryNether;
|
||||
public static Block lavaTankNether;
|
||||
public static Block searedBlockNether;
|
||||
|
||||
public static Block dryingRack;
|
||||
|
||||
// Decoration
|
||||
public static Block stoneTorch;
|
||||
public static Block stoneLadder;
|
||||
public static Block multiBrick;
|
||||
public static Block multiBrickFancy;
|
||||
|
||||
public static Block searedSlab;
|
||||
public static Block speedSlab;
|
||||
|
||||
public static Block meatBlock;
|
||||
public static Block woolSlab1;
|
||||
public static Block woolSlab2;
|
||||
public static Block glueBlock;
|
||||
|
||||
// Traps
|
||||
public static Block landmine;
|
||||
public static Block punji;
|
||||
public static Block barricadeOak;
|
||||
public static Block barricadeSpruce;
|
||||
public static Block barricadeBirch;
|
||||
public static Block barricadeJungle;
|
||||
public static Block slimeExplosive;
|
||||
|
||||
// InfiBlocks
|
||||
public static Block speedBlock;
|
||||
public static Block clearGlass;
|
||||
// public static Block stainedGlass;
|
||||
public static Block stainedGlassClear;
|
||||
public static Block glassPane;
|
||||
// public static Block stainedGlassPane;
|
||||
public static Block stainedGlassClearPane;
|
||||
public static Block glassMagicSlab;
|
||||
public static Block stainedGlassMagicSlab;
|
||||
public static Block stainedGlassClearMagicSlab;
|
||||
|
||||
// Liquids
|
||||
public static Material liquidMetal;
|
||||
|
||||
public static Fluid moltenIronFluid;
|
||||
public static Fluid moltenGoldFluid;
|
||||
public static Fluid moltenCopperFluid;
|
||||
public static Fluid moltenTinFluid;
|
||||
public static Fluid moltenAluminumFluid;
|
||||
public static Fluid moltenCobaltFluid;
|
||||
public static Fluid moltenArditeFluid;
|
||||
public static Fluid moltenBronzeFluid;
|
||||
public static Fluid moltenAlubrassFluid;
|
||||
public static Fluid moltenManyullynFluid;
|
||||
public static Fluid moltenAlumiteFluid;
|
||||
public static Fluid moltenObsidianFluid;
|
||||
public static Fluid moltenSteelFluid;
|
||||
public static Fluid moltenGlassFluid;
|
||||
public static Fluid moltenStoneFluid;
|
||||
public static Fluid moltenEmeraldFluid;
|
||||
public static Fluid bloodFluid;
|
||||
public static Fluid moltenNickelFluid;
|
||||
public static Fluid moltenLeadFluid;
|
||||
public static Fluid moltenSilverFluid;
|
||||
public static Fluid moltenShinyFluid;
|
||||
public static Fluid moltenInvarFluid;
|
||||
public static Fluid moltenElectrumFluid;
|
||||
public static Fluid moltenEnderFluid;
|
||||
public static Fluid blueSlimeFluid;
|
||||
public static Fluid pigIronFluid;
|
||||
|
||||
public static Block moltenIron;
|
||||
public static Block moltenGold;
|
||||
public static Block moltenCopper;
|
||||
public static Block moltenTin;
|
||||
public static Block moltenAluminum;
|
||||
public static Block moltenCobalt;
|
||||
public static Block moltenArdite;
|
||||
public static Block moltenBronze;
|
||||
public static Block moltenAlubrass;
|
||||
public static Block moltenManyullyn;
|
||||
public static Block moltenAlumite;
|
||||
public static Block moltenObsidian;
|
||||
public static Block moltenSteel;
|
||||
public static Block moltenGlass;
|
||||
public static Block moltenStone;
|
||||
public static Block moltenEmerald;
|
||||
public static Block blood;
|
||||
public static Block moltenNickel;
|
||||
public static Block moltenLead;
|
||||
public static Block moltenSilver;
|
||||
public static Block moltenShiny;
|
||||
public static Block moltenInvar;
|
||||
public static Block moltenElectrum;
|
||||
public static Block moltenEnder;
|
||||
|
||||
// Slime
|
||||
public static SoundType slimeStep;
|
||||
public static Block slimePool;
|
||||
public static Block slimeGel;
|
||||
public static Block slimeGrass;
|
||||
public static Block slimeTallGrass;
|
||||
public static SlimeLeaves slimeLeaves;
|
||||
public static SlimeSapling slimeSapling;
|
||||
|
||||
public static Block slimeChannel;
|
||||
public static Block slimePad;
|
||||
public static Block bloodChannel;
|
||||
|
||||
// Glue
|
||||
public static Fluid glueFluid;
|
||||
public static Block glueFluidBlock;
|
||||
|
||||
// Ores
|
||||
public static Block oreSlag;
|
||||
public static Block oreGravel;
|
||||
public static OreberryBush oreBerry;
|
||||
public static OreberryBush oreBerrySecond;
|
||||
public static Item oreBerries;
|
||||
|
||||
// Tool modifiers
|
||||
public static ModFlux modFlux;
|
||||
public static ModLapis modLapis;
|
||||
public static ModAttack modAttack;
|
||||
|
||||
public static Item creativeModifier;
|
||||
|
||||
// Wearables
|
||||
public static Item heavyHelmet;
|
||||
public static Item heavyChestplate;
|
||||
public static Item heavyPants;
|
||||
public static Item heavyBoots;
|
||||
public static Item glove;
|
||||
public static Item knapsack;
|
||||
|
||||
public static Item heartCanister;
|
||||
public static Item goldHead;
|
||||
|
||||
// Rail-related
|
||||
public static Block woodenRail;
|
||||
|
||||
// Chest hooks
|
||||
public static ChestGenHooks tinkerHouseChest;
|
||||
public static ChestGenHooks tinkerHousePatterns;
|
||||
|
||||
// Armor - basic
|
||||
public static Item helmetWood;
|
||||
public static Item chestplateWood;
|
||||
public static Item leggingsWood;
|
||||
public static Item bootsWood;
|
||||
public static ArmorMaterial materialWood;
|
||||
|
||||
// Armor - exosuit
|
||||
public static Item exoGoggles;
|
||||
public static Item exoChest;
|
||||
public static Item exoPants;
|
||||
public static Item exoShoes;
|
||||
|
||||
public static Fluid[] fluids = new Fluid[27];
|
||||
public static Block[] fluidBlocks = new Block[26];
|
||||
|
||||
// recipe stuff
|
||||
public static boolean thaumcraftAvailable;
|
||||
public static boolean initRecipes;
|
||||
public static Item[] patternOutputs;
|
||||
public static FluidStack[] liquids;
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -247,56 +248,26 @@ public class Battleaxe extends HarvestTool
|
||||
if (!stack.hasTagCompound())
|
||||
return false;
|
||||
|
||||
World world = player.worldObj;
|
||||
final Block wood = world.getBlock(x, y, z);
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
for (int yPos = y + 1; yPos < y + 9; yPos++)
|
||||
if (player instanceof EntityPlayerMP)
|
||||
{
|
||||
Block block = world.getBlock(x, yPos, z);
|
||||
if (!(tags.getBoolean("Broken")) && block != null && block.getMaterial() == Material.wood)
|
||||
EntityPlayerMP mplayer = (EntityPlayerMP)player;
|
||||
World world = player.worldObj;
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (!tags.hasKey("AOEBreaking") || !tags.getBoolean("AOEBreaking"))
|
||||
{
|
||||
Block localblock = world.getBlock(x, yPos, z);
|
||||
int localMeta = world.getBlockMetadata(x, yPos, z);
|
||||
int hlvl = block.getHarvestLevel(meta);
|
||||
|
||||
if (hlvl <= tags.getInteger("HarvestLevel"))
|
||||
tags.setBoolean("AOEBreaking", true);
|
||||
for (int yPos = y + 1; yPos < y + 9; yPos++)
|
||||
{
|
||||
boolean cancelHarvest = false;
|
||||
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
|
||||
{
|
||||
if (mod.beforeBlockBreak(this, stack, x, yPos, z, player))
|
||||
cancelHarvest = true;
|
||||
}
|
||||
|
||||
if (!cancelHarvest)
|
||||
{
|
||||
if (block != null && block.getMaterial() == Material.wood)
|
||||
{
|
||||
localMeta = world.getBlockMetadata(x, yPos, z);
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
if (block.removedByPlayer(world, player, x, yPos, z))
|
||||
{
|
||||
block.onBlockDestroyedByPlayer(world, x, yPos, z, localMeta);
|
||||
}
|
||||
block.harvestBlock(world, player, x, yPos, z, localMeta);
|
||||
block.onBlockHarvested(world, x, yPos, z, localMeta, player);
|
||||
onBlockDestroyed(stack, world, block, x, yPos, z, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
WorldHelper.setBlockToAir(world, x, yPos, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
Block block = world.getBlock(x, yPos, z);
|
||||
if (block != null && block.getMaterial() == Material.wood
|
||||
&& block.getPlayerRelativeBlockHardness(mplayer, world, x, yPos, z) > 0)
|
||||
mplayer.theItemInWorldManager.tryHarvestBlock(x, yPos, z);
|
||||
else
|
||||
break;
|
||||
}
|
||||
tags.setBoolean("AOEBreaking", false);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (!world.isRemote)
|
||||
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(wood) + (meta << 12));
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import mantle.world.WorldHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -141,107 +142,54 @@ public class Excavator extends HarvestTool
|
||||
return false;
|
||||
|
||||
World world = player.worldObj;
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (!stack.hasTagCompound())
|
||||
return false;
|
||||
|
||||
if (block == null)
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
|
||||
float blockHardness = block.getBlockHardness(world, x, y, z);
|
||||
|
||||
boolean validStart = false;
|
||||
for (int iter = 0; iter < materials.length; iter++)
|
||||
{
|
||||
if (materials[iter] == block.getMaterial())
|
||||
{
|
||||
validStart = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
MovingObjectPosition mop = AbilityHelper.raytraceFromEntity(world, player, true, 5.0D);
|
||||
if (mop == null || !validStart)
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
|
||||
int xRange = 1;
|
||||
int yRange = 1;
|
||||
int zRange = 1;
|
||||
switch (mop.sideHit)
|
||||
if (mop != null && player instanceof EntityPlayerMP)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
yRange = 0;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
zRange = 0;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
xRange = 0;
|
||||
break;
|
||||
}
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
for (int xPos = x - xRange; xPos <= x + xRange; xPos++)
|
||||
{
|
||||
for (int yPos = y - yRange; yPos <= y + yRange; yPos++)
|
||||
EntityPlayerMP mplayer = (EntityPlayerMP) player;
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (!tags.hasKey("AOEBreaking") || !tags.getBoolean("AOEBreaking"))
|
||||
{
|
||||
for (int zPos = z - zRange; zPos <= z + zRange; zPos++)
|
||||
tags.setBoolean("AOEBreaking", true);
|
||||
|
||||
int xRange = 1;
|
||||
int yRange = 1;
|
||||
int zRange = 1;
|
||||
switch (mop.sideHit)
|
||||
{
|
||||
if (!(tags.getBoolean("Broken")))
|
||||
case 0:
|
||||
case 1:
|
||||
yRange = 0;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
zRange = 0;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
xRange = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
for (int xPos = x - xRange; xPos <= x + xRange; xPos++)
|
||||
{
|
||||
for (int yPos = y - yRange; yPos <= y + yRange; yPos++)
|
||||
{
|
||||
Block localblock = world.getBlock(xPos, yPos, zPos);
|
||||
block = localblock;
|
||||
int localMeta = world.getBlockMetadata(xPos, yPos, zPos);
|
||||
int hlvl = block.getHarvestLevel(meta);
|
||||
float localHardness = block == null ? Float.MAX_VALUE : block.getBlockHardness(world, xPos, yPos, zPos);
|
||||
|
||||
if (hlvl <= tags.getInteger("HarvestLevel") && localHardness - 1.5 <= blockHardness)
|
||||
for (int zPos = z - zRange; zPos <= z + zRange; zPos++)
|
||||
{
|
||||
boolean cancelHarvest = false;
|
||||
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
|
||||
Block block = world.getBlock(xPos, yPos, zPos);
|
||||
for (Material mat : this.materials)
|
||||
{
|
||||
if (mod.beforeBlockBreak(this, stack, xPos, yPos, zPos, player))
|
||||
cancelHarvest = true;
|
||||
}
|
||||
|
||||
if (!cancelHarvest)
|
||||
{
|
||||
if (block != null && !(localHardness < 0))
|
||||
{
|
||||
for (int iter = 0; iter < materials.length; iter++)
|
||||
{
|
||||
if (materials[iter] == block.getMaterial())
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
if (block.removedByPlayer(world, player, xPos, yPos, zPos))
|
||||
{
|
||||
block.onBlockDestroyedByPlayer(world, xPos, yPos, zPos, localMeta);
|
||||
}
|
||||
block.harvestBlock(world, player, xPos, yPos, zPos, localMeta);
|
||||
block.onBlockHarvested(world, xPos, yPos, zPos, localMeta, player);
|
||||
if (blockHardness > 0f)
|
||||
onBlockDestroyed(stack, world, localblock, xPos, yPos, zPos, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
WorldHelper.setBlockToAir(world, xPos, yPos, zPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (block != null && mat == block.getMaterial()
|
||||
&& block.getPlayerRelativeBlockHardness(mplayer, world, x, yPos, z) > 0)
|
||||
mplayer.theItemInWorldManager.tryHarvestBlock(xPos, yPos, zPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
tags.setBoolean("AOEBreaking", false);
|
||||
}
|
||||
}
|
||||
if (!world.isRemote)
|
||||
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));
|
||||
return true;
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -235,115 +236,54 @@ public class Hammer extends HarvestTool
|
||||
return false;
|
||||
|
||||
World world = player.worldObj;
|
||||
final Block block = world.getBlock(x, y, z);
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
if (!stack.hasTagCompound())
|
||||
return false;
|
||||
|
||||
if (block == null)
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
|
||||
float blockHardness = block.getBlockHardness(world, x, y, z);
|
||||
|
||||
boolean validStart = false;
|
||||
for (int iter = 0; iter < materials.length; iter++)
|
||||
{
|
||||
if (materials[iter] == block.getMaterial())
|
||||
{
|
||||
validStart = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (block == Blocks.monster_egg)
|
||||
validStart = true;
|
||||
|
||||
MovingObjectPosition mop = AbilityHelper.raytraceFromEntity(world, player, true, 4.5D);
|
||||
if (mop == null || !validStart)
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
|
||||
int xRange = 1;
|
||||
int yRange = 1;
|
||||
int zRange = 1;
|
||||
switch (mop.sideHit)
|
||||
if (mop != null && player instanceof EntityPlayerMP)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
yRange = 0;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
zRange = 0;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
xRange = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
int toolLevel = tags.getInteger("HarvestLevel");
|
||||
for (int xPos = x - xRange; xPos <= x + xRange; xPos++)
|
||||
{
|
||||
for (int yPos = y - yRange; yPos <= y + yRange; yPos++)
|
||||
EntityPlayerMP mplayer = (EntityPlayerMP) player;
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (!tags.hasKey("AOEBreaking") || !tags.getBoolean("AOEBreaking"))
|
||||
{
|
||||
for (int zPos = z - zRange; zPos <= z + zRange; zPos++)
|
||||
tags.setBoolean("AOEBreaking", true);
|
||||
|
||||
int xRange = 1;
|
||||
int yRange = 1;
|
||||
int zRange = 1;
|
||||
switch (mop.sideHit)
|
||||
{
|
||||
if (!(tags.getBoolean("Broken")))
|
||||
case 0:
|
||||
case 1:
|
||||
yRange = 0;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
zRange = 0;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
xRange = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
for (int xPos = x - xRange; xPos <= x + xRange; xPos++)
|
||||
{
|
||||
for (int yPos = y - yRange; yPos <= y + yRange; yPos++)
|
||||
{
|
||||
Block localBlock = world.getBlock(xPos, yPos, zPos);
|
||||
int localMeta = world.getBlockMetadata(xPos, yPos, zPos);
|
||||
int hlvl = -1;
|
||||
if (localBlock.getHarvestTool(localMeta) != null && localBlock.getHarvestTool(localMeta).equals(this.getHarvestType()))
|
||||
hlvl = localBlock.getHarvestLevel(localMeta);
|
||||
float localHardness = localBlock == null ? Float.MAX_VALUE : localBlock.getBlockHardness(world, xPos, yPos, zPos);
|
||||
|
||||
if (hlvl <= toolLevel && localHardness - 1.5 <= blockHardness)
|
||||
for (int zPos = z - zRange; zPos <= z + zRange; zPos++)
|
||||
{
|
||||
boolean cancelHarvest = false;
|
||||
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
|
||||
Block block = world.getBlock(xPos, yPos, zPos);
|
||||
for (Material mat : this.materials)
|
||||
{
|
||||
if (mod.beforeBlockBreak(this, stack, xPos, yPos, zPos, player))
|
||||
cancelHarvest = true;
|
||||
}
|
||||
|
||||
if (!cancelHarvest)
|
||||
{
|
||||
if (localBlock != null && !(localHardness < 0))
|
||||
{
|
||||
for (int iter = 0; iter < materials.length; iter++)
|
||||
{
|
||||
if (materials[iter] == localBlock.getMaterial() || localBlock == Blocks.monster_egg)
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
if (localBlock.removedByPlayer(world, player, xPos, yPos, zPos))
|
||||
{
|
||||
localBlock.onBlockDestroyedByPlayer(world, xPos, yPos, zPos, localMeta);
|
||||
}
|
||||
localBlock.harvestBlock(world, player, xPos, yPos, zPos, localMeta);
|
||||
localBlock.onBlockHarvested(world, xPos, yPos, zPos, localMeta, player);
|
||||
if (blockHardness > 0f)
|
||||
onBlockDestroyed(stack, world, localBlock, xPos, yPos, zPos, player);
|
||||
world.func_147479_m(x, y, z);
|
||||
}
|
||||
else
|
||||
{
|
||||
WorldHelper.setBlockToAir(world, xPos, yPos, zPos);
|
||||
world.func_147479_m(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (block != null && mat == block.getMaterial()
|
||||
&& block.getPlayerRelativeBlockHardness(mplayer, world, x, yPos, z) > 0)
|
||||
mplayer.theItemInWorldManager.tryHarvestBlock(xPos, yPos, zPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
tags.setBoolean("AOEBreaking", false);
|
||||
}
|
||||
}
|
||||
if (!world.isRemote)
|
||||
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));
|
||||
return true;
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,6 +5,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -135,150 +136,81 @@ public class LumberAxe extends HarvestTool
|
||||
if (!stack.hasTagCompound())
|
||||
return false;
|
||||
|
||||
World world = player.worldObj;
|
||||
final Block wood = world.getBlock(x, y, z);
|
||||
;
|
||||
if (wood == null)
|
||||
if (player instanceof EntityPlayerMP)
|
||||
{
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
}
|
||||
if (wood.isWood(world, x, y, z) || wood.getMaterial() == Material.sponge)
|
||||
{
|
||||
int height = y;
|
||||
boolean foundTop = false;
|
||||
do
|
||||
EntityPlayerMP mplayer = (EntityPlayerMP) player;
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (!tags.hasKey("AOEBreaking") || !tags.getBoolean("AOEBreaking"))
|
||||
{
|
||||
height++;
|
||||
Block block = world.getBlock(x, height, z);
|
||||
if (block != wood)
|
||||
tags.setBoolean("AOEBreaking", true);
|
||||
World world = player.worldObj;
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (block.isWood(world, x, y, z))
|
||||
{
|
||||
height--;
|
||||
foundTop = true;
|
||||
}
|
||||
} while (!foundTop);
|
||||
|
||||
int numLeaves = 0;
|
||||
if (height - y < 50)
|
||||
{
|
||||
for (int xPos = x - 1; xPos <= x + 1; xPos++)
|
||||
{
|
||||
for (int yPos = height - 1; yPos <= height + 1; yPos++)
|
||||
int height = y;
|
||||
while (true)
|
||||
{
|
||||
for (int zPos = z - 1; zPos <= z + 1; zPos++)
|
||||
height++;
|
||||
if (block != world.getBlock(x, height, z))
|
||||
{
|
||||
Block leaves = world.getBlock(xPos, yPos, zPos);
|
||||
if (leaves != null && leaves.isLeaves(world, xPos, yPos, zPos))
|
||||
numLeaves++;
|
||||
height--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int numLeaves = 0;
|
||||
if (height - y < 50)
|
||||
{
|
||||
for (int xPos = x - 1; xPos <= x + 1; xPos++)
|
||||
{
|
||||
for (int zPos = z - 1; zPos <= z + 1; zPos++)
|
||||
{
|
||||
for (int yPos = height - 1; yPos <= height + 1; yPos++)
|
||||
{
|
||||
Block leaf = world.getBlock(xPos, yPos, zPos);
|
||||
if (leaf != null && leaf.isLeaves(world, xPos, yPos, zPos))
|
||||
numLeaves++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (numLeaves > 3)
|
||||
breakTree(world, x, y, z, stack, tags, block, world.getBlockMetadata(x, y, z), mplayer);
|
||||
else
|
||||
destroyWood(world, x, y, z, stack, tags, mplayer);
|
||||
}
|
||||
else if (block.getMaterial() == Material.wood)
|
||||
{
|
||||
destroyWood(world, x, y, z, stack, tags, mplayer);
|
||||
}
|
||||
tags.setBoolean("AOEBreaking", false);
|
||||
}
|
||||
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (numLeaves > 3)
|
||||
breakTree(world, x, y, z, stack, tags, wood, meta, player);
|
||||
else
|
||||
destroyWood(world, x, y, z, stack, tags, player);
|
||||
|
||||
if (!world.isRemote)
|
||||
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(wood) + (meta << 12));
|
||||
}
|
||||
else if (wood.getMaterial() == Material.wood)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
destroyWood(world, x, y, z, stack, tags, player);
|
||||
if (!world.isRemote)
|
||||
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(wood) + (meta << 12));
|
||||
}
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
}
|
||||
|
||||
void breakTree (World world, int x, int y, int z, ItemStack stack, NBTTagCompound tags, Block bID, int meta, EntityPlayer player)
|
||||
void breakTree (World world, int x, int y, int z, ItemStack stack, NBTTagCompound tags, Block bID, int meta, EntityPlayerMP player)
|
||||
{
|
||||
Block block;
|
||||
for (int xPos = x - 1; xPos <= x + 1; xPos++)
|
||||
{
|
||||
for (int yPos = y; yPos <= y + 1; yPos++)
|
||||
{
|
||||
for (int zPos = z - 1; zPos <= z + 1; zPos++)
|
||||
{
|
||||
if (!(tags.getBoolean("Broken")))
|
||||
Block block = world.getBlock(xPos, yPos, zPos);
|
||||
if (bID == block && world.getBlockMetadata(xPos, yPos, zPos) == meta)
|
||||
{
|
||||
Block localblock = world.getBlock(xPos, yPos, zPos);
|
||||
if (bID == localblock)
|
||||
{
|
||||
block = localblock;
|
||||
meta = world.getBlockMetadata(xPos, yPos, zPos);
|
||||
int hlvl = block.getHarvestLevel(meta);
|
||||
|
||||
if (hlvl <= tags.getInteger("HarvestLevel"))
|
||||
{
|
||||
boolean cancelHarvest = false;
|
||||
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
|
||||
{
|
||||
if (mod.beforeBlockBreak(this, stack, xPos, yPos, zPos, player))
|
||||
cancelHarvest = true;
|
||||
}
|
||||
|
||||
if (cancelHarvest)
|
||||
{
|
||||
breakTree(world, xPos, yPos, zPos, stack, tags, bID, meta, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (localblock == bID && world.getBlockMetadata(xPos, yPos, zPos) % 4 == meta % 4)
|
||||
{
|
||||
/*
|
||||
* world.setBlock(xPos, yPos, zPos, 0,
|
||||
* 0, 3); if
|
||||
* (!player.capabilities.isCreativeMode)
|
||||
* {
|
||||
* Block.blocksList[bID].harvestBlock(world
|
||||
* , player, xPos, yPos, zPos, meta);
|
||||
* onBlockDestroyed(stack, world, bID,
|
||||
* xPos, yPos, zPos, player); }
|
||||
*/
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
if (block.removedByPlayer(world, player, xPos, yPos, zPos))
|
||||
{
|
||||
block.onBlockDestroyedByPlayer(world, xPos, yPos, zPos, meta);
|
||||
}
|
||||
block.harvestBlock(world, player, xPos, yPos, zPos, meta);
|
||||
block.onBlockHarvested(world, xPos, yPos, zPos, meta, player);
|
||||
onBlockDestroyed(stack, world, localblock, xPos, yPos, zPos, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
WorldHelper.setBlockToAir(world, xPos, yPos, zPos);
|
||||
}
|
||||
breakTree(world, xPos, yPos, zPos, stack, tags, bID, meta, player);
|
||||
}
|
||||
/*
|
||||
* else { Block leaves =
|
||||
* Block.blocksList[localID]; if (leaves !=
|
||||
* null && leaves.isLeaves(world, xPos,
|
||||
* yPos, zPos)) {
|
||||
* WorldHelper.setBlockToAir(world, xPos,
|
||||
* yPos, zPos); if
|
||||
* (!player.capabilities.isCreativeMode) {
|
||||
* Block.blocksList[bID].harvestBlock(world,
|
||||
* player, xPos, yPos, zPos, meta);
|
||||
* onBlockDestroyed(stack, world, bID, xPos,
|
||||
* yPos, zPos, player); } } }
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
if (block.getPlayerRelativeBlockHardness(player, world, x, yPos, z) > 0)
|
||||
player.theItemInWorldManager.tryHarvestBlock(x, yPos, z);
|
||||
breakTree(world, xPos, yPos, zPos, stack, tags, bID, meta, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void destroyWood (World world, int x, int y, int z, ItemStack stack, NBTTagCompound tags, EntityPlayer player)
|
||||
void destroyWood (World world, int x, int y, int z, ItemStack stack, NBTTagCompound tags, EntityPlayerMP player)
|
||||
{
|
||||
for (int xPos = x - 1; xPos <= x + 1; xPos++)
|
||||
{
|
||||
@@ -286,36 +218,10 @@ public class LumberAxe extends HarvestTool
|
||||
{
|
||||
for (int zPos = z - 1; zPos <= z + 1; zPos++)
|
||||
{
|
||||
if (!(tags.getBoolean("Broken")))
|
||||
{
|
||||
Block block = world.getBlock(xPos, yPos, zPos);
|
||||
int meta = world.getBlockMetadata(xPos, yPos, zPos);
|
||||
int hlvl = block.getHarvestLevel(meta);
|
||||
|
||||
if (block != null && block.getMaterial() == Material.wood)
|
||||
{
|
||||
if (hlvl <= tags.getInteger("HarvestLevel"))
|
||||
{
|
||||
boolean cancelHarvest = false;
|
||||
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
|
||||
{
|
||||
if (mod.beforeBlockBreak(this, stack, xPos, yPos, zPos, player))
|
||||
cancelHarvest = true;
|
||||
}
|
||||
|
||||
if (!cancelHarvest)
|
||||
{
|
||||
WorldHelper.setBlockToAir(world, xPos, yPos, zPos);
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
// TODO harvestBlock
|
||||
block.harvestBlock(world, player, xPos, yPos, zPos, meta);
|
||||
onBlockDestroyed(stack, world, block, xPos, yPos, zPos, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Block block = world.getBlock(xPos, yPos, zPos);
|
||||
if (block != null && block.getMaterial() == Material.wood
|
||||
&& block.getPlayerRelativeBlockHardness(player, world, xPos, yPos, zPos) > 0)
|
||||
player.theItemInWorldManager.tryHarvestBlock(xPos, yPos, zPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -162,97 +163,40 @@ public class Scythe extends Weapon
|
||||
if (!stack.hasTagCompound())
|
||||
return false;
|
||||
|
||||
World world = player.worldObj;
|
||||
final Block blockB = world.getBlock(x, y, z);
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
if (!stack.hasTagCompound())
|
||||
return false;
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
boolean butter = EnchantmentHelper.getEnchantmentLevel(Enchantment.silkTouch.effectId, stack) > 0;
|
||||
for (int xPos = x - 1; xPos <= x + 1; xPos++)
|
||||
if (player instanceof EntityPlayerMP)
|
||||
{
|
||||
for (int yPos = y - 1; yPos <= y + 1; yPos++)
|
||||
EntityPlayerMP mplayer = (EntityPlayerMP) player;
|
||||
World world = player.worldObj;
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (!tags.hasKey("AOEBreaking") || !tags.getBoolean("AOEBreaking"))
|
||||
{
|
||||
for (int zPos = z - 1; zPos <= z + 1; zPos++)
|
||||
tags.setBoolean("AOEBreaking", true);
|
||||
for (int xPos = x - 1; xPos <= x + 1; xPos++)
|
||||
{
|
||||
if (!(tags.getBoolean("Broken")))
|
||||
for (int yPos = y - 1; yPos <= y + 1; yPos++)
|
||||
{
|
||||
boolean cancelHarvest = false;
|
||||
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
|
||||
for (int zPos = z - 1; zPos <= z + 1; zPos++)
|
||||
{
|
||||
if (mod.beforeBlockBreak(this, stack, xPos, yPos, zPos, player))
|
||||
cancelHarvest = true;
|
||||
}
|
||||
|
||||
if (!cancelHarvest)
|
||||
{
|
||||
Block localBlock = world.getBlock(xPos, yPos, zPos);
|
||||
int localMeta = world.getBlockMetadata(xPos, yPos, zPos);
|
||||
float localHardness = localBlock == null ? Float.MAX_VALUE : localBlock.getBlockHardness(world, xPos, yPos, zPos);
|
||||
if (localBlock != null)// && (block.blockMaterial == Material.leaves || block.isLeaves(world, xPos, yPos, zPos)))
|
||||
Block block = world.getBlock(xPos, yPos, zPos);
|
||||
for (Material mat : this.materials)
|
||||
{
|
||||
for (int iter = 0; iter < materials.length; iter++)
|
||||
{
|
||||
if (materials[iter] == localBlock.getMaterial())
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
if (butter && localBlock instanceof IShearable && ((IShearable) localBlock).isShearable(stack, player.worldObj, x, y, z))
|
||||
{
|
||||
ArrayList<ItemStack> drops = ((IShearable) localBlock).onSheared(stack, player.worldObj, x, y, z,
|
||||
EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack));
|
||||
Random rand = new Random();
|
||||
|
||||
if (!world.isRemote)
|
||||
for (ItemStack dropStack : drops)
|
||||
{
|
||||
float f = 0.7F;
|
||||
double d = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
double d1 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
double d2 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
EntityItem entityitem = new EntityItem(player.worldObj, (double) xPos + d, (double) yPos + d1, (double) zPos + d2, dropStack);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
player.worldObj.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
|
||||
if (localHardness > 0f)
|
||||
onBlockDestroyed(stack, world, localBlock, xPos, yPos, zPos, player);
|
||||
player.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(localBlock)], 1);
|
||||
world.setBlockToAir(xPos, yPos, zPos);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (localBlock.removedByPlayer(world, player, xPos, yPos, zPos))
|
||||
{
|
||||
localBlock.onBlockDestroyedByPlayer(world, xPos, yPos, zPos, localMeta);
|
||||
}
|
||||
localBlock.harvestBlock(world, player, xPos, yPos, zPos, localMeta);
|
||||
localBlock.onBlockHarvested(world, xPos, yPos, zPos, localMeta, player);
|
||||
if (localHardness > 0f)
|
||||
onBlockDestroyed(stack, world, localBlock, xPos, yPos, zPos, player);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
world.setBlockToAir(xPos, yPos, zPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (block != null && mat == block.getMaterial()
|
||||
&& block.getPlayerRelativeBlockHardness(mplayer, world, x, yPos, z) > 0)
|
||||
mplayer.theItemInWorldManager.tryHarvestBlock(xPos, yPos, zPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
tags.setBoolean("AOEBreaking", false);
|
||||
}
|
||||
}
|
||||
if (!world.isRemote)
|
||||
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(blockB) + (meta << 12));
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLeftClickEntity (ItemStack stack, EntityPlayer player, Entity entity)
|
||||
{
|
||||
AxisAlignedBB box = AxisAlignedBB.getAABBPool().getAABB(entity.posX, entity.posY, entity.posZ, entity.posX + 1.0D, entity.posY + 1.0D, entity.posZ + 1.0D).expand(1.0D, 1.0D, 1.0D);
|
||||
AxisAlignedBB box = AxisAlignedBB.getBoundingBox(entity.posX, entity.posY, entity.posZ, entity.posX + 1.0D, entity.posY + 1.0D, entity.posZ + 1.0D).expand(1.0D, 1.0D, 1.0D);
|
||||
List list = player.worldObj.getEntitiesWithinAABBExcludingEntity(player, box);
|
||||
for (Object o : list)
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@ final class BehaviorDispenseArmorCopy extends BehaviorDefaultDispenseItem
|
||||
int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX();
|
||||
int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY();
|
||||
int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ();
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.getAABBPool().getAABB((double) i, (double) j, (double) k, (double) (i + 1), (double) (j + 1), (double) (k + 1));
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) i, (double) j, (double) k, (double) (i + 1), (double) (j + 1), (double) (k + 1));
|
||||
List list = par1IBlockSource.getWorld().selectEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb, new IEntitySelector.ArmoredMob(par2ItemStack));
|
||||
|
||||
if (list.size() > 0)
|
||||
|
||||
@@ -300,7 +300,7 @@ public class AbilityHelper
|
||||
{
|
||||
EntityWolf var3 = (EntityWolf) living;
|
||||
|
||||
if (var3.isTamed() && player.getDisplayName().equals(var3.getOwnerName()))
|
||||
if (var3.isTamed() && player.getDisplayName().equals(var3.func_152113_b()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -309,14 +309,14 @@ public class AbilityHelper
|
||||
if (!(living instanceof EntityPlayer) || player.canAttackPlayer((EntityPlayer) living))
|
||||
{
|
||||
List var6 = player.worldObj.getEntitiesWithinAABB(EntityWolf.class,
|
||||
AxisAlignedBB.getAABBPool().getAABB(player.posX, player.posY, player.posZ, player.posX + 1.0D, player.posY + 1.0D, player.posZ + 1.0D).expand(16.0D, 4.0D, 16.0D));
|
||||
AxisAlignedBB.getBoundingBox(player.posX, player.posY, player.posZ, player.posX + 1.0D, player.posY + 1.0D, player.posZ + 1.0D).expand(16.0D, 4.0D, 16.0D));
|
||||
Iterator var4 = var6.iterator();
|
||||
|
||||
while (var4.hasNext())
|
||||
{
|
||||
EntityWolf var5 = (EntityWolf) var4.next();
|
||||
|
||||
if (var5.isTamed() && var5.getEntityToAttack() == null && player.getDisplayName().equals(var5.getOwnerName()) && (!par2 || !var5.isSitting()))
|
||||
if (var5.isTamed() && var5.getEntityToAttack() == null && player.getDisplayName().equals(var5.func_152113_b()) && (!par2 || !var5.isSitting()))
|
||||
{
|
||||
var5.setSitting(false);
|
||||
var5.setTarget(living);
|
||||
@@ -621,7 +621,7 @@ public class AbilityHelper
|
||||
if (!world.isRemote && player instanceof EntityPlayer)
|
||||
d1 += 1.62D;
|
||||
double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double) f;
|
||||
Vec3 vec3 = world.getWorldVec3Pool().getVecFromPool(d0, d1, d2);
|
||||
Vec3 vec3 = Vec3.createVectorHelper(d0, d1, d2);
|
||||
float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI);
|
||||
float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI);
|
||||
float f5 = -MathHelper.cos(-f1 * 0.017453292F);
|
||||
|
||||
@@ -20,44 +20,6 @@ public abstract class DualHarvestTool extends HarvestTool
|
||||
super(baseDamage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
World world = player.worldObj;
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
Block block = player.worldObj.getBlock(x, y, z);
|
||||
if (block == null || block == Blocks.air)
|
||||
return false;
|
||||
int hlvl = -1;
|
||||
int shlvl = -1;
|
||||
if (block.getHarvestTool(meta) == null || block.getHarvestTool(meta).equals(getHarvestType()))
|
||||
hlvl = block.getHarvestLevel(meta);
|
||||
if (block.getHarvestTool(meta) == null || block.getHarvestTool(meta).equals(getSecondHarvestType()))
|
||||
shlvl = block.getHarvestLevel(meta);
|
||||
|
||||
if (hlvl <= tags.getInteger("HarvestLevel") && shlvl <= tags.getInteger("HarvestLevel2"))
|
||||
{
|
||||
boolean cancelHarvest = false;
|
||||
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
|
||||
{
|
||||
if (mod.beforeBlockBreak(this, stack, x, y, z, player))
|
||||
cancelHarvest = true;
|
||||
}
|
||||
|
||||
return cancelHarvest;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
onBlockDestroyed(stack, world, block, x, y, z, player);
|
||||
WorldHelper.setBlockToAir(world, x, y, z);
|
||||
if (!world.isRemote)
|
||||
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDigSpeed (ItemStack stack, Block block, int meta)
|
||||
{
|
||||
|
||||
@@ -22,96 +22,6 @@ public abstract class HarvestTool extends ToolCore
|
||||
super(baseDamage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
if (!stack.hasTagCompound())
|
||||
return false;
|
||||
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
World world = player.worldObj;
|
||||
Block block = player.worldObj.getBlock(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
// Block block = Block.blocksList[bID];
|
||||
if (block == null || block == Blocks.air)
|
||||
return false;
|
||||
int hlvl = -1;
|
||||
if (!(tags.getBoolean("Broken")))
|
||||
{
|
||||
Block localBlock = world.getBlock(x, y, z);
|
||||
int localMeta = world.getBlockMetadata(x, y, z);
|
||||
if (block.getHarvestTool(meta) != null && block.getHarvestTool(meta).equals(this.getHarvestType()))
|
||||
hlvl = block.getHarvestLevel(meta);
|
||||
int toolLevel = tags.getInteger("HarvestLevel");
|
||||
float blockHardness = block.getBlockHardness(world, x, y, z);
|
||||
float localHardness = localBlock == null ? Float.MAX_VALUE : localBlock.getBlockHardness(world, x, y, z);
|
||||
|
||||
if (hlvl <= toolLevel && localHardness - 1.5 <= blockHardness)
|
||||
{
|
||||
boolean cancelHarvest = false;
|
||||
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
|
||||
{
|
||||
if (mod.beforeBlockBreak(this, stack, x, y, z, player))
|
||||
cancelHarvest = true;
|
||||
}
|
||||
|
||||
if (!cancelHarvest)
|
||||
{
|
||||
if (localBlock != null && !(localHardness < 0))
|
||||
{
|
||||
|
||||
boolean isEffective = false;
|
||||
|
||||
for (int iter = 0; iter < getEffectiveMaterials().length; iter++)
|
||||
{
|
||||
if (getEffectiveMaterials()[iter] == localBlock.getMaterial() || localBlock == Blocks.monster_egg)
|
||||
{
|
||||
isEffective = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (localBlock.getMaterial().isToolNotRequired())
|
||||
{
|
||||
isEffective = true;
|
||||
}
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
if (isEffective)
|
||||
{
|
||||
if (localBlock.removedByPlayer(world, player, x, y, z))
|
||||
{
|
||||
localBlock.onBlockDestroyedByPlayer(world, x, y, z, localMeta);
|
||||
}
|
||||
localBlock.harvestBlock(world, player, x, y, z, localMeta);
|
||||
localBlock.onBlockHarvested(world, x, y, z, localMeta, player);
|
||||
if (blockHardness > 0f)
|
||||
onBlockDestroyed(stack, world, localBlock, x, y, z, player);
|
||||
world.func_147479_m(x, y, z);
|
||||
}
|
||||
else
|
||||
{
|
||||
WorldHelper.setBlockToAir(world, x, y, z);
|
||||
world.func_147479_m(x, y, z);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
WorldHelper.setBlockToAir(world, x, y, z);
|
||||
world.func_147479_m(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!world.isRemote)
|
||||
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDigSpeed (ItemStack stack, Block block, int meta)
|
||||
{
|
||||
|
||||
@@ -606,14 +606,28 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem
|
||||
@Override
|
||||
public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
boolean cancelHarvest = false;
|
||||
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
|
||||
{
|
||||
if (mod.beforeBlockBreak(this, stack, x, y, z, player))
|
||||
cancelHarvest = true;
|
||||
}
|
||||
World world = player.worldObj;
|
||||
if (stack.getTagCompound().getCompoundTag("InfiTool").getBoolean("Lava") && world.isRemote)
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
float f = (float) x + random.nextFloat();
|
||||
float f1 = (float) y + random.nextFloat();
|
||||
float f2 = (float) z + random.nextFloat();
|
||||
float f3 = 0.52F;
|
||||
float f4 = random.nextFloat() * 0.6F - 0.3F;
|
||||
world.spawnParticle("smoke", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
|
||||
return cancelHarvest;
|
||||
world.spawnParticle("smoke", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
|
||||
world.spawnParticle("smoke", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
|
||||
|
||||
world.spawnParticle("smoke", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -532,7 +532,7 @@ public class BlockLandmine extends BlockContainer
|
||||
protected AxisAlignedBB getSensitiveAABB (World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
float f = 0.125F;
|
||||
// return AxisAlignedBB.getAABBPool().getAABB((double)((float)par1 + f),
|
||||
// return AxisAlignedBB.getBoundingBox((double)((float)par1 + f),
|
||||
// (double)par2, (double)((float)par3 + f), (double)((float)(par1 + 1) -
|
||||
// f), (double)par2 + 0.25D, (double)((float)(par3 + 1) - f));
|
||||
|
||||
@@ -559,7 +559,7 @@ public class BlockLandmine extends BlockContainer
|
||||
maxY = par3 + 1;
|
||||
maxZ = par4 + 1;
|
||||
}
|
||||
return AxisAlignedBB.getAABBPool().getAABB(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
return AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
}
|
||||
|
||||
public Entity getMineTriggerer (World par1World, int par2, int par3, int par4)
|
||||
@@ -597,17 +597,17 @@ public class BlockLandmine extends BlockContainer
|
||||
|
||||
if (triggerType == Sensitivity.everything)
|
||||
{
|
||||
list = par1World.getEntitiesWithinAABBExcludingEntity((Entity) null, AxisAlignedBB.getAABBPool().getAABB(par2 + 0D, par3 + 0D, par4 + 0D, par2 + 1D, par3 + 1D, par4 + 1D));
|
||||
list = par1World.getEntitiesWithinAABBExcludingEntity((Entity) null, AxisAlignedBB.getBoundingBox(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));
|
||||
list = par1World.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(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));
|
||||
list = par1World.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(par2 + 0D, par3 + 0D, par4 + 0D, par2 + 1D, par3 + 1D, par4 + 1D));
|
||||
}
|
||||
|
||||
if (list != null && !list.isEmpty())
|
||||
|
||||
@@ -31,7 +31,7 @@ public class BehaviorShears extends Behavior
|
||||
{
|
||||
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));
|
||||
List<IShearable> sheeps = par1World.getEntitiesWithinAABB(IShearable.class, AxisAlignedBB.getBoundingBox(par2 - 2, par3 - 2, par4 - 2, par2 + 2, par3 + 2, par4 + 2));
|
||||
|
||||
if (sheeps != null && !sheeps.isEmpty())
|
||||
{
|
||||
|
||||
@@ -61,18 +61,11 @@ public class GlassBlockConnected extends MantleBlock
|
||||
|
||||
/**
|
||||
* This is checked to see if the texture should connect to this block
|
||||
*
|
||||
* @param par2
|
||||
* x
|
||||
* @param par3
|
||||
* y
|
||||
* @param par4
|
||||
* z
|
||||
* @param par5
|
||||
* ID this block is asking to connect to (may be 0 if there is no
|
||||
* block)
|
||||
* @param par6
|
||||
* Metadata of the block this block is trying to connect to
|
||||
* @param par2 x
|
||||
* @param par3 y
|
||||
* @param par4 z
|
||||
* @param par5 ID this block is asking to connect to (may be 0 if there is no block)
|
||||
* @param par6 Metadata of the block this block is trying to connect to
|
||||
* @return true if should connect
|
||||
*/
|
||||
public boolean shouldConnectToBlock (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, Block par5, int par6)
|
||||
@@ -371,11 +364,11 @@ public class GlassBlockConnected extends MantleBlock
|
||||
}
|
||||
else if (isOpenUp && isOpenDown && isOpenLeft)
|
||||
{
|
||||
return icons[13];
|
||||
return icons[14];
|
||||
}
|
||||
else if (isOpenUp && isOpenDown && isOpenRight)
|
||||
{
|
||||
return icons[14];
|
||||
return icons[13];
|
||||
}
|
||||
else if (isOpenUp && isOpenLeft && isOpenRight)
|
||||
{
|
||||
@@ -395,19 +388,19 @@ public class GlassBlockConnected extends MantleBlock
|
||||
}
|
||||
else if (isOpenDown && isOpenLeft)
|
||||
{
|
||||
return icons[9];
|
||||
return icons[10];
|
||||
}
|
||||
else if (isOpenDown && isOpenRight)
|
||||
{
|
||||
return icons[10];
|
||||
return icons[9];
|
||||
}
|
||||
else if (isOpenUp && isOpenLeft)
|
||||
{
|
||||
return icons[7];
|
||||
return icons[8];
|
||||
}
|
||||
else if (isOpenUp && isOpenRight)
|
||||
{
|
||||
return icons[8];
|
||||
return icons[7];
|
||||
}
|
||||
else if (isOpenDown)
|
||||
{
|
||||
@@ -419,11 +412,11 @@ public class GlassBlockConnected extends MantleBlock
|
||||
}
|
||||
else if (isOpenLeft)
|
||||
{
|
||||
return icons[4];
|
||||
return icons[3];
|
||||
}
|
||||
else if (isOpenRight)
|
||||
{
|
||||
return icons[3];
|
||||
return icons[4];
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
@@ -535,11 +528,11 @@ public class GlassBlockConnected extends MantleBlock
|
||||
}
|
||||
else if (isOpenUp && isOpenDown && isOpenLeft)
|
||||
{
|
||||
return icons[14];
|
||||
return icons[13];
|
||||
}
|
||||
else if (isOpenUp && isOpenDown && isOpenRight)
|
||||
{
|
||||
return icons[13];
|
||||
return icons[14];
|
||||
}
|
||||
else if (isOpenUp && isOpenLeft && isOpenRight)
|
||||
{
|
||||
@@ -559,19 +552,19 @@ public class GlassBlockConnected extends MantleBlock
|
||||
}
|
||||
else if (isOpenDown && isOpenLeft)
|
||||
{
|
||||
return icons[10];
|
||||
return icons[9];
|
||||
}
|
||||
else if (isOpenDown && isOpenRight)
|
||||
{
|
||||
return icons[9];
|
||||
return icons[10];
|
||||
}
|
||||
else if (isOpenUp && isOpenLeft)
|
||||
{
|
||||
return icons[8];
|
||||
return icons[7];
|
||||
}
|
||||
else if (isOpenUp && isOpenRight)
|
||||
{
|
||||
return icons[7];
|
||||
return icons[8];
|
||||
}
|
||||
else if (isOpenDown)
|
||||
{
|
||||
@@ -583,11 +576,11 @@ public class GlassBlockConnected extends MantleBlock
|
||||
}
|
||||
else if (isOpenLeft)
|
||||
{
|
||||
return icons[3];
|
||||
return icons[4];
|
||||
}
|
||||
else if (isOpenRight)
|
||||
{
|
||||
return icons[4];
|
||||
return icons[3];
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -618,7 +611,7 @@ public class GlassBlockConnected extends MantleBlock
|
||||
}
|
||||
else
|
||||
{
|
||||
return AxisAlignedBB.getAABBPool().getAABB(0D, 0D, 0D, 0D, 0D, 0D);
|
||||
return AxisAlignedBB.getBoundingBox(0D, 0D, 0D, 0D, 0D, 0D);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -338,11 +338,11 @@ public class GlassPaneConnected extends GlassBlockConnected
|
||||
}
|
||||
else if (isOpenUp && isOpenDown && isOpenLeft)
|
||||
{
|
||||
return icons[13];
|
||||
return icons[14];
|
||||
}
|
||||
else if (isOpenUp && isOpenDown && isOpenRight)
|
||||
{
|
||||
return icons[14];
|
||||
return icons[13];
|
||||
}
|
||||
else if (isOpenUp && isOpenLeft && isOpenRight)
|
||||
{
|
||||
@@ -362,19 +362,19 @@ public class GlassPaneConnected extends GlassBlockConnected
|
||||
}
|
||||
else if (isOpenDown && isOpenLeft)
|
||||
{
|
||||
return icons[9];
|
||||
return icons[10];
|
||||
}
|
||||
else if (isOpenDown && isOpenRight)
|
||||
{
|
||||
return icons[10];
|
||||
return icons[9];
|
||||
}
|
||||
else if (isOpenUp && isOpenLeft)
|
||||
{
|
||||
return icons[7];
|
||||
return icons[8];
|
||||
}
|
||||
else if (isOpenUp && isOpenRight)
|
||||
{
|
||||
return icons[8];
|
||||
return icons[7];
|
||||
}
|
||||
else if (isOpenDown)
|
||||
{
|
||||
@@ -386,11 +386,11 @@ public class GlassPaneConnected extends GlassBlockConnected
|
||||
}
|
||||
else if (isOpenLeft)
|
||||
{
|
||||
return icons[4];
|
||||
return icons[3];
|
||||
}
|
||||
else if (isOpenRight)
|
||||
{
|
||||
return icons[3];
|
||||
return icons[4];
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
@@ -526,19 +526,19 @@ public class GlassPaneConnected extends GlassBlockConnected
|
||||
}
|
||||
else if (isOpenDown && isOpenLeft)
|
||||
{
|
||||
return icons[10];
|
||||
return icons[9];
|
||||
}
|
||||
else if (isOpenDown && isOpenRight)
|
||||
{
|
||||
return icons[9];
|
||||
return icons[10];
|
||||
}
|
||||
else if (isOpenUp && isOpenLeft)
|
||||
{
|
||||
return icons[8];
|
||||
return icons[7];
|
||||
}
|
||||
else if (isOpenUp && isOpenRight)
|
||||
{
|
||||
return icons[7];
|
||||
return icons[8];
|
||||
}
|
||||
else if (isOpenDown)
|
||||
{
|
||||
@@ -550,11 +550,11 @@ public class GlassPaneConnected extends GlassBlockConnected
|
||||
}
|
||||
else if (isOpenLeft)
|
||||
{
|
||||
return icons[3];
|
||||
return icons[4];
|
||||
}
|
||||
else if (isOpenRight)
|
||||
{
|
||||
return icons[4];
|
||||
return icons[3];
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -690,11 +690,6 @@ public class GlassPaneConnected extends GlassBlockConnected
|
||||
@Override
|
||||
public boolean shouldSideBeRendered (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
// if(par5 == 0 || par5 == 1){
|
||||
// return par1IBlockAccess.getBlock(par2, par3, par4) != this.blockID;
|
||||
// }else{
|
||||
// return true;
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -316,7 +316,7 @@ public class SearedBlock extends InventoryBlock
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta != 1)
|
||||
{
|
||||
return AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + 1, y + 1, z + 1);
|
||||
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -348,7 +348,7 @@ public class SearedBlock extends InventoryBlock
|
||||
break;
|
||||
}
|
||||
|
||||
return AxisAlignedBB.getAABBPool().getAABB((double) ((float) x + xMin), (double) y + 0.25, (double) ((float) z + zMin), (double) ((float) x + xMax), (double) y + 0.625,
|
||||
return AxisAlignedBB.getBoundingBox((double) ((float) x + xMin), (double) y + 0.25, (double) ((float) z + zMin), (double) ((float) x + xMax), (double) y + 0.625,
|
||||
(double) ((float) z + zMax));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
|
||||
void detectEntities ()
|
||||
{
|
||||
AxisAlignedBB box = AxisAlignedBB.getAABBPool().getAABB(centerPos.x, centerPos.y, centerPos.z, centerPos.x + 1.0D, centerPos.y + 1.0D, centerPos.z + 1.0D).expand(1.0D, 0.0D, 1.0D);
|
||||
AxisAlignedBB box = AxisAlignedBB.getBoundingBox(centerPos.x, centerPos.y, centerPos.z, centerPos.x + 1.0D, centerPos.y + 1.0D, centerPos.z + 1.0D).expand(1.0D, 0.0D, 1.0D);
|
||||
|
||||
List list = worldObj.getEntitiesWithinAABB(Entity.class, box);
|
||||
for (Object o : list)
|
||||
|
||||
@@ -77,9 +77,9 @@ public class CraftingSlab extends InventorySlab
|
||||
{
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
if (metadata == 5)
|
||||
return AxisAlignedBB.getAABBPool().getAABB((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY - 0.125,
|
||||
return AxisAlignedBB.getBoundingBox((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY - 0.125,
|
||||
(double) z + this.maxZ);
|
||||
return AxisAlignedBB.getAABBPool().getAABB((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY, (double) z + this.maxZ);
|
||||
return AxisAlignedBB.getBoundingBox((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY, (double) z + this.maxZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -116,9 +116,9 @@ public class ToolStationBlock extends InventoryBlock
|
||||
{
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
if (metadata == 5)
|
||||
return AxisAlignedBB.getAABBPool().getAABB((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY - 0.125,
|
||||
return AxisAlignedBB.getBoundingBox((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY - 0.125,
|
||||
(double) z + this.maxZ);
|
||||
return AxisAlignedBB.getAABBPool().getAABB((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY, (double) z + this.maxZ);
|
||||
return AxisAlignedBB.getBoundingBox((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY, (double) z + this.maxZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -103,7 +103,7 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa
|
||||
i.setBlockBoundsBasedOnState(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
AxisAlignedBB axisalignedbb = i.getCollisionBoundingBoxFromPool(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
|
||||
if (axisalignedbb != null && axisalignedbb.isVecInside(this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ)))
|
||||
if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ)))
|
||||
{
|
||||
this.inGround = true;
|
||||
}
|
||||
@@ -143,15 +143,15 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa
|
||||
else
|
||||
{
|
||||
++this.ticksInAir;
|
||||
Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);
|
||||
Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
||||
Vec3 vec3 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
|
||||
Vec3 vec31 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
||||
MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec3, vec31, false, true, false);
|
||||
vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);
|
||||
vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
||||
vec3 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
|
||||
vec31 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
||||
|
||||
if (movingobjectposition != null)
|
||||
{
|
||||
vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
|
||||
vec31 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
|
||||
}
|
||||
|
||||
Entity entity = null;
|
||||
|
||||
@@ -32,6 +32,6 @@ public class MaterialItem extends CraftingItem
|
||||
static String[] craftingTextures = new String[] { "paperstack", "slimecrystal", "searedbrick", "cobaltingot", "arditeingot", "manyullyningot", "mossball", "lavacrystal", "necroticbone",
|
||||
"copperingot", "tiningot", "aluminumingot", "aluminumraw", "bronzeingot", "alubrassingot", "alumiteingot", "steelingot", "blueslimecrystal", "obsidianingot", "nugget_iron",
|
||||
"nugget_copper", "nugget_tin", "nugget_aluminum", "", "nugget_alubrass", "silkycloth", "silkyjewel", "nugget_obsidian", "nugget_cobalt", "nugget_ardite", "nugget_manyullyn",
|
||||
"nugget_bronze", "nugget_alumite", "nugget_steel", "pigironingot", "nugget_pigiron", "glueball", "searedbrick_nether", "ardite_dust", "cobalt_dust", "aluminium_dust", "manyullyn_dust",
|
||||
"nugget_bronze", "nugget_alumite", "nugget_steel", "pigironingot", "nugget_pigiron", "glueball", "searedbrick_nether", "ardite_dust", "cobalt_dust", "aluminum_dust", "manyullyn_dust",
|
||||
"alubrass_dust" };
|
||||
}
|
||||
@@ -59,91 +59,6 @@ public class TActiveOmniMod extends ActiveToolMod
|
||||
return false;
|
||||
TinkerTools.modLapis.midStreamModify(stack, tool);
|
||||
|
||||
World world = entity.worldObj;
|
||||
Block block = entity.worldObj.getBlock(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
// TODO do we need the next to lines????????
|
||||
if (block == null)
|
||||
return false;
|
||||
|
||||
if (tags.getBoolean("Lava") && block.quantityDropped(meta, 0, random) != 0)
|
||||
{
|
||||
ItemStack smeltStack = new ItemStack(block.getItemDropped(meta, random, 0), block.quantityDropped(meta, 0, random), block.damageDropped(meta));
|
||||
if (smeltStack.getItem() == null)
|
||||
return false;
|
||||
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(smeltStack);
|
||||
if (result != null)
|
||||
{
|
||||
WorldHelper.setBlockToAir(world, x, y, z);
|
||||
if (entity instanceof EntityPlayer && !((EntityPlayer) entity).capabilities.isCreativeMode)
|
||||
tool.onBlockDestroyed(stack, world, block, x, y, z, entity);
|
||||
if (!world.isRemote)
|
||||
{
|
||||
ItemStack spawnme = result.copy();
|
||||
if (!(result.getItem() instanceof ItemBlock) && PHConstruct.lavaFortuneInteraction)
|
||||
{
|
||||
int loot = EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack);
|
||||
if (loot > 0)
|
||||
{
|
||||
spawnme.stackSize *= (random.nextInt(loot + 1) + 1);
|
||||
}
|
||||
}
|
||||
EntityItem entityitem = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, spawnme);
|
||||
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));
|
||||
|
||||
int i = spawnme.stackSize;
|
||||
float f = FurnaceRecipes.smelting().func_151398_b(spawnme);
|
||||
int j;
|
||||
|
||||
if (f == 0.0F)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
else if (f < 1.0F)
|
||||
{
|
||||
j = MathHelper.floor_float((float) i * f);
|
||||
|
||||
if (j < MathHelper.ceiling_float_int((float) i * f) && (float) Math.random() < (float) i * f - (float) j)
|
||||
{
|
||||
++j;
|
||||
}
|
||||
|
||||
i = j;
|
||||
}
|
||||
|
||||
while (i > 0)
|
||||
{
|
||||
j = EntityXPOrb.getXPSplit(i);
|
||||
i -= j;
|
||||
entity.worldObj.spawnEntityInWorld(new EntityXPOrb(world, x, y + 0.5, z, j));
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
float f = (float) x + random.nextFloat();
|
||||
float f1 = (float) y + random.nextFloat();
|
||||
float f2 = (float) z + random.nextFloat();
|
||||
float f3 = 0.52F;
|
||||
float f4 = random.nextFloat() * 0.6F - 0.3F;
|
||||
world.spawnParticle("smoke", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
|
||||
world.spawnParticle("smoke", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
|
||||
world.spawnParticle("smoke", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
|
||||
|
||||
world.spawnParticle("smoke", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,11 +31,11 @@ public class EnvironmentChecks
|
||||
{
|
||||
List<String> modIds = new ArrayList<String>();
|
||||
|
||||
if (Loader.isModLoaded("gregtech_addon"))
|
||||
if (Loader.isModLoaded("gregtech"))
|
||||
{
|
||||
TConstruct.logger.error("Tinkers' Construct and GregTech are incompatible for the following reasons:");
|
||||
TConstruct.logger.error(modCompatDetails("GregTech", true));
|
||||
modIds.add("gregtech_addon");
|
||||
modIds.add("gregtech");
|
||||
incompatibilities.add("GregTech");
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,785 @@
|
||||
package tconstruct.util;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import mantle.blocks.BlockUtils;
|
||||
import mantle.world.WorldHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.IEntityLivingData;
|
||||
import net.minecraft.entity.boss.EntityDragon;
|
||||
import net.minecraft.entity.boss.IBossDisplayData;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.EntityXPOrb;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.monster.EntityGhast;
|
||||
import net.minecraft.entity.monster.EntitySkeleton;
|
||||
import net.minecraft.entity.monster.EntitySpider;
|
||||
import net.minecraft.entity.monster.EntityZombie;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.entity.passive.EntityChicken;
|
||||
import net.minecraft.entity.passive.EntityCow;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EntityDamageSourceIndirect;
|
||||
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
|
||||
import net.minecraftforge.event.entity.player.BonemealEvent;
|
||||
import net.minecraftforge.event.entity.player.FillBucketEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
||||
import net.minecraftforge.event.world.BlockEvent.BreakEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent;
|
||||
import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent;
|
||||
import tconstruct.common.TRepo;
|
||||
import tconstruct.items.tools.FryingPan;
|
||||
import tconstruct.library.ActiveToolMod;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.event.PartBuilderEvent;
|
||||
import tconstruct.library.event.ToolCraftEvent;
|
||||
import tconstruct.library.tools.ArrowMaterial;
|
||||
import tconstruct.library.tools.BowMaterial;
|
||||
import tconstruct.library.tools.BowstringMaterial;
|
||||
import tconstruct.library.tools.FletchingMaterial;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.library.tools.Weapon;
|
||||
import tconstruct.smeltery.blocks.LiquidMetalFinite;
|
||||
import tconstruct.smeltery.blocks.TankAirBlock;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
import tconstruct.util.player.ArmorExtended;
|
||||
import tconstruct.util.player.TPlayerStats;
|
||||
import tconstruct.world.entity.BlueSlime;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class TEventHandler
|
||||
{
|
||||
Random random = new Random();
|
||||
|
||||
/* Crafting */
|
||||
@SubscribeEvent
|
||||
public void craftTool (ToolCraftEvent.NormalTool event)
|
||||
{
|
||||
NBTTagCompound toolTag = event.toolTag.getCompoundTag("InfiTool");
|
||||
if (PHConstruct.denyMattock && event.tool == TRepo.mattock)
|
||||
{
|
||||
int head = toolTag.getInteger("Head");
|
||||
int handle = toolTag.getInteger("Handle");
|
||||
int accessory = toolTag.getInteger("Accessory");
|
||||
|
||||
if (!allowCrafting(head, handle, accessory))
|
||||
{
|
||||
event.setResult(Result.DENY);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int thaum = 0;
|
||||
if (toolTag.getInteger("Head") == 31)
|
||||
thaum++;
|
||||
if (toolTag.getInteger("Handle") == 31)
|
||||
thaum++;
|
||||
if (toolTag.getInteger("Accessory") == 31)
|
||||
thaum++;
|
||||
if (toolTag.getInteger("Extra") == 31)
|
||||
thaum++;
|
||||
|
||||
if ((thaum >= 3) || (!toolTag.hasKey("Accessory") && thaum >= 2))
|
||||
{
|
||||
int modifiers = toolTag.getInteger("Modifiers");
|
||||
modifiers += 2;
|
||||
toolTag.setInteger("Modifiers", modifiers);
|
||||
}
|
||||
else if (thaum >= 1)
|
||||
{
|
||||
int modifiers = toolTag.getInteger("Modifiers");
|
||||
modifiers += 1;
|
||||
toolTag.setInteger("Modifiers", modifiers);
|
||||
}
|
||||
|
||||
if (event.tool == TRepo.shortbow)
|
||||
{
|
||||
BowMaterial top = TConstructRegistry.getBowMaterial(toolTag.getInteger("Head"));
|
||||
BowMaterial bottom = TConstructRegistry.getBowMaterial(toolTag.getInteger("Accessory"));
|
||||
BowstringMaterial string = (BowstringMaterial) TConstructRegistry.getCustomMaterial(toolTag.getInteger("Handle"), BowstringMaterial.class);
|
||||
|
||||
if (top != null && bottom != null && string != null)
|
||||
{
|
||||
if (toolTag.getInteger("Handle") == 1)
|
||||
{
|
||||
int modifiers = toolTag.getInteger("Modifiers");
|
||||
modifiers += 1;
|
||||
toolTag.setInteger("Modifiers", modifiers);
|
||||
}
|
||||
|
||||
int durability = (int) ((top.durability + bottom.durability) / 2 * string.durabilityModifier);
|
||||
toolTag.setInteger("TotalDurability", durability);
|
||||
toolTag.setInteger("BaseDurability", durability);
|
||||
|
||||
int drawSpeed = (int) ((top.drawspeed + bottom.drawspeed) / 2 * string.drawspeedModifier);
|
||||
toolTag.setInteger("DrawSpeed", drawSpeed);
|
||||
toolTag.setInteger("BaseDrawSpeed", drawSpeed);
|
||||
|
||||
float flightSpeed = (top.flightSpeedMax + bottom.flightSpeedMax) / 2f * string.flightSpeedModifier;
|
||||
toolTag.setFloat("FlightSpeed", flightSpeed);
|
||||
}
|
||||
}
|
||||
|
||||
if (event.tool == TRepo.arrow)
|
||||
{
|
||||
ArrowMaterial head = TConstructRegistry.getArrowMaterial(toolTag.getInteger("Head"));
|
||||
ArrowMaterial shaft = TConstructRegistry.getArrowMaterial(toolTag.getInteger("Handle"));
|
||||
FletchingMaterial fletching = (FletchingMaterial) TConstructRegistry.getCustomMaterial(toolTag.getInteger("Accessory"), FletchingMaterial.class);
|
||||
|
||||
if (head != null && shaft != null && fletching != null)
|
||||
{
|
||||
float mass = head.mass / 5f + shaft.mass + fletching.mass;
|
||||
float shatter = (head.breakChance + shaft.breakChance + fletching.breakChance) / 4f;
|
||||
float accuracy = (head.accuracy + shaft.accuracy + fletching.accuracy) / 3;
|
||||
|
||||
ItemStack arrow = new ItemStack(event.tool, 4);
|
||||
toolTag.setInteger("TotalDurability", 0);
|
||||
toolTag.setFloat("Mass", mass);
|
||||
toolTag.setFloat("BreakChance", shatter);
|
||||
toolTag.setFloat("Accuracy", accuracy);
|
||||
toolTag.setInteger("Unbreaking", 10);
|
||||
arrow.setTagCompound(event.toolTag);
|
||||
event.overrideResult(arrow);
|
||||
}
|
||||
}
|
||||
|
||||
if (event.tool == TRepo.battlesign)
|
||||
{
|
||||
int modifiers = toolTag.getInteger("Modifiers");
|
||||
modifiers += 1;
|
||||
toolTag.setInteger("Modifiers", modifiers);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean allowCrafting (int head, int handle, int accessory)
|
||||
{
|
||||
int[] nonMetals = { 0, 1, 3, 4, 5, 6, 7, 8, 9, 17 };
|
||||
for (int i = 0; i < nonMetals.length; i++)
|
||||
{
|
||||
if (head == nonMetals[i] || handle == nonMetals[i] || accessory == nonMetals[i])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void craftPart (PartBuilderEvent.NormalPart event)
|
||||
{
|
||||
if (event.pattern.getItem() == TRepo.woodPattern && event.pattern.getItemDamage() == 23)
|
||||
{
|
||||
ItemStack result = craftBowString(event.material);
|
||||
if (result != null)
|
||||
{
|
||||
event.overrideResult(new ItemStack[] { result, null });
|
||||
}
|
||||
}
|
||||
|
||||
if (event.pattern.getItem() == TRepo.woodPattern && event.pattern.getItemDamage() == 24)
|
||||
{
|
||||
ItemStack result = craftFletching(event.material);
|
||||
if (result != null)
|
||||
{
|
||||
event.overrideResult(new ItemStack[] { result, null });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack craftBowString (ItemStack stack)
|
||||
{
|
||||
if (stack.stackSize < 3)
|
||||
return null;
|
||||
|
||||
BowstringMaterial mat = (BowstringMaterial) TConstructRegistry.getCustomMaterial(stack, BowstringMaterial.class);
|
||||
if (mat != null)
|
||||
return mat.craftingItem.copy();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ItemStack craftFletching (ItemStack stack)
|
||||
{
|
||||
if (matchesLeaves(stack))
|
||||
{
|
||||
FletchingMaterial leaves = (FletchingMaterial) TConstructRegistry.getCustomMaterial(new ItemStack(Blocks.leaves), FletchingMaterial.class);
|
||||
return leaves.craftingItem.copy();
|
||||
}
|
||||
|
||||
FletchingMaterial mat = (FletchingMaterial) TConstructRegistry.getCustomMaterial(stack, FletchingMaterial.class);
|
||||
if (mat != null)
|
||||
return mat.craftingItem.copy();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean matchesLeaves (ItemStack stack)
|
||||
{
|
||||
if (stack != null)
|
||||
{
|
||||
Block block = BlockUtils.getBlockFromItemStack(stack);
|
||||
if (block != null)
|
||||
{
|
||||
if (block.isLeaves(null, 0, 0, 0))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Damage */
|
||||
@SubscribeEvent
|
||||
public void onHurt (LivingHurtEvent event)
|
||||
{
|
||||
EntityLivingBase reciever = event.entityLiving;
|
||||
if (reciever instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
// Cutlass
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if (stack != null && player.isUsingItem())
|
||||
{
|
||||
Item item = stack.getItem();
|
||||
if (item == TRepo.cutlass)
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 3 * 20, 1));
|
||||
}
|
||||
else if (item == TRepo.battlesign)
|
||||
{
|
||||
event.ammount *= 1.5; //Puts battlesign blocking at 3/4 instead of 1/2
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (reciever instanceof EntityCreeper)
|
||||
{
|
||||
Entity attacker = event.source.getEntity();
|
||||
if (attacker instanceof EntityLivingBase)
|
||||
{
|
||||
Entity target = ((EntityCreeper) reciever).getAttackTarget();
|
||||
if (target != null)
|
||||
{
|
||||
float d1 = reciever.getDistanceToEntity(((EntityCreeper) reciever).getAttackTarget());
|
||||
float d2 = reciever.getDistanceToEntity(attacker);
|
||||
if (d2 < d1)
|
||||
{
|
||||
((EntityCreeper) event.entityLiving).setAttackTarget((EntityLivingBase) event.source.getEntity());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onAttack (LivingAttackEvent event)
|
||||
{
|
||||
//System.out.println("Damage: "+event.ammount);
|
||||
if (event.entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
//Cutlass
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if (stack != null && stack.getItem() == TRepo.battlesign && player.isUsingItem())
|
||||
{
|
||||
DamageSource source = event.source;
|
||||
if (!source.isUnblockable() && !source.isMagicDamage() && !source.isExplosion())
|
||||
{
|
||||
if (source instanceof EntityDamageSourceIndirect)
|
||||
{
|
||||
if (random.nextInt(3) == 0)
|
||||
{
|
||||
Entity attacker = source.getEntity();
|
||||
Entity projectile = ((EntityDamageSourceIndirect) source).getSourceOfDamage();
|
||||
projectile.motionX *= -1;
|
||||
projectile.motionZ *= -1;
|
||||
projectile.setDead();
|
||||
event.setCanceled(true);
|
||||
|
||||
if (projectile.getClass() == EntityArrow.class && !player.worldObj.isRemote)
|
||||
{
|
||||
EntityArrow reflection = null;
|
||||
if (attacker instanceof EntityLivingBase)
|
||||
reflection = new EntityArrow(player.worldObj, (EntityLivingBase) attacker, 0);
|
||||
else
|
||||
reflection = new EntityArrow(player.worldObj, player, 0);
|
||||
|
||||
Vec3 look = player.getLookVec();
|
||||
reflection.posX = projectile.posX;
|
||||
reflection.posY = projectile.posY;
|
||||
reflection.posZ = projectile.posZ;
|
||||
reflection.motionX = (projectile.motionX + (look.xCoord * 8)) / 6;
|
||||
reflection.motionY = (projectile.motionY + (look.yCoord * 8)) / 6;
|
||||
reflection.motionZ = (projectile.motionZ + (look.zCoord * 8)) / 6;
|
||||
reflection.damage = ((EntityArrow) projectile).damage;
|
||||
player.worldObj.spawnEntityInWorld(reflection);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Entity attacker = source.getEntity();
|
||||
if(attacker != null)
|
||||
{
|
||||
attacker.attackEntityFrom(DamageSource.causeThornsDamage(player), event.ammount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Drops */
|
||||
@SubscribeEvent
|
||||
public void onLivingDrop (LivingDropsEvent event)
|
||||
{
|
||||
if (event.entityLiving == null)
|
||||
return;
|
||||
|
||||
if (event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) event.source.getEntity();
|
||||
if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof FryingPan)
|
||||
{
|
||||
for (int i = 0; i < event.drops.size(); i++)
|
||||
{
|
||||
ItemStack is = event.drops.get(i).getEntityItem();
|
||||
if (FurnaceRecipes.smelting().getSmeltingResult(is) != null && FurnaceRecipes.smelting().getSmeltingResult(is).getItem() instanceof ItemFood)
|
||||
{
|
||||
NBTTagCompound stackCompound = is.getTagCompound();
|
||||
if (stackCompound == null)
|
||||
{
|
||||
stackCompound = new NBTTagCompound();
|
||||
}
|
||||
stackCompound.setBoolean("frypanKill", true);
|
||||
is.setTagCompound(stackCompound);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (random.nextInt(200) == 0 && event.entityLiving instanceof IMob && event.source.damageType.equals("player"))
|
||||
{
|
||||
if (event.entityLiving instanceof BlueSlime)
|
||||
{
|
||||
BlueSlime slime = (BlueSlime) event.entityLiving;
|
||||
if (slime.getSlimeSize() < 8)
|
||||
return;
|
||||
}
|
||||
int count = event.entityLiving instanceof EntityDragon ? 5 : 1;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
ItemStack dropStack = new ItemStack(TRepo.heartCanister, 1, 1);
|
||||
EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
event.drops.add(entityitem);
|
||||
}
|
||||
}
|
||||
|
||||
if (event.entityLiving instanceof IBossDisplayData)
|
||||
{
|
||||
ItemStack dropStack = new ItemStack(TRepo.heartCanister, 1, 3);
|
||||
EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
event.drops.add(entityitem);
|
||||
}
|
||||
|
||||
if (!event.entityLiving.isChild() && event.entityLiving.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot"))
|
||||
{
|
||||
|
||||
if (event.entityLiving.getClass() == EntityCow.class)
|
||||
{
|
||||
int amount = random.nextInt(3) + random.nextInt(1 + event.lootingLevel) + random.nextInt(3) + random.nextInt(1 + event.lootingLevel) + 1;
|
||||
|
||||
for (int iter = 0; iter < amount; ++iter)
|
||||
{
|
||||
addDrops(event, new ItemStack(Items.leather, 1));
|
||||
}
|
||||
}
|
||||
|
||||
if (event.entityLiving.getClass() == EntityChicken.class)
|
||||
{
|
||||
int amount = random.nextInt(3) + random.nextInt(1 + event.lootingLevel) + random.nextInt(3) + random.nextInt(1 + event.lootingLevel) + 1;
|
||||
|
||||
for (int iter = 0; iter < amount; ++iter)
|
||||
{
|
||||
addDrops(event, new ItemStack(Items.feather, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (event.recentlyHit)
|
||||
{
|
||||
if (event.entityLiving.getClass() == EntitySkeleton.class)
|
||||
{
|
||||
EntitySkeleton enemy = (EntitySkeleton) event.entityLiving;
|
||||
|
||||
if (event.source.damageType.equals("player"))
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) event.source.getEntity();
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if (stack != null && stack.hasTagCompound() && stack.getItem() instanceof ToolCore)
|
||||
{
|
||||
int beheading = stack.getTagCompound().getCompoundTag("InfiTool").getInteger("Beheading");
|
||||
if (stack.getItem() == TRepo.cleaver)
|
||||
beheading += 2;
|
||||
if (beheading > 0 && random.nextInt(100) < beheading * 10)
|
||||
{
|
||||
addDrops(event, new ItemStack(Items.skull, 1, enemy.getSkeletonType()));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (enemy.getSkeletonType() == 1 && random.nextInt(Math.max(1, 5 - event.lootingLevel)) == 0)
|
||||
{
|
||||
addDrops(event, new ItemStack(TRepo.materials, 1, 8));
|
||||
}
|
||||
}
|
||||
|
||||
if (event.entityLiving.getClass() == EntityZombie.class)
|
||||
{
|
||||
EntityZombie enemy = (EntityZombie) event.entityLiving;
|
||||
|
||||
if (event.source.damageType.equals("player"))
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) event.source.getEntity();
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
|
||||
if (stack != null && stack.hasTagCompound() && stack.getItem() instanceof ToolCore)
|
||||
{
|
||||
int beheading = stack.getTagCompound().getCompoundTag("InfiTool").getInteger("Beheading");
|
||||
if (stack != null && stack.hasTagCompound() && stack.getItem() == TRepo.cleaver)
|
||||
beheading += 2;
|
||||
if (beheading > 0 && random.nextInt(100) < beheading * 10)
|
||||
{
|
||||
addDrops(event, new ItemStack(Items.skull, 1, 2));
|
||||
}
|
||||
}
|
||||
|
||||
if (stack != null && stack.hasTagCompound() && stack.getItem() == TRepo.cleaver && random.nextInt(100) < 10) //Swap out for real beheading
|
||||
{
|
||||
addDrops(event, new ItemStack(Items.skull, 1, 2));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (event.entityLiving.getClass() == EntityCreeper.class)
|
||||
{
|
||||
EntityCreeper enemy = (EntityCreeper) event.entityLiving;
|
||||
|
||||
if (event.source.damageType.equals("player"))
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) event.source.getEntity();
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if (stack != null && stack.hasTagCompound() && stack.getItem() instanceof ToolCore)
|
||||
{
|
||||
int beheading = stack.getTagCompound().getCompoundTag("InfiTool").getInteger("Beheading");
|
||||
if (stack.getItem() == TRepo.cleaver)
|
||||
beheading += 2;
|
||||
if (beheading > 0 && random.nextInt(100) < beheading * 5)
|
||||
{
|
||||
addDrops(event, new ItemStack(Items.skull, 1, 4));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (event.entityLiving.getClass() == EntityGhast.class)
|
||||
{
|
||||
if (PHConstruct.uhcGhastDrops)
|
||||
{
|
||||
for (EntityItem o : event.drops)
|
||||
{
|
||||
if (o.getEntityItem().getItem() == Items.ghast_tear)
|
||||
{
|
||||
o.setEntityItemStack(new ItemStack(Items.gold_ingot, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
addDrops(event, new ItemStack(Items.ghast_tear, 1));
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
if (event.entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
|
||||
if (PHConstruct.dropPlayerHeads)
|
||||
{
|
||||
ItemStack dropStack = new ItemStack(Items.skull, 1, 3);
|
||||
NBTTagCompound nametag = new NBTTagCompound();
|
||||
nametag.setString("SkullOwner", player.getDisplayName());
|
||||
dropStack.setTagCompound(nametag);
|
||||
addDrops(event, dropStack);
|
||||
}
|
||||
|
||||
else if (event.source.damageType.equals("player"))
|
||||
{
|
||||
EntityPlayer source = (EntityPlayer) event.source.getEntity();
|
||||
ItemStack stack = source.getCurrentEquippedItem();
|
||||
if (stack != null && stack.hasTagCompound() && stack.getItem() instanceof ToolCore)
|
||||
{
|
||||
int beheading = stack.getTagCompound().getCompoundTag("InfiTool").getInteger("Beheading");
|
||||
if (stack.getItem() == TRepo.cleaver)
|
||||
beheading += 2;
|
||||
if (beheading > 0 && random.nextInt(100) < beheading * 50)
|
||||
{
|
||||
ItemStack dropStack = new ItemStack(Items.skull, 1, 3);
|
||||
NBTTagCompound nametag = new NBTTagCompound();
|
||||
nametag.setString("SkullOwner", player.getDisplayName());
|
||||
dropStack.setTagCompound(nametag);
|
||||
addDrops(event, dropStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*@SubscribeEvent
|
||||
public void onLivingDeath (LivingDeathEvent event)
|
||||
{
|
||||
Entity cause = event.source.getSourceOfDamage();
|
||||
if (cause != null && cause instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer murderer = (EntityPlayer) cause;
|
||||
ItemStack stack = murderer.getHeldItem();
|
||||
if (stack != null && stack.getItem() instanceof Weapon)
|
||||
{
|
||||
murderer.addStat(TAchievements.achievements.get("tconstruct:enemySlayer"), 1);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
void addDrops (LivingDropsEvent event, ItemStack dropStack)
|
||||
{
|
||||
EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
event.drops.add(entityitem);
|
||||
}
|
||||
|
||||
/*
|
||||
* @ForgeSubscribe public void onLivingSpawn (EntityJoinWorldEvent event) {
|
||||
* if (event.entity instanceof EntityXPOrb) {
|
||||
* TConstruct.logger.info("Entity: " + event.entity); } }
|
||||
*/
|
||||
|
||||
@SubscribeEvent
|
||||
public void onLivingSpawn (LivingSpawnEvent.SpecialSpawn event)
|
||||
{
|
||||
EntityLivingBase living = event.entityLiving;
|
||||
if (living.getClass() == EntitySpider.class && random.nextInt(100) == 0)
|
||||
{
|
||||
EntityCreeper creeper = new EntityCreeper(living.worldObj);
|
||||
spawnEntityLiving(living.posX, living.posY + 1, living.posZ, creeper, living.worldObj);
|
||||
if (living.riddenByEntity != null)
|
||||
creeper.mountEntity(living.riddenByEntity);
|
||||
else
|
||||
creeper.mountEntity(living);
|
||||
|
||||
EntityXPOrb orb = new EntityXPOrb(living.worldObj, living.posX, living.posY, living.posZ, random.nextInt(20) + 20);
|
||||
orb.mountEntity(creeper);
|
||||
}
|
||||
}
|
||||
|
||||
public static void spawnEntityLiving (double x, double y, double z, EntityLiving entity, World world)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
entity.setPosition(x, y, z);
|
||||
entity.onSpawnWithEgg((IEntityLivingData) null);
|
||||
world.spawnEntityInWorld(entity);
|
||||
}
|
||||
}
|
||||
|
||||
/* Bonemeal */
|
||||
|
||||
@SubscribeEvent
|
||||
public void bonemealEvent (BonemealEvent event)
|
||||
{
|
||||
if (!event.world.isRemote)
|
||||
{
|
||||
if (event.block == TRepo.slimeSapling)
|
||||
{
|
||||
if (TRepo.slimeSapling.boneFertilize(event.world, event.x, event.y, event.z, event.world.rand, event.entityPlayer))
|
||||
event.setResult(Event.Result.ALLOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Ore Dictionary */
|
||||
@SubscribeEvent
|
||||
public void registerOre (OreRegisterEvent evt)
|
||||
{
|
||||
|
||||
if (evt.Name == "crystalQuartz")
|
||||
{
|
||||
TRepo.modAttack.addStackToMatchList(evt.Ore, 2);
|
||||
}
|
||||
|
||||
else if (evt.Name == "crystalCerusQuartz")
|
||||
{
|
||||
TRepo.modAttack.addStackToMatchList(evt.Ore, 24);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void bucketFill (FillBucketEvent evt)
|
||||
{
|
||||
if (evt.current.getItem() == Items.bucket && evt.target.typeOfHit == MovingObjectType.ENTITY)
|
||||
{
|
||||
int hitX = evt.target.blockX;
|
||||
int hitY = evt.target.blockY;
|
||||
int hitZ = evt.target.blockZ;
|
||||
|
||||
if (evt.entityPlayer != null && !evt.entityPlayer.canPlayerEdit(hitX, hitY, hitZ, evt.target.sideHit, evt.current))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Block bID = evt.world.getBlock(hitX, hitY, hitZ);
|
||||
for (int id = 0; id < TRepo.fluidBlocks.length; id++)
|
||||
{
|
||||
if (bID == TRepo.fluidBlocks[id])
|
||||
{
|
||||
if (evt.entityPlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
WorldHelper.setBlockToAir(evt.world, hitX, hitY, hitZ);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TRepo.fluidBlocks[id] instanceof LiquidMetalFinite)
|
||||
{
|
||||
WorldHelper.setBlockToAir(evt.world, hitX, hitY, hitZ);
|
||||
/*
|
||||
* int quanta = 0; for (int posX = -1; posX <= 1;
|
||||
* posX++) { for (int posZ = -1; posZ <= 1; posZ++)
|
||||
* { int localID = evt.world.getBlockId(hitX + posX,
|
||||
* hitY, hitZ + posZ); if (localID == bID) { quanta
|
||||
* += evt.world.getBlockMetadata(hitX + posX, hitY,
|
||||
* hitZ + posZ) + 1; } } }
|
||||
*
|
||||
* if (quanta >= 8) { while (quanta > 0) { for (int
|
||||
* posX = -1; posX <= 1; posX++) { for (int posZ =
|
||||
* -1; posZ <= 1; posZ++) { int localID =
|
||||
* evt.world.getBlockId(hitX + posX, hitY, hitZ +
|
||||
* posZ); if (localID == bID) { quanta -= 1; int
|
||||
* meta = evt.world.getBlockMetadata(hitX + posX,
|
||||
* hitY, hitZ + posZ); if (meta > 0)
|
||||
* evt.world.setBlockMetadataWithNotify(hitX + posX,
|
||||
* hitY, hitZ + posZ, meta - 1, 3); else
|
||||
* evt.world.setBlockToAir(hitX + posX, hitY, hitZ +
|
||||
* posZ); } } } } }
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
WorldHelper.setBlockToAir(evt.world, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
evt.setResult(Result.ALLOW);
|
||||
evt.result = new ItemStack(TRepo.buckets, 1, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO 1.7 Fix this -- for ticking stuffs in extra armor slots
|
||||
|
||||
@SubscribeEvent
|
||||
public void livingUpdate (LivingUpdateEvent event)
|
||||
{
|
||||
if (event.entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
|
||||
if (stats != null && stats.armor != null)
|
||||
{
|
||||
ArmorExtended armor = stats.armor;
|
||||
for (int i = 0; i < armor.getSizeInventory(); i++)
|
||||
{
|
||||
if (armor.getStackInSlot(i) != null)
|
||||
{
|
||||
armor.getStackInSlot(i).getItem().onUpdate(armor.getStackInSlot(i), player.worldObj, player, i, false);
|
||||
armor.getStackInSlot(i).getItem().onArmorTick(player.worldObj, player, armor.getStackInSlot(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Player interact event - prevent breaking of tank air blocks in creative
|
||||
@SubscribeEvent
|
||||
public void playerInteract (PlayerInteractEvent event)
|
||||
{
|
||||
if (event.action == Action.LEFT_CLICK_BLOCK)
|
||||
{
|
||||
Block block = event.entity.worldObj.getBlock(event.x, event.y, event.z);
|
||||
if (block instanceof TankAirBlock)
|
||||
{
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void harvestBlock (HarvestDropsEvent event)
|
||||
{
|
||||
if (event.harvester == null)
|
||||
return;
|
||||
ItemStack stack = event.harvester.getCurrentEquippedItem();
|
||||
if (stack == null || stack.getItem() == null || !(stack.getItem() instanceof ToolCore))
|
||||
return;
|
||||
if (stack.getTagCompound().getCompoundTag("InfiTool").getBoolean("Lava"))
|
||||
{
|
||||
for (int i = 0; i < event.drops.size(); i++)
|
||||
{
|
||||
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(event.drops.get(i));
|
||||
if (result != null)
|
||||
event.drops.set(i, result.copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void breakBlock (BreakEvent event)
|
||||
{
|
||||
ItemStack stack = event.getPlayer().getCurrentEquippedItem();
|
||||
if (stack == null || stack.getItem() == null || !(stack.getItem() instanceof ToolCore))
|
||||
return;
|
||||
if (stack.getTagCompound().getCompoundTag("InfiTool").getBoolean("Broken"))
|
||||
{
|
||||
event.setCanceled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
|
||||
if (mod.beforeBlockBreak((ToolCore)stack.getItem(), stack, event.x, event.y, event.z, event.getPlayer()))
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -103,8 +103,8 @@ public class MiningExplosion extends Explosion
|
||||
int l1 = MathHelper.floor_double(this.explosionY + (double) this.explosionSize + 1.0D);
|
||||
int i2 = MathHelper.floor_double(this.explosionZ - (double) this.explosionSize - 1.0D);
|
||||
int j2 = MathHelper.floor_double(this.explosionZ + (double) this.explosionSize + 1.0D);
|
||||
List list = this.world.getEntitiesWithinAABBExcludingEntity(this.exploder, AxisAlignedBB.getAABBPool().getAABB((double) i, (double) k, (double) i2, (double) j, (double) l1, (double) j2));
|
||||
Vec3 vec3 = this.world.getWorldVec3Pool().getVecFromPool(this.explosionX, this.explosionY, this.explosionZ);
|
||||
List list = this.world.getEntitiesWithinAABBExcludingEntity(this.exploder, AxisAlignedBB.getBoundingBox((double) i, (double) k, (double) i2, (double) j, (double) l1, (double) j2));
|
||||
Vec3 vec3 = Vec3.createVectorHelper(this.explosionX, this.explosionY, this.explosionZ);
|
||||
|
||||
for (int k2 = 0; k2 < list.size(); ++k2)
|
||||
{
|
||||
@@ -134,7 +134,7 @@ public class MiningExplosion extends Explosion
|
||||
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
this.field_77288_k.put((EntityPlayer) entity, this.world.getWorldVec3Pool().getVecFromPool(d0 * d10, d1 * d10, d2 * d10));
|
||||
this.field_77288_k.put((EntityPlayer) entity, Vec3.createVectorHelper(d0 * d10, d1 * d10, d2 * d10));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -632,7 +632,7 @@ public class CartEntity extends Entity implements IInventory, IEntityAdditionalS
|
||||
par3 += 0.5D;
|
||||
}
|
||||
|
||||
return this.worldObj.getWorldVec3Pool().getVecFromPool(par1, par3, par5);
|
||||
return Vec3.createVectorHelper(par1, par3, par5);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -767,9 +767,9 @@ public class CartEntity extends Entity implements IInventory, IEntityAdditionalS
|
||||
{
|
||||
double var10 = par1Entity.posX - this.posX;
|
||||
double var12 = par1Entity.posZ - this.posZ;
|
||||
Vec3 var14 = this.worldObj.getWorldVec3Pool().getVecFromPool(var10, 0.0D, var12).normalize();
|
||||
Vec3 var15 = this.worldObj.getWorldVec3Pool()
|
||||
.getVecFromPool((double) MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F), 0.0D, (double) MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F))
|
||||
Vec3 var14 = Vec3.createVectorHelper(var10, 0.0D, var12).normalize();
|
||||
Vec3 var15 = Vec3.createVectorHelper
|
||||
((double) MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F), 0.0D, (double) MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F))
|
||||
.normalize();
|
||||
double var16 = Math.abs(var14.dotProduct(var15));
|
||||
|
||||
|
||||
Reference in new issue
Block a user