Misc fixes, and fixing a derp where a tome doesn't open the knowledge of the person who owns it

This commit is contained in:
Pahimar 2015-03-24 17:45:14 -04:00
parent aeb617d22c
commit 68c89ae7b5
9 changed files with 46 additions and 11 deletions

View File

@ -1,5 +1,7 @@
package com.pahimar.ee3.block;
import com.pahimar.ee3.creativetab.CreativeTab;
import com.pahimar.ee3.init.ModBlocks;
import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.reference.Textures;
import com.pahimar.ee3.tileentity.TileEntityTransmutationTablet;
@ -10,6 +12,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
@ -26,6 +29,7 @@ public class BlockAshInfusedStoneSlab extends BlockSlab
public BlockAshInfusedStoneSlab()
{
super(false, Material.rock);
this.setCreativeTab(CreativeTab.EE3_TAB);
this.setHardness(2.0f);
this.setBlockName(Names.Blocks.ASH_INFUSED_STONE_SLAB);
}
@ -270,4 +274,17 @@ public class BlockAshInfusedStoneSlab extends BlockSlab
return false;
}
@Override
@SideOnly(Side.CLIENT)
public Item getItem(World world, int x, int y, int z)
{
return Item.getItemFromBlock(ModBlocks.ashInfusedStoneSlab);
}
@Override
public int getDamageValue(World world, int x, int y, int z)
{
return 0;
}
}

View File

@ -14,6 +14,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
@ -24,9 +25,9 @@ public class GuiAlchemicalTome extends GuiBase
private ElementButton nextPageButton;
private ElementTextField searchTextField;
public GuiAlchemicalTome(InventoryPlayer inventoryPlayer)
public GuiAlchemicalTome(InventoryPlayer inventoryPlayer, ItemStack itemStack)
{
super(new ContainerAlchemicalTome(inventoryPlayer.player), Textures.Gui.ALCHEMICAL_TOME);
super(new ContainerAlchemicalTome(inventoryPlayer.player, itemStack), Textures.Gui.ALCHEMICAL_TOME);
xSize = 256;
ySize = 226;
}
@ -66,7 +67,6 @@ public class GuiAlchemicalTome extends GuiBase
if (((ContainerAlchemicalTome) this.inventorySlots).getKnownTransmutationsCount() == 0)
{
fontRendererObj.drawSplitString(StatCollector.translateToLocal(Messages.Gui.NO_KNOWN_TRANSMUTATIONS), 142, 20, 100, new GuiColor(50, 50, 50).getColor());
fontRendererObj.drawSplitString(StatCollector.translateToLocal(Messages.Gui.HOW_TO_LEARN_TRANSMUTATIONS), 142, 60, 100, new GuiColor(50, 50, 50).getColor());
}
}

View File

@ -29,7 +29,7 @@ public class GuiHandler implements IGuiHandler
}
else if (id == GUIs.ALCHEMICAL_TOME.ordinal())
{
return new ContainerAlchemicalTome(entityPlayer);
return new ContainerAlchemicalTome(entityPlayer, entityPlayer.getHeldItem());
}
else if (id == GUIs.CALCINATOR.ordinal())
{
@ -88,7 +88,7 @@ public class GuiHandler implements IGuiHandler
}
else if (id == GUIs.ALCHEMICAL_TOME.ordinal())
{
return new GuiAlchemicalTome(entityPlayer.inventory);
return new GuiAlchemicalTome(entityPlayer.inventory, entityPlayer.getHeldItem());
}
else if (id == GUIs.CALCINATOR.ordinal())
{

View File

@ -26,6 +26,9 @@ public class Recipes
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.alchemicalFuel, 9, 1), new ItemStack(ModBlocks.alchemicalFuelBlock, 1, 1));
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.alchemicalFuel, 9, 2), new ItemStack(ModBlocks.alchemicalFuelBlock, 1, 2));
GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.ashInfusedStoneSlab, 6), "sss", 's', new ItemStack(ModBlocks.ashInfusedStone));
GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.ashInfusedStone, 1), "s", "s", 's', new ItemStack(ModBlocks.ashInfusedStoneSlab));
GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.chalkBlock), "bcb", "cbc", "bcb", 'b', new ItemStack(Items.dye, 1, 15), 'c', new ItemStack(Items.clay_ball));
GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.chalkBlock), "cc", "cc", 'c', new ItemStack(ModItems.chalk));

