Fix diamond meteor giving blocks + dynamically calculate weight (#1126)

This commit is contained in:
Nicholas Ignoffo 2017-05-21 12:25:35 -07:00
parent 66e3066dc9
commit a2ceee3218
3 changed files with 14 additions and 10 deletions

View file

@ -25,13 +25,17 @@ public class Meteor
@Setter
public int version;
public Meteor(ItemStack catalystStack, List<MeteorComponent> components, float explosionStrength, int radius, int maxWeight)
public Meteor(ItemStack catalystStack, List<MeteorComponent> components, float explosionStrength, int radius)
{
this.catalystStack = catalystStack;
this.components = components;
this.explosionStrength = explosionStrength;
this.radius = radius;
this.maxWeight = maxWeight;
int weight = 0;
for (MeteorComponent component : components)
weight += component.getWeight();
this.maxWeight = weight;
}
public void generateMeteor(World world, BlockPos pos, IBlockState fillerBlock, double radiusModifier, double explosionModifier, double fillerChance)

View file

@ -120,8 +120,9 @@ public class MeteorConfigHandler
ironMeteorList.add(new MeteorComponent(30, "oreGold"));
ironMeteorList.add(new MeteorComponent(60, "oreLapis"));
ironMeteorList.add(new MeteorComponent(100, "oreRedstone"));
Meteor ironMeteor = new Meteor(new ItemStack(Blocks.IRON_BLOCK), ironMeteorList, 15, 5, 1000);
Meteor ironMeteor = new Meteor(new ItemStack(Blocks.IRON_BLOCK), ironMeteorList, 15, 5);
ironMeteor.setVersion(2);
// Gold
List<MeteorComponent> goldMeteorList = Lists.newArrayList();
goldMeteorList.add(new MeteorComponent(200, "oreIron"));
@ -132,10 +133,10 @@ public class MeteorConfigHandler
goldMeteorList.add(new MeteorComponent(30, "oreDiamond"));
goldMeteorList.add(new MeteorComponent(20, "oreEmerald"));
goldMeteorList.add(new MeteorComponent(20, "oreCoal"));
Meteor goldMeteor = new Meteor(new ItemStack(Blocks.GOLD_BLOCK), goldMeteorList, 18, 6, 1000);
Meteor goldMeteor = new Meteor(new ItemStack(Blocks.GOLD_BLOCK), goldMeteorList, 18, 6);
goldMeteor.setVersion(3);
// Diamond
List<MeteorComponent> diamondMeteorList = Lists.newArrayList();
diamondMeteorList.add(new MeteorComponent(50, "oreIron"));
diamondMeteorList.add(new MeteorComponent(100, "oreGold"));
@ -143,9 +144,8 @@ public class MeteorConfigHandler
diamondMeteorList.add(new MeteorComponent(250, "oreDiamond"));
diamondMeteorList.add(new MeteorComponent(180, "oreEmerald"));
diamondMeteorList.add(new MeteorComponent(50, "oreRedstone"));
diamondMeteorList.add(new MeteorComponent(400, "minecraft:diamond_block"));
Meteor diamondMeteor = new Meteor(new ItemStack(Blocks.DIAMOND_BLOCK), diamondMeteorList, 10, 3, 1000);
diamondMeteorList.add(new MeteorComponent(400, "oreDiamond"));
Meteor diamondMeteor = new Meteor(new ItemStack(Blocks.DIAMOND_BLOCK), diamondMeteorList, 10, 3);
diamondMeteor.setVersion(3);
holders.add(Pair.of("IronMeteor", ironMeteor));

View file

@ -23,9 +23,9 @@ public class MeteorRegistry
}
}
public static void registerMeteor(ItemStack stack, List<MeteorComponent> componentList, float explosionStrength, int radius, int maxWeight)
public static void registerMeteor(ItemStack stack, List<MeteorComponent> componentList, float explosionStrength, int radius)
{
Meteor holder = new Meteor(stack, componentList, explosionStrength, radius, maxWeight);
Meteor holder = new Meteor(stack, componentList, explosionStrength, radius);
registerMeteor(stack, holder);
}