Skip to content

Commit

Permalink
Expose Pile of Rubble loot table to MineTweaker scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
OreCruncher committed Sep 3, 2015
1 parent 33e29da commit 7786bcb
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public static void addRubbleDrop(final ItemStack stack, final int min, final int
rubbleContent.addItem(new WeightedRandomChestContent(stack, min, max, weight));
}

public static void removeRubbleDrop(final ItemStack stack) {
rubbleContent.removeItem(stack);
}

public static void addRubbleDrop(final Item item, final int min, final int max, final int weight) {
hasContent = true;
rubbleContent.addItem(new WeightedRandomChestContent(item, 0, min, max, weight));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ public boolean initialize() {
// Glass
pulverizer.setEnergy(3200).appendSubtypeRange("Forestry:stained", 0, 15).output(Blocks.sand).save();

// Pile of Rubble - add apatite, empty can, and scoop
registerPileOfRubbleDrop(1, 3, 5, "apatite");
registerPileOfRubbleDrop(1, 2, 3, "canEmpty");
registerPileOfRubbleDrop(1, 1, 2, "scoop");

return true;
}

Expand All @@ -180,11 +185,6 @@ public boolean postInit() {
registerForestryRecipes(forestry.api.recipes.RecipeManagers.carpenterManager.getRecipes());
registerForestryRecipes(forestry.api.recipes.RecipeManagers.fabricatorManager.getRecipes());

// Pile of Rubble - add apatite, empty can, and scoop
registerPileOfRubbleDrop(1, 3, 5, "apatite");
registerPileOfRubbleDrop(1, 2, 3, "canEmpty");
registerPileOfRubbleDrop(1, 1, 2, "scoop");

return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,10 @@ public boolean initialize() {
.appendSubtypeRange("MineFactoryReloaded:stainedglass.block",
0, 15).output(Blocks.sand).save();

return true;
}

@Override
public boolean postInit() {
// Register some stuff
registerPileOfRubbleDrop(1, 2, 4, "meat.ingot.cooked", "rubber.bar");
registerPileOfRubbleDrop(1, 1, 2, "plastic.boots");

return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,9 @@ public boolean initialize() {

registerCompostIngredient(CompostIngredient.BROWN, "^dustWood");

return true;
}

@Override
public boolean postInit() {
// Register some stuff for the Pile of Rubble
registerPileOfRubbleDrop(1, 1, 3, "satchel:1");

return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,9 @@ public boolean initialize() {
registerExtraTiCGearRecipe("ThermalFoundation:material:140");
}

return true;
}

@Override
public boolean postInit() {
// Pile of Rubble - add Copper and Tin ores
registerPileOfRubbleDrop(1, 3, 5, "Ore:0", "Ore:1" );

return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,18 @@ public boolean initialize() {
registerItemBlockedFromScrapping(true, "^" + s);
}

// Register scrap items for Pile of Rubble
PileOfRubble.addRubbleDrop(ScrappingTables.poorScrap, 1, 2, 5);
PileOfRubble.addRubbleDrop(ScrappingTables.poorScrapBox, 1, 1, 2);
PileOfRubble.addRubbleDrop(ScrappingTables.standardScrap, 1, 2, 4);
PileOfRubble.addRubbleDrop(ScrappingTables.standardScrapBox, 1, 1, 1);

PileOfRubble.addRubbleDrop(new ItemStack(ItemManager.material, 1, Material.LITTER_BAG), 1, 2, 4);

PileOfRubble.addRubbleDrop(new ItemStack(ItemManager.soylentGreen), 1, 1, 1);
PileOfRubble.addRubbleDrop(new ItemStack(ItemManager.soylentYellow), 1, 1, 2);
PileOfRubble.addRubbleDrop(new ItemStack(ItemManager.soylentRed), 1, 1, 2);

return true;
}

Expand Down Expand Up @@ -213,18 +225,6 @@ public boolean postInit() {
ScrapHandler.freeze();
ExtractionData.freeze();

// Register scrap items for Pile of Rubble
PileOfRubble.addRubbleDrop(ScrappingTables.poorScrap, 1, 2, 5);
PileOfRubble.addRubbleDrop(ScrappingTables.poorScrapBox, 1, 1, 2);
PileOfRubble.addRubbleDrop(ScrappingTables.standardScrap, 1, 2, 4);
PileOfRubble.addRubbleDrop(ScrappingTables.standardScrapBox, 1, 1, 1);

PileOfRubble.addRubbleDrop(new ItemStack(ItemManager.material, 1, Material.LITTER_BAG), 1, 2, 4);

PileOfRubble.addRubbleDrop(new ItemStack(ItemManager.soylentGreen), 1, 1, 1);
PileOfRubble.addRubbleDrop(new ItemStack(ItemManager.soylentYellow), 1, 1, 2);
PileOfRubble.addRubbleDrop(new ItemStack(ItemManager.soylentRed), 1, 1, 2);

return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,6 @@ public boolean initialize() {
.save();
pulverizer.setEnergy(3200).append(Items.glass_bottle).output(Blocks.sand).save();

return true;
}

@Override
public boolean postInit() {

PileOfRubble.addRubbleDrop(Blocks.cobblestone, 1, 4, 12);
PileOfRubble.addRubbleDrop(Blocks.stone, 1, 2, 9);
PileOfRubble.addRubbleDrop(Items.coal, 1, 3, 8);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public static void initialize() {
MineTweakerAPI.registerClass(RecipeDataRegistry.class);
MineTweakerAPI.registerClass(ExtractionDataRegistry.class);
MineTweakerAPI.registerClass(VendingProfessionRegistry.class);
MineTweakerAPI.registerClass(RubblePileDataRegistry.class);

// Register the constants
Constants.register();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/* This file is part of ThermalRecycling, licensed under the MIT License (MIT).
*
* Copyright (c) OreCruncher
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

package org.blockartistry.mod.ThermalRecycling.tweaker;

import org.blockartistry.mod.ThermalRecycling.blocks.PileOfRubble;
import minetweaker.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;

@ZenClass("mods.recycling.RubblePileDataRegistry")
public class RubblePileDataRegistry {

private RubblePileDataRegistry() {

}

@ZenMethod
public static void add(final IItemStack item, final int min, final int max, final int weight) {

if (!MineTweakerUtil.checkNotNull(item, "item cannot be null"))
return;

if (!MineTweakerUtil.checkArgument(min >= 0, "min value must be greater than 0"))
return;

if (!MineTweakerUtil.checkArgument(max >= min, "max value must be greater or equal to min value"))
return;

if (!MineTweakerUtil.checkArgument(weight > 0, "weight value must be greater than 0"))
return;

final ItemStack stack = MineTweakerMC.getItemStack(item);
PileOfRubble.addRubbleDrop(stack, min, max, weight);
}

@ZenMethod
public static void remove(final IItemStack item) {

if (!MineTweakerUtil.checkNotNull(item, "item cannot be null"))
return;

final ItemStack stack = MineTweakerMC.getItemStack(item);
PileOfRubble.removeRubbleDrop(stack);
}
}

0 comments on commit 7786bcb

Please sign in to comment.