player arm can swing

This commit is contained in:
Mohammad-Ali Minaie
2017-03-21 23:39:26 -04:00
parent 958633ff2a
commit 9c332d6b61
2 changed files with 118 additions and 104 deletions

View File

@@ -1,15 +1,16 @@
To-Dos
*** Priority ***
- [ ] Create the hoe Item
- [ ] Sound Handler
- [ ] OreDict Stuff
- [ ] Create the Sword Model
- [ ] Add randomInt to anvil
- [ ] Sword Item
- [ ] Sword Json
*** Backlog ***
- [ ] Create a method which adds the types of NBT upgrades and creates a unique float instead of using magic numbers
- [ ] Add forgehammer to oreDict
- [ ] Finish Toolhead Recipes
- [ ] WeaponHead recipes
- [ ] Casting Table
@@ -25,6 +26,9 @@ To-Dos
*** Completed ***
- [x] Create the hoe Item
- [x] Finish Toolhead Recipes
- [x] Add randomInt to anvil
- [x] Create the axe Item
- [x] Create the shovel Item
- [x] Create the axe Model

View File

@@ -73,15 +73,23 @@ public class Anvil extends CustomContainerFacing {
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
if (!world.isRemote) {
TileAnvil tile = (TileAnvil) world.getTileEntity(pos);
if (tile != null) {
ItemStack pItem = player.inventory.getCurrentItem();
if (world.isRemote) {
if (!player.isSwingInProgress) {
player.swingArm(hand);
}
}
/******************************************************************************
Crafting Anvil Recipes
*****************************************************************************/
if (!world.isRemote) {
if ((player.inventory.getCurrentItem().getItem().equals(PrimalItems.STONE_GALLAGHER)) || (player.inventory.getCurrentItem().getItem() == ModItems.forgehammer)) {
TileAnvil tile = (TileAnvil) world.getTileEntity(pos);
ItemStack pItem = player.inventory.getCurrentItem();
if (tile != null) {
if ((pItem.getItem().equals(PrimalItems.STONE_GALLAGHER)) || (pItem.getItem() == ModItems.forgehammer)) {
String[] tempArray = new String[25];
for (int i = 0; i < 25; i++) {
@@ -98,6 +106,10 @@ public class Anvil extends CustomContainerFacing {
if (pItem.getItem().equals(ModItems.forgehammer)) {
pItem.damageItem(1, player);
}
world.playEvent(1031, pos, 0);
if (world.rand.nextBoolean()) {
if (recipe.getOutput().getItem() instanceof ToolPart) {
@@ -174,17 +186,7 @@ public class Anvil extends CustomContainerFacing {
} else {
CommonUtils.spawnItemEntityFromWorld(world, pos, recipe.getOutput());
}
/*
NBTTagCompound tempNBT = this.getSlotStack(i).getSubCompound("tags");
ItemStack outputStack = recipe.getOutput();
outputStack.getTagCompound().setTag("tags", tempNBT);
outputStack.getSubCompound("tags").setBoolean("hot", true);
this.setSlotStack(i, outputStack);
*/
world.playEvent(1031, pos, 0);
//world.playEvent(1031, pos, 0);
for (int i = 0; i < tile.getSlotListSize(); i++) {
if (!tile.getSlotStack(i).isEmpty()) {
tile.setSlotStack(i, ItemStack.EMPTY);
@@ -193,6 +195,11 @@ public class Anvil extends CustomContainerFacing {
return true;
}
}
}
}
/*****************************************************************************
@@ -200,6 +207,8 @@ public class Anvil extends CustomContainerFacing {
*****************************************************************************/
if ((pItem.getItem() != PrimalItems.STONE_GALLAGHER) || (pItem.getItem() != ModItems.forgehammer)) {
if (state.getValue(FACING) == EnumFacing.NORTH) {
@@ -262,10 +271,11 @@ public class Anvil extends CustomContainerFacing {
}
}
}
return false;
}
}
return false;
}