Closes #434, Add tooltips to grinder and batbox. Fix centrifuge. closes #436

This commit is contained in:
Stuart Pomeroy 2016-03-28 17:50:25 +01:00
parent 1dfa6c094f
commit 427963b40a
6 changed files with 62 additions and 30 deletions

View file

@ -63,4 +63,5 @@ public class BlockGrinder extends BlockMachineBase implements IAdvancedRotationT
{
return prefix + "tier1_machine_bottom";
}
}

View file

@ -3,6 +3,7 @@ package techreborn.client;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.client.Minecraft;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
@ -60,8 +61,8 @@ public class StackToolTipEvent
try
{
Block block = Block.getBlockFromItem(event.getItemStack().getItem());
if (block != null && block instanceof BlockContainer
&& block.getClass().getCanonicalName().startsWith("techreborn."))
if (block != null && (block instanceof BlockContainer || block instanceof ITileEntityProvider)
&& Block.blockRegistry.getNameForObject(block).getResourceDomain().contains("techreborn"))
{
TileEntity tile = block.createTileEntity(Minecraft.getMinecraft().theWorld,
block.getDefaultState());

View file

@ -2034,7 +2034,7 @@ public class ModRecipes {
new ItemStack(TechRebornAPI.recipeCompact.getItem("cell").getItem(), 5),
new ItemStack(ModItems.parts, 8, 41),
new ItemStack(Blocks.sapling, 6), ItemCells.getCellByName("methane", 1),
ItemCells.getCellByName("carbon", 4), 5000, 5));
ItemCells.getCellByName("carbon", 4), 5000, 5, false));
// Soul Sand Byproducts
RecipeHandler.addRecipe(

View file

@ -1,26 +1,27 @@
package techreborn.tiles;
import java.util.List;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.text.ITextComponent;
import reborncore.api.IListInfoProvider;
import reborncore.api.power.EnumPowerTier;
import reborncore.api.power.IEnergyItemInfo;
import reborncore.common.powerSystem.PoweredItem;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.util.Inventory;
import techreborn.api.recipe.RecipeCrafter;
import techreborn.config.ConfigTechReborn;
import techreborn.init.ModBlocks;
import techreborn.lib.Reference;
import ic2.api.tile.IWrenchable;
import java.util.List;
public class TileCentrifuge extends TilePowerAcceptor
implements IWrenchable, IInventory, ISidedInventory, IListInfoProvider
implements IWrenchable, IInventory, IListInfoProvider
{
public int tickTime;
@ -51,6 +52,19 @@ public class TileCentrifuge extends TilePowerAcceptor
super.updateEntity();
crafter.updateEntity();
charge(6);
if (inventory.getStackInSlot(6) != null)
{
ItemStack stack = inventory.getStackInSlot(6);
IEnergyItemInfo item = (IEnergyItemInfo) stack.getItem();
if (item.canProvideEnergy(stack))
{
if (getEnergy() != getMaxPower())
{
addEnergy(item.getMaxTransfer(stack));
PoweredItem.setEnergy(PoweredItem.getEnergy(stack) - item.getMaxTransfer(stack), stack);
}
}
}
}
@Override
@ -163,26 +177,26 @@ public class TileCentrifuge extends TilePowerAcceptor
return inventory.isItemValidForSlot(slot, stack);
}
// ISidedInventory
@Override
public int[] getSlotsForFace(EnumFacing side)
{
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3, 4, 5 } : new int[] { 0, 1, 2, 3, 4, 5 };
}
@Override
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side)
{
if (slotIndex >= 2)
return false;
return isItemValidForSlot(slotIndex, itemStack);
}
@Override
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side)
{
return slotIndex == 2 || slotIndex == 3 || slotIndex == 4 || slotIndex == 5;
}
// // ISidedInventory
// @Override
// public int[] getSlotsForFace(EnumFacing side)
// {
// return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3, 4, 5 } : new int[] { 0, 1, 2, 3, 4, 5 };
// }
//
// @Override
// public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side)
// {
// if (slotIndex >= 2)
// return false;
// return isItemValidForSlot(slotIndex, itemStack);
// }
//
// @Override
// public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side)
// {
// return slotIndex == 2 || slotIndex == 3 || slotIndex == 4 || slotIndex == 5;
// }
public int getProgressScaled(int scale)
{

View file

@ -1,16 +1,23 @@
package techreborn.tiles.storage;
import reborncore.api.IListInfoProvider;
import reborncore.api.power.EnumPowerTier;
import techreborn.init.ModBlocks;
import java.util.List;
/**
* Created by modmuss50 on 14/03/2016.
*/
public class TileBatBox extends TileEnergyStorage
public class TileBatBox extends TileEnergyStorage implements IListInfoProvider
{
public TileBatBox()
{
super("BatBox", 2, ModBlocks.batBox, EnumPowerTier.LOW, 32, 32, 4000);
}
@Override public void addInfo(List<String> info, boolean isRealTile)
{
info.add("Batbox");
}
}

View file

@ -7,6 +7,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.text.ITextComponent;
import reborncore.api.IListInfoProvider;
import reborncore.api.power.EnumPowerTier;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.util.Inventory;
@ -15,7 +16,10 @@ import techreborn.init.ModBlocks;
import techreborn.lib.Reference;
import ic2.api.tile.IWrenchable;
public class TileGrinder extends TilePowerAcceptor implements IWrenchable, IInventory, ISidedInventory
import java.util.List;
public class TileGrinder extends TilePowerAcceptor implements IWrenchable, IInventory, ISidedInventory,
IListInfoProvider
{
public Inventory inventory = new Inventory(6, "TileGrinder", 64, this);
@ -262,4 +266,9 @@ public class TileGrinder extends TilePowerAcceptor implements IWrenchable, IInve
{
return inventory.getDisplayName();
}
@Override public void addInfo(List<String> info, boolean isRealTile)
{
info.add("Macerator");
}
}