mirror of
https://github.com/GTNewHorizons/Avaritia.git
synced 2026-11-27 23:45:44 +00:00
Funky stuff for infinity metal tonk
This commit is contained in:
1 parent
a2ae147343
commit
df94126ea8
3 files changed
+115
-31
No files matched your search
@@ -76,40 +76,16 @@ public class LudicrousEvents {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void extraLuck(HarvestDropsEvent event){
|
||||
if(event.harvester == null)
|
||||
public void handleExtraLuck(HarvestDropsEvent event) {
|
||||
if(event.harvester == null)
|
||||
return;
|
||||
if(event.harvester.getHeldItem() == null)
|
||||
return;
|
||||
ItemStack held = event.harvester.getHeldItem();
|
||||
if(held.getItem() == LudicrousItems.infinity_pickaxe){
|
||||
if(event.block.getMaterial() == Material.rock){
|
||||
List<ItemStack> adds = new ArrayList<ItemStack>();
|
||||
List<ItemStack> removals = new ArrayList<ItemStack>();
|
||||
for(ItemStack drop : event.drops){
|
||||
if(drop.getItem() != Item.getItemFromBlock(event.block) && !(drop.getItem() instanceof ItemBlock)){
|
||||
drop.stackSize = Math.min(drop.stackSize * 4, drop.getMaxStackSize());
|
||||
}
|
||||
else if(drop.getItem() == Item.getItemFromBlock(event.block))
|
||||
{
|
||||
ItemFracturedOre ifo = (ItemFracturedOre)LudicrousItems.fractured_ore;
|
||||
int[] oreids = OreDictionary.getOreIDs(drop);
|
||||
for (int i=0; i<oreids.length; i++) {
|
||||
String orename = OreDictionary.getOreName(oreids[i]);
|
||||
if (orename.startsWith("ore")) {
|
||||
// add the fractured ores
|
||||
adds.add(ifo.getStackForOre(drop, Math.min(drop.stackSize * 5, drop.getMaxStackSize())));
|
||||
removals.add(drop);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
event.drops.addAll(adds);
|
||||
event.drops.removeAll(removals);
|
||||
}
|
||||
|
||||
if (held.getTagCompound().getBoolean("hammer")
|
||||
if(held.getItem() == LudicrousItems.infinity_pickaxe) {
|
||||
extraLuck(event, 4);
|
||||
|
||||
if (held.getTagCompound().getBoolean("hammer")
|
||||
&& ToolHelper.hammering.contains(event.harvester)
|
||||
&& ToolHelper.hammerdrops.containsKey(event.harvester)
|
||||
&& ToolHelper.hammerdrops.get(event.harvester) != null) {
|
||||
@@ -119,6 +95,34 @@ public class LudicrousEvents {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void extraLuck(HarvestDropsEvent event, int mult){
|
||||
if(event.block.getMaterial() == Material.rock){
|
||||
List<ItemStack> adds = new ArrayList<ItemStack>();
|
||||
List<ItemStack> removals = new ArrayList<ItemStack>();
|
||||
for(ItemStack drop : event.drops){
|
||||
if(drop.getItem() != Item.getItemFromBlock(event.block) && !(drop.getItem() instanceof ItemBlock)){
|
||||
drop.stackSize = Math.min(drop.stackSize * mult, drop.getMaxStackSize());
|
||||
}
|
||||
else if(drop.getItem() == Item.getItemFromBlock(event.block))
|
||||
{
|
||||
ItemFracturedOre ifo = (ItemFracturedOre)LudicrousItems.fractured_ore;
|
||||
int[] oreids = OreDictionary.getOreIDs(drop);
|
||||
for (int i=0; i<oreids.length; i++) {
|
||||
String orename = OreDictionary.getOreName(oreids[i]);
|
||||
if (orename.startsWith("ore")) {
|
||||
// add the fractured ores
|
||||
adds.add(ifo.getStackForOre(drop, Math.min(drop.stackSize * (mult+1), drop.getMaxStackSize())));
|
||||
removals.add(drop);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
event.drops.addAll(adds);
|
||||
event.drops.removeAll(removals);
|
||||
}
|
||||
}
|
||||
|
||||
private void dropItem(ItemStack drop, World world, int x, int y, int z){
|
||||
float f = 0.7F;
|
||||
|
||||
Reference in new issue
Block a user