Fix diamond meteor giving blocks + dynamically calculate weight (#1126)
This commit is contained in:
parent
66e3066dc9
commit
a2ceee3218
|
@ -25,13 +25,17 @@ public class Meteor
|
||||||
@Setter
|
@Setter
|
||||||
public int version;
|
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.catalystStack = catalystStack;
|
||||||
this.components = components;
|
this.components = components;
|
||||||
this.explosionStrength = explosionStrength;
|
this.explosionStrength = explosionStrength;
|
||||||
this.radius = radius;
|
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)
|
public void generateMeteor(World world, BlockPos pos, IBlockState fillerBlock, double radiusModifier, double explosionModifier, double fillerChance)
|
||||||
|
|
|
@ -120,8 +120,9 @@ public class MeteorConfigHandler
|
||||||
ironMeteorList.add(new MeteorComponent(30, "oreGold"));
|
ironMeteorList.add(new MeteorComponent(30, "oreGold"));
|
||||||
ironMeteorList.add(new MeteorComponent(60, "oreLapis"));
|
ironMeteorList.add(new MeteorComponent(60, "oreLapis"));
|
||||||
ironMeteorList.add(new MeteorComponent(100, "oreRedstone"));
|
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);
|
ironMeteor.setVersion(2);
|
||||||
|
|
||||||
// Gold
|
// Gold
|
||||||
List<MeteorComponent> goldMeteorList = Lists.newArrayList();
|
List<MeteorComponent> goldMeteorList = Lists.newArrayList();
|
||||||
goldMeteorList.add(new MeteorComponent(200, "oreIron"));
|
goldMeteorList.add(new MeteorComponent(200, "oreIron"));
|
||||||
|
@ -132,10 +133,10 @@ public class MeteorConfigHandler
|
||||||
goldMeteorList.add(new MeteorComponent(30, "oreDiamond"));
|
goldMeteorList.add(new MeteorComponent(30, "oreDiamond"));
|
||||||
goldMeteorList.add(new MeteorComponent(20, "oreEmerald"));
|
goldMeteorList.add(new MeteorComponent(20, "oreEmerald"));
|
||||||
goldMeteorList.add(new MeteorComponent(20, "oreCoal"));
|
goldMeteorList.add(new MeteorComponent(20, "oreCoal"));
|
||||||
|
Meteor goldMeteor = new Meteor(new ItemStack(Blocks.GOLD_BLOCK), goldMeteorList, 18, 6);
|
||||||
Meteor goldMeteor = new Meteor(new ItemStack(Blocks.GOLD_BLOCK), goldMeteorList, 18, 6, 1000);
|
|
||||||
goldMeteor.setVersion(3);
|
goldMeteor.setVersion(3);
|
||||||
|
|
||||||
|
// Diamond
|
||||||
List<MeteorComponent> diamondMeteorList = Lists.newArrayList();
|
List<MeteorComponent> diamondMeteorList = Lists.newArrayList();
|
||||||
diamondMeteorList.add(new MeteorComponent(50, "oreIron"));
|
diamondMeteorList.add(new MeteorComponent(50, "oreIron"));
|
||||||
diamondMeteorList.add(new MeteorComponent(100, "oreGold"));
|
diamondMeteorList.add(new MeteorComponent(100, "oreGold"));
|
||||||
|
@ -143,9 +144,8 @@ public class MeteorConfigHandler
|
||||||
diamondMeteorList.add(new MeteorComponent(250, "oreDiamond"));
|
diamondMeteorList.add(new MeteorComponent(250, "oreDiamond"));
|
||||||
diamondMeteorList.add(new MeteorComponent(180, "oreEmerald"));
|
diamondMeteorList.add(new MeteorComponent(180, "oreEmerald"));
|
||||||
diamondMeteorList.add(new MeteorComponent(50, "oreRedstone"));
|
diamondMeteorList.add(new MeteorComponent(50, "oreRedstone"));
|
||||||
diamondMeteorList.add(new MeteorComponent(400, "minecraft:diamond_block"));
|
diamondMeteorList.add(new MeteorComponent(400, "oreDiamond"));
|
||||||
|
Meteor diamondMeteor = new Meteor(new ItemStack(Blocks.DIAMOND_BLOCK), diamondMeteorList, 10, 3);
|
||||||
Meteor diamondMeteor = new Meteor(new ItemStack(Blocks.DIAMOND_BLOCK), diamondMeteorList, 10, 3, 1000);
|
|
||||||
diamondMeteor.setVersion(3);
|
diamondMeteor.setVersion(3);
|
||||||
|
|
||||||
holders.add(Pair.of("IronMeteor", ironMeteor));
|
holders.add(Pair.of("IronMeteor", ironMeteor));
|
||||||
|
|
|
@ -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);
|
registerMeteor(stack, holder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue