Skip to content

Commit

Permalink
Add some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander committed Apr 18, 2014
1 parent da42896 commit 89ee007
Show file tree
Hide file tree
Showing 13 changed files with 131 additions and 19 deletions.
13 changes: 12 additions & 1 deletion src/main/java/tconstruct/blocks/logic/CraftingStationLogic.java
Expand Up @@ -97,11 +97,22 @@ public boolean canInsertItem (int i, ItemStack itemstack, int j)
{
return i != 0;
}

@Override
public ItemStack decrStackSize (int slot, int quantity)
{
if (slot == 0)
{
for (int i = 1; i < getSizeInventory(); i++)
decrStackSize(i, 1);
}
return super.decrStackSize(slot, quantity);
}

@Override
public boolean canExtractItem (int i, ItemStack itemstack, int j)
{
return true;
return i == 0;
}

@Override
Expand Down
52 changes: 44 additions & 8 deletions src/main/java/tconstruct/common/TRecipes.java
Expand Up @@ -656,14 +656,17 @@ protected static void addRecipesForCraftingTable ()
ItemStack exoChestStack = new ItemStack(TRepo.exoChest);
ItemStack exoPantsStack = new ItemStack(TRepo.exoPants);
ItemStack exoShoesStack = new ItemStack(TRepo.exoShoes);
ToolBuilder.instance.addArmorTag(exoGoggleStack);
ToolBuilder.instance.addArmorTag(exoChestStack);
ToolBuilder.instance.addArmorTag(exoPantsStack);
ToolBuilder.instance.addArmorTag(exoShoesStack);
GameRegistry.addShapedRecipe(exoGoggleStack, helm, 'w', new ItemStack(TRepo.largePlate, 1, 14));
GameRegistry.addShapedRecipe(exoChestStack, chest, 'w', new ItemStack(TRepo.largePlate, 1, 14));
GameRegistry.addShapedRecipe(exoPantsStack, pants, 'w', new ItemStack(TRepo.largePlate, 1, 14));
GameRegistry.addShapedRecipe(exoShoesStack, shoes, 'w', new ItemStack(TRepo.largePlate, 1, 14));
if (!PHConstruct.exoCraftingEnabled)
{
ToolBuilder.instance.addArmorTag(exoGoggleStack);
ToolBuilder.instance.addArmorTag(exoChestStack);
ToolBuilder.instance.addArmorTag(exoPantsStack);
ToolBuilder.instance.addArmorTag(exoShoesStack);
GameRegistry.addShapedRecipe(exoGoggleStack, helm, 'w', new ItemStack(TRepo.largePlate, 1, 14));
GameRegistry.addShapedRecipe(exoChestStack, chest, 'w', new ItemStack(TRepo.largePlate, 1, 14));
GameRegistry.addShapedRecipe(exoPantsStack, pants, 'w', new ItemStack(TRepo.largePlate, 1, 14));
GameRegistry.addShapedRecipe(exoShoesStack, shoes, 'w', new ItemStack(TRepo.largePlate, 1, 14));
}

// Metal conversion Recipes
GameRegistry.addRecipe(new ItemStack(TRepo.metalBlock, 1, 3), patBlock, '#', new ItemStack(TRepo.materials, 1, 9)); // Copper
Expand Down Expand Up @@ -1198,6 +1201,39 @@ public void modRecipes ()
RecipeRemover.removeAnyRecipe(new ItemStack(Items.golden_hoe));
RecipeRemover.removeAnyRecipe(new ItemStack(Items.golden_sword));
}

if (PHConstruct.labotimizeVanillaTools)
{
Items.wooden_pickaxe.setMaxDamage(1);
Items.wooden_axe.setMaxDamage(1);
Items.wooden_shovel.setMaxDamage(1);
Items.wooden_hoe.setMaxDamage(1);
Items.wooden_sword.setMaxDamage(1);

Items.stone_pickaxe.setMaxDamage(1);
Items.stone_axe.setMaxDamage(1);
Items.stone_shovel.setMaxDamage(1);
Items.stone_hoe.setMaxDamage(1);
Items.stone_sword.setMaxDamage(1);

Items.iron_pickaxe.setMaxDamage(1);
Items.iron_axe.setMaxDamage(1);
Items.iron_shovel.setMaxDamage(1);
Items.iron_hoe.setMaxDamage(1);
Items.iron_sword.setMaxDamage(1);

Items.diamond_pickaxe.setMaxDamage(1);
Items.diamond_axe.setMaxDamage(1);
Items.diamond_shovel.setMaxDamage(1);
Items.diamond_hoe.setMaxDamage(1);
Items.diamond_sword.setMaxDamage(1);

Items.golden_pickaxe.setMaxDamage(1);
Items.golden_axe.setMaxDamage(1);
Items.golden_shovel.setMaxDamage(1);
Items.golden_hoe.setMaxDamage(1);
Items.golden_sword.setMaxDamage(1);
}
}
}

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/tconstruct/inventory/ContainerLandmine.java
Expand Up @@ -4,12 +4,14 @@
import java.util.Iterator;
import java.util.Set;

