mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-16 18:54:54 +00:00
port to forestry 4.2
This commit is contained in:
1 parent
dbc5c1a564
commit
f969f63b66
3697 files changed
+78372
No files matched your search
@@ -0,0 +1,97 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core;
|
||||
|
||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||
import cpw.mods.fml.common.versioning.Restriction;
|
||||
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class Mods
|
||||
{
|
||||
public static Mod Forestry;
|
||||
public static Mod IC2;
|
||||
public static Mod Botania;
|
||||
private static boolean WARN;
|
||||
|
||||
private static Item findItem(final String modId, final String name) {
|
||||
final Item stack = GameRegistry.findItem(modId, name);
|
||||
if (stack == null && Mods.WARN && modId == "Forestry") {
|
||||
throw new RuntimeException("Item not found: " + modId + ":" + name);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
private static ItemStack findItemStack(final String modId, final String name, final int stackSize) {
|
||||
final ItemStack stack = GameRegistry.findItemStack(modId, name, stackSize);
|
||||
if (stack == null && Mods.WARN && modId == "Forestry") {
|
||||
throw new RuntimeException("Stack not found: " + modId + ":" + name);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
private static Block findBlock(final String modId, final String name) {
|
||||
final Block stack = GameRegistry.findBlock(modId, name);
|
||||
if (stack == null && Mods.WARN && modId == "Forestry") {
|
||||
throw new RuntimeException("Block not found: " + modId + ":" + name);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
static {
|
||||
Mods.Forestry = new Mod("Forestry") {
|
||||
@Override
|
||||
public boolean dev() {
|
||||
final String forVersion = Loader.instance().getIndexedModList().get("Forestry").getVersion();
|
||||
final Restriction rest = new Restriction(new DefaultArtifactVersion("3.6"), true, (ArtifactVersion) null, false);
|
||||
return rest.containsVersion(new DefaultArtifactVersion(forVersion));
|
||||
}
|
||||
};
|
||||
Mods.IC2 = new Mod("IC2");
|
||||
Mods.Botania = new Mod("Botania");
|
||||
Mods.WARN = true;
|
||||
}
|
||||
|
||||
public static class Mod
|
||||
{
|
||||
private String id;
|
||||
|
||||
private Mod(final String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Item item(final String name) {
|
||||
return findItem(this.id, name);
|
||||
}
|
||||
|
||||
public Block block(final String name) {
|
||||
return findBlock(this.id, name);
|
||||
}
|
||||
|
||||
public ItemStack stack(final String name, final int stackSize) {
|
||||
return findItemStack(this.id, name, stackSize);
|
||||
}
|
||||
|
||||
public ItemStack stack(final String name) {
|
||||
return this.stack(name, 1);
|
||||
}
|
||||
|
||||
public ItemStack stack(final String string, final int i, final int j) {
|
||||
return new ItemStack(this.item(string), i, j);
|
||||
}
|
||||
|
||||
public boolean active() {
|
||||
return Loader.isModLoaded(this.id);
|
||||
}
|
||||
|
||||
public boolean dev() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user