Closes #402,#404,406

This commit is contained in:
Stuart Pomeroy 2016-03-27 17:41:56 +01:00
parent 96464980c2
commit 8fba82312c
16 changed files with 149 additions and 163 deletions

View file

@ -1,7 +1,5 @@
package techreborn.client.gui;
import java.io.IOException;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
@ -19,6 +17,8 @@ import techreborn.init.ModBlocks;
import techreborn.proxies.ClientProxy;
import techreborn.tiles.TileBlastFurnace;
import java.io.IOException;
public class GuiBlastFurnace extends GuiContainer
{
@ -28,7 +28,7 @@ public class GuiBlastFurnace extends GuiContainer
TileBlastFurnace blastfurnace;
ContainerBlastFurnace containerBlastFurnace;
boolean hasMultiBlock;
public GuiBlastFurnace(EntityPlayer player, TileBlastFurnace tileblastfurnace)
{
super(new ContainerBlastFurnace(tileblastfurnace, player));
@ -41,6 +41,8 @@ public class GuiBlastFurnace extends GuiContainer
@Override
public void initGui()
{
hasMultiBlock = containerBlastFurnace.heat != 0;
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
GuiButton button = new GuiButton(212, k + 4, l + 6, 20, 20, "");
@ -69,7 +71,7 @@ public class GuiBlastFurnace extends GuiContainer
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
if (containerBlastFurnace.heat == 0)
if (hasMultiBlock)
{
GuiUtil.drawTooltipBox(k + 30, l + 50 + 12 - 0, 114, 10);
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38,

View file

@ -17,6 +17,7 @@ public class GuiIndustrialGrinder extends GuiContainer
TileIndustrialGrinder grinder;
ContainerIndustrialGrinder containerGrinder;
boolean hasMultiBlock;
public GuiIndustrialGrinder(EntityPlayer player, TileIndustrialGrinder tilegrinder)
{
super(new ContainerIndustrialGrinder(tilegrinder, player));
@ -25,7 +26,12 @@ public class GuiIndustrialGrinder extends GuiContainer
grinder = tilegrinder;
containerGrinder = (ContainerIndustrialGrinder) this.inventorySlots;
}
@Override
public void initGui()
{
hasMultiBlock = containerGrinder.connectionStatus != 1;
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
@ -36,7 +42,12 @@ public class GuiIndustrialGrinder extends GuiContainer
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = 0;
if (hasMultiBlock)
{
// GuiDraw.drawTooltipBox(k + 30, l + 50 + 12 - j, 114, 10);
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38,
l + 52 + 12 - j, -1);
}
j = grinder.getProgressScaled(24);
if (j > 0)
{
@ -49,12 +60,7 @@ public class GuiIndustrialGrinder extends GuiContainer
this.drawTexturedModalRect(k + 132, l + 63 + 12 - j, 176, 12 - j, 14, j + 2);
}
if (containerGrinder.connectionStatus != 1)
{
// GuiDraw.drawTooltipBox(k + 30, l + 50 + 12 - j, 114, 10);
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38,
l + 52 + 12 - j, -1);
}
// TODO 1.8 nope
// if (grinder.tank.getFluidAmount() != 0) {

View file

@ -10,7 +10,7 @@ public class ItemAdvancedDrill extends ItemDrill
public ItemAdvancedDrill()
{
super(ToolMaterial.DIAMOND, "techreborn.advancedDrill", ConfigTechReborn.AdvancedDrillCharge,
ConfigTechReborn.AdvancedDrillTier, 4.0F);
ConfigTechReborn.AdvancedDrillTier, 4.0F, 20F);
this.cost = 250;
}

View file

@ -10,7 +10,7 @@ public class ItemDiamondDrill extends ItemDrill
public ItemDiamondDrill()
{
super(ToolMaterial.DIAMOND, "techreborn.diamondDrill", ConfigTechReborn.DiamondDrillCharge,
ConfigTechReborn.DiamondDrillTier, 2.5F);
ConfigTechReborn.DiamondDrillTier, 2.5F, 15F);
this.cost = 250;
}

View file

@ -1,12 +1,14 @@
package techreborn.items.tools;
import java.util.List;
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
@ -24,6 +26,9 @@ import reborncore.common.util.TorchHelper;
import techreborn.client.TechRebornCreativeTab;
import techreborn.lib.ModInfo;
import java.util.List;
import java.util.Random;
public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem
{
@ -33,10 +38,10 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITextured
public float unpoweredSpeed = 2.0F;
public double transferLimit = 100;
public ItemDrill(ToolMaterial material, String unlocalizedName, int energyCapacity, int tier, float unpoweredSpeed)
public ItemDrill(ToolMaterial material, String unlocalizedName, int energyCapacity, int tier, float unpoweredSpeed, float efficiencyOnProperMaterial)
{
super(material);
efficiencyOnProperMaterial = 20F;
this.efficiencyOnProperMaterial = efficiencyOnProperMaterial;
setCreativeTab(TechRebornCreativeTab.instance);
setMaxStackSize(1);
setMaxDamage(240);
@ -47,83 +52,77 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITextured
this.unpoweredSpeed = unpoweredSpeed;
}
// @Override
// public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block
// blockIn, BlockPos pos, EntityLivingBase playerIn) {
// Random rand = new Random();
// if
// (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId,
// stack)+1) == 0) {
// PoweredItem.useEnergy(cost, stack);
// }
// return true;
// }
//
// @Override
// public float getDigSpeed(ItemStack stack, IBlockState state) {
// if (!PoweredItem.canUseEnergy(cost, stack)) {
// return unpoweredSpeed;
// }
// if (Items.wooden_pickaxe.getDigSpeed(stack, state) > 1.0F ||
// Items.wooden_shovel.getDigSpeed(stack, state) > 1.0F) {
// return efficiencyOnProperMaterial;
// } else {
// return super.getDigSpeed(stack, state);
// }
// }
@Override public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos,
EntityLivingBase entityLiving)
{
Random rand = new Random();
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantment.getEnchantmentByID(34), stack) + 1) == 0)
{
PoweredItem.useEnergy(cost, stack);
}
return true;
}
@Override
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1)
@Override public float getStrVsBlock(ItemStack stack, IBlockState state)
{
if (!PoweredItem.canUseEnergy(cost, stack))
{
return unpoweredSpeed;
}
if (Items.wooden_pickaxe.getStrVsBlock(stack, state) > 1.0F
|| Items.wooden_shovel.getStrVsBlock(stack, state) > 1.0F)
{
return efficiencyOnProperMaterial;
} else
{
return super.getStrVsBlock(stack, state);
}
}
@Override public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving,
EntityLivingBase entityliving1)
{
return true;
}
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
@Override public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
return TorchHelper.placeTorch(stack, playerIn, worldIn, pos, facing, hitX, hitY, hitZ, hand);
}
@Override
public boolean isRepairable()
@Override public boolean isRepairable()
{
return false;
}
@Override
public double getMaxPower(ItemStack stack)
@Override public double getMaxPower(ItemStack stack)
{
return maxCharge;
}
@Override
public boolean canAcceptEnergy(ItemStack stack)
@Override public boolean canAcceptEnergy(ItemStack stack)
{
return true;
}
@Override
public boolean canProvideEnergy(ItemStack stack)
@Override public boolean canProvideEnergy(ItemStack stack)
{
return false;
}
@Override
public double getMaxTransfer(ItemStack stack)
@Override public double getMaxTransfer(ItemStack stack)
{
return transferLimit;
}
@Override
public int getStackTier(ItemStack stack)
@Override public int getStackTier(ItemStack stack)
{
return tier;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList)
@SuppressWarnings({ "rawtypes", "unchecked" }) @SideOnly(Side.CLIENT) public void getSubItems(Item item,
CreativeTabs par2CreativeTabs, List itemList)
{
ItemStack itemStack = new ItemStack(this, 1);
itemList.add(itemStack);
@ -133,35 +132,30 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITextured
itemList.add(charged);
}
@Override
public double getDurabilityForDisplay(ItemStack stack)
@Override public double getDurabilityForDisplay(ItemStack stack)
{
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
return 1 - charge;
}
@Override
public boolean showDurabilityBar(ItemStack stack)
@Override public boolean showDurabilityBar(ItemStack stack)
{
return true;
}
@Override
public String getTextureName(int damage)
@Override public String getTextureName(int damage)
{
return "techreborn:items/tool/nullDrill";
}
@Override
public int getMaxMeta()
@Override public int getMaxMeta()
{
return 1;
}
@Override
@SideOnly(Side.CLIENT)
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
@Override @SideOnly(Side.CLIENT) public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player,
int useRemaining)
{
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
}

