Move FieldKit from botany to genetics module

This commit is contained in:
kordum committed 2017-06-24 10:59:51 +03:00
1 parent c2481365b9
commit 46140e2e66
13 files changed
+71 -64

No files matched your search

@@ -24,8 +24,8 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
public class WindowGenepool extends WindowMachine {
static Texture ProgressBase = new StandardTexture(64, 0, 130, 21, ExtraBeeTexture.GUIProgress.getTexture());
static Texture Progress = new StandardTexture(64, 21, 130, 21, ExtraBeeTexture.GUIProgress.getTexture());
static Texture progressBase = new StandardTexture(64, 0, 130, 21, ExtraBeeTexture.GUIProgress.getTexture());
static Texture progress = new StandardTexture(64, 21, 130, 21, ExtraBeeTexture.GUIProgress.getTexture());
public WindowGenepool(EntityPlayer player, IInventory inventory, Side side) {
super(280, 198, player, inventory, side);
@@ -40,15 +40,20 @@ public class WindowGenepool extends WindowMachine {
super.initialiseClient();
int x = 16;
int y = 32;
new ControlLiquidTank(this, x, y).setTankID(1);
new ControlLiquidTank(this, x, y).setTankID(Genepool.TANK_ETHANOL);
x += 26;
new ControlSlotArray(this, x, y + 3, 2, 3).create(Genepool.SLOT_RESERVE);
x += 38;
new ControlIconDisplay(this, x, y + 3 + 18 + 1, GUIIcon.ArrowRight.getIcon());
new ControlIconDisplay(this, x, y + 22, GUIIcon.ArrowRight.getIcon());
x += 18;
new ControlSlot(this, x, y + 3 + 18).assign(0);
new ControlSlot(this, x, y + 21).assign(Genepool.SLOT_BEE);
x += 18;
new ControlMachineProgress(this, x, y + 19, WindowGenepool.ProgressBase, WindowGenepool.Progress, Position.LEFT);
new ControlMachineProgress(this, x, y + 19, progressBase, progress, Position.LEFT);
x += 130;
new ControlLiquidTank(this, x, y).setTankID(Genepool.TANK_DNA);
new ControlEnergyBar(this, 21, 115, 16, 60, Position.BOTTOM);
@@ -0,0 +1,85 @@
package binnie.genetics.item;
import binnie.botany.Botany;
import binnie.core.BinnieCore;
import binnie.core.gui.BinnieCoreGUI;
import binnie.core.util.I18N;
import binnie.genetics.GeneticsCreativeTab;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import java.util.List;
public class ItemFieldKit extends Item {
private IIcon fieldKit0;
private IIcon fieldKit1;
private IIcon fieldKit2;
private IIcon fieldKit3;
public ItemFieldKit() {
setUnlocalizedName("fieldKit");
setCreativeTab(GeneticsCreativeTab.instance);
setMaxStackSize(1);
setMaxDamage(64);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister register) {
fieldKit0 = Botany.proxy.getIcon(register, "fieldKit");
fieldKit1 = Botany.proxy.getIcon(register, "fieldKit1");
fieldKit2 = Botany.proxy.getIcon(register, "fieldKit2");
fieldKit3 = Botany.proxy.getIcon(register, "fieldKit3");
itemIcon = fieldKit0;
}
@Override
public IIcon getIcon(ItemStack stack, int pass) {
int damage = stack.getItemDamage();
if (damage < 24) {
return fieldKit3;
}
if (damage < 48) {
return fieldKit2;
}
if (damage < 64) {
return fieldKit1;
}
return fieldKit0;
}
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
if (!player.isSneaking()) {
BinnieCore.proxy.openGui(BinnieCoreGUI.FieldKit, player, (int) player.posX, (int) player.posY, (int) player.posZ);
}
return itemStack;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemStack, EntityPlayer player, List tooltip, boolean advanced) {
int i = getMaxDamage() - itemStack.getItemDamage();
if (i == 0) {
tooltip.add(I18N.localise("genetics.item.fieldKit.tooltip.noPaper"));
} else {
if (i > 1) {
tooltip.add(I18N.localise("genetics.item.fieldKit.tooltip.sheetsOfPaper", i));
} else {
tooltip.add(I18N.localise("genetics.item.fieldKit.tooltip.sheetOfPaper", i));
}
}
super.addInformation(itemStack, player, tooltip, advanced);
}
@Override
public String getItemStackDisplayName(ItemStack stack) {
return I18N.localise("genetics.item.fieldKit.name");
}
}
@@ -25,36 +25,38 @@ public class GenepoolComponentFX extends MachineComponent implements IRender.Ran
@SideOnly(Side.CLIENT)
@Override
public void onDisplayTick(World world, int x, int y, int z, Random rand) {
if (rand.nextFloat() < 1.0f && getUtil().getProcess().isInProgress()) {
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.3 + rand.nextDouble() * 0.4, y + 1, z + 0.3 + rand.nextDouble() * 0.4, 0.0, 0.0, 0.0) {
double axisX = posX;
double axisZ = posZ;
double angle = rand.nextDouble() * 2.0 * 3.1415;
{
axisX = 0.0;
axisZ = 0.0;
angle = 0.0;
motionX = 0.0;
motionZ = 0.0;
motionY = rand.nextFloat() * 0.01;
particleMaxAge = 25;
particleGravity = 0.0f;
noClip = true;
setRBGColorF(0.4f + 0.6f * rand.nextFloat(), 0.6f * rand.nextFloat(), 0.6f + 0.4f * rand.nextFloat());
}
@Override
public void onUpdate() {
super.onUpdate();
setAlphaF((float) Math.cos(1.57 * particleAge / particleMaxAge));
}
@Override
public int getFXLayer() {
return 0;
}
});
if (rand.nextFloat() >= 1.0f || !getUtil().getProcess().isInProgress()) {
return;
}
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.3 + rand.nextDouble() * 0.4, y + 1, z + 0.3 + rand.nextDouble() * 0.4, 0.0, 0.0, 0.0) {
double axisX = posX;
double axisZ = posZ;
double angle = rand.nextDouble() * 2.0 * 3.1415;
{
axisX = 0.0;
axisZ = 0.0;
angle = 0.0;
motionX = 0.0;
motionZ = 0.0;
motionY = rand.nextFloat() * 0.01;
particleMaxAge = 25;
particleGravity = 0.0f;
noClip = true;
setRBGColorF(0.4f + 0.6f * rand.nextFloat(), 0.6f * rand.nextFloat(), 0.6f + 0.4f * rand.nextFloat());
}
@Override
public void onUpdate() {
super.onUpdate();
setAlphaF((float) Math.cos(1.57 * particleAge / particleMaxAge));
}
@Override
public int getFXLayer() {
return 0;
}
});
}
}