Merge branch 'master' into weaponry

This commit is contained in:
Bernhard Bonigl committed 2014-10-21 20:59:46 +02:00
commit a1434c0e33
8 files changed
+117 -33

No files matched your search

+1
View File
@@ -79,6 +79,7 @@ public class TConstruct
public static final int blockLiquidValue = ingotLiquidValue * 9;
public static final int chunkLiquidValue = ingotLiquidValue / 2;
public static final int nuggetLiquidValue = ingotLiquidValue / 9;
public static final int stoneLiquidValue = ingotLiquidValue/8;
public static final int liquidUpdateAmount = 6;
public static final String modID = "TConstruct";
@@ -1,5 +1,6 @@
package tconstruct.library;
import net.minecraft.block.Block;
import net.minecraft.entity.*;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -20,11 +21,17 @@ public class ActiveToolMod
return false;
}
@Deprecated
public boolean afterBlockBreak () // Unfinished, not called
{
return false;
}
public void afterBlockBreak(ToolCore tool, ItemStack stack, Block block, int x, int y, int z, EntityLivingBase entity)
{
}
/* Attacking */
public int baseAttackDamage (int earlyModDamage, int damage, ToolCore tool, NBTTagCompound tags, NBTTagCompound toolTags, ItemStack stack, EntityLivingBase player, Entity entity)
@@ -549,6 +549,9 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem, IMo
@Override
public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player)
{
if(!stack.hasTagCompound())
return false;
boolean cancelHarvest = false;
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
{
@@ -562,6 +565,13 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem, IMo
@Override
public boolean onBlockDestroyed (ItemStack itemstack, World world, Block block, int x, int y, int z, EntityLivingBase player)
{
if(!itemstack.hasTagCompound())
return false;
// callbacks!
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
mod.afterBlockBreak(this, itemstack, block, x, y, z, player);
if (block != null && (double) block.getBlockHardness(world, x, y, z) != 0.0D)
{
return AbilityHelper.onBlockChanged(itemstack, world, block, x, y, z, player, random);
@@ -848,7 +848,7 @@ public class TinkerSmeltery
public void addOreDictionarySmelteryRecipes ()
{
List<FluidType> exceptions = Arrays.asList(new FluidType[] { FluidType.getFluidType("Water"), FluidType.getFluidType("Stone"), FluidType.getFluidType("Ender"), FluidType.getFluidType("Glass"), FluidType.getFluidType("Slime"), FluidType.getFluidType("Obsidian") });
List<FluidType> exceptions = Arrays.asList(new FluidType[] { FluidType.getFluidType("Water"), FluidType.getFluidType("Stone"), FluidType.getFluidType("Emerald"), FluidType.getFluidType("Ender"), FluidType.getFluidType("Glass"), FluidType.getFluidType("Slime"), FluidType.getFluidType("Obsidian") });
Iterator iter = FluidType.fluidTypes.entrySet().iterator();
while (iter.hasNext())
{
@@ -924,10 +924,10 @@ public class TinkerSmeltery
}
}
// Compressed materials
for (int i = 1; i <= 8; i++)
// Compressed materials. max 4x because it's too much otherwise.
for (int i = 1; i <= 4; i++)
{
Smeltery.addDictionaryMelting("compressedCobblestone" + i + "x", FluidType.getFluidType("Stone"), 0, TConstruct.ingotLiquidValue / 18 * (int) Math.pow(9, i));
Smeltery.addDictionaryMelting("compressedCobblestone" + i + "x", FluidType.getFluidType("Stone"), 0, TConstruct.stoneLiquidValue * (int) Math.pow(9, i));
}
Smeltery.addDictionaryMelting("compressedSand1x", FluidType.getFluidType("Glass"), 175, FluidContainerRegistry.BUCKET_VOLUME * 9);
Smeltery.addDictionaryMelting("compressedSand2x", FluidType.getFluidType("Glass"), 175, FluidContainerRegistry.BUCKET_VOLUME * 9 * 9);
@@ -1194,9 +1194,10 @@ public class TinkerSmeltery
Smeltery.addMelting(Blocks.sand, 0, 625, new FluidStack(TinkerSmeltery.moltenGlassFluid, FluidContainerRegistry.BUCKET_VOLUME));
Smeltery.addMelting(Blocks.glass, 0, 625, new FluidStack(TinkerSmeltery.moltenGlassFluid, FluidContainerRegistry.BUCKET_VOLUME));
Smeltery.addMelting(Blocks.glass_pane, 0, 625, new FluidStack(TinkerSmeltery.moltenGlassFluid, 250));
Smeltery.addMelting(Blocks.stone, 0, 800, new FluidStack(TinkerSmeltery.moltenStoneFluid, TConstruct.ingotLiquidValue / 18));
Smeltery.addMelting(Blocks.cobblestone, 0, 800, new FluidStack(TinkerSmeltery.moltenStoneFluid, TConstruct.ingotLiquidValue / 8));
Smeltery.addMelting(Blocks.stone, 0, 800, new FluidStack(TinkerSmeltery.moltenStoneFluid, TConstruct.stoneLiquidValue));
Smeltery.addMelting(Blocks.cobblestone, 0, 800, new FluidStack(TinkerSmeltery.moltenStoneFluid, TConstruct.stoneLiquidValue));
Smeltery.addMelting(Blocks.emerald_block, 0, 800, new FluidStack(TinkerSmeltery.moltenEmeraldFluid, 640 * 9));
Smeltery.addMelting(Blocks.emerald_ore, 0, 800, new FluidStack(TinkerSmeltery.moltenEmeraldFluid, 640 * 2)); // the ore also is done here
Smeltery.addMelting(TinkerSmeltery.glueBlock, 0, 250, new FluidStack(TinkerSmeltery.glueFluid, TConstruct.blockLiquidValue));
Smeltery.addMelting(TinkerTools.craftedSoil, 1, 600, new FluidStack(TinkerSmeltery.moltenStoneFluid, TConstruct.ingotLiquidValue / 4));
@@ -507,8 +507,12 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
needsUpdate = true;
if (moltenMetal.size() == 0)
{
// does it fit in?
if(liquid.amount > this.getCapacity())
return false;
moltenMetal.add(liquid.copy());
currentLiquid += liquid.amount;
updateCurrentLiquid();
return true;
}
else
@@ -5,6 +5,7 @@ import net.minecraft.block.Block;
import net.minecraft.enchantment.*;
import net.minecraft.entity.*;
import net.minecraft.entity.item.*;
import net.minecraft.entity.monster.EntitySlime;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.*;
import net.minecraft.item.crafting.FurnaceRecipes;
@@ -16,6 +17,7 @@ import tconstruct.library.ActiveToolMod;
import tconstruct.library.tools.*;
import tconstruct.util.config.PHConstruct;
import tconstruct.world.TinkerWorld;
import tconstruct.world.entity.BlueSlime;
public class TActiveOmniMod extends ActiveToolMod
{
@@ -56,6 +58,12 @@ public class TActiveOmniMod extends ActiveToolMod
return false;
}
@Override
public void afterBlockBreak(ToolCore tool, ItemStack stack, Block block, int x, int y, int z, EntityLivingBase entity) {
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
slimify(tool, tags, block, x,y,z, entity.worldObj);
}
private boolean autoSmelt (ToolCore tool, NBTTagCompound tags, ItemStack stack, int x, int y, int z, EntityLivingBase entity)
{
World world = entity.worldObj;
@@ -168,11 +176,12 @@ public class TActiveOmniMod extends ActiveToolMod
private void baconator (ToolCore tool, ItemStack stack, EntityLivingBase entity, NBTTagCompound tags)
{
final int pigiron = TinkerTools.MaterialID.PigIron;
int bacon = 0;
bacon += tags.getInteger("Head") == 18 ? 1 : 0;
bacon += tags.getInteger("Handle") == 18 ? 1 : 0;
bacon += tags.getInteger("Accessory") == 18 ? 1 : 0;
bacon += tags.getInteger("Extra") == 18 ? 1 : 0;
bacon += tags.getInteger("Head") == pigiron ? 1 : 0;
bacon += tags.getInteger("Handle") == pigiron ? 1 : 0;
bacon += tags.getInteger("Accessory") == pigiron ? 1 : 0;
bacon += tags.getInteger("Extra") == pigiron ? 1 : 0;
int chance = tool.getPartAmount() * 100;
if (random.nextInt(chance) < bacon)
{
@@ -183,6 +192,54 @@ public class TActiveOmniMod extends ActiveToolMod
}
}
private void slimify(ToolCore tool, NBTTagCompound tags, Block block, int x, int y, int z, World world)
{
if (world.isRemote)
return;
int chance = tool.getPartAmount() * 100;
int count = 0;
int slimeMat = TinkerTools.MaterialID.Slime;
// regular slime
if(tags.getInteger("Head") == slimeMat)
count++;
if(tags.getInteger("Handle") == slimeMat)
count++;
if(tags.getInteger("Accessory") == slimeMat)
count++;
if(tags.getInteger("Extra") == slimeMat)
count++;
if(random.nextInt(chance) < count) {
EntitySlime entity = new EntitySlime(world);
entity.setPosition(x+0.5,y,z+0.5);
entity.setSlimeSize(1); // minislime!
world.spawnEntityInWorld(entity);
entity.playLivingSound();
}
// blueslime
slimeMat = TinkerTools.MaterialID.BlueSlime;
count = 0;
if(tags.getInteger("Head") == slimeMat)
count++;
if(tags.getInteger("Handle") == slimeMat)
count++;
if(tags.getInteger("Accessory") == slimeMat)
count++;
if(tags.getInteger("Extra") == slimeMat)
count++;
if(random.nextInt(chance) < count) {
BlueSlime entity = new BlueSlime(world);
entity.setPosition(x+0.5,y,z+0.5);
entity.setSlimeSize(1); // minislime!
world.spawnEntityInWorld(entity);
entity.playLivingSound();
}
}
@Override
public int attackDamage (int modDamage, int currentDamage, ToolCore tool, NBTTagCompound tags, NBTTagCompound toolTags, ItemStack stack, EntityLivingBase player, Entity entity)
{