diff --git a/src/main/java/mekanism/api/Coord4D.java b/src/main/java/mekanism/api/Coord4D.java index cee802fe7..e7faff4b7 100644 --- a/src/main/java/mekanism/api/Coord4D.java +++ b/src/main/java/mekanism/api/Coord4D.java @@ -334,6 +334,16 @@ public class Coord4D return world.isAirBlock(xCoord, yCoord, zCoord); } + /** + * Whether or not this block this Coord4D represents is replaceable. + * @param world - world this Coord4D is in + * @return if this Coord4D is replaceable + */ + public boolean isReplaceable(IBlockAccess world) + { + return getBlock(world).isReplaceable(world, xCoord, yCoord, zCoord); + } + /** * Gets a bounding box that contains the area this Coord4D would take up in a world. * @return this Coord4D's bounding box diff --git a/src/main/java/mekanism/client/render/item/ItemRenderingHandler.java b/src/main/java/mekanism/client/render/item/ItemRenderingHandler.java index 5febb1b5d..fb9b13f6e 100644 --- a/src/main/java/mekanism/client/render/item/ItemRenderingHandler.java +++ b/src/main/java/mekanism/client/render/item/ItemRenderingHandler.java @@ -463,7 +463,8 @@ public class ItemRenderingHandler implements IItemRenderer } else if(type == ItemRenderType.INVENTORY) { - GL11.glRotatef(45F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(-0.5F, 0.0F, 0.0F); + GL11.glRotatef(45, 0.0F, 1.0F, 0.0F); } flamethrower.render(0.0625F); diff --git a/src/main/java/mekanism/common/Mekanism.java b/src/main/java/mekanism/common/Mekanism.java index 416bc6e70..7e63de7e9 100644 --- a/src/main/java/mekanism/common/Mekanism.java +++ b/src/main/java/mekanism/common/Mekanism.java @@ -607,6 +607,9 @@ public class Mekanism CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(Blocks.rail, 24), new Object[] { "O O", "OSO", "O O", Character.valueOf('O'), "ingotOsmium", Character.valueOf('S'), "stickWood" })); + CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(Flamethrower.getEmptyItem(), new Object[] { + "TTT", "TGS", "BCB", Character.valueOf('T'), "ingotTin", Character.valueOf('G'), MekanismUtils.getEmptyGasTank(), Character.valueOf('S'), Items.flint_and_steel, Character.valueOf('B'), "ingotBronze", Character.valueOf('C'), "circuitAdvanced" + })); //Energy Cube recipes CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(MekanismUtils.getEnergyCube(EnergyCubeTier.BASIC), new Object[] { diff --git a/src/main/java/mekanism/common/entity/EntityFlame.java b/src/main/java/mekanism/common/entity/EntityFlame.java index 9f78b975a..f3eb06353 100644 --- a/src/main/java/mekanism/common/entity/EntityFlame.java +++ b/src/main/java/mekanism/common/entity/EntityFlame.java @@ -6,6 +6,7 @@ import java.util.List; import mekanism.api.Coord4D; import mekanism.api.Pos3D; +import mekanism.common.util.MekanismUtils; import mekanism.common.util.StackUtils; import net.minecraft.block.Block; import net.minecraft.entity.Entity; @@ -17,10 +18,12 @@ import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; +import net.minecraft.util.EntityDamageSourceIndirect; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; public class EntityFlame extends Entity implements IEntityAdditionalSpawnData @@ -28,8 +31,6 @@ public class EntityFlame extends Entity implements IEntityAdditionalSpawnData public static final int LIFESPAN = 60; public static final int DAMAGE = 4; - public DamageSource flamethrowerDamage = (new DamageSource("flamethrower")).setFireDamage().setProjectile(); - public Entity owner = null; public EntityFlame(World world) @@ -93,10 +94,7 @@ public class EntityFlame extends Entity implements IEntityAdditionalSpawnData posY += motionY; posZ += motionZ; - if(rand.nextInt(4) == 0) - { - calculateVector(); - } + calculateVector(); if(ticksExisted > LIFESPAN) { @@ -108,8 +106,8 @@ public class EntityFlame extends Entity implements IEntityAdditionalSpawnData private void calculateVector() { Vec3 localVec = Vec3.createVectorHelper(posX, posY, posZ); - Vec3 motionVec = Vec3.createVectorHelper(posX + motionX, posY + motionY, posZ + motionZ); - MovingObjectPosition mop = worldObj.func_147447_a(localVec, motionVec, true, true, false); + Vec3 motionVec = Vec3.createVectorHelper(posX + motionX*2, posY + motionY*2, posZ + motionZ*2); + MovingObjectPosition mop = worldObj.func_147447_a(localVec, motionVec, true, false, false); localVec = Vec3.createVectorHelper(posX, posY, posZ); motionVec = Vec3.createVectorHelper(posX + motionX, posY + motionY, posZ + motionZ); @@ -127,7 +125,7 @@ public class EntityFlame extends Entity implements IEntityAdditionalSpawnData { if((entity1 instanceof EntityItem || entity1.canBeCollidedWith()) && (entity1 != owner || ticksExisted >= 5)) { - float boundsScale = 0.3F; + float boundsScale = 0.4F; AxisAlignedBB newBounds = entity1.boundingBox.expand((double)boundsScale, (double)boundsScale, (double)boundsScale); MovingObjectPosition movingobjectposition1 = newBounds.calculateIntercept(localVec, motionVec); @@ -180,10 +178,23 @@ public class EntityFlame extends Entity implements IEntityAdditionalSpawnData else { Block block = worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ); int meta = worldObj.getBlockMetadata(mop.blockX, mop.blockY, mop.blockZ); + boolean fluid = MekanismUtils.isFluid(worldObj, mop.blockX, mop.blockY, mop.blockZ) || MekanismUtils.isDeadFluid(worldObj, mop.blockX, mop.blockY, mop.blockZ); - smeltBlock(new Coord4D(mop.blockX, mop.blockY, mop.blockZ)); + Coord4D sideCoord = new Coord4D(mop.blockX, mop.blockY, mop.blockZ, worldObj.provider.dimensionId).getFromSide(ForgeDirection.getOrientation(mop.sideHit)); - System.out.println(block); + if(!fluid && (sideCoord.isAirBlock(worldObj) || sideCoord.isReplaceable(worldObj))) + { + if(!smeltBlock(new Coord4D(mop.blockX, mop.blockY, mop.blockZ))) + { + worldObj.setBlock(sideCoord.xCoord, sideCoord.yCoord, sideCoord.zCoord, Blocks.fire); + } + } + + if(fluid) + { + spawnParticlesAt(new Pos3D(this)); + worldObj.playSoundAtEntity(this, "random.fizz", 1.0F, 1.0F); + } } setDead(); @@ -200,6 +211,7 @@ public class EntityFlame extends Entity implements IEntityAdditionalSpawnData item.ticksExisted = 0; spawnParticlesAt(new Pos3D(item)); + worldObj.playSoundAtEntity(this, "random.fizz", 1.0F, 1.0F); return true; } @@ -226,6 +238,9 @@ public class EntityFlame extends Entity implements IEntityAdditionalSpawnData worldObj.setBlockToAir(block.xCoord, block.yCoord, block.zCoord); EntityItem item = new EntityItem(worldObj, block.xCoord + 0.5, block.yCoord + 0.5, block.zCoord + 0.5, result.copy()); + item.motionX = 0; + item.motionY = 0; + item.motionZ = 0; worldObj.spawnEntityInWorld(item); } @@ -242,8 +257,19 @@ public class EntityFlame extends Entity implements IEntityAdditionalSpawnData private void burn(Entity entity) { - entity.setFire(200); - entity.attackEntityFrom(flamethrowerDamage, DAMAGE); + entity.setFire(20); + entity.attackEntityFrom(getFlamethrowerDamage(), DAMAGE); + } + + private DamageSource getFlamethrowerDamage() + { + if(owner == null) + { + return DamageSource.causeThrownDamage(this, this); + } + else { + return DamageSource.causeThrownDamage(this, owner); + } } private void spawnParticlesAt(Pos3D pos)