import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import tconstruct.blocks.logic.TileEntityLandmine;
import tconstruct.common.TRepo;

/**
*
Expand Down Expand Up @@ -60,6 +62,9 @@ public void bindPlayerInventory (InventoryPlayer inventory)
@Override
public boolean canInteractWith (EntityPlayer entityplayer)
{
Block block = te.getWorldObj().getBlock(te.xCoord, te.yCoord, te.zCoord);
if (block != TRepo.landmine)
return false;
return te.isUseableByPlayer(entityplayer);
}

Expand Down
10 changes: 8 additions & 2 deletions src/main/java/tconstruct/inventory/CraftingStationContainer.java
@@ -1,5 +1,6 @@
package tconstruct.inventory;

import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
Expand All @@ -12,6 +13,7 @@
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.world.World;
import tconstruct.blocks.logic.CraftingStationLogic;
import tconstruct.common.TRepo;
import tconstruct.library.armor.ArmorCore;
import tconstruct.library.crafting.ToolBuilder;
import tconstruct.library.tools.ToolCore;
Expand Down Expand Up @@ -152,9 +154,13 @@ public void onContainerClosed (EntityPlayer par1EntityPlayer)
}

@Override
public boolean canInteractWith (EntityPlayer par1EntityPlayer)
public boolean canInteractWith (EntityPlayer player)
{
return par1EntityPlayer.getDistanceSq((double) this.posX + 0.5D, (double) this.posY + 0.5D, (double) this.posZ + 0.5D) <= 64.0D;

Block block = worldObj.getBlock(this.posX, this.posY, this.posZ);
if (block != TRepo.craftingStationWood && block != TRepo.craftingSlabWood)
return false;
return player.getDistanceSq((double) this.posX + 0.5D, (double) this.posY + 0.5D, (double) this.posZ + 0.5D) <= 64.0D;
}

@Override
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/tconstruct/inventory/FrypanContainer.java
@@ -1,12 +1,14 @@
package tconstruct.inventory;

import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import tconstruct.blocks.logic.FrypanLogic;
import tconstruct.common.TRepo;

public class FrypanContainer extends Container
{
Expand Down Expand Up @@ -85,6 +87,10 @@ public void updateProgressBar (int i, int j)
@Override
public boolean canInteractWith (EntityPlayer entityplayer)
{
Block block = logic.getWorldObj().getBlock(logic.xCoord, logic.yCoord, logic.zCoord);
if (block != TRepo.heldItemBlock)
return false;

return logic.isUseableByPlayer(entityplayer);
}

Expand Down
@@ -1,11 +1,13 @@
package tconstruct.inventory;

import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import tconstruct.blocks.logic.PartBuilderLogic;
import tconstruct.blocks.logic.PatternChestLogic;
import tconstruct.common.TRepo;
import tconstruct.library.util.IPattern;

public class PartCrafterChestContainer extends ActiveContainer
Expand Down Expand Up @@ -54,9 +56,12 @@ public PartCrafterChestContainer(InventoryPlayer inventoryplayer, PartBuilderLog
}

@Override
public boolean canInteractWith (EntityPlayer var1)
public boolean canInteractWith (EntityPlayer entityplayer)
{
return true;
Block block = logic.getWorldObj().getBlock(logic.xCoord, logic.yCoord, logic.zCoord);
if (block != TRepo.toolStationWood && block != TRepo.craftingSlabWood)
return false;
return logic.isUseableByPlayer(entityplayer);
}

@Override
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/tconstruct/inventory/PartCrafterContainer.java
@@ -1,10 +1,12 @@
package tconstruct.inventory;

import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import tconstruct.blocks.logic.PartBuilderLogic;
import tconstruct.common.TRepo;
import tconstruct.library.util.IPattern;

public class PartCrafterContainer extends ActiveContainer
Expand Down Expand Up @@ -43,9 +45,12 @@ public PartCrafterContainer(InventoryPlayer inventoryplayer, PartBuilderLogic pa
}

@Override
public boolean canInteractWith (EntityPlayer var1)
public boolean canInteractWith (EntityPlayer entityplayer)
{
return true;
Block block = logic.getWorldObj().getBlock(logic.xCoord, logic.yCoord, logic.zCoord);
if (block != TRepo.toolStationWood && block != TRepo.craftingSlabWood)
return false;
return logic.isUseableByPlayer(entityplayer);
}

@Override
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/tconstruct/inventory/PatternChestContainer.java
@@ -1,11 +1,13 @@
package tconstruct.inventory;

import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import tconstruct.blocks.logic.PatternChestLogic;
import tconstruct.common.TRepo;
import tconstruct.library.util.IPattern;

public class PatternChestContainer extends Container
Expand Down Expand Up @@ -44,6 +46,9 @@ public PatternChestContainer(InventoryPlayer inventoryplayer, PatternChestLogic
@Override
public boolean canInteractWith (EntityPlayer entityplayer)
{
Block block = logic.getWorldObj().getBlock(logic.xCoord, logic.yCoord, logic.zCoord);
if (block != TRepo.toolStationWood && block != TRepo.craftingSlabWood)
return false;
return logic.isUseableByPlayer(entityplayer);
}

Expand Down
@@ -1,11 +1,13 @@
package tconstruct.inventory;

import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import tconstruct.blocks.logic.StencilTableLogic;
import tconstruct.common.TRepo;

public class PatternShaperContainer extends Container
{
Expand Down Expand Up @@ -41,7 +43,7 @@ public PatternShaperContainer(InventoryPlayer inventoryplayer, StencilTableLogic

/*public void onCraftMatrixChanged(IInventory iinventory)
{
craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj));
craftResult.setInventorySloTRepos(0, CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj));
}*/

