Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ dependencies {
compileOnlyApi("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")
compileOnlyApi("com.github.GTNewHorizons:Natura:2.8.15:dev")
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.11-GTNH:dev')
runtimeOnly('com.github.GTNewHorizons:TiC-Tooltips:1.4.1:dev'){transitive = false}
runtimeOnly("com.github.GTNewHorizons:ServerUtilities:2.2.18:dev")


// For testing scythe crop harvesting
// devOnlyNonPublishable("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/tconstruct/tools/TinkerTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
import tconstruct.tools.logic.FrypanLogic;
import tconstruct.tools.logic.FurnaceLogic;
import tconstruct.tools.logic.PartBuilderLogic;
import tconstruct.tools.logic.PartChestLogic;
import tconstruct.tools.logic.PatternChestLogic;
import tconstruct.tools.logic.StencilTableLogic;
import tconstruct.tools.logic.ToolForgeLogic;
Expand Down Expand Up @@ -251,6 +252,7 @@ public void preInit(FMLPreInitializationEvent event) {
GameRegistry.registerTileEntity(ToolStationLogic.class, "ToolStation");
GameRegistry.registerTileEntity(PartBuilderLogic.class, "PartCrafter");
GameRegistry.registerTileEntity(PatternChestLogic.class, "PatternHolder");
GameRegistry.registerTileEntity(PartChestLogic.class, "PartHolder");
GameRegistry.registerTileEntity(StencilTableLogic.class, "PatternShaper");
GameRegistry.registerBlock(TinkerTools.toolForge, MetadataItemBlock.class, "ToolForgeBlock");
GameRegistry.registerTileEntity(ToolForgeLogic.class, "ToolForge");
Expand Down
19 changes: 16 additions & 3 deletions src/main/java/tconstruct/tools/ToolProxyClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import tconstruct.tools.gui.CraftingStationGui;
import tconstruct.tools.gui.FrypanGui;
import tconstruct.tools.gui.FurnaceGui;
import tconstruct.tools.gui.PartChestGui;
import tconstruct.tools.gui.PartCrafterGui;
import tconstruct.tools.gui.PatternChestGui;
import tconstruct.tools.gui.StencilTableGui;
Expand All @@ -62,6 +63,7 @@
import tconstruct.tools.logic.FrypanLogic;
import tconstruct.tools.logic.FurnaceLogic;
import tconstruct.tools.logic.PartBuilderLogic;
import tconstruct.tools.logic.PartChestLogic;
import tconstruct.tools.logic.PatternChestLogic;
import tconstruct.tools.logic.StencilTableLogic;
import tconstruct.tools.logic.ToolForgeLogic;
Expand Down Expand Up @@ -297,6 +299,7 @@ public void registerManualIcons() {
MantleClientRegistry.registerManualIcon("toolstation", new ItemStack(TinkerTools.toolStationWood, 1, 0));
MantleClientRegistry.registerManualIcon("partcrafter", new ItemStack(TinkerTools.toolStationWood, 1, 1));
MantleClientRegistry.registerManualIcon("patternchest", new ItemStack(TinkerTools.toolStationWood, 1, 5));
MantleClientRegistry.registerManualIcon("partchest", new ItemStack(TinkerTools.toolStationWood, 1, 6));
MantleClientRegistry.registerManualIcon("stenciltable", new ItemStack(TinkerTools.toolStationWood, 1, 10));

// TODO: Untwine this
Expand Down Expand Up @@ -397,6 +400,13 @@ void registerManualRecipes() {
pattern,
null,
chest);
MantleClientRegistry.registerManualSmallRecipe(
"partchest",
new ItemStack(TinkerTools.toolStationWood, 1, 6),
null,
stick,
null,
chest);
MantleClientRegistry.registerManualSmallRecipe(
"stenciltable",
new ItemStack(TinkerTools.toolStationWood, 1, 10),
Expand Down Expand Up @@ -596,6 +606,7 @@ protected void registerGuiHandler() {
TProxyCommon.registerClientGuiHandler(toolStationID, this);
TProxyCommon.registerClientGuiHandler(partBuilderID, this);
TProxyCommon.registerClientGuiHandler(patternChestID, this);
TProxyCommon.registerClientGuiHandler(partChestID, this);
TProxyCommon.registerClientGuiHandler(stencilTableID, this);
TProxyCommon.registerClientGuiHandler(frypanGuiID, this);
TProxyCommon.registerClientGuiHandler(toolForgeID, this);
Expand Down Expand Up @@ -627,6 +638,8 @@ public Object getClientGuiElement(int ID, EntityPlayer player, World world, int
x,
y,
z);
if (ID == ToolProxyCommon.partChestID)
return new PartChestGui(player.inventory, (PartChestLogic) world.getTileEntity(x, y, z), world, x, y, z);
if (ID == ToolProxyCommon.frypanGuiID)
return new FrypanGui(player.inventory, (FrypanLogic) world.getTileEntity(x, y, z), world, x, y, z);
if (ID == ToolProxyCommon.battlesignTextID)
Expand Down Expand Up @@ -683,13 +696,13 @@ void addStencilButtons() {
{ 10, 2 }, // excavator head
{ 6, 2 }, // lumberaxe head
{ 9, 2 }, // large plate
{}, { 4, 2 }, // frying pan
{ 4, 2 }, // frying pan
{ 5, 2 }, // battlesign
{ 7, 3 }, // chisel
{}, { 7, 2 }, // knifeblade
{ 7, 2 }, // knifeblade
{ 1, 2 }, // swordblade
{ 6, 3 }, // cleaver blade
{}, { 4, 3 }, // crossbar
{ 4, 3 }, // crossbar
{ 3, 3 }, // small guard
{ 2, 3 }, // wide guard
};
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/tconstruct/tools/ToolProxyCommon.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class ToolProxyCommon implements IGuiHandler {
public static final int stencilTableID = 3;
public static final int frypanGuiID = 4;
public static final int toolForgeID = 5;
public static final int partChestID = 6;
public static final int furnaceID = 8;
public static final int craftingStationID = 11;
public static final int battlesignTextID = 12;
Expand All @@ -33,6 +34,7 @@ protected void registerGuiHandler() {
TProxyCommon.registerServerGuiHandler(stencilTableID, this);
TProxyCommon.registerServerGuiHandler(frypanGuiID, this);
TProxyCommon.registerServerGuiHandler(toolForgeID, this);
TProxyCommon.registerServerGuiHandler(partChestID, this);
TProxyCommon.registerServerGuiHandler(furnaceID, this);
TProxyCommon.registerServerGuiHandler(craftingStationID, this);
}
Expand Down
11 changes: 8 additions & 3 deletions src/main/java/tconstruct/tools/blocks/CraftingSlab.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import tconstruct.tools.ToolProxyCommon;
import tconstruct.tools.logic.CraftingStationLogic;
import tconstruct.tools.logic.PartBuilderLogic;
import tconstruct.tools.logic.PartChestLogic;
import tconstruct.tools.logic.PatternChestLogic;
import tconstruct.tools.logic.StencilTableLogic;
import tconstruct.tools.logic.ToolForgeLogic;
Expand All @@ -47,7 +48,8 @@ public String[] getTextureNames() {
"toolstation_top", "toolstation_slab_side", "toolstation_bottom", "partbuilder_oak_top",
"partbuilder_slab_side", "partbuilder_oak_bottom", "stenciltable_oak_top", "stenciltable_slab_side",
"stenciltable_oak_bottom", "patternchest_top", "patternchest_slab_side", "patternchest_bottom",
"toolforge_top", "toolforge_slab_side", "toolforge_top" };
"toolforge_top", "toolforge_slab_side", "toolforge_top", "partchest_top", "partchest_slab_side",
"partchest_bottom" };
}

@Override
Expand All @@ -71,7 +73,7 @@ public int getTextureIndex(int side) {
@Override
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 5) return AxisAlignedBB.getBoundingBox(
if (metadata == 5 || metadata == 6) return AxisAlignedBB.getBoundingBox(
(double) x + this.minX,
(double) y + this.minY,
(double) z + this.minZ,
Expand All @@ -96,6 +98,7 @@ public TileEntity createTileEntity(World world, int metadata) {
case 3 -> new StencilTableLogic();
case 4 -> new PatternChestLogic();
case 5 -> new ToolForgeLogic();
case 6 -> new PartChestLogic();
default -> null;
};
}
Expand All @@ -110,6 +113,7 @@ public Integer getGui(World world, int x, int y, int z, EntityPlayer entityplaye
case 3 -> ToolProxyCommon.stencilTableID;
case 4 -> ToolProxyCommon.patternChestID;
case 5 -> ToolProxyCommon.toolForgeID;
case 6 -> ToolProxyCommon.partChestID;
default -> -1;
};

Expand All @@ -122,7 +126,7 @@ public Object getModInstance() {

@Override
public void getSubBlocks(Item b, CreativeTabs tab, List<ItemStack> list) {
for (int iter = 0; iter < 6; iter++) {
for (int iter = 0; iter < 7; iter++) {
list.add(new ItemStack(b, 1, iter));
}
}
Expand Down Expand Up @@ -163,6 +167,7 @@ public TileEntity createNewTileEntity(World var1, int metadata) {
case 3 -> new StencilTableLogic();
case 4 -> new PatternChestLogic();
case 5 -> new ToolForgeLogic();
case 6 -> new PartChestLogic();
default -> null;
};
}
Expand Down
86 changes: 75 additions & 11 deletions src/main/java/tconstruct/tools/blocks/ToolStationBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mantle.blocks.abstracts.InventoryBlock;
import mantle.blocks.abstracts.InventoryLogic;
import tconstruct.TConstruct;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.util.IPattern;
import tconstruct.library.util.IToolPart;
import tconstruct.tools.TinkerTools;
import tconstruct.tools.logic.PartBuilderLogic;
import tconstruct.tools.logic.PartChestLogic;
import tconstruct.tools.logic.PatternChestLogic;
import tconstruct.tools.logic.StencilTableLogic;
import tconstruct.tools.logic.ToolStationLogic;
Expand All @@ -50,21 +54,28 @@ public String[] getTextureNames() {
"partbuilder_spruce_bottom", "partbuilder_birch_top", "partbuilder_birch_side",
"partbuilder_birch_bottom", "partbuilder_jungle_top", "partbuilder_jungle_side",
"partbuilder_jungle_bottom", "patternchest_top", "patternchest_side", "patternchest_bottom",
"stenciltable_oak_top", "stenciltable_oak_side", "stenciltable_oak_bottom", "stenciltable_spruce_top",
"stenciltable_spruce_side", "stenciltable_spruce_bottom", "stenciltable_birch_top",
"stenciltable_birch_side", "stenciltable_birch_bottom", "stenciltable_jungle_top",
"stenciltable_jungle_side", "stenciltable_jungle_bottom" };
"partchest_top", "partchest_side", "partchest_bottom", "stenciltable_oak_top", "stenciltable_oak_side",
"stenciltable_oak_bottom", "stenciltable_spruce_top", "stenciltable_spruce_side",
"stenciltable_spruce_bottom", "stenciltable_birch_top", "stenciltable_birch_side",
"stenciltable_birch_bottom", "stenciltable_jungle_top", "stenciltable_jungle_side",
"stenciltable_jungle_bottom" };
}

@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
if (meta <= 4) {
// toolstation && partbuilder
return icons[meta * 3 + getTextureIndex(side)];
} else if (meta <= 9) {
} else if (meta == 5) {
// patternchest meta == 5
return icons[15 + getTextureIndex(side)];
} else if (meta <= 9) {
// partchest meta == 6
return icons[18 + getTextureIndex(side)];
} else {
return icons[meta * 3 + getTextureIndex(side) - 12];
// stenciltable
return icons[meta * 3 + getTextureIndex(side) - 9];
}
}

Expand Down Expand Up @@ -103,7 +114,7 @@ public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int
@Override
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 5) return AxisAlignedBB.getBoundingBox(
if (metadata == 5 || metadata == 6) return AxisAlignedBB.getBoundingBox(
(double) x + this.minX,
(double) y + this.minY,
(double) z + this.minZ,
Expand All @@ -124,7 +135,8 @@ public TileEntity createNewTileEntity(World world, int metadata) {
return switch (metadata) {
case 0 -> new ToolStationLogic();
case 1, 3, 2, 4 -> new PartBuilderLogic();
case 5, 9, 8, 7, 6 -> new PatternChestLogic();
case 5 -> new PatternChestLogic();
case 6, 9, 8, 7 -> new PartChestLogic();
case 10, 13, 12, 11 -> new StencilTableLogic();
default -> null;
};
Expand All @@ -135,6 +147,7 @@ public Integer getGui(World world, int x, int y, int z, EntityPlayer entityplaye
int md = world.getBlockMetadata(x, y, z);
if (md == 0) return 0;
else if (md < 5) return 1;
else if (md == 6) return 6;
else if (md < 10) return 2;
else return 3;

Expand All @@ -148,7 +161,7 @@ public Object getModInstance() {

@Override
public void getSubBlocks(Item id, CreativeTabs tab, List<ItemStack> list) {
for (int iter = 0; iter < 6; iter++) {
for (int iter = 0; iter < 7; iter++) {
list.add(new ItemStack(id, 1, iter));
}

Expand Down Expand Up @@ -179,9 +192,27 @@ public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, i
if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) {
int meta = world.getBlockMetadata(x, y, z);
if (meta >= 5 && meta <= 9) {
ItemStack chest = new ItemStack(this, 1, 5);
ItemStack chest = null;
InventoryLogic logic = null;
switch (meta) {
case 5: {
chest = new ItemStack(this, 1, 5);
logic = (PatternChestLogic) world.getTileEntity(x, y, z);
break;
}
case 6: {
chest = new ItemStack(this, 1, 6);
logic = (PartChestLogic) world.getTileEntity(x, y, z);
break;
}
default: {
chest = new ItemStack(this, 1, 6);
logic = (PartChestLogic) world.getTileEntity(x, y, z);
break;
}
}
NBTTagCompound inventory = new NBTTagCompound();
PatternChestLogic logic = (PatternChestLogic) world.getTileEntity(x, y, z);

logic.writeInventoryToNBT(inventory);
NBTTagCompound baseTag = new NBTTagCompound();
baseTag.setTag("Inventory", inventory);
Expand Down Expand Up @@ -229,6 +260,12 @@ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase l
logic.yCoord = y;
logic.zCoord = z;
keptInventory = true;
} else if (inventory != null && te instanceof PartChestLogic logic) {
logic.readInventoryFromNBT(inventory);
logic.xCoord = x;
logic.yCoord = y;
logic.zCoord = z;
keptInventory = true;
}
}
if (!keptInventory && PHConstruct.freePatterns) {
Expand All @@ -243,4 +280,31 @@ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase l
}
super.onBlockPlacedBy(world, x, y, z, living, stack);
}

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float clickX,
float clickY, float clickZ) {
if (world.getTileEntity(x, y, z) instanceof PatternChestLogic logic && !player.isSneaking()) {
// is the pattern chest and player is not holding shift key
ItemStack itemInHand = player.getHeldItem();
if (itemInHand != null && itemInHand.getItem() instanceof IPattern) {
// is the player holding a tinker pattern
if (logic.insertItemStackIntoInventory(itemInHand)) {
// try insert into chest
return true;
}
}
} else if (world.getTileEntity(x, y, z) instanceof PartChestLogic logic && !player.isSneaking()) {
// is the part chest and player is not holding shift key
ItemStack itemInHand = player.getHeldItem();
if (itemInHand != null && itemInHand.getItem() instanceof IToolPart) {
// is the player holding a tinker part
if (logic.insertItemStackIntoInventory(itemInHand)) {
// try insert into chest
return true;
}
}
}
return super.onBlockActivated(world, x, y, z, player, side, clickX, clickY, clickZ);
}
}
41 changes: 41 additions & 0 deletions src/main/java/tconstruct/tools/gui/PartChestGui.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package tconstruct.tools.gui;

import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;

import org.lwjgl.opengl.GL11;

import tconstruct.tools.logic.PartChestLogic;

public class PartChestGui extends GuiContainer {

public PartChestLogic logic;

public PartChestGui(InventoryPlayer inventoryplayer, PartChestLogic holder, World world, int x, int y, int z) {
super(holder.getGuiContainer(inventoryplayer, world, x, y, z));
logic = holder;
xSize = 194;
ySize = 168;
}

@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
fontRendererObj.drawString(StatCollector.translateToLocal("inventory.PartChest"), 8, 8, 0x404040);
fontRendererObj
.drawString(StatCollector.translateToLocal("container.inventory"), 17, (ySize - 96) + 2, 0x404040);
}

private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/partchest.png");

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(background);
int cornerX = (width - xSize) / 2;
int cornerY = (height - ySize) / 2;
drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);
}
}
Loading
Loading