View File

@ -1,5 +1,6 @@
package com.pahimar.ee3.inventory;
import com.pahimar.ee3.item.ItemAlchemicalTome;
import com.pahimar.ee3.knowledge.TransmutationKnowledgeRegistry;
import com.pahimar.ee3.util.FilterUtils;
import com.pahimar.ee3.util.ItemHelper;
@ -13,10 +14,12 @@ import net.minecraft.item.ItemStack;
import java.util.ArrayList;
import java.util.List;
import java.util.TreeSet;
import java.util.UUID;
public class ContainerAlchemicalTome extends ContainerEE implements ITextFieldElementHandler
{
private final InventoryAlchemicalTome inventoryAlchemicalTome;
private final ItemStack alchemicalTomeItemStack;
private int pageOffset, maxPageOffset;
private String searchTerm;
private boolean requiresUpdate = false;
@ -24,10 +27,16 @@ public class ContainerAlchemicalTome extends ContainerEE implements ITextFieldEl
private final static int MAX_ROW_INDEX = 8;
private final static int MAX_COLUMN_INDEX = 5;
public ContainerAlchemicalTome(EntityPlayer entityPlayer)
public ContainerAlchemicalTome(EntityPlayer entityPlayer, ItemStack itemStack)
{
this.alchemicalTomeItemStack = itemStack;
TreeSet<ItemStack> knownTransmutations = new TreeSet<ItemStack>(ItemHelper.displayNameComparator);
knownTransmutations.addAll(TransmutationKnowledgeRegistry.getInstance().getPlayersKnownTransmutations(entityPlayer.getUniqueID()));
if (itemStack.getItem() instanceof ItemAlchemicalTome && ItemHelper.hasOwnerUUID(itemStack))
{
UUID ownerUUID = ItemHelper.getOwnerUUID(itemStack);
knownTransmutations.addAll(TransmutationKnowledgeRegistry.getInstance().getPlayersKnownTransmutations(ownerUUID));
}
inventoryAlchemicalTome = new InventoryAlchemicalTome(knownTransmutations);
pageOffset = 0;

View File

@ -68,6 +68,14 @@ public class ContainerTransmutationTablet extends ContainerEE implements ITextFi
}
});
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 3; j++)
{
this.addSlotToContainer(new SlotTabletOutput(inventoryTransmutationTablet, i * 4 + j + 10, 175 + j * 20, 163 + i * 19));
}
}
// Add the player's inventory slots to the container
for (int inventoryRowIndex = 0; inventoryRowIndex < PLAYER_INVENTORY_ROWS; ++inventoryRowIndex)
{

View File

@ -107,7 +107,7 @@ public class InventoryTransmutationTablet implements IInventory
@Override
public int getInventoryStackLimit()
{
return 64;
return 1;
}
@Override

View File

@ -20,7 +20,6 @@ public final class Messages
private static final String GUI_PREFIX = "container.ee3:";
public static final String NO_KNOWN_TRANSMUTATIONS = GUI_PREFIX + "alchemicalTome.noTransmutationsKnown";
public static final String HOW_TO_LEARN_TRANSMUTATIONS = GUI_PREFIX + "alchemicalTome.howToLearnTransmutations";
}
public static final class Commands

View File

@ -103,8 +103,7 @@ container.ee3:glassBell=Glass Bell
container.ee3:researchStation=Research Station
container.ee3:augmentationTable=Augmentation Table [WIP]
container.ee3:alchemicalTome=Tome of Alchemical Knowledge
container.ee3:alchemicalTome.noTransmutationsKnown=You don't know how to transmute anything yet!
container.ee3:alchemicalTome.howToLearnTransmutations=Use a Research Station to teach yourself how to transmute items
container.ee3:alchemicalTome.noTransmutationsKnown=No known transmutations
container.ee3:transmutationAlchemyArray=Transmutation Square [WIP]
# NEI