Fixed double ender pearl drop from sword, default power of travel staff.

Needs config change again.
This commit is contained in:
CrazyPants committed 2014-04-27 01:57:19 +08:00
1 parent 076b041622
commit 8ffb259e06
4 files changed
+40 -8

No files matched your search

+1 -1
View File
@@ -107,7 +107,7 @@ public final class Config {
public static float vanillaSwordSkullLootingModifier = 0.1f;
public static int darkSteelSwordPowerUsePerHit = 750;
public static double darkSteelSwordEnderPearlDropChance = 1;
public static double darkSteelSwordEnderPearlDropChancePerLooting = 0.1;
public static double darkSteelSwordEnderPearlDropChancePerLooting = 0.5;
public static int darkSteelPickPowerUseObsidian = 10000;
public static int darkSteelPickEffeciencyObsidian = 50;
@@ -102,15 +102,25 @@ public class ItemDarkSteelSword extends ItemSword implements IEnergyContainerIte
numPearls++;
}
for (int i = 0; i < evt.lootingLevel; i++) {
if(Math.random() >= Config.darkSteelSwordEnderPearlDropChancePerLooting) {
if(Math.random() <= Config.darkSteelSwordEnderPearlDropChancePerLooting) {
numPearls++;
}
}
//TODO: Shouldn't I add this to the list in the event?
Util.dropItems(player.worldObj, new ItemStack(Items.ender_pearl, numPearls, 0), evt.entityLiving.posX, evt.entityLiving.posY, evt.entityLiving.posZ,
true);
}
int existing = 0;
for (EntityItem stack : evt.drops) {
if(stack.getEntityItem() != null && stack.getEntityItem().getItem() == Items.ender_pearl) {
existing += stack.getEntityItem().stackSize;
}
}
int toDrop = numPearls - existing;
if(toDrop > 0) {
evt.drops.add(Util.createDrop(player.worldObj, new ItemStack(Items.ender_pearl, toDrop, 0), evt.entityLiving.posX, evt.entityLiving.posY,
evt.entityLiving.posZ,
false));
}
}
}
}
@@ -244,7 +254,7 @@ public class ItemDarkSteelSword extends ItemSword implements IEnergyContainerIte
list.add(str);
}
if(EnergyUpgrade.itemHasAnyPowerUpgrade(itemstack)) {
list.add(EnumChatFormatting.WHITE + Lang.localize("item.darkSteel_sword.tooltip.line1"));
list.add(EnumChatFormatting.WHITE + Lang.localize("item.darkSteel_sword.tooltip.line1"));
list.add(EnumChatFormatting.WHITE + Lang.localize("item.darkSteel_sword.tooltip.line2"));
list.add(EnumChatFormatting.WHITE + Lang.localize("item.darkSteel_sword.tooltip.line3"));
}
@@ -47,7 +47,7 @@ public class ItemTravelStaff extends ItemEnergyContainer implements IEnergyConta
}
protected ItemTravelStaff() {
super(Config.darkSteelPowerStorageBase, Config.darkSteelPowerStorageBase / 100, 0);
super(Config.darkSteelPowerStorageLevelTwo, Config.darkSteelPowerStorageLevelTwo / 100, 0);
setCreativeTab(EnderIOTab.tabEnderIO);
setUnlocalizedName(ModObject.itemTravelStaff.name());
setMaxDamage(16);
+22
View File
@@ -101,6 +101,28 @@ public class Util {
}
public static EntityItem createDrop(World world, ItemStack stack, double x, double y, double z, boolean doRandomSpread) {
if(stack == null || stack.stackSize <= 0) {
return null;
}
if(doRandomSpread) {
float f1 = 0.7F;
double d = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D;
double d1 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D;
double d2 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D;
EntityItem entityitem = new EntityItem(world, x + d, y + d1, z + d2, stack);
entityitem.delayBeforeCanPickup = 10;
return entityitem;
} else {
EntityItem entityitem = new EntityItem(world, x, y, z, stack);
entityitem.motionX = 0;
entityitem.motionY = 0;
entityitem.motionZ = 0;
entityitem.delayBeforeCanPickup = 0;
return entityitem;
}
}
public static void dropItems(World world, ItemStack stack, double x, double y, double z, boolean doRandomSpread) {
if(stack.stackSize <= 0) {
return;