From 8074116a34299235b0fbfad2777b140153abe237 Mon Sep 17 00:00:00 2001 From: Jordan Byrne Date: Tue, 12 Dec 2017 12:26:31 +1000 Subject: $ Using Apache Commons FieldUtils.class to remove final modifiers from stupid events. % Changed Analytics Properties to be stored per Segment object, as opposed to per method call. - Disabled Analytics on braking blocks. (Was just for testing). --- .../core/handler/events/BlockEventHandler.java | 141 +++++++++++---------- .../events/ZombieBackupSpawnEventHandler.java | 47 +++++-- 2 files changed, 108 insertions(+), 80 deletions(-) (limited to 'src/Java/gtPlusPlus/core') diff --git a/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java index 93786b1b3f..4b5bc96006 100644 --- a/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java @@ -73,100 +73,101 @@ public class BlockEventHandler { } - + //Used to handle Thaumcraft Shards when TC is not installed. @SubscribeEvent public void harvestDrops(final BlockEvent.HarvestDropsEvent event) { try { - //Spawn Dull Shards (Can spawn from Tree Logs, Grass or Stone. Stone going to be the most common source.) - if (((event.block == Blocks.stone) || (event.block == Blocks.sandstone) || (event.block == Blocks.log) || (event.block == Blocks.log2) || (event.block == Blocks.grass)) - && !LoadedMods.Thaumcraft && (chanceToDropDrainedShard != 0)) { - //small chance for one to spawn per stone mined. 1 per 3 stacks~ - if (MathUtils.randInt(1, chanceToDropDrainedShard) == 1){ - //Let's sort out a lucky charm for the player. - final int FancyChance = MathUtils.randInt(1, 4); - if (MathUtils.randInt(1, 100) < 90){ - event.drops.add(new ItemStack(ModItems.shardDull)); - } - //Make a Fire Shard - else if (FancyChance == 1){ - event.drops.add(new ItemStack(ModItems.shardIgnis)); - } - //Make a Water Shard. - else if (FancyChance == 2){ - event.drops.add(new ItemStack(ModItems.shardAqua)); - } - //Make an Earth Shard. - else if (FancyChance == 3){ - event.drops.add(new ItemStack(ModItems.shardTerra)); + //Spawn Dull Shards (Can spawn from Tree Logs, Grass or Stone. Stone going to be the most common source.) + if (((event.block == Blocks.stone) || (event.block == Blocks.sandstone) || (event.block == Blocks.log) || (event.block == Blocks.log2) || (event.block == Blocks.grass)) + && !LoadedMods.Thaumcraft && (chanceToDropDrainedShard != 0)) { + //small chance for one to spawn per stone mined. 1 per 3 stacks~ + if (MathUtils.randInt(1, chanceToDropDrainedShard) == 1){ + //Let's sort out a lucky charm for the player. + final int FancyChance = MathUtils.randInt(1, 4); + if (MathUtils.randInt(1, 100) < 90){ + event.drops.add(new ItemStack(ModItems.shardDull)); + } + //Make a Fire Shard + else if (FancyChance == 1){ + event.drops.add(new ItemStack(ModItems.shardIgnis)); + } + //Make a Water Shard. + else if (FancyChance == 2){ + event.drops.add(new ItemStack(ModItems.shardAqua)); + } + //Make an Earth Shard. + else if (FancyChance == 3){ + event.drops.add(new ItemStack(ModItems.shardTerra)); + } + //Make an Air Shard. + else if (FancyChance == 4){ + event.drops.add(new ItemStack(ModItems.shardAer)); + } } - //Make an Air Shard. - else if (FancyChance == 4){ - event.drops.add(new ItemStack(ModItems.shardAer)); + else { + Utils.LOG_WARNING("invalid chance"); } } - else { - Utils.LOG_WARNING("invalid chance"); - } - } - //Spawns Fluorite from Lime Stone - if (chanceToDropFluoriteOre != 0){ - if (!oreLimestone.isEmpty() || !blockLimestone.isEmpty()){ + //Spawns Fluorite from Lime Stone + if (chanceToDropFluoriteOre != 0){ + if (!oreLimestone.isEmpty() || !blockLimestone.isEmpty()){ - ArrayList mBlockTypes = new ArrayList(); - if (!oreLimestone.isEmpty()){ - for (int i=0;i mBlockTypes = new ArrayList(); + if (!oreLimestone.isEmpty()){ + for (int i=0;i