More tweaks to the alchemy table, as well as some minor recipes.

This commit is contained in:
WayofTime 2016-05-02 20:08:25 -04:00
parent ce385bd9a6
commit c80b083865
8 changed files with 115 additions and 22 deletions

View file

@ -4,6 +4,7 @@ import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -44,6 +45,16 @@ public class GuiAlchemyTable extends GuiContainer
int l = this.getCookProgressScaled(90); int l = this.getCookProgressScaled(90);
this.drawTexturedModalRect(i + 115, j + 14 + 90 - l, 176, 90 - l, 18, l); this.drawTexturedModalRect(i + 115, j + 14 + 90 - l, 176, 90 - l, 18, l);
for (int slotId = 0; slotId < 6; slotId++)
{
if (!((TileAlchemyTable) tileTable).isInputSlotAccessible(slotId))
{
Slot slot = this.inventorySlots.getSlot(slotId);
this.drawTexturedModalRect(i + slot.xDisplayPosition, j + slot.yDisplayPosition, 195, 1, 16, 16);
}
}
} }
public int getCookProgressScaled(int scale) public int getCookProgressScaled(int scale)

View file

@ -83,7 +83,7 @@ public class AlchemyTableRecipeCategory implements IRecipeCategory
for (int x = 0; x < 3; ++x) for (int x = 0; x < 3; ++x)
{ {
int index = INPUT_SLOT + x + (y * 3); int index = INPUT_SLOT + x + (y * 3);
guiItemStacks.init(index, true, x * 18, y * 18); guiItemStacks.init(index, true, x * 18, y * 18 - 18);
} }
} }
@ -92,7 +92,7 @@ public class AlchemyTableRecipeCategory implements IRecipeCategory
AlchemyTableRecipeJEI recipe = (AlchemyTableRecipeJEI) recipeWrapper; AlchemyTableRecipeJEI recipe = (AlchemyTableRecipeJEI) recipeWrapper;
guiItemStacks.set(ORB_SLOT, (ArrayList<ItemStack>) recipe.getInputs().get(1)); guiItemStacks.set(ORB_SLOT, (ArrayList<ItemStack>) recipe.getInputs().get(1));
craftingGridHelper.setOutput(guiItemStacks, recipe.getOutputs()); craftingGridHelper.setOutput(guiItemStacks, recipe.getOutputs());
craftingGridHelper.setInput(guiItemStacks, (List) recipe.getInputs().get(0), 2, 3); craftingGridHelper.setInput(guiItemStacks, (List) recipe.getInputs().get(0), 3, 2);
} }
} }
} }

View file

