Skip to content

Commit

Permalink
Add ManaSteel Anvil, can use less steel to make redsteel
Browse files Browse the repository at this point in the history
  • Loading branch information
kuzuanpa committed Jan 20, 2023
1 parent 3f63819 commit 59f88bd
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 17 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ gradle-app.setting
*.ipr
*.iws

## Plugin-specific files:

## Plugin-specific files
/libs/
# IntelliJ
/out/

Expand Down Expand Up @@ -181,3 +181,4 @@ src/Resources/META-INF/openbees_at.cfg
src/Resources/META-INF/PneumaticCraft_at.cfg
src/Resources/META-INF/simplyjetpacks_at.cfg
classes/
/libs/
Binary file not shown.
7 changes: 5 additions & 2 deletions src/API/com/bioxx/tfc/api/Crafting/AnvilRecipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
import java.util.List;
import java.util.Random;

import cpw.mods.fml.common.FMLLog;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

import com.bioxx.tfc.Core.TFC_Core;
import com.bioxx.tfc.api.Constant.Global;
import org.apache.logging.log4j.Level;

public class AnvilRecipe
{
Expand Down Expand Up @@ -119,8 +121,8 @@ public AnvilRecipe addRecipeSkill(String s)
* Used to check if a recipe matches current crafting inventory
*/
public boolean matches(AnvilRecipe recipe)
{
if( areItemStacksEqual(input1, recipe.input1) &&
{
if( areItemStacksEqual(input1, recipe.input1) &&
areItemStacksEqual(input2, recipe.input2) &&
plan.equals(recipe.plan) &&
AnvilReq.matches(anvilreq, recipe.anvilreq))
Expand All @@ -132,6 +134,7 @@ public boolean matches(AnvilRecipe recipe)

public boolean isComplete(AnvilManager am, AnvilRecipe recipe, int[] rules)
{
FMLLog.log(Level.FATAL,anvilreq+"/"+recipe.anvilreq);
PlanRecipe pr = am.getPlan(recipe.plan);
if( areItemStacksEqual(input1, recipe.input1) &&
areItemStacksEqual(input2, recipe.input2) &&
Expand Down
28 changes: 18 additions & 10 deletions src/API/com/bioxx/tfc/api/Crafting/AnvilReq.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.bioxx.tfc.api.Crafting;

import cpw.mods.fml.common.FMLLog;
import org.apache.logging.log4j.Level;

public enum AnvilReq
{
STONE("Stone", 0),
Expand All @@ -8,13 +11,14 @@ public enum AnvilReq
WROUGHTIRON("Wrought Iron", 3),
STEEL("Steel", 5),
BLACKSTEEL("Black Steel", 5),
REDSTEEL("Red Steel", 6),
BLUESTEEL("Blue Steel", 6),
BISMUTHBRONZE("Bismuth Bronze", 2),
REDSTEEL("Red Steel", 7),
BLUESTEEL("Blue Steel", 7),
BISMUTHBRONZE("Bismuth Bronze", 2),
BLACKBRONZE("Black Bronze", 2),
ROSEGOLD("Rose Gold", 2);

public static final AnvilReq RULES[] = new AnvilReq[]{STONE, COPPER, BRONZE, WROUGHTIRON, STEEL, BLACKSTEEL, REDSTEEL, BLUESTEEL, BISMUTHBRONZE, BLACKBRONZE, ROSEGOLD};
ROSEGOLD("Rose Gold", 2),
MANASTEEL("Mana Steel", 6);

public static final AnvilReq[] RULES = new AnvilReq[]{STONE, COPPER, BRONZE, WROUGHTIRON, STEEL, BLACKSTEEL,MANASTEEL, REDSTEEL, BLUESTEEL, BISMUTHBRONZE, BLACKBRONZE, ROSEGOLD, MANASTEEL};
public final int Tier;

public final String Name;
Expand All @@ -24,7 +28,7 @@ public enum AnvilReq
Name = n;
Tier = tier;
}

public boolean matches(int tier)
{
return tier >= Tier;
Expand All @@ -33,10 +37,10 @@ public boolean matches(AnvilReq req)
{
return req.Tier >= Tier;
}
public static boolean matches(int i, int j)
public static boolean matches(int recipeLevel, int anvilLevel)
{
return j >= i;
}
return anvilLevel >= recipeLevel;
}

public static AnvilReq getReqFromInt(int i)
{
Expand Down Expand Up @@ -74,4 +78,8 @@ public static AnvilReq getReqFromInt2(int i)
return BISMUTHBRONZE;
}
}
public static AnvilReq getReqFromInt3(int i){
return MANASTEEL;
}

}
1 change: 1 addition & 0 deletions src/API/com/bioxx/tfc/api/TFCBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public class TFCBlocks
public static Block bellows;
public static Block anvil;
public static Block anvil2;
public static Block anvil3;
public static Block forge;
public static Block blastFurnace;
public static Block molten;
Expand Down
2 changes: 2 additions & 0 deletions src/Common/com/bioxx/tfc/BlockSetup.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public static void registerBlocks()
GameRegistry.registerBlock(bellows, ItemBellows.class, "Bellows");
GameRegistry.registerBlock(anvil, ItemAnvil1.class, "Anvil");
GameRegistry.registerBlock(anvil2, ItemAnvil2.class, "Anvil2");
GameRegistry.registerBlock(anvil3, ItemAnvil3.class, "Anvil3");
GameRegistry.registerBlock(forge, "Forge");

GameRegistry.registerBlock(molten, "Molten");
Expand Down Expand Up @@ -313,6 +314,7 @@ public static void loadBlocks()
forge= new BlockForge().setBlockName("Forge").setHardness(20).setLightLevel(0F);
anvil = new BlockAnvil().setBlockName("Anvil").setHardness(3).setResistance(100F);
anvil2 = new BlockAnvil(8).setBlockName("Anvil2").setHardness(3).setResistance(100F);
anvil3 = new BlockAnvil(11).setBlockName("Anvil3").setHardness(3).setResistance(100F);

molten = new BlockMolten().setBlockName("Molten").setHardness(20);
blastFurnace = new BlockBlastFurnace().setBlockName("BlastFurnace").setHardness(10).setLightLevel(0F);
Expand Down
8 changes: 7 additions & 1 deletion src/Common/com/bioxx/tfc/Blocks/Devices/BlockAnvil.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List
for(int i = 0; i < 3; i++)
par3List.add(new ItemStack(this, 1, i));
}
if(this == TFCBlocks.anvil3)
{
par3List.add(new ItemStack(this, 1, 0));
}
}

@Override
Expand Down Expand Up @@ -106,7 +110,7 @@ public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2,
if (te instanceof TEAnvil)
{
TEAnvil teAnvil = (TEAnvil) te;
if (teAnvil.anvilTier != AnvilReq.STONE.Tier || this == TFCBlocks.anvil2)
if (teAnvil.anvilTier != AnvilReq.STONE.Tier || this == TFCBlocks.anvil2 || this == TFCBlocks.anvil3)
{
if(direction == 0)
return AxisAlignedBB.getBoundingBox(par2 + 0.2, (double)par3 + 0, (double)par4 + 0, par2 + 0.8, par3 + 0.6, (double)par4 + 1);
Expand Down Expand Up @@ -266,6 +270,8 @@ public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase e
te.anvilTier = AnvilReq.getReqFromInt(meta).Tier;
else if(this == TFCBlocks.anvil2)
te.anvilTier = AnvilReq.getReqFromInt2(meta).Tier;
else if(this == TFCBlocks.anvil3)
te.anvilTier = AnvilReq.getReqFromInt3(meta).Tier;
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/Common/com/bioxx/tfc/Core/ItemHeat.java
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ public static void setupItemHeat()
manager.addIndex(new HeatIndex(new ItemStack(TFCItems.cloudberry, 1), 1, 1200, null));

//manager.addIndex(new HeatIndex(new ItemStack(TFCItems.MealGeneric, 1, WILDCARD_VALUE), 0.2, 200, new ItemStack(Items.bowl, 1)));

manager.addIndex(new HeatIndex(new ItemStack(TFCBlocks.anvil3, 1, 0), steelRaw, null));
//Other
manager.addIndex(new HeatIndex(new ItemStack(TFCItems.stick, 1, WILDCARD_VALUE), 1, 40, new ItemStack(TFCBlocks.torch, 2)));
}
Expand Down
3 changes: 3 additions & 0 deletions src/Common/com/bioxx/tfc/Core/Recipes.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.bioxx.tfc.api.Constant.Global;
import com.bioxx.tfc.api.Crafting.*;
import com.bioxx.tfc.api.Enums.RuleEnum;
import vazkii.botania.common.lib.LibOreDict;

public class Recipes
{
Expand Down Expand Up @@ -151,6 +152,7 @@ else if(i/16 == 1)
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TFCBlocks.anvil2, 1, 0), "###"," D ","###", '#', "ingotRoseGold", 'D',"ingotDoubleRoseGold"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TFCBlocks.anvil2, 1, 1), "###"," D ","###", '#', "ingotBismuthBronze", 'D',"ingotDoubleBismuthBronze"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TFCBlocks.anvil2, 1, 2), "###"," D ","###", '#', "ingotBlackBronze", 'D',"ingotDoubleBlackBronze"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TFCBlocks.anvil3, 1, 0), "###"," # ","###", '#', LibOreDict.MANA_STEEL));

GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TFCBlocks.bloomery, 1), "PPP", "P P", "PPP", 'P', "plateDoubleAnyBronze"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TFCBlocks.blastFurnace, 1), "PPP", "PCP", "PPP", 'P', "plateDoubleWroughtIron", 'C', new ItemStack(TFCBlocks.crucible, 1)));
Expand Down Expand Up @@ -1301,6 +1303,7 @@ public static void registerAnvilRecipes(Random r, World world)
manager.addRecipe(new AnvilRecipe(new ItemStack(TFCItems.highCarbonBlueSteelIngot), null, "ingot", false, AnvilReq.BLACKSTEEL, new ItemStack(TFCItems.blueSteelIngot)).clearRecipeSkills());
manager.addRecipe(new AnvilRecipe(new ItemStack(TFCItems.highCarbonRedSteelIngot), null, "ingot", false, AnvilReq.BLACKSTEEL, new ItemStack(TFCItems.redSteelIngot)).clearRecipeSkills());
manager.addRecipe(new AnvilRecipe(new ItemStack(TFCItems.highCarbonSteelIngot), null, "ingot", false, AnvilReq.WROUGHTIRON, new ItemStack(TFCItems.steelIngot)).clearRecipeSkills());
manager.addRecipe(new AnvilRecipe(new ItemStack(TFCItems.weakRedSteelIngot), new ItemStack(TFCItems.smallMetalChunk,1,3), "ingot", false, AnvilReq.MANASTEEL, new ItemStack(TFCItems.redSteelIngot)).clearRecipeSkills());