View file

@ -10,7 +10,7 @@ public class ItemIronDrill extends ItemDrill
public ItemIronDrill()
{
super(ToolMaterial.IRON, "techreborn.ironDrill", ConfigTechReborn.IronDrillCharge,
ConfigTechReborn.IronDrillTier, 2.0F);
ConfigTechReborn.IronDrillTier, 2.0F, 10F);
this.cost = 50;
}

View file

@ -1,11 +1,11 @@
package techreborn.items.tools;
import java.util.List;
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@ -26,6 +26,9 @@ import techreborn.client.TechRebornCreativeTab;
import techreborn.lib.ModInfo;
import techreborn.utils.OreDictUtils;
import java.util.List;
import java.util.Random;
public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem
{
@ -47,17 +50,16 @@ public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo, ITex
this.tier = tier;
}
// @Override
// public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block
// blockIn, BlockPos pos, EntityLivingBase playerIn) {
// Random rand = new Random();
// if
// (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId,
// stack) + 1) == 0) {
// PoweredItem.useEnergy(cost, stack);
// }
// return true;
// }
@Override public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos,
EntityLivingBase entityLiving)
{
Random rand = new Random();
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantment.getEnchantmentByID(34), stack) + 1) == 0)
{
PoweredItem.useEnergy(cost, stack);
}
return true;
}
@Override
public boolean canHarvestBlock(IBlockState state)
@ -70,15 +72,15 @@ public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo, ITex
return false;
}
// @Override
// public float getDigSpeed(ItemStack stack, IBlockState state) {
// if (OreDictUtils.isOre(state, "stone") && PoweredItem.canUseEnergy(cost,
// stack)) {
// return efficiencyOnProperMaterial;
// } else {
// return 0.5F;
// }
// }
@Override
public float getStrVsBlock(ItemStack stack, IBlockState state) {
if (OreDictUtils.isOre(state, "stone") && PoweredItem.canUseEnergy(cost,
stack)) {
return efficiencyOnProperMaterial;
} else {
return 0.5F;
}
}
@Override
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1)