/*@Override
Expand All @@ -62,7 +64,10 @@ public void onContainerClosed(EntityPlayer entityplayer)
@Override
public boolean canInteractWith (EntityPlayer entityplayer)
{
return true;
Block block = logic.getWorldObj().getBlock(logic.xCoord, logic.yCoord, logic.zCoord);
if (block != TRepo.toolStationWood && block != TRepo.craftingSlabWood)
return false;
return logic.isUseableByPlayer(entityplayer);
}

@Override
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/tconstruct/inventory/SmelteryContainer.java
@@ -1,10 +1,12 @@
package tconstruct.inventory;

import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import tconstruct.blocks.logic.SmelteryLogic;
import tconstruct.common.TRepo;

public class SmelteryContainer extends ActiveContainer
{
Expand Down Expand Up @@ -114,6 +116,9 @@ public void updateProgressBar (int id, int value)
@Override
public boolean canInteractWith (EntityPlayer entityplayer)
{
Block block = logic.getWorldObj().getBlock(logic.xCoord, logic.yCoord, logic.zCoord);
if (block != TRepo.smeltery && block != TRepo.smelteryNether)
return false;
return logic.isUseableByPlayer(entityplayer);
}

Expand Down
12 changes: 12 additions & 0 deletions src/main/java/tconstruct/inventory/ToolForgeContainer.java
@@ -1,11 +1,14 @@
package tconstruct.inventory;

import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.blocks.logic.ToolForgeLogic;
import tconstruct.blocks.logic.ToolStationLogic;
import tconstruct.common.TRepo;
import tconstruct.library.tools.ToolCore;

public class ToolForgeContainer extends ToolStationContainer
Expand Down Expand Up @@ -87,4 +90,13 @@ protected void craftTool (ItemStack stack)
logic.getWorldObj().playAuxSFX(1021, (int) logic.xCoord, (int) logic.yCoord, (int) logic.zCoord, 0);
}
}

@Override
public boolean canInteractWith (EntityPlayer entityplayer)
{
Block block = logic.getWorldObj().getBlock(logic.xCoord, logic.yCoord, logic.zCoord);
if (block != TRepo.toolForge && block != TRepo.craftingSlabWood)
return false;
return logic.isUseableByPlayer(entityplayer);
}
}
9 changes: 7 additions & 2 deletions src/main/java/tconstruct/inventory/ToolStationContainer.java
Expand Up @@ -2,12 +2,14 @@

import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.blocks.logic.ToolStationLogic;
import tconstruct.common.TRepo;
import tconstruct.library.tools.ToolCore;

public class ToolStationContainer extends ActiveContainer
Expand Down Expand Up @@ -80,9 +82,12 @@ public void resetSlots (int[] posX, int[] posY)
}

@Override
public boolean canInteractWith (EntityPlayer var1)
public boolean canInteractWith (EntityPlayer entityplayer)
{
return true;
Block block = logic.getWorldObj().getBlock(logic.xCoord, logic.yCoord, logic.zCoord);
if (block != TRepo.toolStationWood && block != TRepo.craftingSlabWood)
return false;
return logic.isUseableByPlayer(entityplayer);
}

@Override
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/tconstruct/util/config/PHConstruct.java
Expand Up @@ -52,6 +52,9 @@ public static void initProps (File confFile)
ingotsAlumiteAlloy = config.get("Smeltery Output Modification", "Alumite ingot return", 3, "Number of ingots returned from smelting Alumite in the smeltery").getDouble(3);
ingotsManyullynAlloy = config.get("Smeltery Output Modification", "Manyullyn ingot return", 1, "Number of ingots returned from smelting Manyullyn in the smeltery").getDouble(1);
ingotsPigironAlloy = config.get("Smeltery Output Modification", "Pig Iron ingot return", 1, "Number of ingots returned from smelting Pig Iron in the smeltery").getDouble(1);

exoCraftingEnabled = config.get("Equipables", "Exo-Armor-Craftable", false).getBoolean(false);
capesEnabled = config.get("Superfun", "Enable-TCon-Capes", true).getBoolean(true);

boolean ic2 = true;
boolean xycraft = true;
Expand Down Expand Up @@ -182,6 +185,9 @@ public static void initProps (File confFile)
gregtech = gtConfig.get("smelting", "tile.anvil.slightlyDamaged", false).getBoolean(false);
}
}

public static boolean exoCraftingEnabled;
public static boolean capesEnabled;

// Ore values
public static boolean generateCopper;
Expand Down

0 comments on commit 89ee007

Please sign in to comment.