@ -100,6 +100,8 @@ public class ModRecipes
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.experienceTome), "ses", "lbl", "gog", 'o', OrbRegistry.getOrbStack(ModItems.orbMagician), 'e', Blocks.LAPIS_BLOCK, 'l', new ItemStack(ModItems.slate, 1, 2), 'b', Items.ENCHANTED_BOOK, 's', Items.STRING, 'g', "ingotGold")); GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.experienceTome), "ses", "lbl", "gog", 'o', OrbRegistry.getOrbStack(ModItems.orbMagician), 'e', Blocks.LAPIS_BLOCK, 'l', new ItemStack(ModItems.slate, 1, 2), 'b', Items.ENCHANTED_BOOK, 's', Items.STRING, 'g', "ingotGold"));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.ritualReader), "gog", "isi", " s ", 's', new ItemStack(ModItems.slate, 1, 3), 'g', "blockGlass", 'i', "ingotGold", 'o', OrbRegistry.getOrbStack(ModItems.orbMaster))); GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.ritualReader), "gog", "isi", " s ", 's', new ItemStack(ModItems.slate, 1, 3), 'g', "blockGlass", 'i', "ingotGold", 'o', OrbRegistry.getOrbStack(ModItems.orbMaster)));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.alchemyTable), "sss", "wbw", "gog", 's', "stone", 'w', Blocks.WOOL, 'b', Items.BLAZE_ROD, 'g', "ingotGold", 'o', OrbRegistry.getOrbStack(ModItems.orbWeak)));
for (int i = 1; i < BlockBloodRune.names.length; i++) for (int i = 1; i < BlockBloodRune.names.length; i++)
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModBlocks.bloodRune), new ItemStack(ModBlocks.bloodRune, 1, i))); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModBlocks.bloodRune), new ItemStack(ModBlocks.bloodRune, 1, i)));
@ -259,6 +261,15 @@ public class ModRecipes
public static void addAlchemyTableRecipes() public static void addAlchemyTableRecipes()
{ {
AlchemyTableRecipeRegistry.registerRecipe(new ItemStack(Items.STRING, 4), 0, 100, 0, Blocks.WOOL); AlchemyTableRecipeRegistry.registerRecipe(new ItemStack(Items.STRING, 4), 0, 100, 0, Blocks.WOOL, Items.FLINT);
AlchemyTableRecipeRegistry.registerRecipe(new ItemStack(Items.FLINT, 2), 0, 20, 0, Blocks.GRAVEL, Items.FLINT);
AlchemyTableRecipeRegistry.registerRecipe(new ItemStack(Items.LEATHER, 4), 100, 200, 1, Items.ROTTEN_FLESH, Items.ROTTEN_FLESH, Items.ROTTEN_FLESH, Items.ROTTEN_FLESH, Items.FLINT, Items.WATER_BUCKET);
AlchemyTableRecipeRegistry.registerRecipe(new ItemStack(Items.BREAD), 100, 200, 1, Items.WHEAT, Items.SUGAR);
AlchemyTableRecipeRegistry.registerRecipe(new ItemStack(Blocks.GRASS), 200, 200, 1, Blocks.DIRT, new ItemStack(Items.DYE, 1, 15), Items.WHEAT_SEEDS);
AlchemyTableRecipeRegistry.registerRecipe(new ItemStack(Blocks.SAND, 2), 50, 50, 1, "cobblestone", Items.GUNPOWDER);
AlchemyTableRecipeRegistry.registerRecipe(new ItemStack(Items.CLAY_BALL, 4), 50, 100, 2, Items.WATER_BUCKET, "sand");
AlchemyTableRecipeRegistry.registerRecipe(new ItemStack(Blocks.CLAY, 5), 200, 200, 1, Items.WATER_BUCKET, Blocks.HARDENED_CLAY, Blocks.HARDENED_CLAY, Blocks.HARDENED_CLAY, Blocks.HARDENED_CLAY, Blocks.HARDENED_CLAY);
AlchemyTableRecipeRegistry.registerRecipe(new ItemStack(Blocks.OBSIDIAN), 50, 50, 1, Items.WATER_BUCKET, Items.LAVA_BUCKET);
} }
} }

View file

