mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-19 03:49:07 +00:00
Localization and refactoring (#77)
* Some refactoring for bee production * Code cleanup * Code cleanup * Added some localization * Fix wrong dropped class * Added some localization * Added some localization * Added some localization * Fix wrong import
This commit is contained in:
1 parent
68bbe7710c
commit
1ea7b62e5f
157 files changed
+3240
-5045
No files matched your search
@@ -1,45 +0,0 @@
|
||||
package binnie.extratrees.alcohol.drink;
|
||||
|
||||
import binnie.extratrees.alcohol.ModuleAlcohol;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
// TODO unused class?
|
||||
public class BlockDrink extends BlockContainer {
|
||||
public BlockDrink() {
|
||||
super(Material.glass);
|
||||
setBlockName("drink");
|
||||
setCreativeTab(CreativeTabs.tabTools);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityDrink();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return ModuleAlcohol.drinkRendererID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package binnie.extratrees.alcohol.drink;
|
||||
|
||||
import binnie.extratrees.alcohol.ModuleAlcohol;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
// TODO unused class?
|
||||
public class BlockDrinkRenderer implements ISimpleBlockRenderingHandler {
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
GL11.glPushMatrix();
|
||||
Tessellator.instance.setColorRGBA(255, 255, 255, 150);
|
||||
Tessellator tess = Tessellator.instance;
|
||||
renderer.renderFaceYPos(block, x, y, z, Blocks.dirt.getIcon(0, 0));
|
||||
float s = 0.0625f;
|
||||
|
||||
for (int h = 0; h < 16; ++h) {
|
||||
float d1 = 8.0f * s;
|
||||
float h2 = h * s;
|
||||
tess.addVertexWithUV(x + 0.5f - d1, y + h2, z + 0.5f - d1, 0.0, 0.0);
|
||||
tess.addVertexWithUV(x + 0.5f - d1, y + h2, z + 0.5f - d1, 0.0, 0.0);
|
||||
tess.addVertexWithUV(x + 0.5f + d1, y + h2, z + 0.5f - d1, 0.0, 0.0);
|
||||
tess.addVertexWithUV(x + 0.5f + d1, y + h2, z + 0.5f - d1, 0.0, 0.0);
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return ModuleAlcohol.drinkRendererID;
|
||||
}
|
||||
}
|
||||
@@ -7,5 +7,5 @@ public interface IDesignMaterial {
|
||||
|
||||
String getName();
|
||||
|
||||
int getColour();
|
||||
int getColor();
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
package binnie.extratrees.block;
|
||||
|
||||
import binnie.core.block.BlockMetadata;
|
||||
import binnie.core.block.IBlockMetadata;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.Tabs;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLog;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
// TODO unused class?
|
||||
public class BlockBranch extends BlockLog implements IBlockMetadata {
|
||||
public BlockBranch() {
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
setBlockName("branch");
|
||||
setResistance(5.0f);
|
||||
setHardness(2.0f);
|
||||
setStepSound(Block.soundTypeWood);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
for (int i = 0; i < ILogType.ExtraTreeLog.values().length; ++i) {
|
||||
itemList.add(TileEntityMetadata.getItemStack(this, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return getIcon(side, tile.getTileMetadata(), world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
public IIcon getIcon(int side, int tileMeta, int blockMeta) {
|
||||
int oriented = blockMeta & 0xC;
|
||||
ILogType.ExtraTreeLog log = ILogType.ExtraTreeLog.values()[tileMeta];
|
||||
if (side > 3) {
|
||||
return log.getTrunk();
|
||||
}
|
||||
return log.getBark();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int tileMeta) {
|
||||
return getIcon(side, tileMeta, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return ExtraTrees.branchRenderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropAsStack(World world, int x, int y, int z, ItemStack itemStack) {
|
||||
dropBlockAsItem(world, x, y, z, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int meta) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
||||
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(ItemStack itemStack) {
|
||||
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||
return ILogType.ExtraTreeLog.values()[meta].getName() + " Branch";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||
return TileEntityMetadata.getItemDamage(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
||||
super.breakBlock(world, x, y, z, block, side);
|
||||
world.removeTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -114,11 +114,11 @@ public class BlockETDoor extends BlockDoor implements IBlockMetadata {
|
||||
int i1 = getFullMetadata(blockAccess, x, y, z);
|
||||
if ((i1 & 0x8) != 0) {
|
||||
int meta = TileEntityMetadata.getTileMetadata(blockAccess, x, y - 1, z);
|
||||
return WoodManager.getPlankType(meta & 0xFF).getColour();
|
||||
return WoodManager.getPlankType(meta & 0xFF).getColor();
|
||||
}
|
||||
|
||||
int meta = TileEntityMetadata.getTileMetadata(blockAccess, x, y, z);
|
||||
return WoodManager.getPlankType(meta & 0xFF).getColour();
|
||||
return WoodManager.getPlankType(meta & 0xFF).getColor();
|
||||
}
|
||||
|
||||
public int getFullMetadata(IBlockAccess blockAccess, int x, int y, int pzr4) {
|
||||
@@ -156,8 +156,7 @@ public class BlockETDoor extends BlockDoor implements IBlockMetadata {
|
||||
}
|
||||
|
||||
@Override
|
||||
// TODO fix deprecated code
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
@@ -108,6 +108,6 @@ public class ItemETDoor extends ItemMetadata {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int meta) {
|
||||
return WoodManager.getPlankType((stack == null) ? 0 : (stack.getItemDamage() & 0xFF)).getColour();
|
||||
return WoodManager.getPlankType((stack == null) ? 0 : (stack.getItemDamage() & 0xFF)).getColor();
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public class PlankType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ public class PlankType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ public class PlankType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ public class PlankType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package binnie.extratrees.block.decor;
|
||||
|
||||
import binnie.extratrees.genetics.LeafType;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlockWithMetadata;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
// TODO unused class?
|
||||
public class ItemHedge extends ItemBlockWithMetadata {
|
||||
public ItemHedge(Block block) {
|
||||
super(block, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack item) {
|
||||
int meta = item.getItemDamage();
|
||||
return LeafType.values()[meta % 6].description + ((meta >= 8) ? " Full" : "") + " Hedge";
|
||||
}
|
||||
}
|
||||
@@ -64,61 +64,11 @@ public class DesignBlock {
|
||||
}
|
||||
|
||||
public int getPrimaryColour() {
|
||||
return getPrimaryMaterial().getColour();
|
||||
return getPrimaryMaterial().getColor();
|
||||
}
|
||||
|
||||
public int getSecondaryColour() {
|
||||
return getSecondaryMaterial().getColour();
|
||||
}
|
||||
|
||||
// TODO unused method?
|
||||
ForgeDirection getRotation(ForgeDirection dir, ModuleCarpentry.Axis axis) {
|
||||
if (axis == ModuleCarpentry.Axis.Y) {
|
||||
switch (dir) {
|
||||
case EAST:
|
||||
return ForgeDirection.NORTH;
|
||||
|
||||
case NORTH:
|
||||
return ForgeDirection.WEST;
|
||||
|
||||
case SOUTH:
|
||||
return ForgeDirection.EAST;
|
||||
|
||||
case WEST:
|
||||
return ForgeDirection.SOUTH;
|
||||
}
|
||||
return dir;
|
||||
} else if (axis == ModuleCarpentry.Axis.X) {
|
||||
switch (dir) {
|
||||
case EAST:
|
||||
return ForgeDirection.UP;
|
||||
|
||||
case UP:
|
||||
return ForgeDirection.WEST;
|
||||
|
||||
case WEST:
|
||||
return ForgeDirection.DOWN;
|
||||
|
||||
case DOWN:
|
||||
return ForgeDirection.EAST;
|
||||
}
|
||||
return dir;
|
||||
} else {
|
||||
switch (dir) {
|
||||
case SOUTH:
|
||||
return ForgeDirection.UP;
|
||||
|
||||
case UP:
|
||||
return ForgeDirection.NORTH;
|
||||
|
||||
case NORTH:
|
||||
return ForgeDirection.DOWN;
|
||||
|
||||
case DOWN:
|
||||
return ForgeDirection.SOUTH;
|
||||
}
|
||||
return dir;
|
||||
}
|
||||
return getSecondaryMaterial().getColor();
|
||||
}
|
||||
|
||||
public ILayout getLayout(ForgeDirection dir) {
|
||||
|
||||
@@ -72,7 +72,7 @@ public class GlassType implements IDesignMaterial {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
public int getColor() {
|
||||
return colour;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package binnie.extratrees.craftgui.dictionary;
|
||||
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.minecraft.Dialog;
|
||||
|
||||
// TODO unused class?
|
||||
public class DialogBreweryRecipe extends Dialog {
|
||||
public DialogBreweryRecipe(IWidget parent, float w, float h) {
|
||||
super(parent, w, h);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialise() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose() {
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package binnie.extratrees.craftgui.kitchen;
|
||||
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.controls.button.ControlButton;
|
||||
import binnie.core.craftgui.events.EventMouse;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
|
||||
// TODO unused class?
|
||||
public abstract class ControlDropdownButton extends ControlButton {
|
||||
public ControlDropdownButton(IWidget parent, float x, float y, float width, float height, String text) {
|
||||
super(parent, x, y, width, height, text);
|
||||
addSelfEventHandler(new EventMouse.Down.Handler() {
|
||||
@Override
|
||||
public void onEvent(EventMouse.Down event) {
|
||||
ControlDropDownMenu menu = getWidget(ControlDropDownMenu.class);
|
||||
deleteChild(getWidget(ControlDropDownMenu.class));
|
||||
if (getWidget(ControlDropDownMenu.class) == null) {
|
||||
menu = createDropDownMenu();
|
||||
Window.get(getWidget()).setFocusedWidget(menu);
|
||||
} else {
|
||||
deleteChild(getWidget(ControlDropDownMenu.class));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public abstract ControlDropDownMenu createDropDownMenu();
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package binnie.extratrees.craftgui.kitchen;
|
||||
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.controls.core.IControlValue;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlotBase;
|
||||
import binnie.extratrees.alcohol.Glassware;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
// TODO unused class?
|
||||
public class ControlSlotGlassware extends ControlSlotBase implements IControlValue<Glassware> {
|
||||
Glassware glassware;
|
||||
|
||||
public ControlSlotGlassware(IWidget parent, int x, int y, Glassware glassware) {
|
||||
super(parent, x, y);
|
||||
this.glassware = glassware;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Glassware getValue() {
|
||||
return glassware;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(Glassware value) {
|
||||
glassware = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack() {
|
||||
return glassware.get(1);
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package binnie.extratrees.genetics;
|
||||
|
||||
import forestry.api.arboriculture.EnumGrowthConditions;
|
||||
import forestry.api.arboriculture.IAlleleGrowth;
|
||||
import forestry.api.arboriculture.IGrowthProvider;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
// TODO unused class?
|
||||
public class ExtraTreeGrowthProvider implements IAlleleGrowth, IGrowthProvider {
|
||||
@Override
|
||||
public String getUID() {
|
||||
return "extratrees.fruit." + toString().toLowerCase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDominant() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGrowthProvider getProvider() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGrow(ITreeGenome genome, World world, int xPos, int yPos, int zPos, int expectedGirth, int expectedHeight) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumGrowthConditions getGrowthConditions(ITreeGenome genome, World world, int xPos, int yPos, int zPos) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getInfo() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return getProvider().getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return getUID();
|
||||
}
|
||||
}
|
||||
@@ -1,161 +0,0 @@
|
||||
package binnie.extratrees.machines;
|
||||
|
||||
import binnie.core.craftgui.minecraft.IMachineInformation;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import binnie.core.machines.inventory.ComponentInventorySlots;
|
||||
import binnie.core.machines.inventory.ComponentTankContainer;
|
||||
import binnie.core.machines.inventory.MachineSide;
|
||||
import binnie.core.machines.inventory.TankValidator;
|
||||
import binnie.core.machines.power.ComponentPowerReceptor;
|
||||
import binnie.core.machines.power.ComponentProcessSetCost;
|
||||
import binnie.core.machines.power.ErrorState;
|
||||
import binnie.core.machines.power.IProcess;
|
||||
import binnie.extratrees.core.ExtraTreeTexture;
|
||||
import binnie.extratrees.core.ExtraTreesGUID;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Infuser {
|
||||
public static int tankInput = 0;
|
||||
public static int tankOutput = 1;
|
||||
static Map<Fluid, FluidStack> recipes = new HashMap<>();
|
||||
|
||||
public static FluidStack getOutput(FluidStack fluid, ItemStack stack) {
|
||||
if (fluid == null) {
|
||||
return null;
|
||||
}
|
||||
return Infuser.recipes.get(fluid.getFluid());
|
||||
}
|
||||
|
||||
public static boolean isValidInputLiquid(FluidStack fluid) {
|
||||
return Infuser.recipes.containsKey(fluid.getFluid());
|
||||
}
|
||||
|
||||
public static boolean isValidOutputLiquid(FluidStack fluid) {
|
||||
for (Map.Entry<Fluid, FluidStack> entry : Infuser.recipes.entrySet()) {
|
||||
if (entry.getValue().isFluidEqual(fluid)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void addRecipe(FluidStack input, FluidStack output) {
|
||||
Infuser.recipes.put(input.getFluid(), output);
|
||||
}
|
||||
|
||||
// TODO unused class?
|
||||
public static class PackageInfuser extends ExtraTreeMachine.PackageExtraTreeMachine implements IMachineInformation {
|
||||
public PackageInfuser() {
|
||||
super("infuser", ExtraTreeTexture.infuserTexture, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ExtraTreeMachine.ComponentExtraTreeGUI(machine, ExtraTreesGUID.Infuser);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
ComponentTankContainer tanks = new ComponentTankContainer(machine);
|
||||
tanks.addTank(Infuser.tankInput, "input", 5000);
|
||||
tanks.getTankSlot(Infuser.tankInput).setValidator(new TankValidatorInfuserInput());
|
||||
tanks.getTankSlot(Infuser.tankInput).setOutputSides(MachineSide.TopAndBottom);
|
||||
tanks.addTank(Infuser.tankOutput, "output", 5000);
|
||||
tanks.getTankSlot(Infuser.tankOutput).setValidator(new TankValidatorInfuserOutput());
|
||||
tanks.getTankSlot(Infuser.tankOutput).setReadOnly();
|
||||
tanks.getTankSlot(Infuser.tankOutput).setOutputSides(MachineSide.Sides);
|
||||
new ComponentPowerReceptor(machine);
|
||||
new ComponentInfuserLogic(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ComponentInfuserLogic extends ComponentProcessSetCost implements IProcess {
|
||||
protected ItemStack infusing;
|
||||
|
||||
public ComponentInfuserLogic(Machine machine) {
|
||||
super(machine, 16000, 800);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProcessEnergy() {
|
||||
return getProcessLength() * 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProcessLength() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (getUtil().isTankEmpty(Infuser.tankInput)) {
|
||||
return new ErrorState.InsufficientLiquid("No Input Liquid", Infuser.tankInput);
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
if (!getUtil().isTankEmpty(Infuser.tankOutput) && getOutput() != null && !getOutput().isFluidEqual(getUtil().getFluid(Infuser.tankOutput))) {
|
||||
return new ErrorState.Tank("No Room", "No room for liquid", new int[]{Infuser.tankOutput});
|
||||
}
|
||||
if (getUtil().getFluid(Infuser.tankOutput) != null && !getUtil().getFluid(Infuser.tankOutput).isFluidEqual(getOutput())) {
|
||||
return new ErrorState.TankSpace("Different fluid in tank", Infuser.tankOutput);
|
||||
}
|
||||
return super.canProgress();
|
||||
}
|
||||
|
||||
private FluidStack getOutput() {
|
||||
return Infuser.getOutput(getUtil().getFluid(Infuser.tankInput), infusing);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishTask() {
|
||||
FluidStack output = getOutput().copy();
|
||||
getUtil().fillTank(Infuser.tankOutput, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTickTask() {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return "Infusing";
|
||||
}
|
||||
}
|
||||
|
||||
public static class TankValidatorInfuserInput extends TankValidator {
|
||||
@Override
|
||||
public boolean isValid(FluidStack liquid) {
|
||||
return Infuser.isValidInputLiquid(liquid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return "Infusable Liquids";
|
||||
}
|
||||
}
|
||||
|
||||
public static class TankValidatorInfuserOutput extends TankValidator {
|
||||
@Override
|
||||
public boolean isValid(FluidStack liquid) {
|
||||
return Infuser.isValidOutputLiquid(liquid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return "Infused Liquids";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package binnie.extratrees.village;
|
||||
|
||||
import cpw.mods.fml.common.registry.VillagerRegistry;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.gen.structure.MapGenStructureIO;
|
||||
import net.minecraft.world.gen.structure.StructureVillagePieces;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
// TODO Unused class?
|
||||
public class VillageHandlerExtraTrees implements VillagerRegistry.IVillageCreationHandler {
|
||||
public static void registerVillageComponents() {
|
||||
try {
|
||||
MapGenStructureIO.func_143031_a(ComponentVillageGrove.class, "ExtraTrees:Grove");
|
||||
} catch (Throwable t) {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public StructureVillagePieces.PieceWeight getVillagePieceWeight(Random random, int size) {
|
||||
return new StructureVillagePieces.PieceWeight(ComponentVillageGrove.class, 505, MathHelper.getRandomIntegerInRange(random, size, 1 + size));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getComponentClass() {
|
||||
return ComponentVillageGrove.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5) {
|
||||
return ComponentVillageGrove.buildComponent(startPiece, pieces, random, p1, p2, p3, p4, p5);
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
package binnie.extratrees.worldgen;
|
||||
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.world.ITreeGenData;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// TODO unused class?
|
||||
public class TreeGenBase extends WorldGenerator {
|
||||
protected ITree tree;
|
||||
protected ITreeGenData treeGen;
|
||||
protected World world;
|
||||
protected Random rand;
|
||||
protected int startX;
|
||||
protected int startY;
|
||||
protected int startZ;
|
||||
protected int girth;
|
||||
protected int height;
|
||||
protected int minHeight;
|
||||
protected int maxHeight;
|
||||
protected boolean spawnPods;
|
||||
protected int minPodHeight;
|
||||
|
||||
public TreeGenBase() {
|
||||
minHeight = 4;
|
||||
maxHeight = 80;
|
||||
spawnPods = false;
|
||||
minPodHeight = 3;
|
||||
}
|
||||
|
||||
protected int randBetween(int a, int b) {
|
||||
return a + rand.nextInt(b - a);
|
||||
}
|
||||
|
||||
protected float randBetween(float a, float b) {
|
||||
return a + rand.nextFloat() * (b - a);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(World world, Random random, int x, int y, int z) {
|
||||
this.world = world;
|
||||
startX = x;
|
||||
startY = y;
|
||||
startZ = z;
|
||||
girth = tree.getGirth(world, x, y, z);
|
||||
height = (int) (randBetween(getHeight()[0], getHeight()[1]) * tree.getGenome().getHeight());
|
||||
|
||||
if (tree.canGrow(world, x, y, z, girth, height)) {
|
||||
generate();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void generate() {
|
||||
}
|
||||
|
||||
protected int[] getHeight() {
|
||||
return new int[]{5, 2};
|
||||
}
|
||||
|
||||
private static class Vector {
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
public Vector(int x, int y, int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user