mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-27 15:33:12 +00:00
Improve code readability in binnie.extrabees package and other packages
* Improve code readability in binnie.extrabees package and other packages * Fix compile error after refactoring
This commit is contained in:
1 parent
b609d6688f
commit
c09ad04284
95 files changed
+3916
-3900
No files matched your search
@@ -1,24 +1,19 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extrabees.core;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import binnie.extrabees.gui.WindowAlvearyHatchery;
|
||||
import binnie.extrabees.gui.WindowAlvearyStimulator;
|
||||
import binnie.extrabees.gui.WindowAlvearyFrame;
|
||||
import binnie.extrabees.gui.WindowAlvearyMutator;
|
||||
import binnie.extrabees.gui.database.WindowApiaristDatabase;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import binnie.core.gui.IBinnieGUID;
|
||||
import binnie.extrabees.gui.WindowAlvearyFrame;
|
||||
import binnie.extrabees.gui.WindowAlvearyHatchery;
|
||||
import binnie.extrabees.gui.WindowAlvearyMutator;
|
||||
import binnie.extrabees.gui.WindowAlvearyStimulator;
|
||||
import binnie.extrabees.gui.database.WindowApiaristDatabase;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public enum ExtraBeeGUID implements IBinnieGUID
|
||||
{
|
||||
public enum ExtraBeeGUID implements IBinnieGUID {
|
||||
Database,
|
||||
DatabaseNEI,
|
||||
AlvearyMutator,
|
||||
@@ -28,35 +23,35 @@ public enum ExtraBeeGUID implements IBinnieGUID
|
||||
AlvearyHatchery;
|
||||
|
||||
@Override
|
||||
public Window getWindow(final EntityPlayer player, final World world, final int x, final int y, final int z, final Side side) {
|
||||
public Window getWindow(EntityPlayer player, World world, int x, int y, int z, Side side) {
|
||||
Window window = null;
|
||||
final TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
IInventory object = null;
|
||||
if (tileEntity instanceof IInventory) {
|
||||
object = (IInventory) tileEntity;
|
||||
}
|
||||
|
||||
switch (this) {
|
||||
case Database:
|
||||
case DatabaseNEI: {
|
||||
window = WindowApiaristDatabase.create(player, side, this != ExtraBeeGUID.Database);
|
||||
break;
|
||||
}
|
||||
case AlvearyMutator: {
|
||||
window = WindowAlvearyMutator.create(player, object, side);
|
||||
break;
|
||||
}
|
||||
case AlvearyFrame: {
|
||||
window = WindowAlvearyFrame.create(player, object, side);
|
||||
break;
|
||||
}
|
||||
case AlvearyStimulator: {
|
||||
window = WindowAlvearyStimulator.create(player, object, side);
|
||||
break;
|
||||
}
|
||||
case AlvearyHatchery: {
|
||||
window = WindowAlvearyHatchery.create(player, object, side);
|
||||
break;
|
||||
}
|
||||
case Database:
|
||||
case DatabaseNEI:
|
||||
window = WindowApiaristDatabase.create(player, side, this != ExtraBeeGUID.Database);
|
||||
break;
|
||||
|
||||
case AlvearyMutator:
|
||||
window = WindowAlvearyMutator.create(player, object, side);
|
||||
break;
|
||||
|
||||
case AlvearyFrame:
|
||||
window = WindowAlvearyFrame.create(player, object, side);
|
||||
break;
|
||||
|
||||
case AlvearyStimulator:
|
||||
window = WindowAlvearyStimulator.create(player, object, side);
|
||||
break;
|
||||
|
||||
case AlvearyHatchery:
|
||||
window = WindowAlvearyHatchery.create(player, object, side);
|
||||
break;
|
||||
}
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -1,28 +1,24 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extrabees.core;
|
||||
|
||||
import java.util.List;
|
||||
import binnie.Binnie;
|
||||
import binnie.core.Mods;
|
||||
import binnie.core.item.IItemMisc;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import binnie.core.Mods;
|
||||
import binnie.Binnie;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import binnie.core.item.IItemMisc;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public enum ExtraBeeItems implements IItemMisc
|
||||
{
|
||||
import java.util.List;
|
||||
|
||||
public enum ExtraBeeItems implements IItemMisc {
|
||||
ScentedGear("Scented Gear", "scentedGear"),
|
||||
DiamondShard("Diamond Fragment", "diamondShard"),
|
||||
EmeraldShard("Emerald Fragment", "emeraldShard"),
|
||||
@@ -54,117 +50,6 @@ public enum ExtraBeeItems implements IItemMisc
|
||||
BlutoniumDust("Blutonium Grains", "blutoniumDust"),
|
||||
CyaniteDust("Cyanite Grains", "cyaniteDust");
|
||||
|
||||
String name;
|
||||
String iconPath;
|
||||
IIcon icon;
|
||||
String metalString;
|
||||
String gemString;
|
||||
|
||||
public static void init() {
|
||||
OreDictionary.registerOre("dyeRed", ExtraBeeItems.RedDye.get(1));
|
||||
OreDictionary.registerOre("dyeYellow", ExtraBeeItems.YellowDye.get(1));
|
||||
OreDictionary.registerOre("dyeBlue", ExtraBeeItems.BlueDye.get(1));
|
||||
OreDictionary.registerOre("dyeGreen", ExtraBeeItems.GreenDye.get(1));
|
||||
OreDictionary.registerOre("dyeBlack", ExtraBeeItems.BlackDye.get(1));
|
||||
OreDictionary.registerOre("dyeWhite", ExtraBeeItems.WhiteDye.get(1));
|
||||
OreDictionary.registerOre("dyeBrown", ExtraBeeItems.BrownDye.get(1));
|
||||
}
|
||||
|
||||
public static void postInit() {
|
||||
final ItemStack lapisShard = ExtraBeeItems.LapisShard.get(1);
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(Items.dye, 1, 4), new Object[] { lapisShard, lapisShard, lapisShard, lapisShard });
|
||||
for (final ExtraBeeItems item : values()) {
|
||||
if (item.metalString != null) {
|
||||
ItemStack dust = null;
|
||||
ItemStack ingot = null;
|
||||
if (!OreDictionary.getOres("ingot" + item.metalString).isEmpty()) {
|
||||
ingot = OreDictionary.getOres("ingot" + item.metalString).get(0).copy();
|
||||
}
|
||||
if (!OreDictionary.getOres("dust" + item.metalString).isEmpty()) {
|
||||
dust = OreDictionary.getOres("dust" + item.metalString).get(0).copy();
|
||||
}
|
||||
final ItemStack input = item.get(1);
|
||||
if (dust != null) {
|
||||
GameRegistry.addShapelessRecipe(dust, new Object[] { input, input, input, input });
|
||||
}
|
||||
else if (ingot != null) {
|
||||
GameRegistry.addShapelessRecipe(ingot, new Object[] { input, input, input, input, input, input, input, input, input });
|
||||
}
|
||||
else if (item == ExtraBeeItems.CoalDust) {
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(Items.coal), new Object[] { input, input, input, input });
|
||||
}
|
||||
}
|
||||
else if (item.gemString != null) {
|
||||
ItemStack gem = null;
|
||||
if (!OreDictionary.getOres("gem" + item.gemString).isEmpty()) {
|
||||
gem = OreDictionary.getOres("gem" + item.gemString).get(0);
|
||||
}
|
||||
final ItemStack input2 = item.get(1);
|
||||
if (gem != null) {
|
||||
GameRegistry.addShapelessRecipe(gem.copy(), new Object[] { input2, input2, input2, input2, input2, input2, input2, input2, input2 });
|
||||
}
|
||||
}
|
||||
}
|
||||
Item woodGear = null;
|
||||
try {
|
||||
woodGear = (Item) Class.forName("buildcraft.BuildCraftCore").getField("woodenGearItem").get(null);
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
ItemStack gear = new ItemStack(Blocks.planks, 1);
|
||||
if (woodGear != null) {
|
||||
gear = new ItemStack(woodGear, 1);
|
||||
}
|
||||
RecipeManagers.carpenterManager.addRecipe(100, Binnie.Liquid.getLiquidStack("for.honey", 500), (ItemStack) null, ExtraBeeItems.ScentedGear.get(1), new Object[] { " j ", "bgb", " p ", 'j', Mods.Forestry.item("royalJelly"), 'b', Mods.Forestry.item("beeswax"), 'p', Mods.Forestry.item("pollen"), 'g', gear });
|
||||
}
|
||||
|
||||
private ExtraBeeItems(final String name, final String iconPath) {
|
||||
this.metalString = null;
|
||||
this.gemString = null;
|
||||
this.name = name;
|
||||
this.iconPath = iconPath;
|
||||
}
|
||||
|
||||
private void setGem(final String string) {
|
||||
this.gemString = string;
|
||||
}
|
||||
|
||||
private void setMetal(final String string) {
|
||||
this.metalString = string;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
if (this.metalString != null) {
|
||||
return !OreDictionary.getOres("ingot" + this.metalString).isEmpty() || !OreDictionary.getOres("dust" + this.metalString).isEmpty() || this == ExtraBeeItems.CoalDust;
|
||||
}
|
||||
return this.gemString == null || !OreDictionary.getOres("gem" + this.gemString).isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(final ItemStack itemStack) {
|
||||
return this.icon;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(final IIconRegister register) {
|
||||
this.icon = ExtraBees.proxy.getIcon(register, "misc/" + this.iconPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(final List data) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(final ItemStack itemStack) {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack get(final int count) {
|
||||
return new ItemStack(ExtraBees.itemMisc, count, this.ordinal());
|
||||
}
|
||||
|
||||
static {
|
||||
ExtraBeeItems.TinDust.setMetal("Tin");
|
||||
ExtraBeeItems.ZincDust.setMetal("Zinc");
|
||||
@@ -186,4 +71,132 @@ public enum ExtraBeeItems implements IItemMisc
|
||||
ExtraBeeItems.RubyShard.setGem("Ruby");
|
||||
ExtraBeeItems.SapphireShard.setGem("Sapphire");
|
||||
}
|
||||
|
||||
protected String name;
|
||||
protected String iconPath;
|
||||
protected IIcon icon;
|
||||
protected String metalString;
|
||||
protected String gemString;
|
||||
|
||||
ExtraBeeItems(String name, String iconPath) {
|
||||
this.name = name;
|
||||
this.iconPath = iconPath;
|
||||
metalString = null;
|
||||
gemString = null;
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
OreDictionary.registerOre("dyeRed", ExtraBeeItems.RedDye.get(1));
|
||||
OreDictionary.registerOre("dyeYellow", ExtraBeeItems.YellowDye.get(1));
|
||||
OreDictionary.registerOre("dyeBlue", ExtraBeeItems.BlueDye.get(1));
|
||||
OreDictionary.registerOre("dyeGreen", ExtraBeeItems.GreenDye.get(1));
|
||||
OreDictionary.registerOre("dyeBlack", ExtraBeeItems.BlackDye.get(1));
|
||||
OreDictionary.registerOre("dyeWhite", ExtraBeeItems.WhiteDye.get(1));
|
||||
OreDictionary.registerOre("dyeBrown", ExtraBeeItems.BrownDye.get(1));
|
||||
}
|
||||
|
||||
public static void postInit() {
|
||||
ItemStack lapisShard = ExtraBeeItems.LapisShard.get(1);
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(Items.dye, 1, 4), lapisShard, lapisShard, lapisShard, lapisShard);
|
||||
for (ExtraBeeItems item : values()) {
|
||||
if (item.metalString != null) {
|
||||
ItemStack dust = null;
|
||||
ItemStack ingot = null;
|
||||
if (!OreDictionary.getOres("ingot" + item.metalString).isEmpty()) {
|
||||
ingot = OreDictionary.getOres("ingot" + item.metalString).get(0).copy();
|
||||
}
|
||||
if (!OreDictionary.getOres("dust" + item.metalString).isEmpty()) {
|
||||
dust = OreDictionary.getOres("dust" + item.metalString).get(0).copy();
|
||||
}
|
||||
|
||||
ItemStack input = item.get(1);
|
||||
if (dust != null) {
|
||||
GameRegistry.addShapelessRecipe(dust, input, input, input, input);
|
||||
} else if (ingot != null) {
|
||||
GameRegistry.addShapelessRecipe(ingot, input, input, input, input, input, input, input, input, input);
|
||||
} else if (item == ExtraBeeItems.CoalDust) {
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(Items.coal), input, input, input, input);
|
||||
}
|
||||
} else if (item.gemString != null) {
|
||||
ItemStack gem = null;
|
||||
if (!OreDictionary.getOres("gem" + item.gemString).isEmpty()) {
|
||||
gem = OreDictionary.getOres("gem" + item.gemString).get(0);
|
||||
}
|
||||
|
||||
ItemStack input2 = item.get(1);
|
||||
if (gem != null) {
|
||||
GameRegistry.addShapelessRecipe(gem.copy(), input2, input2, input2, input2, input2, input2, input2, input2, input2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item woodGear = null;
|
||||
try {
|
||||
woodGear = (Item) Class.forName("buildcraft.BuildCraftCore").getField("woodenGearItem").get(null);
|
||||
} catch (Exception ex) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
ItemStack gear = new ItemStack(Blocks.planks, 1);
|
||||
if (woodGear != null) {
|
||||
gear = new ItemStack(woodGear, 1);
|
||||
}
|
||||
|
||||
RecipeManagers.carpenterManager.addRecipe(
|
||||
100,
|
||||
Binnie.Liquid.getLiquidStack("for.honey", 500),
|
||||
null,
|
||||
ExtraBeeItems.ScentedGear.get(1),
|
||||
" j ", "bgb", " p ",
|
||||
'j', Mods.Forestry.item("royalJelly"),
|
||||
'b', Mods.Forestry.item("beeswax"),
|
||||
'p', Mods.Forestry.item("pollen"),
|
||||
'g', gear
|
||||
);
|
||||
}
|
||||
|
||||
private void setGem(String string) {
|
||||
gemString = string;
|
||||
}
|
||||
|
||||
private void setMetal(String string) {
|
||||
metalString = string;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
if (metalString != null) {
|
||||
return !OreDictionary.getOres("ingot" + metalString).isEmpty()
|
||||
|| !OreDictionary.getOres("dust" + metalString).isEmpty()
|
||||
|| this == ExtraBeeItems.CoalDust;
|
||||
}
|
||||
return gemString == null
|
||||
|| !OreDictionary.getOres("gem" + gemString).isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack itemStack) {
|
||||
return icon;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
icon = ExtraBees.proxy.getIcon(register, "misc/" + iconPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(List data) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(ItemStack itemStack) {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack get(int count) {
|
||||
return new ItemStack(ExtraBees.itemMisc, count, ordinal());
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,12 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extrabees.core;
|
||||
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.Binnie;
|
||||
import binnie.core.resource.BinnieResource;
|
||||
import binnie.core.resource.ResourceType;
|
||||
import binnie.core.resource.IBinnieTexture;
|
||||
import binnie.core.resource.ResourceType;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
|
||||
public enum ExtraBeeTexture implements IBinnieTexture
|
||||
{
|
||||
public enum ExtraBeeTexture implements IBinnieTexture {
|
||||
AlvearyMutator(ResourceType.Tile, "alveary/AlvearyMutator"),
|
||||
AlvearyNovaBlock(ResourceType.Tile, "alveary/AlvearyNovaBlock"),
|
||||
AlvearyFrame(ResourceType.Tile, "alveary/AlvearyFrame"),
|
||||
@@ -25,16 +20,16 @@ public enum ExtraBeeTexture implements IBinnieTexture
|
||||
GUIProgress2(ResourceType.GUI, "processes2"),
|
||||
AlvearyTransmission(ResourceType.Tile, "alveary/AlvearyTransmission");
|
||||
|
||||
String texture;
|
||||
ResourceType type;
|
||||
protected String texture;
|
||||
protected ResourceType type;
|
||||
|
||||
private ExtraBeeTexture(final ResourceType base, final String texture) {
|
||||
ExtraBeeTexture(ResourceType base, String texture) {
|
||||
this.texture = texture;
|
||||
this.type = base;
|
||||
type = base;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BinnieResource getTexture() {
|
||||
return Binnie.Resource.getPNG(ExtraBees.instance, this.type, this.texture);
|
||||
return Binnie.Resource.getPNG(ExtraBees.instance, type, texture);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,11 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extrabees.core;
|
||||
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import forestry.api.core.Tabs;
|
||||
import binnie.Binnie;
|
||||
import binnie.core.IInitializable;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import forestry.api.core.Tabs;
|
||||
|
||||
public class ModuleCore implements IInitializable
|
||||
{
|
||||
public class ModuleCore implements IInitializable {
|
||||
@Override
|
||||
public void preInit() {
|
||||
ExtraBees.itemMisc = Binnie.Item.registerMiscItems(ExtraBeeItems.values(), Tabs.tabApiculture);
|
||||
|
||||
Reference in new issue
Block a user