Merge branch 'master' of github.com:kitsushadow/forgecraft

This commit is contained in:
elite
2017-04-01 22:04:18 -05:00
8 changed files with 121 additions and 54 deletions

View File

@@ -94,6 +94,8 @@ public class Anvil extends CustomContainerFacing {
//System.out.println("Tile is not null");
//if ((player.inventory.getCurrentItem().getItem().equals(PrimalItems.STONE_GALLAGHER)) || (player.inventory.getCurrentItem().getItem() == ModItems.forgehammer)) {
if ((pItem.getItem() instanceof WorkMallet) || (pItem.getItem() == ModItems.forgehammer)) {
@@ -244,65 +246,66 @@ public class Anvil extends CustomContainerFacing {
if ( (!(pItem.getItem() instanceof WorkMallet)) || (!(pItem.getItem() instanceof ForgeHammer)) ) {
if(Block.getBlockFromItem(pItem.getItem()) instanceof IngotBall) {
return false;
}
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);
return true;
}
}
counter++;
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);
return true;
}
}
counter++;
}
if (state.getValue(FACING) == EnumFacing.SOUTH) {
int counter = 0;
for (int z = 0; z < 5; z++) {
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++;
}
}
if (state.getValue(FACING) == EnumFacing.SOUTH) {
int counter = 0;
for (int z = 0; z < 5; z++) {
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++;
}
if (state.getValue(FACING) == EnumFacing.WEST) {
int counter = 0;
for (int x = 0; x < 5; x++) {
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++;
}
}
if (state.getValue(FACING) == EnumFacing.WEST) {
int counter = 0;
for (int x = 0; x < 5; x++) {
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++;
}
if (state.getValue(FACING) == EnumFacing.EAST) {
int counter = 0;
for (int x = 0; x < 5; x++) {
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++;
}
}
if (state.getValue(FACING) == EnumFacing.EAST) {
int counter = 0;
for (int x = 0; x < 5; x++) {
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;

View File

@@ -106,7 +106,7 @@ public class ModBlocks {
//CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.stoneanvil, 1));
return true;
}
if (pItem.equals(PrimalItems.STONE_GALLAGHER) || pItem.equals(ModItems.forgehammer)) {
if (pItem instanceof WorkMallet || pItem.equals(ModItems.forgehammer)) {
if(world.getBlockState(belowPos).getBlock().equals(ModBlocks.stoneanvil)) {

View File

@@ -49,24 +49,24 @@ public class TileAnvil extends TileBaseSlot implements ITickable {
if (!world.isRemote) {
IBlockState state = world.getBlockState(this.pos);
if ( ThreadLocalRandom.current().nextInt(0,500) == 0 ) {
if ( ThreadLocalRandom.current().nextInt(0,10000) == 0 ) {
for(int i=0; i<this.getSlotListSize(); i++){
if(this.getSlotStack(i).getItem() == ModItems.ironchunkhot){
if(ThreadLocalRandom.current().nextInt(0,10) == 1){
if(ThreadLocalRandom.current().nextInt(0,100) == 1){
this.setSlotStack(i, new ItemStack(ModBlocks.ironchunk, 1));
this.updateBlock();
this.markDirty();
}
}
if(this.getSlotStack(i).getItem() == ModItems.ironingotballhot){
if(ThreadLocalRandom.current().nextInt(0,20) == 2){
if(ThreadLocalRandom.current().nextInt(0,100) == 2){
this.setSlotStack(i, new ItemStack(ModBlocks.ironball, 1));
this.updateBlock();
this.markDirty();
}
}
if(this.getSlotStack(i).getItem() instanceof ToolPart){
if(ThreadLocalRandom.current().nextInt(0,10) == 0){
if(ThreadLocalRandom.current().nextInt(0,100) == 0){
((ToolPart) this.getSlotStack(i).getItem()).setHot(this.getSlotStack(i), false);
this.updateBlock();
this.markDirty();