@ -37,6 +37,7 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
public int ticksRequired = 1; public int ticksRequired = 1;
public BlockPos connectedPos = BlockPos.ORIGIN; public BlockPos connectedPos = BlockPos.ORIGIN;
public List<Integer> blockedSlots = new ArrayList<Integer>();
public TileAlchemyTable() public TileAlchemyTable()
{ {
@ -59,6 +60,30 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
return isSlave(); return isSlave();
} }
public boolean isInputSlotAccessible(int slot)
{
if (slot < 6 && slot >= 0)
{
return !blockedSlots.contains(slot);
}
return true;
}
public void toggleInputSlotAccessible(int slot)
{
if (slot < 6 && slot >= 0)
{
if (blockedSlots.contains(slot))
{
blockedSlots.remove((Object) slot);
} else
{
blockedSlots.add(slot);
}
}
}
@Override @Override
public void readFromNBT(NBTTagCompound tag) public void readFromNBT(NBTTagCompound tag)
{ {
@ -70,6 +95,13 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
burnTime = tag.getInteger("burnTime"); burnTime = tag.getInteger("burnTime");
ticksRequired = tag.getInteger("ticksRequired"); ticksRequired = tag.getInteger("ticksRequired");
blockedSlots.clear();
int[] blockedSlotArray = tag.getIntArray("blockedSlots");
for (int blocked : blockedSlotArray)
{
blockedSlots.add(blocked);
}
} }
@Override @Override
@ -85,6 +117,14 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
tag.setInteger("burnTime", burnTime); tag.setInteger("burnTime", burnTime);
tag.setInteger("ticksRequired", ticksRequired); tag.setInteger("ticksRequired", ticksRequired);
int[] blockedSlotArray = new int[blockedSlots.size()];
for (int i = 0; i < blockedSlots.size(); i++)
{
blockedSlotArray[i] = blockedSlots.get(i);
}
tag.setIntArray("blockedSlots", blockedSlotArray);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -136,15 +176,14 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
return true; return true;
} else if (index == toolSlot) } else if (index == toolSlot)
{ {
return true; //TODO: return false; //TODO:
} else } else
{ {
return true; return true;
} }
default: default:
break; return getAccessibleInputSlots(direction).contains(index);
} }
return true;
} }
@Override @Override
@ -166,10 +205,25 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
return true; return true;
} }
default: default:
return true; return getAccessibleInputSlots(direction).contains(index);
} }
} }
public List<Integer> getAccessibleInputSlots(EnumFacing direction)
{
List<Integer> list = new ArrayList<Integer>();
for (int i = 0; i < 6; i++)
{
if (isInputSlotAccessible(i))
{
list.add(i);
}
}
return list;
}
@Override @Override
public void update() public void update()
{ {

View file

@ -2,6 +2,7 @@ package WayofTime.bloodmagic.tile.container;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ClickType;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
@ -40,6 +41,23 @@ public class ContainerAlchemyTable extends Container
} }
} }
@Override
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player)
{
InventoryPlayer inventoryPlayer = player.inventory;
if (slotId < 6 && slotId >= 0)
{
Slot slot = this.getSlot(slotId);
if (!slot.getHasStack() && inventoryPlayer.getItemStack() == null)
{
((TileAlchemyTable) tileTable).toggleInputSlotAccessible(slotId);
}
}
return super.slotClick(slotId, dragType, clickTypeIn, player);
}
@Override @Override
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) public ItemStack transferStackInSlot(EntityPlayer playerIn, int index)
{ {

View file

@ -33,8 +33,8 @@ public class ContainerItemRoutingNode extends Container
addSlotToContainer(new SlotGhostItem(itemInventory, j + i * 3, 26 + j * 18, 15 + i * 18)); addSlotToContainer(new SlotGhostItem(itemInventory, j + i * 3, 26 + j * 18, 15 + i * 18));
} }
} }
slotsOccupied = 10; slotsOccupied = 10;
// this.addSlotToContainer(new SlotOutput(tileItemRoutingNode, TileSoulForge.outputSlot, 44, 51));
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
@ -64,7 +64,6 @@ public class ContainerItemRoutingNode extends Container
InventoryPlayer inventoryPlayer = player.inventory; InventoryPlayer inventoryPlayer = player.inventory;
// if (!player.worldObj.isRemote) // if (!player.worldObj.isRemote)
{ {
if (slotId >= 0) if (slotId >= 0)
{ {
Slot slot = this.inventorySlots.get(slotId); Slot slot = this.inventorySlots.get(slotId);

View file

@ -185,14 +185,14 @@ f 38/57/28 37/65/28 34/66/28 33/63/28
f 38/67/29 33/55/29 36/58/29 39/68/29 f 38/67/29 33/55/29 36/58/29 39/68/29
f 34/56/30 37/59/30 40/62/30 35/57/30 f 34/56/30 37/59/30 40/62/30 35/57/30
o Base o Base
v 1.000000 -0.037500 0.000000 v 1.000000 0.002500 0.000000
v -1.000000 -0.037500 0.000000 v -1.000000 0.002500 0.000000
v -1.000000 0.087500 0.000000 v -1.000000 0.127500 0.000000
v 1.000000 0.087500 0.000000 v 1.000000 0.127500 0.000000
v -1.000000 -0.037500 1.000000 v -1.000000 0.002500 1.000000
v 1.000000 -0.037500 1.000000 v 1.000000 0.002500 1.000000
v 1.000000 0.087500 1.000000 v 1.000000 0.127500 1.000000
v -1.000000 0.087500 1.000000 v -1.000000 0.127500 1.000000
vt 0.125000 0.859375 vt 0.125000 0.859375
vt 0.375000 0.859375 vt 0.375000 0.859375
vt 0.375000 0.875000 vt 0.375000 0.875000
@ -1170,15 +1170,15 @@ f 254/421/190 253/429/190 250/430/190 249/427/190
f 254/431/191 249/419/191 252/422/191 255/432/191 f 254/431/191 249/419/191 252/422/191 255/432/191
f 250/420/192 253/423/192 256/426/192 251/421/192 f 250/420/192 253/423/192 256/426/192 251/421/192
o Recipe o Recipe
v 0.806155 0.843750 0.598917 v 0.746155 0.846250 0.501083
v 0.550214 0.843750 0.324838 v 0.490214 0.846250 0.775162
v 0.276135 0.843750 0.580779 v 0.216135 0.846250 0.519221
v 0.532076 0.843750 0.854858 v 0.472076 0.846250 0.245142
vt 0.046875 0.953125 vt 0.046875 0.953125
vt 0.093750 0.953125 vt 0.093750 0.953125
vt 0.093750 1.000000 vt 0.093750 1.000000
vt 0.046875 1.000000 vt 0.046875 1.000000
vn 0.000000 -1.000000 0.000000 vn 0.000000 1.000000 -0.000000
usemtl None usemtl None
s off s off
f 260/433/193 259/434/193 258/435/193 257/436/193 f 260/433/193 259/434/193 258/435/193 257/436/193

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB