Initial stab at 1.11

About halfway.
This commit is contained in:
Nicholas Ignoffo 2016-12-12 19:56:36 -08:00
parent ce52aea512
commit 00d6f8eb46
157 changed files with 1036 additions and 1554 deletions

View file

@ -203,16 +203,16 @@ public class RitualAltarBuilder extends Ritual
{
if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN))
{
IItemHandler iItemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN);
IItemHandler itemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN);
if (iItemHandler.getSlots() <= 0)
if (itemHandler.getSlots() <= 0)
{
return false;
}
for (int i = 0; i < iItemHandler.getSlots(); i++)
for (int i = 0; i < itemHandler.getSlots(); i++)
{
if (iItemHandler.getStackInSlot(i) != null && iItemHandler.getStackInSlot(i).stackSize > 0 && iItemHandler.getStackInSlot(i).getItem() == item && iItemHandler.getStackInSlot(i).getItemDamage() == damage && iItemHandler.extractItem(i, 1, !consumeItem) != null)
if (!itemHandler.getStackInSlot(i).isEmpty() && itemHandler.getStackInSlot(i).getItem() == item && itemHandler.getStackInSlot(i).getItemDamage() == damage && !itemHandler.extractItem(i, 1, !consumeItem).isEmpty())
{
return true;
}
@ -222,7 +222,7 @@ public class RitualAltarBuilder extends Ritual
IInventory inv = (IInventory) tileEntity;
for (int i = 0; i < inv.getSizeInventory(); i++)
{
if (inv.getStackInSlot(i) != null && inv.getStackInSlot(i).stackSize > 0 && inv.getStackInSlot(i).getItem() == item && inv.getStackInSlot(i).getItemDamage() == damage)
if (!inv.getStackInSlot(0).isEmpty() && inv.getStackInSlot(i).getItem() == item && inv.getStackInSlot(i).getItemDamage() == damage)
{
if (consumeItem)
{
@ -242,19 +242,19 @@ public class RitualAltarBuilder extends Ritual
{
if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN))
{
IItemHandler iItemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN);
IItemHandler itemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN);
if (iItemHandler.getSlots() <= 0)
if (itemHandler.getSlots() <= 0)
{
return null;
}
for (int i = 0; i < iItemHandler.getSlots(); i++)
for (int i = 0; i < itemHandler.getSlots(); i++)
{
if (iItemHandler.getStackInSlot(i) != null && iItemHandler.getStackInSlot(i).stackSize > 0 && iItemHandler.getStackInSlot(i).getItem() instanceof ItemBlock && Block.getBlockFromItem(iItemHandler.getStackInSlot(i).getItem()) instanceof BlockBloodRune && iItemHandler.extractItem(i, 1, true) != null)
if (!itemHandler.getStackInSlot(i).isEmpty() && itemHandler.getStackInSlot(i).getItem() instanceof ItemBlock && Block.getBlockFromItem(itemHandler.getStackInSlot(i).getItem()) instanceof BlockBloodRune && itemHandler.extractItem(i, 1, true) != null)
{
BlockStack blockStack = new BlockStack(Utils.getBlockForComponent(EnumAltarComponent.BLOODRUNE), iItemHandler.getStackInSlot(i).getItemDamage());
iItemHandler.extractItem(i, 1, false);
BlockStack blockStack = new BlockStack(Utils.getBlockForComponent(EnumAltarComponent.BLOODRUNE), itemHandler.getStackInSlot(i).getItemDamage());
itemHandler.extractItem(i, 1, false);
return blockStack;
}
}
@ -263,7 +263,7 @@ public class RitualAltarBuilder extends Ritual
IInventory inv = (IInventory) tileEntity;
for (int i = 0; i < inv.getSizeInventory(); i++)
{
if (inv.getStackInSlot(i) != null && inv.getStackInSlot(i).stackSize > 0 && inv.getStackInSlot(i).getItem() instanceof ItemBlock && Block.getBlockFromItem(inv.getStackInSlot(i).getItem()) instanceof BlockBloodRune)
if (!inv.getStackInSlot(i).isEmpty() && inv.getStackInSlot(i).getItem() instanceof ItemBlock && Block.getBlockFromItem(inv.getStackInSlot(i).getItem()) instanceof BlockBloodRune)
{
BlockStack blockStack = new BlockStack(Utils.getBlockForComponent(EnumAltarComponent.BLOODRUNE), inv.getStackInSlot(i).getItemDamage());
inv.decrStackSize(i, 1);
@ -281,22 +281,22 @@ public class RitualAltarBuilder extends Ritual
{
if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN))
{
IItemHandler iItemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN);
IItemHandler itemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN);
if (iItemHandler.getSlots() <= 0)
if (itemHandler.getSlots() <= 0)
{
return null;
}
for (int i = 0; i < iItemHandler.getSlots(); i++)
for (int i = 0; i < itemHandler.getSlots(); i++)
{
if (iItemHandler.getStackInSlot(i) != null && iItemHandler.getStackInSlot(i).stackSize > 0 && iItemHandler.getStackInSlot(i).getItem() instanceof ItemBlock && !(Block.getBlockFromItem(iItemHandler.getStackInSlot(i).getItem()) instanceof BlockBloodRune) && iItemHandler.extractItem(i, 1, true) != null)
if (!itemHandler.getStackInSlot(i).isEmpty() && itemHandler.getStackInSlot(i).getItem() instanceof ItemBlock && !(Block.getBlockFromItem(itemHandler.getStackInSlot(i).getItem()) instanceof BlockBloodRune) && itemHandler.extractItem(i, 1, true) != null)
{
Block block = Block.getBlockFromItem(iItemHandler.getStackInSlot(i).getItem());
Block block = Block.getBlockFromItem(itemHandler.getStackInSlot(i).getItem());
if (block != null && block != Blocks.GLOWSTONE && block != ModBlocks.BLOOD_STONE && block != ModBlocks.CRYSTAL)
{
BlockStack blockStack = new BlockStack(block, iItemHandler.getStackInSlot(i).getItemDamage());
iItemHandler.extractItem(i, 1, false);
BlockStack blockStack = new BlockStack(block, itemHandler.getStackInSlot(i).getItemDamage());
itemHandler.extractItem(i, 1, false);
return blockStack;
}
}
@ -306,10 +306,10 @@ public class RitualAltarBuilder extends Ritual
IInventory inv = (IInventory) tileEntity;
for (int i = 0; i < inv.getSizeInventory(); i++)
{
if (inv.getStackInSlot(i) != null && inv.getStackInSlot(i).stackSize > 0 && inv.getStackInSlot(i).getItem() instanceof ItemBlock && !(Block.getBlockFromItem(inv.getStackInSlot(i).getItem()) instanceof BlockBloodRune))
if (!inv.getStackInSlot(i).isEmpty() && inv.getStackInSlot(i).getItem() instanceof ItemBlock && !(Block.getBlockFromItem(inv.getStackInSlot(i).getItem()) instanceof BlockBloodRune))
{
Block block = Block.getBlockFromItem(inv.getStackInSlot(i).getItem());
if (block != null && block != Blocks.GLOWSTONE && block != ModBlocks.BLOOD_STONE && block != ModBlocks.CRYSTAL)
if (block != Blocks.GLOWSTONE && block != ModBlocks.BLOOD_STONE && block != ModBlocks.CRYSTAL)
{
BlockStack blockStack = new BlockStack(block, inv.getStackInSlot(i).getItemDamage());
inv.decrStackSize(i, 1);

View file

@ -232,7 +232,14 @@ public class RitualAnimalGrowth extends Ritual
@Override
public ITextComponent[] provideInformationOfRitualToPlayer(EntityPlayer player)
{
return new ITextComponent[] { new TextComponentTranslation(this.getUnlocalizedName() + ".info"), new TextComponentTranslation(this.getUnlocalizedName() + ".default.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".corrosive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".steadfast.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".destructive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".vengeful.info") };
return new ITextComponent[] {
new TextComponentTranslation(this.getUnlocalizedName() + ".info"),
new TextComponentTranslation(this.getUnlocalizedName() + ".default.info"),
new TextComponentTranslation(this.getUnlocalizedName() + ".corrosive.info"),
new TextComponentTranslation(this.getUnlocalizedName() + ".steadfast.info"),
new TextComponentTranslation(this.getUnlocalizedName() + ".destructive.info"),
new TextComponentTranslation(this.getUnlocalizedName() + ".vengeful.info")
};
}
public int getBreedingDecreaseForWill(double vengefulWill)

View file

@ -55,7 +55,7 @@ public class RitualArmourEvolve extends Ritual
masterRitualStone.setActive(false);
world.spawnEntityInWorld(new EntityLightningBolt(world, pos.getX(), pos.getY() - 1, pos.getZ(), true));
world.spawnEntity(new EntityLightningBolt(world, pos.getX(), pos.getY() - 1, pos.getZ(), true));
}
}
}

View file

@ -48,7 +48,7 @@ public class RitualCobblestone extends Ritual
if (tileEntity != null && tileEntity instanceof TileAlchemyArray)
{
TileAlchemyArray alchemyArray = (TileAlchemyArray) tileEntity;
if (alchemyArray.getStackInSlot(0) != null && alchemyArray.getStackInSlot(0).getItem() instanceof ItemComponent)
if (!alchemyArray.getStackInSlot(0).isEmpty() && alchemyArray.getStackInSlot(0).getItem() instanceof ItemComponent)
{
switch (alchemyArray.getStackInSlot(0).getItemDamage())
{

View file

@ -129,7 +129,7 @@ public class RitualCrushing extends Ritual
if (useCuttingFluid)
{
ItemStack checkStack = block.getItem(world, newPos, state);
if (checkStack == null)
if (checkStack.isEmpty())
{
continue;
}
@ -159,7 +159,7 @@ public class RitualCrushing extends Ritual
}
ItemStack result = recipe.getRecipeOutput(input);
if (result == null)
if (result.isEmpty())
{
continue;
}
@ -167,7 +167,7 @@ public class RitualCrushing extends Ritual
if (tile != null)
{
result = Utils.insertStackIntoTile(result, tile, EnumFacing.DOWN);
if (result != null && result.stackSize > 0)
if (!result.isEmpty())
{
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, result);
}
@ -189,7 +189,7 @@ public class RitualCrushing extends Ritual
if (!isBlockClaimed && isSilkTouch && block.canSilkHarvest(world, newPos, state, null))
{
ItemStack checkStack = block.getItem(world, newPos, state);
if (checkStack == null)
if (checkStack.isEmpty())
{
continue;
}
@ -210,7 +210,7 @@ public class RitualCrushing extends Ritual
else
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, copyStack);
if (copyStack != null && copyStack.stackSize > 0)
if (!copyStack.isEmpty())
{
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, copyStack);
}
@ -223,31 +223,28 @@ public class RitualCrushing extends Ritual
List<ItemStack> stackList = block.getDrops(world, newPos, state, fortune);
if (stackList != null && !stackList.isEmpty())
for (ItemStack item : stackList)
{
for (ItemStack item : stackList)
{
ItemStack copyStack = ItemStack.copyItemStack(item);
ItemStack copyStack = item.copy();
if (tile != null)
{
copyStack = Utils.insertStackIntoTile(copyStack, tile, EnumFacing.DOWN);
} else
{
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, copyStack);
continue;
}
if (copyStack != null && copyStack.stackSize > 0)
{
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, copyStack);
}
}
if (fortune > 0)
if (tile != null)
{
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.DESTRUCTIVE, destructiveWillDrain, true);
destructiveWill -= destructiveWillDrain;
copyStack = Utils.insertStackIntoTile(copyStack, tile, EnumFacing.DOWN);
} else
{
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, copyStack);
continue;
}
if (!copyStack.isEmpty())
{
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, copyStack);
}
}
if (fortune > 0)
{
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.DESTRUCTIVE, destructiveWillDrain, true);
destructiveWill -= destructiveWillDrain;
}
}
@ -323,7 +320,14 @@ public class RitualCrushing extends Ritual
@Override
public ITextComponent[] provideInformationOfRitualToPlayer(EntityPlayer player)
{
return new ITextComponent[] { new TextComponentTranslation(this.getUnlocalizedName() + ".info"), new TextComponentTranslation(this.getUnlocalizedName() + ".default.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".corrosive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".steadfast.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".destructive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".vengeful.info") };
return new ITextComponent[] {
new TextComponentTranslation(this.getUnlocalizedName() + ".info"),
new TextComponentTranslation(this.getUnlocalizedName() + ".default.info"),
new TextComponentTranslation(this.getUnlocalizedName() + ".corrosive.info"),
new TextComponentTranslation(this.getUnlocalizedName() + ".steadfast.info"),
new TextComponentTranslation(this.getUnlocalizedName() + ".destructive.info"),
new TextComponentTranslation(this.getUnlocalizedName() + ".vengeful.info")
};
}
@Override

View file

@ -136,20 +136,20 @@ public class RitualExpulsion extends Ritual
moveEntityViaTeleport(entityLiving, event.getTargetX(), event.getTargetY(), event.getTargetZ());
boolean flag = false;
int i = MathHelper.floor_double(entityLiving.posX);
int j = MathHelper.floor_double(entityLiving.posY);
int k = MathHelper.floor_double(entityLiving.posZ);
int i = MathHelper.floor(entityLiving.posX);
int j = MathHelper.floor(entityLiving.posY);
int k = MathHelper.floor(entityLiving.posZ);
int l;
if (!entityLiving.worldObj.isAirBlock(new BlockPos(i, j, k)))
if (!entityLiving.getEntityWorld().isAirBlock(new BlockPos(i, j, k)))
{
boolean flag1 = false;
while (!flag1 && j > 0)
{
IBlockState state = entityLiving.worldObj.getBlockState(new BlockPos(i, j - 1, k));
IBlockState state = entityLiving.getEntityWorld().getBlockState(new BlockPos(i, j - 1, k));
if (state != null && state.getMaterial().blocksMovement())
if (state.getMaterial().blocksMovement())
{
flag1 = true;
} else
@ -163,7 +163,7 @@ public class RitualExpulsion extends Ritual
{
moveEntityViaTeleport(entityLiving, entityLiving.posX, entityLiving.posY, entityLiving.posZ);
if (!entityLiving.isCollided && !entityLiving.worldObj.containsAnyLiquid(entityLiving.getEntityBoundingBox()))
if (!entityLiving.isCollided && !entityLiving.getEntityWorld().containsAnyLiquid(entityLiving.getEntityBoundingBox()))
{
flag = true;
}
@ -179,13 +179,13 @@ public class RitualExpulsion extends Ritual
for (l = 0; l < 128; ++l)
{
double lengthVal = (double) l / ((double) 128 - 1.0D);
float randF1 = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F;
float randF2 = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F;
float randF3 = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F;
double lengthValX = lastX + (entityLiving.posX - lastX) * lengthVal + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D;
double lengthValY = lastY + (entityLiving.posY - lastY) * lengthVal + entityLiving.worldObj.rand.nextDouble() * (double) entityLiving.height;
double lengthValZ = lastZ + (entityLiving.posZ - lastZ) * lengthVal + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D;
entityLiving.worldObj.spawnParticle(EnumParticleTypes.PORTAL, lengthValX, lengthValY, lengthValZ, (double) randF1, (double) randF2, (double) randF3);
float randF1 = (entityLiving.getEntityWorld().rand.nextFloat() - 0.5F) * 0.2F;
float randF2 = (entityLiving.getEntityWorld().rand.nextFloat() - 0.5F) * 0.2F;
float randF3 = (entityLiving.getEntityWorld().rand.nextFloat() - 0.5F) * 0.2F;
double lengthValX = lastX + (entityLiving.posX - lastX) * lengthVal + (entityLiving.getEntityWorld().rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D;
double lengthValY = lastY + (entityLiving.posY - lastY) * lengthVal + entityLiving.getEntityWorld().rand.nextDouble() * (double) entityLiving.height;
double lengthValZ = lastZ + (entityLiving.posZ - lastZ) * lengthVal + (entityLiving.getEntityWorld().rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D;
entityLiving.getEntityWorld().spawnParticle(EnumParticleTypes.PORTAL, lengthValX, lengthValY, lengthValZ, (double) randF1, (double) randF2, (double) randF3);
}
return true;
@ -200,7 +200,7 @@ public class RitualExpulsion extends Ritual
{
EntityPlayerMP entityplayermp = (EntityPlayerMP) entityLiving;
if (entityplayermp.worldObj == entityLiving.worldObj)
if (entityplayermp.getEntityWorld() == entityLiving.getEntityWorld())
{
EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, x, y, z, 5.0F);

View file

@ -138,7 +138,7 @@ public class RitualFeatheredKnife extends Ritual
float sacrificedHealth = 1;
double lpModifier = 1;
if ((health / player.getMaxHealth() > healthThreshold) && ((useIncense && !player.isPotionActive(ModPotions.soulFray)) || !useIncense))
if ((health / player.getMaxHealth() > healthThreshold) && (!useIncense || !player.isPotionActive(ModPotions.soulFray)))
{
if (useIncense)
{

View file

@ -114,17 +114,17 @@ public class RitualFelling extends Ritual
private void placeInInventory(IBlockState blockState, World world, BlockPos blockPos, BlockPos tileEntityPos)
{
TileEntity tile = world.getTileEntity(tileEntityPos);
if (tile != null && blockState.getBlock().getDrops(world, blockPos, world.getBlockState(blockPos), 0) != null)
if (tile != null)
{
if (tile instanceof IInventory)
{
for (ItemStack stack : blockState.getBlock().getDrops(world, blockPos, world.getBlockState(blockPos), 0))
{
ItemStack copyStack = stack.copy();
Utils.insertStackIntoInventory(copyStack, (IInventory) tile, EnumFacing.DOWN);
if (copyStack.stackSize > 0)
Utils.insertStackIntoTile(copyStack, tile, EnumFacing.DOWN);
if (!copyStack.isEmpty())
{
world.spawnEntityInWorld(new EntityItem(world, blockPos.getX() + 0.4, blockPos.getY() + 2, blockPos.getZ() + 0.4, copyStack));
world.spawnEntity(new EntityItem(world, blockPos.getX() + 0.4, blockPos.getY() + 2, blockPos.getZ() + 0.4, copyStack));
}
}
}

View file

@ -123,7 +123,7 @@ public class RitualForsakenSoul extends Ritual
{
if (entity.isEntityAlive() && !(entity instanceof EntityPlayer))
{
if (entity.attackEntityFrom(DamageSource.outOfWorld, 1))
if (entity.attackEntityFrom(DamageSource.OUT_OF_WORLD, 1))
{
if (!entity.isEntityAlive())
{

View file

@ -67,7 +67,7 @@ public class RitualFullStomach extends Ritual
for (int i = lastSlot; i < inventory.getSizeInventory(); i++)
{
ItemStack stack = inventory.getStackInSlot(i);
if (stack != null && stack.getItem() instanceof ItemFood)
if (!stack.isEmpty() && stack.getItem() instanceof ItemFood)
{
ItemFood foodItem = (ItemFood) stack.getItem();

View file

@ -42,30 +42,27 @@ public class RitualJumping extends Ritual
AreaDescriptor jumpRange = getBlockRange(JUMP_RANGE);
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, jumpRange.getAABB(masterRitualStone.getBlockPos()));
if (entities != null)
for (EntityLivingBase entity : entities)
{
for (EntityLivingBase entity : entities)
if (totalEffects >= maxEffects)
{
if (totalEffects >= maxEffects)
{
break;
}
break;
}
double motionY = 1.5;
double motionY = 1.5;
entity.fallDistance = 0;
if (entity.isSneaking())
{
continue;
}
entity.fallDistance = 0;
if (entity.isSneaking())
{
continue;
}
entity.motionY = motionY;
totalEffects++;
entity.motionY = motionY;
totalEffects++;
if (entity instanceof EntityPlayer)
{
Utils.setPlayerSpeedFromServer((EntityPlayer) entity, entity.motionX, entity.motionY, entity.motionZ);
}
if (entity instanceof EntityPlayer)
{
Utils.setPlayerSpeedFromServer((EntityPlayer) entity, entity.motionX, entity.motionY, entity.motionZ);
}
}

View file

@ -9,6 +9,7 @@ import net.minecraft.block.BlockOre;
import net.minecraft.block.BlockRedstoneOre;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
@ -50,7 +51,7 @@ public class RitualMagnetic extends Ritual
if (block instanceof BlockOre || block instanceof BlockRedstoneOre)
return true;
if (Item.getItemFromBlock(block) == null)
if (Item.getItemFromBlock(block) == Items.AIR)
return false;
BlockStack type = new BlockStack(block, meta);
@ -71,7 +72,7 @@ public class RitualMagnetic extends Ritual
public static boolean isBlockOre(ItemStack stack)
{
if (stack == null)
if (stack.isEmpty())
{
return false;
}

View file

@ -65,7 +65,7 @@ public class RitualMeteor extends Ritual
{
EntityMeteor meteor = new EntityMeteor(world, pos.getX(), 260, pos.getZ(), 0, -0.1, 0, radiusModifier, explosionModifier, fillerChance);
meteor.setMeteorStack(stack.copy());
world.spawnEntityInWorld(meteor);
world.spawnEntity(meteor);
entityItem.setDead();

View file

@ -49,32 +49,32 @@ public class RitualPlacer extends Ritual
}
AreaDescriptor areaDescriptor = getBlockRange(PLACER_RANGE);
IInventory iInventory;
IInventory inventory;
if (tileEntity != null)
{
// Using the new Forge inventory system
if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN))
{
IItemHandler iItemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN);
IItemHandler itemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN);
if (iItemHandler.getSlots() <= 0)
if (itemHandler.getSlots() <= 0)
{
return;
}
for (BlockPos blockPos : areaDescriptor.getContainedPositions(masterRitualStone.getBlockPos()))
{
for (int inv = 0; inv < iItemHandler.getSlots(); inv++)
for (int inv = 0; inv < itemHandler.getSlots(); inv++)
{
if (world.getBlockState(blockPos).getBlock().isReplaceable(world, blockPos) && iItemHandler.getStackInSlot(inv) != null && iItemHandler.getStackInSlot(inv).stackSize != 0)
if (world.getBlockState(blockPos).getBlock().isReplaceable(world, blockPos) && !itemHandler.getStackInSlot(inv).isEmpty())
{
if (iItemHandler.getStackInSlot(inv).getItem() instanceof ItemBlock && world.getBlockState(blockPos.down()) != null)
if (itemHandler.getStackInSlot(inv).getItem() instanceof ItemBlock && world.isAirBlock(blockPos.down()))
{
if (iItemHandler.extractItem(inv, 1, true) != null)
if (!itemHandler.extractItem(inv, 1, true).isEmpty())
{
world.setBlockState(blockPos, Block.getBlockFromItem(iItemHandler.getStackInSlot(inv).getItem()).getStateFromMeta(iItemHandler.getStackInSlot(inv).getItemDamage()));
iItemHandler.extractItem(inv, 1, false);
world.setBlockState(blockPos, Block.getBlockFromItem(itemHandler.getStackInSlot(inv).getItem()).getStateFromMeta(itemHandler.getStackInSlot(inv).getItemDamage()));
itemHandler.extractItem(inv, 1, false);
tileEntity.markDirty();
network.syphon(getRefreshCost());
}
@ -85,24 +85,24 @@ public class RitualPlacer extends Ritual
//Compatibility with the old system, as it still exists
} else if (tileEntity instanceof IInventory)
{
iInventory = (IInventory) tileEntity;
inventory = (IInventory) tileEntity;
if (iInventory.getSizeInventory() <= 0)
if (inventory.getSizeInventory() <= 0)
{
return;
}
for (BlockPos blockPos : areaDescriptor.getContainedPositions(masterRitualStone.getBlockPos()))
{
for (int inv = 0; inv < iInventory.getSizeInventory(); inv++)
for (int inv = 0; inv < inventory.getSizeInventory(); inv++)
{
if (world.getBlockState(blockPos).getBlock().isReplaceable(world, blockPos) && iInventory.getStackInSlot(inv) != null && iInventory.getStackInSlot(inv).stackSize != 0)
if (world.getBlockState(blockPos).getBlock().isReplaceable(world, blockPos) && !inventory.getStackInSlot(inv).isEmpty())
{
if (iInventory.getStackInSlot(inv).getItem() instanceof ItemBlock && world.getBlockState(blockPos.down()) != null)
if (inventory.getStackInSlot(inv).getItem() instanceof ItemBlock && world.isAirBlock(blockPos.down()))
{
world.setBlockState(blockPos, Block.getBlockFromItem(iInventory.getStackInSlot(inv).getItem()).getStateFromMeta(iInventory.getStackInSlot(inv).getItemDamage()));
iInventory.decrStackSize(inv, 1);
iInventory.markDirty();
world.setBlockState(blockPos, Block.getBlockFromItem(inventory.getStackInSlot(inv).getItem()).getStateFromMeta(inventory.getStackInSlot(inv).getItemDamage()));
inventory.decrStackSize(inv, 1);
inventory.markDirty();
network.syphon(getRefreshCost());
break;
}

View file

@ -109,13 +109,10 @@ public class RitualPortal extends Ritual
}
}
if (LocationsHandler.getLocationsHandler() != null)
if (LocationsHandler.getLocationsHandler().addLocation(name, new PortalLocation(x, y + 1, z, world.provider.getDimension())))
{
if (LocationsHandler.getLocationsHandler().addLocation(name, new PortalLocation(x, y + 1, z, world.provider.getDimension())))
{
portalRitualTag.setString(PORTAL_ID_TAG, name);
return true;
}
portalRitualTag.setString(PORTAL_ID_TAG, name);
return true;
}
}
return false;
@ -191,10 +188,7 @@ public class RitualPortal extends Ritual
int z = masterRitualStone.getBlockPos().getZ();
EnumFacing direction = masterRitualStone.getDirection();
if (LocationsHandler.getLocationsHandler() != null)
{
LocationsHandler.getLocationsHandler().removeLocation(portalRitualTag.getString(PORTAL_ID_TAG), new PortalLocation(x, y + 1, z, world.provider.getDimension()));
}
LocationsHandler.getLocationsHandler().removeLocation(portalRitualTag.getString(PORTAL_ID_TAG), new PortalLocation(x, y + 1, z, world.provider.getDimension()));
if (direction == EnumFacing.NORTH || direction == EnumFacing.SOUTH)
{

View file

@ -11,7 +11,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler;
import java.util.ArrayList;
import java.util.Iterator;
@ -49,14 +50,17 @@ public class RitualPump extends Ritual
return;
}
if (tileEntity != null && tileEntity instanceof IFluidHandler)
if (tileEntity != null && tileEntity.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, EnumFacing.DOWN))
{
IFluidHandler fluidHandler = (IFluidHandler) tileEntity;
IFluidHandler fluidHandler = tileEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, EnumFacing.DOWN);
if (!cached || liquidsCache.isEmpty())
{
if (fluidHandler.drain(EnumFacing.DOWN, 1000, false) != null)
if (fluidHandler.drain(1000, false) != null)
{
FluidStack fluidStack = fluidHandler.drain(EnumFacing.DOWN, 1000, false);
FluidStack fluidStack = fluidHandler.drain(1000, false);
if (fluidStack == null)
return;
for (BlockPos blockPos : getBlockRange(PUMP_RANGE).getContainedPositions(masterRitualStone.getBlockPos()))
{
if (!liquidsCache.contains(blockPos))
@ -77,7 +81,7 @@ public class RitualPump extends Ritual
{
network.syphon(getRefreshCost());
currentPos = blockPosIterator.next();
fluidHandler.fill(EnumFacing.DOWN, fluidHandler.drain(EnumFacing.DOWN, 1000, false), true);
fluidHandler.fill(fluidHandler.drain(1000, false), true);
world.setBlockState(currentPos, Blocks.STONE.getDefaultState());
blockPosIterator.remove();
}

View file

@ -79,7 +79,7 @@ public class RitualUpgradeRemove extends Ritual
if (successful)
{
removedUpgrade = true;
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, upgradeStack));
world.spawnEntity(new EntityItem(world, player.posX, player.posY, player.posZ, upgradeStack));
for (Entry<String, StatTracker> trackerEntry : armour.trackerMap.entrySet())
{
StatTracker tracker = trackerEntry.getValue();
@ -102,7 +102,7 @@ public class RitualUpgradeRemove extends Ritual
masterRitualStone.setActive(false);
world.spawnEntityInWorld(new EntityLightningBolt(world, pos.getX(), pos.getY() - 1, pos.getZ(), true));
world.spawnEntity(new EntityLightningBolt(world, pos.getX(), pos.getY() - 1, pos.getZ(), true));
}
}

View file

@ -97,7 +97,7 @@ public class RitualWellOfSuffering extends Ritual
if (entity.isEntityAlive() && !(entity instanceof EntityPlayer))
{
if (entity.attackEntityFrom(DamageSource.outOfWorld, 1))
if (entity.attackEntityFrom(DamageSource.OUT_OF_WORLD, 1))
{
String entityName = entity.getClass().getSimpleName();

View file

@ -43,7 +43,6 @@ public class RitualZephyr extends Ritual
BlockPos masterPos = masterRitualStone.getBlockPos();
AreaDescriptor chestRange = getBlockRange(CHEST_RANGE);
TileEntity tileInventory = world.getTileEntity(chestRange.getContainedPositions(masterPos).get(0));
if (!masterRitualStone.getWorldObj().isRemote && tileInventory != null)
{
if (currentEssence < getRefreshCost())
@ -57,32 +56,29 @@ public class RitualZephyr extends Ritual
List<EntityItem> itemList = world.getEntitiesWithinAABB(EntityItem.class, zephyrRange.getAABB(masterRitualStone.getBlockPos()));
int count = 0;
if (itemList != null)
for (EntityItem entityItem : itemList)
{
for (EntityItem entityItem : itemList)
if (entityItem.isDead)
{
if (entityItem.isDead)
{
continue;
}
continue;
}
ItemStack copyStack = entityItem.getEntityItem().copy();
int originalAmount = copyStack.stackSize;
ItemStack newStack = Utils.insertStackIntoTile(copyStack, tileInventory, EnumFacing.DOWN);
ItemStack copyStack = entityItem.getEntityItem().copy();
int originalAmount = copyStack.getCount();
ItemStack newStack = Utils.insertStackIntoTile(copyStack, tileInventory, EnumFacing.DOWN);
if (newStack != null && newStack.stackSize < originalAmount)
{
count++;
if (newStack.stackSize <= 0)
entityItem.setDead();
entityItem.getEntityItem().stackSize = newStack.stackSize;
}
if (newStack == null)
{
if (!newStack.isEmpty() && newStack.getCount() < originalAmount)
{
count++;
if (newStack.isEmpty())
entityItem.setDead();
}
entityItem.getEntityItem().setCount(newStack.getCount());
}
if (newStack.isEmpty())
{
entityItem.setDead();
}
}

View file

@ -51,8 +51,8 @@ public class HarvestHandlerPlantable implements IHarvestHandler
if (stack.getItem() instanceof IPlantable)
{
if (stack.stackSize > 1)
stack.stackSize--;
if (stack.getCount() > 1)
stack.shrink(1);
else
drops.remove(stack);
@ -70,7 +70,7 @@ public class HarvestHandlerPlantable implements IHarvestHandler
if (!world.isRemote)
{
EntityItem toDrop = new EntityItem(world, pos.getX(), pos.getY() + 0.5, pos.getZ(), stack);
world.spawnEntityInWorld(toDrop);
world.spawnEntity(toDrop);
}
}

View file

@ -61,7 +61,7 @@ public class HarvestHandlerStem implements IHarvestHandler
for (ItemStack drop : drops)
{
EntityItem item = new EntityItem(world, cropPos.getX(), cropPos.getY() + 0.5, cropPos.getZ(), drop);
world.spawnEntityInWorld(item);
world.spawnEntity(item);
}
}

View file

@ -47,7 +47,7 @@ public class HarvestHandlerTall implements IHarvestHandler
for (ItemStack drop : drops)
{
EntityItem item = new EntityItem(world, pos.getX(), pos.getY() + 0.5, pos.getZ(), drop);
world.spawnEntityInWorld(item);
world.spawnEntity(item);
}
}

View file

@ -28,7 +28,7 @@ public class ImperfectRitualZombie extends ImperfectRitual
zombie.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 20000, 3));
if (!imperfectRitualStone.getRitualWorld().isRemote)
imperfectRitualStone.getRitualWorld().spawnEntityInWorld(zombie);
imperfectRitualStone.getRitualWorld().spawnEntity(zombie);
return true;
}

View file

@ -54,7 +54,7 @@ public class Teleports
return;
if (teleposer)
if (MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent(entity, entity.worldObj, entity.getPosition(), entity.worldObj, new BlockPos(x, y, z))))
if (MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent(entity, entity.getEntityWorld(), entity.getPosition(), entity.getEntityWorld(), new BlockPos(x, y, z))))
return;
network.syphon(getTeleportCost());
@ -62,13 +62,13 @@ public class Teleports
EntityPlayerMP player = (EntityPlayerMP) entity;
player.setPositionAndUpdate(x + 0.5, y + 0.5, z + 0.5);
player.worldObj.updateEntityWithOptionalForce(player, false);
player.getEntityWorld().updateEntityWithOptionalForce(player, false);
player.connection.sendPacket(new SPacketUpdateHealth(player.getHealth(), player.getFoodStats().getFoodLevel(), player.getFoodStats().getSaturationLevel()));
player.timeUntilPortal = 150;
player.worldObj.playSound(x, y, z, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.AMBIENT, 1.0F, 1.0F, false);
player.getEntityWorld().playSound(x, y, z, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.AMBIENT, 1.0F, 1.0F, false);
if (teleposer)
MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent.Post(entity, entity.worldObj, entity.getPosition(), entity.worldObj, new BlockPos(x, y, z)));
MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent.Post(entity, entity.getEntityWorld(), entity.getPosition(), entity.getEntityWorld(), new BlockPos(x, y, z)));
} else
{
SoulNetwork network = NetworkHelper.getSoulNetwork(networkToDrain);
@ -76,20 +76,20 @@ public class Teleports
return;
if (teleposer)
if (MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent(entity, entity.worldObj, entity.getPosition(), entity.worldObj, new BlockPos(x, y, z))))
if (MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent(entity, entity.getEntityWorld(), entity.getPosition(), entity.getEntityWorld(), new BlockPos(x, y, z))))
return;
network.syphon(getTeleportCost() / 10);
WorldServer world = (WorldServer) entity.worldObj;
WorldServer world = (WorldServer) entity.getEntityWorld();
entity.setPosition(x + 0.5, y + 0.5, z + 0.5);
entity.timeUntilPortal = 150;
world.resetUpdateEntityTick();
entity.worldObj.playSound(x, y, z, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.AMBIENT, 1.0F, 1.0F, false);
entity.getEntityWorld().playSound(x, y, z, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.AMBIENT, 1.0F, 1.0F, false);
if (teleposer)
MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent.Post(entity, entity.worldObj, entity.getPosition(), entity.worldObj, new BlockPos(x, y, z)));
MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent.Post(entity, entity.getEntityWorld(), entity.getPosition(), entity.getEntityWorld(), new BlockPos(x, y, z)));
}
}
}
@ -137,14 +137,14 @@ public class Teleports
{
EntityPlayerMP player = (EntityPlayerMP) entity;
if (!player.worldObj.isRemote)
if (!player.getEntityWorld().isRemote)
{
SoulNetwork network = NetworkHelper.getSoulNetwork(networkToDrain);
if (network.getCurrentEssence() < getTeleportCost())
return;
if (teleposer)
if (MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent(entity, entity.worldObj, entity.getPosition(), newWorldServer, new BlockPos(x, y, z))))
if (MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent(entity, entity.getEntityWorld(), entity.getPosition(), newWorldServer, new BlockPos(x, y, z))))
return;
network.syphon(getTeleportCost());
@ -152,20 +152,20 @@ public class Teleports
player.changeDimension(newWorldID); //TODO: UNTESTED
// server.getConfigurationManager().transferPlayerToDimension(player, newWorldID, new TeleporterBloodMagic(newWorldServer));
player.setPositionAndUpdate(x + 0.5, y + 0.5, z + 0.5);
player.worldObj.updateEntityWithOptionalForce(player, false);
player.getEntityWorld().updateEntityWithOptionalForce(player, false);
player.connection.sendPacket(new SPacketUpdateHealth(player.getHealth(), player.getFoodStats().getFoodLevel(), player.getFoodStats().getSaturationLevel()));
if (teleposer)
MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent.Post(entity, entity.worldObj, entity.getPosition(), newWorldServer, new BlockPos(x, y, z)));
MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent.Post(entity, entity.getEntityWorld(), entity.getPosition(), newWorldServer, new BlockPos(x, y, z)));
}
} else if (!entity.worldObj.isRemote)
} else if (!entity.getEntityWorld().isRemote)
{
SoulNetwork network = NetworkHelper.getSoulNetwork(networkToDrain);
if (network.getCurrentEssence() < (getTeleportCost() / 10))
return;
if (teleposer)
if (MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent(entity, entity.worldObj, entity.getPosition(), newWorldServer, new BlockPos(x, y, z))))
if (MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent(entity, entity.getEntityWorld(), entity.getPosition(), newWorldServer, new BlockPos(x, y, z))))
return;
network.syphon(getTeleportCost() / 10);
@ -181,7 +181,7 @@ public class Teleports
{
teleportedEntity.setLocationAndAngles(x + 0.5, y + 0.5, z + 0.5, entity.rotationYaw, entity.rotationPitch);
teleportedEntity.forceSpawn = true;
newWorldServer.spawnEntityInWorld(teleportedEntity);
newWorldServer.spawnEntity(teleportedEntity);
teleportedEntity.setWorld(newWorldServer);
teleportedEntity.timeUntilPortal = teleportedEntity instanceof EntityPlayer ? 150 : 20;
}
@ -189,7 +189,7 @@ public class Teleports
oldWorldServer.resetUpdateEntityTick();
newWorldServer.resetUpdateEntityTick();
if (teleposer)
MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent.Post(entity, entity.worldObj, entity.getPosition(), newWorldServer, new BlockPos(x, y, z)));
MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent.Post(entity, entity.getEntityWorld(), entity.getPosition(), newWorldServer, new BlockPos(x, y, z)));
}
entity.timeUntilPortal = entity instanceof EntityLiving ? 150 : 20;
newWorldServer.playSound(x, y, z, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.AMBIENT, 1.0F, 1.0F, false);