View file

@ -1,11 +1,10 @@
package techreborn.items.tools;
import java.util.List;
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
@ -21,6 +20,8 @@ import techreborn.client.TechRebornCreativeTab;
import techreborn.config.ConfigTechReborn;
import techreborn.lib.ModInfo;
import java.util.List;
public class ItemRockCutter extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem
{
@ -59,29 +60,29 @@ public class ItemRockCutter extends ItemPickaxe implements IEnergyItemInfo, ITex
{
if (Items.diamond_pickaxe.canHarvestBlock(state))
{
// if (PoweredItem.canUseEnergy(cost, stack)) {
// PoweredItem.useEnergy(cost, stack);
// return true;
// }
// if (PoweredItem.canUseEnergy(cost, stack)) {
// PoweredItem.useEnergy(cost, stack);
// return true;
// }
}
return false;
}
// @Override
// public int getHarvestLevel(ItemStack stack, String toolClass) {
// if (!stack.isItemEnchanted()) {
// stack.addEnchantment(Enchantment.silkTouch, 1);
// }
// return super.getHarvestLevel(stack, toolClass);
// }
//
// @Override
// public float getStrVsBlock(ItemStack stack, Block block) {
// if (!stack.isItemEnchanted()) {
// stack.addEnchantment(Enchantment.silkTouch, 1);
// }
// return super.getStrVsBlock(stack, block);
// }
@Override
public int getHarvestLevel(ItemStack stack, String toolClass) {
if (!stack.isItemEnchanted()) {
stack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
}
return super.getHarvestLevel(stack, toolClass);
}
@Override
public float getStrVsBlock(ItemStack stack, IBlockState block) {
if (!stack.isItemEnchanted()) {
stack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
}
return super.getStrVsBlock(stack, block);
}
@Override
public boolean isRepairable()

View file

@ -1,7 +1,5 @@
package techreborn.manual;
import java.io.IOException;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
@ -10,22 +8,15 @@ import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import techreborn.init.ModBlocks;
import techreborn.init.ModItems;
import techreborn.items.ItemParts;
import techreborn.items.ItemPlates;
import techreborn.manual.pages.AdvancedMachines;
import techreborn.manual.pages.BasicMachinesPage;
import techreborn.manual.pages.ContentsPage;
import techreborn.manual.pages.CraftingInfoPage;
import techreborn.manual.pages.DescriptionPage;
import techreborn.manual.pages.GeneratingPowerPage;
import techreborn.manual.pages.GettingStartedPage;
import techreborn.manual.pages.ToolsPage;
import techreborn.manual.pages.*;
import java.io.IOException;
@SideOnly(Side.CLIENT)
public class GuiManual extends GuiScreen
@ -40,7 +31,7 @@ public class GuiManual extends GuiScreen
public GuiManual()
{
this.xSize = 146;
this.xSize = 200;
this.ySize = 180;
root = createRoot();
}

View file

@ -1,7 +1,5 @@
package techreborn.manual.pages;
import java.io.IOException;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
@ -10,12 +8,14 @@ import net.minecraft.util.text.translation.I18n;
import techreborn.manual.PageCollection;
import techreborn.manual.Reference;
import java.io.IOException;
public class BasePage extends GuiScreen
{
public static final ResourceLocation PAGE_TEXTURE = new ResourceLocation(
"techreborn:textures/manual/gui/manual.png");
private final int xSize = 146;
private final int xSize = 200;
private final int ySize = 180;
// Name Displayed in the index page
public String INDEX_NAME;

View file

@ -1,7 +1,5 @@
package techreborn.manual.pages;
import java.awt.*;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.item.ItemStack;
@ -12,6 +10,8 @@ import techreborn.manual.PageCollection;
import techreborn.manual.Reference;
import techreborn.manual.util.GuiButtonItemTexture;
import java.awt.*;
public class ContentsPage extends TitledPage
{
public ContentsPage(String name, PageCollection collection)

View file

@ -1,12 +1,9 @@
package techreborn.manual.pages;
import java.awt.*;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import com.google.common.base.Objects;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
@ -14,26 +11,22 @@ import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraft.item.crafting.*;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import org.lwjgl.opengl.GL11;
import techreborn.manual.PageCollection;
import techreborn.manual.util.ButtonUtil;
import com.google.common.base.Objects;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import java.awt.*;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class CraftingInfoPage extends TitledPage
{
@ -82,7 +75,7 @@ public class CraftingInfoPage extends TitledPage
{
if (hasRecipe)
{
renderImage(offsetX, offsetY + 10, "craftingtable");
renderImage(offsetX + (offsetX/ 2) , offsetY + 10, "craftingtable");
} else
{
drawString(fontRendererObj, "No Crafting Recipe", offsetX + 40, offsetY + 22, Color.black.getRGB());
@ -149,7 +142,7 @@ public class CraftingInfoPage extends TitledPage
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(1F, 1F, 1F, 1F);
drawTexturedModalRect(offsetX, offsetY - 14, 0, 0, 140, this.height);
drawTexturedModalRect(offsetX + 16, offsetY + 9, 0, 0, 116, 54);
GL11.glDisable(GL11.GL_BLEND);
}

View file

@ -1,15 +1,14 @@
package techreborn.manual.util;
import java.awt.*;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.client.config.GuiButtonExt;
import org.lwjgl.opengl.GL11;
import java.awt.*;
public class GuiButtonItemTexture extends GuiButtonExt
{
@ -39,13 +38,13 @@ public class GuiButtonItemTexture extends GuiButtonExt
mc.getTextureManager().bindTexture(buttonTextures);
int u = textureU;
int v = textureV;
if (flag)
{
u += width;
u += mc.fontRendererObj.getStringWidth(this.NAME) + 25;
v += mc.fontRendererObj.getStringWidth(this.NAME) + 25;
GL11.glPushMatrix();
GL11.glColor4f(0f, 0f, 0f, 1f);
this.drawTexturedModalRect(this.xPosition, this.yPosition, u, v, width, height);
this.drawTexturedModalRect(this.xPosition, this.yPosition, u, v, mc.fontRendererObj.getStringWidth(this.NAME) + 25, height);
GL11.glPopMatrix();
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -319,14 +319,12 @@ public class TileMatterFabricator extends TilePowerAcceptor implements IWrenchab
return 100000000;
}
@Override
public boolean canAcceptEnergy(EnumFacing direction)
@Override public boolean canAcceptEnergy(EnumFacing direction)
{
return true;
}
@Override
public boolean canProvideEnergy(EnumFacing direction)
@Override public boolean canProvideEnergy(EnumFacing direction)
{
return false;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 34 KiB