manager.addRecipe(new AnvilRecipe(new ItemStack(TFCItems.bismuthIngot2x), null, "sheet", false, AnvilReq.STONE, new ItemStack(TFCItems.bismuthSheet)));
manager.addRecipe(new AnvilRecipe(new ItemStack(TFCItems.bismuthBronzeIngot2x), null, "sheet", false, AnvilReq.BISMUTHBRONZE, new ItemStack(TFCItems.bismuthBronzeSheet)));
Expand Down
22 changes: 22 additions & 0 deletions src/Common/com/bioxx/tfc/Items/ItemBlocks/ItemAnvil3.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.bioxx.tfc.Items.ItemBlocks;

import com.bioxx.tfc.api.Constant.Global;
import com.bioxx.tfc.api.Metal;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;

public class ItemAnvil3 extends ItemAnvil
{
public ItemAnvil3(Block par1)
{
super(par1);
this.metaNames = new String[]{ "Mana Steel"};
}

@Override
public Metal getMetalType(ItemStack is)
{
int meta = is.getItemDamage();
return Global.STEEL;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public void generate(World world, Random rand, int x, int y, int z)

private void carve(World world, int x, int y, int z, Block block, int meta)
{
if(world.getBlock(x, y, z).getMaterial() != Material.air && TFC_Core.isGround(world.getBlock(x, y, z)))
if(world.getBlock(x, y, z).getMaterial() != Material.air && TFC_Core.isGround(world.getBlock(x, y, z)))
world.setBlock(x, y, z, Blocks.air, 0, 3);
if(world.getBlock(x - 1, y, z).getMaterial() != Material.air && TFC_Core.isRawStone(world.getBlock(x - 1, y, z)))
world.setBlock(x - 1, y, z, block, meta, 3);
Expand Down

0 comments on commit 59f88bd

Please sign in to comment.