updating the anvil method
This commit is contained in:
@@ -3,9 +3,11 @@ To-Dos
|
||||
*** Priority ***
|
||||
|
||||
- [ ] OreDict Stuff
|
||||
- [ ] Use Primal Brick instead of clay brick
|
||||
- [ ] Iron Plate Recipe
|
||||
- [ ] Bucket Crafting
|
||||
- [x] Can't remove fuel from Bloomery
|
||||
- [ ] Crafting Recipe for Iron Ingot to Iron Ball
|
||||
- [ ] Block To Read Temperature
|
||||
- [ ] Bellows Moves Faster
|
||||
|
||||
|
||||
*** Backlog ***
|
||||
- [ ] Create a method which adds the types of NBT upgrades and creates a unique float instead of using magic numbers
|
||||
|
||||
@@ -83,6 +83,7 @@ public class Anvil extends CustomContainerFacing {
|
||||
ItemStack pItem = player.inventory.getCurrentItem();
|
||||
TileAnvil tile = (TileAnvil) world.getTileEntity(pos);
|
||||
if (tile != null) {
|
||||
//System.out.println("Tile is not null");
|
||||
if ((player.inventory.getCurrentItem().getItem().equals(PrimalItems.STONE_GALLAGHER)) || (player.inventory.getCurrentItem().getItem() == ModItems.forgehammer)) {
|
||||
|
||||
|
||||
@@ -203,22 +204,15 @@ public class Anvil extends CustomContainerFacing {
|
||||
|
||||
|
||||
if ((pItem.getItem() != PrimalItems.STONE_GALLAGHER) || (pItem.getItem() != ModItems.forgehammer)) {
|
||||
if (pItem.getItem().equals(ModItems.stonetongs)) {
|
||||
if ((pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 8) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 9) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 10) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 11) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 0)) {
|
||||
|
||||
if (state.getValue(FACING) == EnumFacing.NORTH) {
|
||||
int counter = 0;
|
||||
for (int z = 0; z < 5; z++) {
|
||||
for (int x = 0; x < 5; x++) {
|
||||
if (hitx >= this.getNormalMin(x) && hitx <= this.getNormalMax(x)) {
|
||||
if (hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) {
|
||||
|
||||
doWork(pItem, counter, tile, world, pos, player);
|
||||
//System.out.println("Doing work");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
@@ -231,9 +225,8 @@ public class Anvil extends CustomContainerFacing {
|
||||
for (int x = 0; x < 5; x++) {
|
||||
if (hitx >= this.getReverseMin(x) && hitx <= this.getReverseMax(x)) {
|
||||
if (hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) {
|
||||
|
||||
doWork(pItem, counter, tile, world, pos, player);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
@@ -246,9 +239,8 @@ public class Anvil extends CustomContainerFacing {
|
||||
for (int z = 0; z < 5; z++) {
|
||||
if (hitx >= this.getNormalMin(x) && hitx <= this.getNormalMax(x)) {
|
||||
if (hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) {
|
||||
|
||||
doWork(pItem, counter, tile, world, pos, player);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
@@ -261,17 +253,16 @@ public class Anvil extends CustomContainerFacing {
|
||||
for (int z = 0; z < 5; z++) {
|
||||
if (hitx >= this.getReverseMin(x) && hitx <= this.getReverseMax(x)) {
|
||||
if (hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) {
|
||||
|
||||
doWork(pItem, counter, tile, world, pos, player);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -280,7 +271,15 @@ public class Anvil extends CustomContainerFacing {
|
||||
}
|
||||
|
||||
private boolean doWork(ItemStack pItem, Integer counter, TileAnvil tile, World world, BlockPos pos, EntityPlayer player) {
|
||||
|
||||
if (pItem.getItem().equals(ModItems.stonetongs)) {
|
||||
if ((pItem.getTagCompound().getInteger("type") == 6) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 7) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 8) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 9) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 10) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 11) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 0)) {
|
||||
//System.out.println("Level 1");
|
||||
|
||||
if (!tile.getSlotStack(counter).isEmpty()) {
|
||||
@@ -294,6 +293,7 @@ public class Anvil extends CustomContainerFacing {
|
||||
pItem.getTagCompound().setInteger("type", 7);
|
||||
tile.setSlotStack(counter, ItemStack.EMPTY);
|
||||
//System.out.println(counter);
|
||||
//System.out.println(counter);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -301,17 +301,20 @@ public class Anvil extends CustomContainerFacing {
|
||||
}
|
||||
|
||||
if (tile.getSlotStack(counter).isEmpty()) {
|
||||
//System.out.println("Activating");
|
||||
System.out.println("Activating");
|
||||
if (pItem.getTagCompound().getInteger("type") == 6) {
|
||||
System.out.println("Tongs meta = 6");
|
||||
tile.setSlotStack((counter), new ItemStack(ModItems.ironingotballhot, 1));
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
return true;
|
||||
//return true;
|
||||
}
|
||||
if (pItem.getTagCompound().getInteger("type") == 7) {
|
||||
System.out.println("Tongs meta = 7");
|
||||
tile.setSlotStack((counter), new ItemStack(ModItems.ironchunkhot, 1));
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
//System.out.println(counter);
|
||||
return true;
|
||||
System.out.println(counter);
|
||||
System.out.println(tile.getSlotStack(counter));
|
||||
//return true;
|
||||
}
|
||||
if (pItem.getTagCompound().getInteger("type") == 8) {
|
||||
ItemStack tempStack = new ItemStack(ModItems.pickaxehead, 1);
|
||||
@@ -379,6 +382,9 @@ public class Anvil extends CustomContainerFacing {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//System.out.println("1" + pItem);
|
||||
|
||||
@@ -448,7 +454,9 @@ public class Anvil extends CustomContainerFacing {
|
||||
}
|
||||
|
||||
if (pItem.getItem().equals(Items.DIAMOND)) {
|
||||
System.out.println("It Is Diamond");
|
||||
if (tile.getSlotStack(counter).isEmpty()) {
|
||||
System.out.println("Slot is empty");
|
||||
tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1));
|
||||
pItem.shrink(1);
|
||||
return true;
|
||||
@@ -534,8 +542,10 @@ public class Anvil extends CustomContainerFacing {
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
if(!worldIn.isRemote) {
|
||||
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
|
||||
@@ -23,6 +23,7 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.forgecraft.CommonUtils;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.tiles.TileBloomery;
|
||||
|
||||
@@ -63,7 +64,9 @@ public class Bloomery extends CustomContainerFacing implements ITileEntityProvid
|
||||
ItemStack tileItem = tile.getSlotStack(0);
|
||||
ItemStack tileItem1 = tile.getSlotStack(1);
|
||||
if(pItem.isEmpty()) {
|
||||
/*if (player.isSneaking()) {
|
||||
|
||||
|
||||
if (player.isSneaking()) {
|
||||
if (!tileItem.isEmpty()) {
|
||||
CommonUtils.spawnItemEntity(world, player, tile.getSlotStack(0));
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
@@ -71,7 +74,7 @@ public class Bloomery extends CustomContainerFacing implements ITileEntityProvid
|
||||
tile.updateBlock();
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
if(!player.isSneaking()){
|
||||
if(world.getBlockState(pos).getValue(ACTIVE) == true){
|
||||
Integer tempInt = tile.getHeat();
|
||||
@@ -200,9 +203,12 @@ public class Bloomery extends CustomContainerFacing implements ITileEntityProvid
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
if(!worldIn.isRemote){
|
||||
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(ACTIVE, Boolean.valueOf(false)).withProperty(COVERED, Boolean.valueOf(false)), 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
int i = 0;
|
||||
|
||||
@@ -345,8 +345,10 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider/
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
if(!worldIn.isRemote) {
|
||||
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(ACTIVE, Boolean.valueOf(false)), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
|
||||
@@ -90,7 +90,7 @@ public class ModBlocks {
|
||||
{
|
||||
if(!world.isRemote){
|
||||
Item pItem = player.getHeldItem(hand).getItem();
|
||||
BlockPos belowPos = new BlockPos(pos.getX(), pos.getY() - 1, pos.getZ());
|
||||
BlockPos belowPos = pos.down();
|
||||
//System.out.println("Activating");
|
||||
if (pItem.equals(PrimalItems.STONE_GALLAGHER) && world.getBlockState(belowPos).getBlock().equals(Blocks.STONE)) {
|
||||
player.swingArm(hand);
|
||||
|
||||
@@ -175,6 +175,17 @@ public class ModCrafting {
|
||||
1.0f
|
||||
);
|
||||
|
||||
// Converts a Vanilla Ingot into ForgeCraft Ingot Ball
|
||||
ForgeCrafting.addRecipe(
|
||||
Items.IRON_INGOT,
|
||||
new ItemStack(ModItems.ironingotballhot, 1),
|
||||
800,
|
||||
200,
|
||||
500,
|
||||
1.0f,
|
||||
1.0f
|
||||
);
|
||||
|
||||
//Makes a Hot Iron Chunk
|
||||
ForgeCrafting.addRecipe(
|
||||
Item.getItemFromBlock(ModBlocks.ironchunk),
|
||||
|
||||
@@ -311,7 +311,7 @@ public class ItemStoneTongs extends Item {
|
||||
else return EnumActionResult.FAIL;
|
||||
//System.out.println(itemstack.getTagCompound().getInteger("type"));
|
||||
}
|
||||
//System.out.println(player.getHeldItem(hand).getTagCompound().getInteger("type"));
|
||||
System.out.println(player.getHeldItem(hand).getTagCompound().getInteger("type"));
|
||||
return EnumActionResult.FAIL;
|
||||
|
||||
}
|
||||
@@ -321,7 +321,7 @@ public class ItemStoneTongs extends Item {
|
||||
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
|
||||
{
|
||||
tooltip.add(ChatFormatting.BLUE + "NBT: " + item.getSubCompound("tags"));
|
||||
//tooltip.add(ChatFormatting.RED + "Consumes sticks");
|
||||
tooltip.add(ChatFormatting.RED + "NBT: " + item.getTagCompound().getInteger("type"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user