Split more files into parts

This commit is contained in:
mDiyo committed 2014-06-06 19:46:05 -08:00
1 parent e2f0558b6f
commit 5a87c102ea
61 files changed
+1365 -1499

No files matched your search

@@ -0,0 +1,234 @@
package tconstruct.world;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.enchantment.EnchantmentProtection;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.ChunkPosition;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
public class MiningExplosion extends Explosion
{
World world;
private Random random = new Random();
private int field_77289_h = 16;
private Map field_77288_k = new HashMap();
public MiningExplosion(World par1World, Entity par2Entity, double par3, double par5, double par7, float par9)
{
super(par1World, par2Entity, par3, par5, par7, par9);
world = par1World;
}
@Override
public void doExplosionA ()
{
float f = this.explosionSize;
HashSet hashset = new HashSet();
int i;
int j;
int k;
double d0;
double d1;
double d2;
for (i = 0; i < this.field_77289_h; ++i)
{
for (j = 0; j < this.field_77289_h; ++j)
{
for (k = 0; k < this.field_77289_h; ++k)
{
if (i == 0 || i == this.field_77289_h - 1 || j == 0 || j == this.field_77289_h - 1 || k == 0 || k == this.field_77289_h - 1)
{
double d3 = (double) ((float) i / ((float) this.field_77289_h - 1.0F) * 2.0F - 1.0F);
double d4 = (double) ((float) j / ((float) this.field_77289_h - 1.0F) * 2.0F - 1.0F);
double d5 = (double) ((float) k / ((float) this.field_77289_h - 1.0F) * 2.0F - 1.0F);
double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
d3 /= d6;
d4 /= d6;
d5 /= d6;
float f1 = this.explosionSize * (0.7F + this.world.rand.nextFloat() * 0.6F);
d0 = this.explosionX;
d1 = this.explosionY;
d2 = this.explosionZ;
for (float f2 = 0.3F; f1 > 0.0F; f1 -= f2 * 0.75F)
{
int l = MathHelper.floor_double(d0);
int i1 = MathHelper.floor_double(d1);
int j1 = MathHelper.floor_double(d2);
Block k1 = this.world.getBlock(l, i1, j1);
if (k1 != Blocks.air)
{
Block block = k1;
float f3 = this.exploder != null ? this.exploder.func_145772_a(this, this.world, l, i1, j1, block) : block.getExplosionResistance(this.exploder, world, l, i1, j1,
explosionX, explosionY, explosionZ);
f1 -= (f3 + 0.8F) * f2 * 0.25f;
}
if (f1 > 0.0F && (this.exploder == null || this.exploder.func_145774_a(this, this.world, l, i1, j1, k1, f1)))
{
hashset.add(new ChunkPosition(l, i1, j1));
}
d0 += d3 * (double) f2;
d1 += d4 * (double) f2;
d2 += d5 * (double) f2;
}
}
}
}
}
this.affectedBlockPositions.addAll(hashset);
this.explosionSize *= 2.0F;
i = MathHelper.floor_double(this.explosionX - (double) this.explosionSize - 1.0D);
j = MathHelper.floor_double(this.explosionX + (double) this.explosionSize + 1.0D);
k = MathHelper.floor_double(this.explosionY - (double) this.explosionSize - 1.0D);
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);
for (int k2 = 0; k2 < list.size(); ++k2)
{
Entity entity = (Entity) list.get(k2);
double d7 = entity.getDistance(this.explosionX, this.explosionY, this.explosionZ) / (double) this.explosionSize;
if (d7 <= 1.0D)
{
d0 = entity.posX - this.explosionX;
d1 = entity.posY + (double) entity.getEyeHeight() - this.explosionY;
d2 = entity.posZ - this.explosionZ;
double d8 = (double) MathHelper.sqrt_double(d0 * d0 + d1 * d1 + d2 * d2);
if (d8 != 0.0D)
{
d0 /= d8;
d1 /= d8;
d2 /= d8;
double d9 = (double) this.world.getBlockDensity(vec3, entity.boundingBox);
double d10 = (1.0D - d7) * d9;
if (!(entity instanceof EntityItem))
entity.attackEntityFrom(DamageSource.setExplosionSource(this), (float) ((int) ((d10 * d10 + d10) / 2.0D * 8.0D * (double) this.explosionSize + 1.0D)));
double d11 = EnchantmentProtection.func_92092_a(entity, d10);
entity.motionX += d0 * d11;
entity.motionY += d1 * d11;
entity.motionZ += d2 * d11;
if (entity instanceof EntityPlayer)
{
this.field_77288_k.put((EntityPlayer) entity, this.world.getWorldVec3Pool().getVecFromPool(d0 * d10, d1 * d10, d2 * d10));
}
}
}
}
this.explosionSize = f;
}
@Override
public void doExplosionB (boolean par1)
{
this.world.playSoundEffect(this.explosionX, this.explosionY, this.explosionZ, "random.explode", 4.0F, (1.0F + (this.world.rand.nextFloat() - this.world.rand.nextFloat()) * 0.2F) * 0.7F);
if (this.explosionSize >= 2.0F && this.isSmoking)
{
this.world.spawnParticle("hugeexplosion", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D);
}
else
{
this.world.spawnParticle("largeexplode", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D);
}
Iterator iterator;
ChunkPosition chunkposition;
int i;
int j;
int k;
Block l;
if (this.isSmoking)
{
iterator = this.affectedBlockPositions.iterator();
while (iterator.hasNext())
{
chunkposition = (ChunkPosition) iterator.next();
i = chunkposition.chunkPosX;
j = chunkposition.chunkPosY;
k = chunkposition.chunkPosZ;
l = this.world.getBlock(i, j, k);
if (par1)
{
double d0 = (double) ((float) i + this.world.rand.nextFloat());
double d1 = (double) ((float) j + this.world.rand.nextFloat());
double d2 = (double) ((float) k + this.world.rand.nextFloat());
double d3 = d0 - this.explosionX;
double d4 = d1 - this.explosionY;
double d5 = d2 - this.explosionZ;
double d6 = (double) MathHelper.sqrt_double(d3 * d3 + d4 * d4 + d5 * d5);
d3 /= d6;
d4 /= d6;
d5 /= d6;
double d7 = 0.5D / (d6 / (double) this.explosionSize + 0.1D);
d7 *= (double) (this.world.rand.nextFloat() * this.world.rand.nextFloat() + 0.3F);
d3 *= d7;
d4 *= d7;
d5 *= d7;
this.world.spawnParticle("explode", (d0 + this.explosionX * 1.0D) / 2.0D, (d1 + this.explosionY * 1.0D) / 2.0D, (d2 + this.explosionZ * 1.0D) / 2.0D, d3, d4, d5);
this.world.spawnParticle("smoke", d0, d1, d2, d3, d4, d5);
}
if (l != Blocks.air)
{
Block block = l;
if (block.canDropFromExplosion(this))
{
block.dropBlockAsItemWithChance(this.world, i, j, k, this.world.getBlockMetadata(i, j, k), 1.0F, 0);
}
block.onBlockExploded(this.world, i, j, k, this);
}
}
}
if (this.isFlaming)
{
iterator = this.affectedBlockPositions.iterator();
while (iterator.hasNext())
{
chunkposition = (ChunkPosition) iterator.next();
i = chunkposition.chunkPosX;
j = chunkposition.chunkPosY;
k = chunkposition.chunkPosZ;
l = this.world.getBlock(i, j, k);
Block i1 = this.world.getBlock(i, j - 1, k);
if (l == Blocks.air && i1.isOpaqueCube() && this.random.nextInt(3) == 0)
{
this.world.setBlock(i, j, k, Blocks.fire);
}
}
}
}
}
@@ -0,0 +1,34 @@
package tconstruct.world;
import net.minecraft.block.BlockDispenser;
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
import net.minecraft.dispenser.IBlockSource;
import net.minecraft.entity.EntityLiving;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import tconstruct.tools.items.TitleIcon;
public class TDispenserBehaviorSpawnEgg extends BehaviorDefaultDispenseItem
{
/**
* Dispense the specified stack, play the dispense sound and spawn
* particles.
*/
@Override
public ItemStack dispenseStack (IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
EnumFacing enumfacing = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
double d0 = par1IBlockSource.getX() + (double) enumfacing.getFrontOffsetX();
double d1 = (double) ((float) par1IBlockSource.getYInt() + 0.2F);
double d2 = par1IBlockSource.getZ() + (double) enumfacing.getFrontOffsetZ();
EntityLiving entity = TitleIcon.activateSpawnEgg(par2ItemStack, par1IBlockSource.getWorld(), d0, d1, d2, 0);
if (par2ItemStack.hasDisplayName())
{
((EntityLiving) entity).setCustomNameTag(par2ItemStack.getDisplayName());
}
par2ItemStack.splitStack(1);
return par2ItemStack;
}
}
+20 -41
View File
@@ -1,11 +1,9 @@
package tconstruct.world;
import java.util.HashMap;
import mantle.utils.RecipeRemover;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDispenser;
import net.minecraft.block.Block.SoundType;
import net.minecraft.block.BlockDispenser;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
@@ -13,19 +11,18 @@ import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.stats.Achievement;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraftforge.common.ChestGenHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import tconstruct.TConstruct;
import tconstruct.achievements.TAchievements;
import tconstruct.armor.TinkerArmor;
import tconstruct.blocks.SlabBase;
import tconstruct.blocks.logic.DryingRackLogic;
@@ -40,13 +37,14 @@ import tconstruct.blocks.traps.Punji;
import tconstruct.client.StepSoundSlime;
import tconstruct.common.itemblocks.MetadataItemBlock;
import tconstruct.library.TConstructRegistry;
import tconstruct.mechworks.blocks.BlockLandmine;
import tconstruct.mechworks.TinkerMechworks;
import tconstruct.mechworks.entity.item.EntityLandmineFirework;
import tconstruct.mechworks.entity.item.ExplosivePrimed;
import tconstruct.mechworks.itemblocks.ItemBlockLandmine;
import tconstruct.mechworks.logic.TileEntityLandmine;
import tconstruct.smeltery.TinkerSmeltery;
import tconstruct.smeltery.blocks.MetalOre;
import tconstruct.tools.TDispenserBehaviorArrow;
import tconstruct.tools.TinkerTools;
import tconstruct.tools.blocks.MultiBrick;
import tconstruct.tools.blocks.MultiBrickFancy;
@@ -56,8 +54,6 @@ import tconstruct.tools.entity.FancyEntityItem;
import tconstruct.tools.entity.LaunchedPotion;
import tconstruct.tools.itemblocks.MultiBrickFancyItem;
import tconstruct.tools.itemblocks.MultiBrickItem;
import tconstruct.util.TDispenserBehaviorArrow;
import tconstruct.util.TDispenserBehaviorSpawnEgg;
import tconstruct.world.blocks.ConveyorBase;
import tconstruct.world.blocks.GravelOre;
import tconstruct.world.blocks.MeatBlock;
@@ -88,6 +84,7 @@ import tconstruct.world.items.StrangeFood;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
@@ -97,8 +94,11 @@ import cpw.mods.fml.common.registry.GameRegistry;
@Mod(modid = "TinkerWorld", name = "TinkerWorld", version = "${tinkerworldversion}")
public class TinkerWorld
{
@Instance("TinkerArmor")
@Instance("TinkerWorld")
public static TinkerWorld instance;
@SidedProxy(clientSide = "tconstruct.world.TinkerWorldProxyClient", serverSide = "tconstruct.world.TinkerWorldProxyCommon")
public static TinkerWorldProxyCommon proxy;
public static Item strangeFood;
// Decoration
public static Block stoneTorch;
@@ -134,9 +134,12 @@ public class TinkerWorld
// Chest hooks
public static ChestGenHooks tinkerHouseChest;
public static ChestGenHooks tinkerHousePatterns;
// Traps
public static Block landmine;
public static Block punji;
public TinkerWorld()
{
MinecraftForge.EVENT_BUS.register(new TinkerWorldEvents());
}
@EventHandler
public void preInit (FMLPreInitializationEvent event)
@@ -148,7 +151,6 @@ public class TinkerWorld
TinkerWorld.woolSlab2 = new SlabBase(Material.cloth, Blocks.wool, 8, 8).setBlockName("cloth");
TinkerWorld.woolSlab2.setStepSound(Block.soundTypeCloth).setCreativeTab(CreativeTabs.tabDecorations);
// Traps
TinkerWorld.landmine = new BlockLandmine().setHardness(0.5F).setResistance(0F).setStepSound(Block.soundTypeMetal).setCreativeTab(CreativeTabs.tabRedstone).setBlockName("landmine");
TinkerWorld.punji = new Punji().setBlockName("trap.punji");
TinkerWorld.barricadeOak = new BarricadeBlock(Blocks.log, 0).setBlockName("trap.barricade.oak");
TinkerWorld.barricadeSpruce = new BarricadeBlock(Blocks.log, 1).setBlockName("trap.barricade.spruce");
@@ -212,7 +214,7 @@ public class TinkerWorld
GameRegistry.registerBlock(TinkerWorld.woolSlab2, WoolSlab2Item.class, "WoolSlab2");
// Traps
GameRegistry.registerBlock(TinkerWorld.landmine, ItemBlockLandmine.class, "Redstone.Landmine");
GameRegistry.registerBlock(TinkerMechworks.landmine, ItemBlockLandmine.class, "Redstone.Landmine");
GameRegistry.registerTileEntity(TileEntityLandmine.class, "Landmine");
GameRegistry.registerBlock(TinkerWorld.punji, "trap.punji");
GameRegistry.registerBlock(TinkerWorld.barricadeOak, BarricadeItem.class, "trap.barricade.oak");
@@ -405,13 +407,13 @@ public class TinkerWorld
// Landmine Recipes
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerWorld.landmine, 1, 0), "mcm", "rpr", 'm', "plankWood", 'c', new ItemStack(TinkerTools.blankPattern, 1, 1), 'r', Items.redstone,
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerMechworks.landmine, 1, 0), "mcm", "rpr", 'm', "plankWood", 'c', new ItemStack(TinkerTools.blankPattern, 1, 1), 'r', Items.redstone,
'p', Blocks.stone_pressure_plate));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerWorld.landmine, 1, 1), "mcm", "rpr", 'm', Blocks.stone, 'c', new ItemStack(TinkerTools.blankPattern, 1, 1), 'r', Items.redstone,
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerMechworks.landmine, 1, 1), "mcm", "rpr", 'm', Blocks.stone, 'c', new ItemStack(TinkerTools.blankPattern, 1, 1), 'r', Items.redstone,
'p', Blocks.stone_pressure_plate));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerWorld.landmine, 1, 2), "mcm", "rpr", 'm', Blocks.obsidian, 'c', new ItemStack(TinkerTools.blankPattern, 1, 1), 'r',
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerMechworks.landmine, 1, 2), "mcm", "rpr", 'm', Blocks.obsidian, 'c', new ItemStack(TinkerTools.blankPattern, 1, 1), 'r',
Items.redstone, 'p', Blocks.stone_pressure_plate));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerWorld.landmine, 1, 3), "mcm", "rpr", 'm', Items.repeater, 'c', new ItemStack(TinkerTools.blankPattern, 1, 1), 'r',
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerMechworks.landmine, 1, 3), "mcm", "rpr", 'm', Items.repeater, 'c', new ItemStack(TinkerTools.blankPattern, 1, 1), 'r',
Items.redstone, 'p', Blocks.stone_pressure_plate));
// Ultra hardcore recipes
@@ -635,29 +637,6 @@ public class TinkerWorld
OreDictionary.registerOre(oreName, is);
}
}
public void addAchievements ()
{
HashMap<String, Achievement> achievements = TAchievements.achievements;
achievements.put("tconstruct:beginner", new Achievement("tconstruct:beginner", "tconstruct.beginner", 0, 0, TinkerTools.manualBook, null));// .setIndependent());
achievements.put("tconstruct:pattern", new Achievement("tconstruct:pattern", "tconstruct.pattern", 2, 1, TinkerTools.blankPattern, achievements.get("tconstruct:beginner")));
achievements.put("tconstruct:tinkerer", new Achievement("tconstruct:tinkerer", "tconstruct.tinkerer", 2, 2, new ItemStack(TinkerTools.titleIcon, 1, 4096), achievements.get("tconstruct:pattern")));
achievements.put("tconstruct:preparedFight",
new Achievement("tconstruct:preparedFight", "tconstruct.preparedFight", 1, 3, new ItemStack(TinkerTools.titleIcon, 1, 4097), achievements.get("tconstruct:tinkerer")));
achievements.put("tconstruct:proTinkerer",
new Achievement("tconstruct:proTinkerer", "tconstruct.proTinkerer", 4, 4, new ItemStack(TinkerTools.titleIcon, 1, 4098), achievements.get("tconstruct:tinkerer")).setSpecial());
achievements.put("tconstruct:smelteryMaker", new Achievement("tconstruct:smelteryMaker", "tconstruct.smelteryMaker", -2, -1, TinkerSmeltery.smeltery, achievements.get("tconstruct:beginner")));
achievements.put("tconstruct:enemySlayer",
new Achievement("tconstruct:enemySlayer", "tconstruct.enemySlayer", 0, 5, new ItemStack(TinkerTools.titleIcon, 1, 4099), achievements.get("tconstruct:preparedFight")));
achievements.put("tconstruct:dualConvenience",
new Achievement("tconstruct:dualConvenience", "tconstruct.dualConvenience", 0, 7, new ItemStack(TinkerTools.titleIcon, 1, 4100), achievements.get("tconstruct:enemySlayer")).setSpecial());
achievements.put("tconstruct:doingItWrong",
new Achievement("tconstruct:doingItWrong", "tconstruct.doingItWrong", -2, -3, new ItemStack(TinkerTools.manualBook, 1, 2), achievements.get("tconstruct:smelteryMaker")));
achievements.put("tconstruct:betterCrafting",
new Achievement("tconstruct:betterCrafting", "tconstruct.betterCrafting", -2, 2, TinkerTools.craftingStationWood, achievements.get("tconstruct:beginner")));
}
public void addLoot ()
@@ -0,0 +1,149 @@
package tconstruct.world;
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.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import net.minecraftforge.event.entity.player.BonemealEvent;
import tconstruct.TConstruct;
import tconstruct.armor.TinkerArmor;
import tconstruct.library.tools.ToolCore;
import tconstruct.tools.TinkerTools;
import tconstruct.util.ItemHelper;
import tconstruct.util.config.PHConstruct;
import tconstruct.world.entity.BlueSlime;
import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class TinkerWorldEvents
{
@SubscribeEvent
public void onLivingSpawn (LivingSpawnEvent.SpecialSpawn event)
{
EntityLivingBase living = event.entityLiving;
if (living.getClass() == EntitySpider.class && TConstruct.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, TConstruct.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 == TinkerWorld.slimeSapling)
{
if (TinkerWorld.slimeSapling.boneFertilize(event.world, event.x, event.y, event.z, event.world.rand, event.entityPlayer))
event.setResult(Event.Result.ALLOW);
}
}
}
/* 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 == TinkerTools.cutlass)
{
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 3 * 20, 1));
}
else if (item == TinkerTools.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 onLivingDrop (LivingDropsEvent event)
{
if (event.entityLiving == null)
return;
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
{
ItemHelper.addDrops(event, new ItemStack(Items.ghast_tear, 1));
}
}
}
}
@@ -0,0 +1,237 @@
package tconstruct.world;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityAuraFX;
import net.minecraft.client.particle.EntityBreakingFX;
import net.minecraft.client.particle.EntityBubbleFX;
import net.minecraft.client.particle.EntityCloudFX;
import net.minecraft.client.particle.EntityCritFX;
import net.minecraft.client.particle.EntityDropParticleFX;
import net.minecraft.client.particle.EntityEnchantmentTableParticleFX;
import net.minecraft.client.particle.EntityExplodeFX;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.particle.EntityFireworkSparkFX;
import net.minecraft.client.particle.EntityFlameFX;
import net.minecraft.client.particle.EntityFootStepFX;
import net.minecraft.client.particle.EntityHeartFX;
import net.minecraft.client.particle.EntityHugeExplodeFX;
import net.minecraft.client.particle.EntityLargeExplodeFX;
import net.minecraft.client.particle.EntityLavaFX;
import net.minecraft.client.particle.EntityNoteFX;
import net.minecraft.client.particle.EntityPortalFX;
import net.minecraft.client.particle.EntityReddustFX;
import net.minecraft.client.particle.EntitySmokeFX;
import net.minecraft.client.particle.EntitySnowShovelFX;
import net.minecraft.client.particle.EntitySpellParticleFX;
import net.minecraft.client.particle.EntitySplashFX;
import net.minecraft.client.particle.EntitySuspendFX;
import net.minecraft.init.Items;
public class TinkerWorldProxyClient extends TinkerWorldProxyCommon
{
Minecraft mc = Minecraft.getMinecraft();
@Override
public void spawnParticle (String particle, double xPos, double yPos, double zPos, double velX, double velY, double velZ)
{
this.doSpawnParticle(particle, xPos, yPos, zPos, velX, velY, velZ);
}
public EntityFX doSpawnParticle (String par1Str, double par2, double par4, double par6, double par8, double par10, double par12)
{
if (this.mc == null)
this.mc = Minecraft.getMinecraft();
if (this.mc.renderViewEntity != null && this.mc.effectRenderer != null)
{
int i = this.mc.gameSettings.particleSetting;
if (i == 1 && mc.theWorld.rand.nextInt(3) == 0)
{
i = 2;
}
double d6 = this.mc.renderViewEntity.posX - par2;
double d7 = this.mc.renderViewEntity.posY - par4;
double d8 = this.mc.renderViewEntity.posZ - par6;
EntityFX entityfx = null;
if (par1Str.equals("hugeexplosion"))
{
this.mc.effectRenderer.addEffect(entityfx = new EntityHugeExplodeFX(mc.theWorld, par2, par4, par6, par8, par10, par12));
}
else if (par1Str.equals("largeexplode"))
{
this.mc.effectRenderer.addEffect(entityfx = new EntityLargeExplodeFX(mc.renderEngine, mc.theWorld, par2, par4, par6, par8, par10, par12));
}
else if (par1Str.equals("fireworksSpark"))
{
this.mc.effectRenderer.addEffect(entityfx = new EntityFireworkSparkFX(mc.theWorld, par2, par4, par6, par8, par10, par12, this.mc.effectRenderer));
}
if (entityfx != null)
{
return (EntityFX) entityfx;
}
else
{
double d9 = 16.0D;
if (d6 * d6 + d7 * d7 + d8 * d8 > d9 * d9)
{
return null;
}
else if (i > 1)
{
return null;
}
else
{
if (par1Str.equals("bubble"))
{
entityfx = new EntityBubbleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("suspended"))
{
entityfx = new EntitySuspendFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("depthsuspend"))
{
entityfx = new EntityAuraFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("townaura"))
{
entityfx = new EntityAuraFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("crit"))
{
entityfx = new EntityCritFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("smoke"))
{
entityfx = new EntitySmokeFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("mobSpell"))
{
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, 0.0D, 0.0D, 0.0D);
((EntityFX) entityfx).setRBGColorF((float) par8, (float) par10, (float) par12);
}
else if (par1Str.equals("mobSpellAmbient"))
{
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, 0.0D, 0.0D, 0.0D);
((EntityFX) entityfx).setAlphaF(0.15F);
((EntityFX) entityfx).setRBGColorF((float) par8, (float) par10, (float) par12);
}
else if (par1Str.equals("spell"))
{
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("instantSpell"))
{
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
((EntitySpellParticleFX) entityfx).setBaseSpellTextureIndex(144);
}
else if (par1Str.equals("witchMagic"))
{
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
((EntitySpellParticleFX) entityfx).setBaseSpellTextureIndex(144);
float f = mc.theWorld.rand.nextFloat() * 0.5F + 0.35F;
((EntityFX) entityfx).setRBGColorF(1.0F * f, 0.0F * f, 1.0F * f);
}
else if (par1Str.equals("note"))
{
entityfx = new EntityNoteFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("portal"))
{
entityfx = new EntityPortalFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("enchantmenttable"))
{
entityfx = new EntityEnchantmentTableParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("explode"))
{
entityfx = new EntityExplodeFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("flame"))
{
entityfx = new EntityFlameFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("lava"))
{
entityfx = new EntityLavaFX(mc.theWorld, par2, par4, par6);
}
else if (par1Str.equals("footstep"))
{
entityfx = new EntityFootStepFX(mc.renderEngine, mc.theWorld, par2, par4, par6);
}
else if (par1Str.equals("splash"))
{
entityfx = new EntitySplashFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("largesmoke"))
{
entityfx = new EntitySmokeFX(mc.theWorld, par2, par4, par6, par8, par10, par12, 2.5F);
}
else if (par1Str.equals("cloud"))
{
entityfx = new EntityCloudFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("reddust"))
{
entityfx = new EntityReddustFX(mc.theWorld, par2, par4, par6, (float) par8, (float) par10, (float) par12);
}
else if (par1Str.equals("snowballpoof"))
{
entityfx = new EntityBreakingFX(mc.theWorld, par2, par4, par6, Items.snowball);
}
else if (par1Str.equals("dripWater"))
{
entityfx = new EntityDropParticleFX(mc.theWorld, par2, par4, par6, Material.water);
}
else if (par1Str.equals("dripLava"))
{
entityfx = new EntityDropParticleFX(mc.theWorld, par2, par4, par6, Material.lava);
}
else if (par1Str.equals("snowshovel"))
{
entityfx = new EntitySnowShovelFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("blueslime"))
{
entityfx = new EntityBreakingFX(mc.theWorld, par2, par4, par6, TinkerWorld.strangeFood);
}
else if (par1Str.equals("heart"))
{
entityfx = new EntityHeartFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("angryVillager"))
{
entityfx = new EntityHeartFX(mc.theWorld, par2, par4 + 0.5D, par6, par8, par10, par12);
((EntityFX) entityfx).setParticleTextureIndex(81);
((EntityFX) entityfx).setRBGColorF(1.0F, 1.0F, 1.0F);
}
else if (par1Str.equals("happyVillager"))
{
entityfx = new EntityAuraFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
((EntityFX) entityfx).setParticleTextureIndex(82);
((EntityFX) entityfx).setRBGColorF(1.0F, 1.0F, 1.0F);
}
if (entityfx != null)
{
this.mc.effectRenderer.addEffect((EntityFX) entityfx);
}
return (EntityFX) entityfx;
}
}
}
else
{
return null;
}
}
}
@@ -0,0 +1,11 @@
package tconstruct.world;
public class TinkerWorldProxyCommon
{
public void spawnParticle (String particle, double xPos, double yPos, double zPos, double velX, double velY, double velZ)
{
}
}
@@ -3,7 +3,7 @@ package tconstruct.world.model;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import tconstruct.client.TProxyClient;
import tconstruct.util.ItemHelper;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
@@ -136,9 +136,9 @@ public class BarricadeRender implements ISimpleBlockRenderingHandler
if (modelID == model)
{
renderer.setRenderBounds(0.375F, 0.0F, 0.375F, 0.625F, 1.0F, 0.625F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.375F, 0.375F, 0.0F, 0.625F, 0.625F, 1.0F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
}
}
@@ -3,7 +3,7 @@ package tconstruct.world.model;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import tconstruct.client.TProxyClient;
import tconstruct.util.ItemHelper;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
@@ -43,7 +43,7 @@ public class OreberryRender implements ISimpleBlockRenderingHandler
if (modelID == model)
{
renderer.setRenderBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.75F, 0.875F);
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
}
}
@@ -6,7 +6,7 @@ import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import tconstruct.client.TProxyClient;
import tconstruct.util.ItemHelper;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
@@ -19,7 +19,7 @@ public class SlimeChannelRender implements ISimpleBlockRenderingHandler
{
if (modelID == model)
{
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
}
}
@@ -4,7 +4,7 @@ import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import tconstruct.client.BlockSkinRenderHelper;
import tconstruct.client.TProxyClient;
import tconstruct.util.ItemHelper;
import tconstruct.world.TinkerWorld;
import tconstruct.world.blocks.SlimePad;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
@@ -19,7 +19,7 @@ public class SlimePadRender implements ISimpleBlockRenderingHandler
{
if (modelID == model)
{
TProxyClient.renderStandardInvBlock(renderer, TinkerWorld.slimeGel, metadata);
ItemHelper.renderStandardInvBlock(renderer, TinkerWorld.slimeGel, metadata);
}
}
@@ -9,6 +9,7 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.village.MerchantRecipe;
import net.minecraft.village.MerchantRecipeList;
import tconstruct.mechworks.TinkerMechworks;
import tconstruct.tools.TinkerTools;
import tconstruct.world.TinkerWorld;
import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler;
@@ -40,7 +41,7 @@ public class TVillageTrades implements IVillageTradeHandler
allowedIngredients.add(new ItemStack(TinkerTools.toolStationWood, 3, 10));
for (int sc = 0; sc < 4; sc++)
{
allowedIngredients.add(new ItemStack(TinkerWorld.landmine, 64, sc));
allowedIngredients.add(new ItemStack(TinkerMechworks.landmine, 64, sc));
}
}