Update mappings

This commit is contained in:
Nicholas Ignoffo 2017-02-04 22:43:18 -08:00
parent 7b21439a03
commit 85a8a12a6f
185 changed files with 825 additions and 1273 deletions

View file

@ -189,7 +189,7 @@ public class AlchemyArrayEffectAttractor extends AlchemyArrayEffect
{ {
if (ent instanceof EntitySlime) if (ent instanceof EntitySlime)
{ {
ent.faceEntity(getTarget(ent.worldObj, pos), 10.0F, 20.0F); ent.faceEntity(getTarget(ent.getEntityWorld(), pos), 10.0F, 20.0F);
} else if (ent instanceof EntitySilverfish) } else if (ent instanceof EntitySilverfish)
{ {
if (counter < 10) if (counter < 10)
@ -197,7 +197,7 @@ public class AlchemyArrayEffectAttractor extends AlchemyArrayEffect
return; return;
} }
EntitySilverfish sf = (EntitySilverfish) ent; EntitySilverfish sf = (EntitySilverfish) ent;
Path pathentity = getPathEntityToEntity(ent, getTarget(ent.worldObj, pos), getRange()); Path pathentity = getPathEntityToEntity(ent, getTarget(ent.getEntityWorld(), pos), getRange());
sf.getNavigator().setPath(pathentity, sf.getAIMoveSpeed()); sf.getNavigator().setPath(pathentity, sf.getAIMoveSpeed());
} else if (ent instanceof EntityBlaze) } else if (ent instanceof EntityBlaze)
{ {
@ -221,7 +221,7 @@ public class AlchemyArrayEffectAttractor extends AlchemyArrayEffect
// ent.setAttackTarget(target); // ent.setAttackTarget(target);
} else if (ent instanceof EntityEnderman) } else if (ent instanceof EntityEnderman)
{ {
((EntityEnderman) ent).setAttackTarget(getTarget(ent.worldObj, pos)); ((EntityEnderman) ent).setAttackTarget(getTarget(ent.getEntityWorld(), pos));
} }
} }
@ -234,7 +234,7 @@ public class AlchemyArrayEffectAttractor extends AlchemyArrayEffect
if (distance > 2) if (distance > 2)
{ {
EntityMob mod = (EntityMob) ent; EntityMob mod = (EntityMob) ent;
mod.faceEntity(getTarget(ent.worldObj, pos), 180, 0); mod.faceEntity(getTarget(ent.getEntityWorld(), pos), 180, 0);
mod.moveEntityWithHeading(0, 0.3f); mod.moveEntityWithHeading(0, 0.3f);
if (mod.posY < pos.getY()) if (mod.posY < pos.getY())
{ {
@ -248,12 +248,12 @@ public class AlchemyArrayEffectAttractor extends AlchemyArrayEffect
public Path getPathEntityToEntity(Entity entity, Entity targetEntity, float range) public Path getPathEntityToEntity(Entity entity, Entity targetEntity, float range)
{ {
int targX = MathHelper.floor_double(targetEntity.posX); int targX = MathHelper.floor(targetEntity.posX);
int targY = MathHelper.floor_double(targetEntity.posY + 1.0D); int targY = MathHelper.floor(targetEntity.posY + 1.0D);
int targZ = MathHelper.floor_double(targetEntity.posZ); int targZ = MathHelper.floor(targetEntity.posZ);
PathFinder pf = new PathFinder(new WalkNodeProcessor()); PathFinder pf = new PathFinder(new WalkNodeProcessor());
return pf.findPath(targetEntity.worldObj, (EntityLiving) entity, new BlockPos(targX, targY, targZ), range); return pf.findPath(targetEntity.getEntityWorld(), (EntityLiving) entity, new BlockPos(targX, targY, targZ), range);
} }
private boolean trackMob(BlockPos pos, EntityLiving ent) private boolean trackMob(BlockPos pos, EntityLiving ent)
@ -261,7 +261,7 @@ public class AlchemyArrayEffectAttractor extends AlchemyArrayEffect
//TODO: Figure out if this crud is needed //TODO: Figure out if this crud is needed
if (useSetTarget(ent)) if (useSetTarget(ent))
{ {
((EntityMob) ent).setAttackTarget(getTarget(ent.worldObj, pos)); ((EntityMob) ent).setAttackTarget(getTarget(ent.getEntityWorld(), pos));
return true; return true;
} else if (useSpecialCase(ent)) } else if (useSpecialCase(ent))
{ {
@ -328,7 +328,7 @@ public class AlchemyArrayEffectAttractor extends AlchemyArrayEffect
} }
cancelCurrentTasks(ent); cancelCurrentTasks(ent);
ent.tasks.addTask(0, new AttractTask(ent, getTarget(ent.worldObj, pos), pos)); ent.tasks.addTask(0, new AttractTask(ent, getTarget(ent.getEntityWorld(), pos), pos));
return true; return true;
} }
@ -364,13 +364,13 @@ public class AlchemyArrayEffectAttractor extends AlchemyArrayEffect
{ {
if (ent instanceof EntitySlime) if (ent instanceof EntitySlime)
{ {
ent.faceEntity(getTarget(ent.worldObj, pos), 10.0F, 20.0F); ent.faceEntity(getTarget(ent.getEntityWorld(), pos), 10.0F, 20.0F);
// ent.setAttackTarget(getTarget(ent.worldObj, pos)); // ent.setAttackTarget(getTarget(ent.getEntityWorld(), pos));
return true; return true;
} else if (ent instanceof EntitySilverfish) } else if (ent instanceof EntitySilverfish)
{ {
EntitySilverfish es = (EntitySilverfish) ent; EntitySilverfish es = (EntitySilverfish) ent;
Path pathentity = getPathEntityToEntity(ent, getTarget(ent.worldObj, pos), getRange()); Path pathentity = getPathEntityToEntity(ent, getTarget(ent.getEntityWorld(), pos), getRange());
es.getNavigator().setPath(pathentity, es.getAIMoveSpeed()); es.getNavigator().setPath(pathentity, es.getAIMoveSpeed());
return true; return true;
} else if (ent instanceof EntityBlaze) } else if (ent instanceof EntityBlaze)
@ -439,7 +439,7 @@ public class AlchemyArrayEffectAttractor extends AlchemyArrayEffect
{ {
boolean res = false; boolean res = false;
//TODO: //TODO:
TileEntity te = mob.worldObj.getTileEntity(coord); TileEntity te = mob.getEntityWorld().getTileEntity(coord);
if (te instanceof TileAlchemyArray) if (te instanceof TileAlchemyArray)
{ {
res = true; res = true;

View file

@ -40,7 +40,7 @@ public class AlchemyArrayEffectBinding extends AlchemyArrayEffectCrafting
ItemStack output = outputStack.copy(); ItemStack output = outputStack.copy();
EntityItem outputEntity = new EntityItem(tile.getWorld(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, output); EntityItem outputEntity = new EntityItem(tile.getWorld(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, output);
tile.getWorld().spawnEntityInWorld(outputEntity); tile.getWorld().spawnEntity(outputEntity);
return true; return true;
} }
@ -60,7 +60,7 @@ public class AlchemyArrayEffectBinding extends AlchemyArrayEffectCrafting
double dispZ = -distance * Math.cos(angle); double dispZ = -distance * Math.cos(angle);
EntityLightningBolt lightning = new EntityLightningBolt(world, pos.getX() + dispX, pos.getY(), pos.getZ() + dispZ, true); EntityLightningBolt lightning = new EntityLightningBolt(world, pos.getX() + dispX, pos.getY(), pos.getZ() + dispZ, true);
world.spawnEntityInWorld(lightning); world.spawnEntity(lightning);
} }
} }

View file

@ -170,7 +170,7 @@ public class AlchemyArrayEffectSkeletonTurret extends AlchemyArrayEffect
{ {
boolean res = false; boolean res = false;
//TODO: //TODO:
TileEntity te = mob.worldObj.getTileEntity(coord); TileEntity te = mob.getEntityWorld().getTileEntity(coord);
if (te instanceof TileAlchemyArray) if (te instanceof TileAlchemyArray)
{ {
res = true; res = true;

View file

@ -47,7 +47,7 @@ public class AlchemyArrayEffectCrafting extends AlchemyArrayEffect
EntityItem outputEntity = new EntityItem(tile.getWorld(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, output); EntityItem outputEntity = new EntityItem(tile.getWorld(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, output);
tile.getWorld().spawnEntityInWorld(outputEntity); tile.getWorld().spawnEntity(outputEntity);
return true; return true;
} }

View file

@ -70,13 +70,13 @@ public class SoulNetwork extends WorldSavedData
if (FMLCommonHandler.instance().getMinecraftServerInstance() == null) if (FMLCommonHandler.instance().getMinecraftServerInstance() == null)
return 0; return 0;
World world = FMLCommonHandler.instance().getMinecraftServerInstance().worldServers[0]; World world = FMLCommonHandler.instance().getMinecraftServerInstance().worlds[0];
SoulNetwork data = (SoulNetwork) world.loadItemData(SoulNetwork.class, event.ownerNetwork); SoulNetwork data = (SoulNetwork) world.loadData(SoulNetwork.class, event.ownerNetwork);
if (data == null) if (data == null)
{ {
data = new SoulNetwork(event.ownerNetwork); data = new SoulNetwork(event.ownerNetwork);
world.setItemData(event.ownerNetwork, data); world.setData(event.ownerNetwork, data);
} }
int currEss = data.getCurrentEssence(); int currEss = data.getCurrentEssence();
@ -129,7 +129,7 @@ public class SoulNetwork extends WorldSavedData
{ {
if (user != null) if (user != null)
{ {
if (user.worldObj.isRemote) if (user.getEntityWorld().isRemote)
return false; return false;
if (!Strings.isNullOrEmpty(mapName)) if (!Strings.isNullOrEmpty(mapName))

View file

@ -78,7 +78,7 @@ public class SoulNetwork implements INBTSerializable<NBTTagCompound>
{ {
if (user != null) if (user != null)
{ {
if (user.worldObj.isRemote) if (user.getEntityWorld().isRemote)
return false; return false;
if (!Strings.isNullOrEmpty(playerId.toString())) if (!Strings.isNullOrEmpty(playerId.toString()))

View file

@ -33,6 +33,6 @@ public class TeleporterBloodMagic extends Teleporter
@Override @Override
public void placeInPortal(Entity entity, float rotationYaw) public void placeInPortal(Entity entity, float rotationYaw)
{ {
entity.setLocationAndAngles(MathHelper.floor_double(entity.posX), MathHelper.floor_double(entity.posY) + 2, MathHelper.floor_double(entity.posZ), entity.rotationYaw, entity.rotationPitch); entity.setLocationAndAngles(MathHelper.floor(entity.posX), MathHelper.floor(entity.posY) + 2, MathHelper.floor(entity.posZ), entity.rotationYaw, entity.rotationPitch);
} }
} }

View file

@ -26,7 +26,7 @@ public class PlayerHelper
public static String getUsernameFromPlayer(EntityPlayer player) public static String getUsernameFromPlayer(EntityPlayer player)
{ {
return player.worldObj.isRemote ? "" : UsernameCache.getLastKnownUsername(getUUIDFromPlayer(player)); return player.getEntityWorld().isRemote ? "" : UsernameCache.getLastKnownUsername(getUUIDFromPlayer(player));
} }
public static EntityPlayer getPlayerFromUsername(String username) public static EntityPlayer getPlayerFromUsername(String username)

View file

@ -81,7 +81,7 @@ public class BlockAlchemyArray extends BlockContainer
} }
@Override @Override
public boolean isVisuallyOpaque() public boolean causesSuffocation()
{ {
return false; return false;
} }

View file

@ -60,7 +60,7 @@ public class BlockAlchemyTable extends BlockContainer
} }
@Override @Override
public boolean isVisuallyOpaque() public boolean causesSuffocation()
{ {
return false; return false;
} }
@ -107,7 +107,7 @@ public class BlockAlchemyTable extends BlockContainer
@Override @Override
protected BlockStateContainer createBlockState() protected BlockStateContainer createBlockState()
{ {
return new BlockStateContainer(this, new IProperty[] { DIRECTION, INVISIBLE }); return new BlockStateContainer(this, DIRECTION, INVISIBLE);
} }
@Override @Override

View file

@ -119,7 +119,7 @@ public class BlockAltar extends BlockContainer implements IVariantProvider, IDoc
} }
@Override @Override
public boolean isVisuallyOpaque() public boolean causesSuffocation()
{ {
return false; return false;
} }

View file

@ -70,7 +70,7 @@ public class BlockBloodLight extends Block
} }
@Override @Override
public boolean isVisuallyOpaque() public boolean causesSuffocation()
{ {
return false; return false;
} }
@ -97,7 +97,7 @@ public class BlockBloodLight extends Block
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand)
{ {
EntityPlayerSP playerSP = Minecraft.getMinecraft().thePlayer; EntityPlayerSP playerSP = Minecraft.getMinecraft().player;
if (rand.nextInt(3) != 0) if (rand.nextInt(3) != 0)
{ {

View file

@ -55,7 +55,7 @@ public class BlockDemonCrucible extends BlockContainer implements IVariantProvid
} }
@Override @Override
public boolean isVisuallyOpaque() public boolean causesSuffocation()
{ {
return false; return false;
} }

View file

@ -112,7 +112,7 @@ public class BlockDemonCrystal extends BlockContainer
} }
@Override @Override
public boolean isVisuallyOpaque() public boolean causesSuffocation()
{ {
return false; return false;
} }

View file

@ -61,7 +61,7 @@ public class BlockDemonCrystallizer extends BlockContainer implements IVariantPr
} }
@Override @Override
public boolean isVisuallyOpaque() public boolean causesSuffocation()
{ {
return false; return false;
} }

View file

@ -54,7 +54,7 @@ public class BlockDemonPylon extends BlockContainer implements IVariantProvider
} }
@Override @Override
public boolean isVisuallyOpaque() public boolean causesSuffocation()
{ {
return false; return false;
} }

View file

@ -58,7 +58,7 @@ public class BlockDimensionalPortal extends BlockIntegerContainer
} }
@Override @Override
public boolean isVisuallyOpaque() public boolean causesSuffocation()
{ {
return false; return false;
} }

View file

@ -61,7 +61,7 @@ public class BlockIncenseAltar extends BlockContainer implements IVariantProvide
} }
@Override @Override
public boolean isVisuallyOpaque() public boolean causesSuffocation()
{ {
return false; return false;
} }

View file

@ -77,7 +77,7 @@ public class BlockInversionPillar extends BlockEnumContainer<EnumSubWillType> im
} }
@Override @Override
public boolean isVisuallyOpaque() public boolean causesSuffocation()
{ {
return false; return false;
} }

View file

@ -52,7 +52,7 @@ public class BlockInversionPillarEnd extends BlockEnum<EnumInversionCap> impleme
} }
@Override @Override
public boolean isVisuallyOpaque() public boolean causesSuffocation()
{ {
return false; return false;
} }

View file

@ -196,7 +196,7 @@ public class BlockMimic extends BlockEnumContainer<EnumMimic> implements IVarian
} }
@Override @Override
public boolean isVisuallyOpaque() public boolean causesSuffocation()
{ {
return false; return false;
} }

View file

@ -54,7 +54,7 @@ public class BlockPhantom extends BlockContainer implements IVariantProvider
} }
@Override @Override
public boolean isVisuallyOpaque() public boolean causesSuffocation()
{ {
return false; return false;
} }

View file

@ -72,7 +72,7 @@ public abstract class BlockRoutingNode extends BlockContainer
} }
@Override @Override
public boolean isVisuallyOpaque() public boolean causesSuffocation()
{ {
return false; return false;
} }

View file

@ -67,7 +67,7 @@ public class BlockSoulForge extends BlockContainer implements IVariantProvider
} }
@Override @Override
public boolean isVisuallyOpaque() public boolean causesSuffocation()
{ {
return false; return false;
} }

View file

@ -63,7 +63,7 @@ public class BlockSpectral extends BlockContainer implements IVariantProvider
} }
@Override @Override
public boolean isVisuallyOpaque() public boolean causesSuffocation()
{ {
return false; return false;
} }

View file

@ -122,15 +122,15 @@ public class BlockEnumPillar<E extends Enum<E> & IStringSerializable> extends Bl
} }
@Override @Override
protected ItemStack createStackedBlock(IBlockState state) protected ItemStack getSilkTouchDrop(IBlockState state)
{ {
return new ItemStack(this, 1, damageDropped(state)); return new ItemStack(this, 1, damageDropped(state));
} }
@Override @Override
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, ItemStack stack)
{ {
return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(BlockRotatedPillar.AXIS, facing.getAxis()); return super.getStateForPlacement(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer, stack).withProperty(BlockRotatedPillar.AXIS, facing.getAxis());
} }
@Override @Override

View file

@ -70,15 +70,15 @@ public class BlockEnumPillarCap<E extends Enum<E> & IStringSerializable> extends
} }
@Override @Override
protected ItemStack createStackedBlock(IBlockState state) protected ItemStack getSilkTouchDrop(IBlockState state)
{ {
return new ItemStack(this, 1, damageDropped(state)); return new ItemStack(this, 1, damageDropped(state));
} }
@Override @Override
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, ItemStack stack)
{ {
return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(FACING, facing); return super.getStateForPlacement(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer, stack).withProperty(FACING, facing);
} }
@Override @Override

View file

@ -172,9 +172,9 @@ public class BlockEnumStairs<E extends Enum<E> & IStringSerializable> extends Bl
} }
@Override @Override
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, ItemStack stack)
{ {
IBlockState state = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer); IBlockState state = super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, stack);
state = state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(BlockStairs.SHAPE, BlockStairs.EnumShape.STRAIGHT); state = state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(BlockStairs.SHAPE, BlockStairs.EnumShape.STRAIGHT);
return facing != EnumFacing.DOWN && (facing == EnumFacing.UP || (double) hitY <= 0.5D) ? state.withProperty(BlockStairs.HALF, BlockStairs.EnumHalf.BOTTOM) : state.withProperty(BlockStairs.HALF, BlockStairs.EnumHalf.TOP); return facing != EnumFacing.DOWN && (facing == EnumFacing.UP || (double) hitY <= 0.5D) ? state.withProperty(BlockStairs.HALF, BlockStairs.EnumHalf.BOTTOM) : state.withProperty(BlockStairs.HALF, BlockStairs.EnumHalf.TOP);
} }
@ -349,7 +349,7 @@ public class BlockEnumStairs<E extends Enum<E> & IStringSerializable> extends Bl
} }
@Override @Override
protected ItemStack createStackedBlock(IBlockState state) protected ItemStack getSilkTouchDrop(IBlockState state)
{ {
return new ItemStack(this, 1, damageDropped(state)); return new ItemStack(this, 1, damageDropped(state));
} }

View file

@ -129,7 +129,7 @@ public class BlockEnumWall<E extends Enum<E> & IStringSerializable> extends Bloc
} }
@Override @Override
protected ItemStack createStackedBlock(IBlockState state) protected ItemStack getSilkTouchDrop(IBlockState state)
{ {
return new ItemStack(this, 1, damageDropped(state)); return new ItemStack(this, 1, damageDropped(state));
} }

View file

@ -52,7 +52,7 @@ public class GuiAlchemyTable extends GuiContainer
{ {
Slot slot = this.inventorySlots.getSlot(slotId); Slot slot = this.inventorySlots.getSlot(slotId);
this.drawTexturedModalRect(i + slot.xDisplayPosition, j + slot.yDisplayPosition, 195, 1, 16, 16); this.drawTexturedModalRect(i + slot.xPos, j + slot.yPos, 195, 1, 16, 16);
} }
} }
} }

View file

@ -34,7 +34,7 @@ public class HUDElementDemonWillAura extends HUDElement
@Override @Override
public void render(Minecraft minecraft, ScaledResolution resolution, float partialTicks) public void render(Minecraft minecraft, ScaledResolution resolution, float partialTicks)
{ {
EntityPlayer player = minecraft.thePlayer; EntityPlayer player = minecraft.player;
if (!Utils.canPlayerSeeDemonWill(player)) if (!Utils.canPlayerSeeDemonWill(player))
{ {

View file

@ -26,13 +26,13 @@ public class HUDElementHolding extends HUDElement
@Override @Override
public void render(Minecraft minecraft, ScaledResolution resolution, float partialTicks) public void render(Minecraft minecraft, ScaledResolution resolution, float partialTicks)
{ {
ItemStack sigilHolding = minecraft.thePlayer.getHeldItemMainhand(); ItemStack sigilHolding = minecraft.player.getHeldItemMainhand();
// TODO - Clean this mess // TODO - Clean this mess
// Check mainhand for Sigil of Holding // Check mainhand for Sigil of Holding
if (sigilHolding == null) if (sigilHolding == null)
return; return;
if (!(sigilHolding.getItem() == ModItems.SIGIL_HOLDING)) if (!(sigilHolding.getItem() == ModItems.SIGIL_HOLDING))
sigilHolding = minecraft.thePlayer.getHeldItemOffhand(); sigilHolding = minecraft.player.getHeldItemOffhand();
// Check offhand for Sigil of Holding // Check offhand for Sigil of Holding
if (sigilHolding == null) if (sigilHolding == null)
return; return;
@ -54,7 +54,7 @@ public class HUDElementHolding extends HUDElement
{ {
for (ItemStack sigil : holdingInv) for (ItemStack sigil : holdingInv)
{ {
renderHotbarItem(resolution.getScaledWidth() / 2 + 103 + xOffset + getXOffset(), resolution.getScaledHeight() - 18 + getYOffset(), partialTicks, minecraft.thePlayer, sigil); renderHotbarItem(resolution.getScaledWidth() / 2 + 103 + xOffset + getXOffset(), resolution.getScaledHeight() - 18 + getYOffset(), partialTicks, minecraft.player, sigil);
xOffset += 20; xOffset += 20;
} }
} }

View file

@ -27,7 +27,7 @@ public enum KeyBindings
@Override @Override
public void handleKeybind() public void handleKeybind()
{ {
ItemStack itemStack = ClientHandler.minecraft.thePlayer.getHeldItemMainhand(); ItemStack itemStack = ClientHandler.minecraft.player.getHeldItemMainhand();
if (itemStack != null && itemStack.getItem() instanceof IKeybindable) if (itemStack != null && itemStack.getItem() instanceof IKeybindable)
BloodMagicPacketHandler.INSTANCE.sendToServer(new KeyProcessor(this, false)); BloodMagicPacketHandler.INSTANCE.sendToServer(new KeyProcessor(this, false));
} }
@ -38,7 +38,7 @@ public enum KeyBindings
@Override @Override
public void handleKeybind() public void handleKeybind()
{ {
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; EntityPlayerSP player = Minecraft.getMinecraft().player;
if (player.getHeldItemMainhand() != null && player.getHeldItemMainhand().getItem() instanceof ItemSigilHolding) if (player.getHeldItemMainhand() != null && player.getHeldItemMainhand().getItem() instanceof ItemSigilHolding)
ClientHandler.cycleSigil(player.getHeldItemMainhand(), player, -1); ClientHandler.cycleSigil(player.getHeldItemMainhand(), player, -1);
} }
@ -49,7 +49,7 @@ public enum KeyBindings
@Override @Override
public void handleKeybind() public void handleKeybind()
{ {
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; EntityPlayerSP player = Minecraft.getMinecraft().player;
if (player.getHeldItemMainhand() != null && player.getHeldItemMainhand().getItem() instanceof ItemSigilHolding) if (player.getHeldItemMainhand() != null && player.getHeldItemMainhand().getItem() instanceof ItemSigilHolding)
ClientHandler.cycleSigil(player.getHeldItemMainhand(), player, 1); ClientHandler.cycleSigil(player.getHeldItemMainhand(), player, 1);
} }

View file

@ -124,8 +124,8 @@ public class RenderAltar extends TileEntitySpecialRenderer<TileAltar>
private void renderHologram(TileAltar altar, EnumAltarTier tier, float partialTicks) private void renderHologram(TileAltar altar, EnumAltarTier tier, float partialTicks)
{ {
EntityPlayerSP player = mc.thePlayer; EntityPlayerSP player = mc.player;
World world = player.worldObj; World world = player.world;
if (tier == EnumAltarTier.ONE) if (tier == EnumAltarTier.ONE)
return; return;

View file

@ -28,7 +28,7 @@ public class RenderItemRoutingNode extends TileEntitySpecialRenderer<TileRouting
@Override @Override
public void renderTileEntityAt(TileRoutingNode tileNode, double x, double y, double z, float partialTicks, int destroyStage) public void renderTileEntityAt(TileRoutingNode tileNode, double x, double y, double z, float partialTicks, int destroyStage)
{ {
if ((mc.thePlayer.getHeldItemMainhand() != null && mc.thePlayer.getHeldItemMainhand().getItem() instanceof INodeRenderer) || ConfigHandler.alwaysRenderRoutingLines) if ((mc.player.getHeldItemMainhand() != null && mc.player.getHeldItemMainhand().getItem() instanceof INodeRenderer) || ConfigHandler.alwaysRenderRoutingLines)
{ {
List<BlockPos> connectionList = tileNode.getConnected(); List<BlockPos> connectionList = tileNode.getConnected();
for (BlockPos wantedPos : connectionList) for (BlockPos wantedPos : connectionList)
@ -41,7 +41,7 @@ public class RenderItemRoutingNode extends TileEntitySpecialRenderer<TileRouting
int yd = offsetPos.getY(); int yd = offsetPos.getY();
int zd = offsetPos.getZ(); int zd = offsetPos.getZ();
double distance = Math.sqrt(xd * xd + yd * yd + zd * zd); double distance = Math.sqrt(xd * xd + yd * yd + zd * zd);
double subLength = MathHelper.sqrt_double(xd * xd + zd * zd); double subLength = MathHelper.sqrt(xd * xd + zd * zd);
float rotYaw = -((float) (Math.atan2(zd, xd) * 180.0D / Math.PI)); float rotYaw = -((float) (Math.atan2(zd, xd) * 180.0D / Math.PI));
float rotPitch = ((float) (Math.atan2(yd, subLength) * 180.0D / Math.PI)); float rotPitch = ((float) (Math.atan2(yd, subLength) * 180.0D / Math.PI));
@ -55,7 +55,7 @@ public class RenderItemRoutingNode extends TileEntitySpecialRenderer<TileRouting
GlStateManager.disableLighting(); GlStateManager.disableLighting();
GlStateManager.disableCull(); GlStateManager.disableCull();
float f2 = 0; float f2 = 0;
float f3 = -f2 * 0.2F - (float) MathHelper.floor_float(-f2 * 0.1F); float f3 = -f2 * 0.2F - (float) MathHelper.floor(-f2 * 0.1F);
GlStateManager.enableBlend(); GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

View file

@ -72,8 +72,8 @@ public class RenderCorruptedZombie extends RenderBiped<EntityCorruptedZombie>
return ZOMBIE_TEXTURES; return ZOMBIE_TEXTURES;
} }
protected void rotateCorpse(EntityCorruptedZombie entityLiving, float p_77043_2_, float p_77043_3_, float partialTicks) protected void applyRotations(EntityCorruptedZombie entityLiving, float p_77043_2_, float p_77043_3_, float partialTicks)
{ {
super.rotateCorpse(entityLiving, p_77043_2_, p_77043_3_, partialTicks); super.applyRotations(entityLiving, p_77043_2_, p_77043_3_, partialTicks);
} }
} }

View file

@ -1,77 +1,46 @@
package WayofTime.bloodmagic.command; package WayofTime.bloodmagic.command;
import WayofTime.bloodmagic.command.sub.SubCommandBind; import WayofTime.bloodmagic.command.sub.SubCommandBind;
import WayofTime.bloodmagic.command.sub.SubCommandHelp;
import WayofTime.bloodmagic.command.sub.SubCommandNetwork; import WayofTime.bloodmagic.command.sub.SubCommandNetwork;
import WayofTime.bloodmagic.command.sub.SubCommandOrb; import WayofTime.bloodmagic.command.sub.SubCommandOrb;
import WayofTime.bloodmagic.util.helper.TextHelper; import WayofTime.bloodmagic.util.helper.TextHelper;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender; import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextComponentString;
import net.minecraftforge.server.command.CommandTreeBase;
import java.util.*; public class CommandBloodMagic extends CommandTreeBase
public class CommandBloodMagic extends CommandBase
{ {
// TODO - Move this and sub commands to CommandTreeBase in 1.11. Much cleaner impl
private final List<String> aliases = new ArrayList<String>();
private final Map<String, ISubCommand> subCommands = new HashMap<String, ISubCommand>();
public CommandBloodMagic() public CommandBloodMagic()
{ {
aliases.add("BloodMagic"); addSubcommand(new SubCommandBind());
aliases.add("bloodmagic"); addSubcommand(new SubCommandNetwork());
aliases.add("bloodMagic"); addSubcommand(new SubCommandOrb());
aliases.add("bm");
subCommands.put("help", new SubCommandHelp(this));
subCommands.put("network", new SubCommandNetwork(this));
subCommands.put("bind", new SubCommandBind(this));
subCommands.put("orb", new SubCommandOrb(this));
} }
@Override @Override
public String getCommandName() public String getName()
{ {
return "/bloodmagic"; return "bloodmagic";
} }
@Override @Override
public int getRequiredPermissionLevel() public String getUsage(ICommandSender sender)
{ {
return 2; return "/bloodmagic help";
} }
@Override public static void displayHelpString(ICommandSender commandSender, String display, Object... info)
public String getCommandUsage(ICommandSender commandSender)
{ {
return getCommandName() + " help"; commandSender.sendMessage(new TextComponentString(TextHelper.localizeEffect(display, info)));
} }
@Override public static void displayErrorString(ICommandSender commandSender, String display, Object... info)
public List<String> getCommandAliases()
{ {
return aliases; commandSender.sendMessage(new TextComponentString(TextHelper.localizeEffect(display, info)));
} }
@Override public static void displaySuccessString(ICommandSender commandSender, String display, Object... info)
public void execute(MinecraftServer server, ICommandSender commandSender, String[] args)
{ {
if (args.length > 0 && subCommands.containsKey(args[0])) commandSender.sendMessage(new TextComponentString(TextHelper.localizeEffect(display, info)));
{
ISubCommand subCommand = subCommands.get(args[0]);
String[] subArgs = Arrays.copyOfRange(args, 1, args.length);
subCommand.processSubCommand(server, commandSender, subArgs);
} else
{
commandSender.addChatMessage(new TextComponentString(TextHelper.localizeEffect("commands.error.unknown")));
}
}
public Map<String, ISubCommand> getSubCommands()
{
return subCommands;
} }
} }

View file

@ -1,19 +0,0 @@
package WayofTime.bloodmagic.command;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
public interface ISubCommand
{
String getSubCommandName();
ICommand getParentCommand();
String getArgUsage(ICommandSender commandSender);
String getHelpText();
void processSubCommand(MinecraftServer server, ICommandSender commandSender, String[] args);
}

View file

@ -1,70 +0,0 @@
package WayofTime.bloodmagic.command;
import WayofTime.bloodmagic.util.helper.TextHelper;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.text.TextComponentString;
import java.util.Locale;
public abstract class SubCommandBase implements ISubCommand
{
private ICommand parent;
private String name;
public SubCommandBase(ICommand parent, String name)
{
this.parent = parent;
this.name = name;
}
@Override
public String getSubCommandName()
{
return name;
}
@Override
public ICommand getParentCommand()
{
return parent;
}
@Override
public void processSubCommand(MinecraftServer server, ICommandSender commandSender, String[] args)
{
if (args.length == 0 && !getSubCommandName().equals("help"))
displayErrorString(commandSender, String.format(TextHelper.localizeEffect("commands.format.error"), capitalizeFirstLetter(getSubCommandName()), getArgUsage(commandSender)));
if (isBounded(0, 2, args.length) && args[0].equals("help"))
displayHelpString(commandSender, String.format(TextHelper.localizeEffect("commands.format.help"), capitalizeFirstLetter(getSubCommandName()), getHelpText()));
}
protected String capitalizeFirstLetter(String toCapital)
{
return String.valueOf(toCapital.charAt(0)).toUpperCase(Locale.ENGLISH) + toCapital.substring(1);
}
protected boolean isBounded(int low, int high, int given)
{
return given > low && given < high;
}
public static void displayHelpString(ICommandSender commandSender, String display, Object... info)
{
commandSender.addChatMessage(new TextComponentString(TextHelper.localizeEffect(display, info)));
}
public static void displayErrorString(ICommandSender commandSender, String display, Object... info)
{
commandSender.addChatMessage(new TextComponentString(TextHelper.localizeEffect(display, info)));
}
public static void displaySuccessString(ICommandSender commandSender, String display, Object... info)
{
commandSender.addChatMessage(new TextComponentString(TextHelper.localizeEffect(display, info)));
}
}

View file

@ -1,7 +0,0 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package WayofTime.bloodmagic.command;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View file

@ -4,43 +4,31 @@ import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.iface.IBindable; import WayofTime.bloodmagic.api.iface.IBindable;
import WayofTime.bloodmagic.api.util.helper.BindableHelper; import WayofTime.bloodmagic.api.util.helper.BindableHelper;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper; import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import WayofTime.bloodmagic.command.SubCommandBase;
import WayofTime.bloodmagic.util.helper.TextHelper; import WayofTime.bloodmagic.util.helper.TextHelper;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import net.minecraft.command.CommandBase; import net.minecraft.command.*;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.PlayerNotFoundException;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextComponentTranslation;
public class SubCommandBind extends SubCommandBase public class SubCommandBind extends CommandBase
{ {
@Override
public SubCommandBind(ICommand parent) public String getName()
{ {
super(parent, "bind"); return "bind";
} }
@Override @Override
public String getArgUsage(ICommandSender commandSender) public String getUsage(ICommandSender commandSender)
{ {
return TextHelper.localizeEffect("commands.bind.usage"); return TextHelper.localizeEffect("commands.bind.usage");
} }
@Override @Override
public String getHelpText() public void execute(MinecraftServer server, ICommandSender commandSender, String[] args) throws CommandException
{ {
return TextHelper.localizeEffect("commands.bind.help");
}
@Override
public void processSubCommand(MinecraftServer server, ICommandSender commandSender, String[] args)
{
super.processSubCommand(server, commandSender, args);
if (commandSender.getEntityWorld().isRemote) if (commandSender.getEntityWorld().isRemote)
return; return;
@ -52,7 +40,7 @@ public class SubCommandBind extends SubCommandBase
ItemStack held = player.getHeldItemMainhand(); ItemStack held = player.getHeldItemMainhand();
boolean bind = true; boolean bind = true;
if (held != null && held.getItem() instanceof IBindable) if (held.getItem() instanceof IBindable)
{ {
if (args.length > 0) if (args.length > 0)
{ {
@ -77,20 +65,20 @@ public class SubCommandBind extends SubCommandBase
{ {
BindableHelper.setItemOwnerName(held, playerName); BindableHelper.setItemOwnerName(held, playerName);
BindableHelper.setItemOwnerUUID(held, uuid); BindableHelper.setItemOwnerUUID(held, uuid);
commandSender.addChatMessage(new TextComponentTranslation("commands.bind.success")); commandSender.sendMessage(new TextComponentTranslation("commands.bind.success"));
} else } else
{ {
if (!Strings.isNullOrEmpty(((IBindable) held.getItem()).getOwnerUUID(held))) if (!Strings.isNullOrEmpty(((IBindable) held.getItem()).getOwnerUUID(held)))
{ {
held.getTagCompound().removeTag(Constants.NBT.OWNER_UUID); held.getTagCompound().removeTag(Constants.NBT.OWNER_UUID);
held.getTagCompound().removeTag(Constants.NBT.OWNER_NAME); held.getTagCompound().removeTag(Constants.NBT.OWNER_NAME);
commandSender.addChatMessage(new TextComponentTranslation("commands.bind.remove.success")); commandSender.sendMessage(new TextComponentTranslation("commands.bind.remove.success"));
} }
} }
} }
} catch (PlayerNotFoundException e) } catch (PlayerNotFoundException e)
{ {
commandSender.addChatMessage(new TextComponentTranslation(TextHelper.localizeEffect("commands.error.404"))); commandSender.sendMessage(new TextComponentTranslation(TextHelper.localizeEffect("commands.error.404")));
} }
} }

View file

@ -1,43 +0,0 @@
package WayofTime.bloodmagic.command.sub;
import WayofTime.bloodmagic.command.CommandBloodMagic;
import WayofTime.bloodmagic.command.ISubCommand;
import WayofTime.bloodmagic.command.SubCommandBase;
import WayofTime.bloodmagic.util.helper.TextHelper;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.text.TextComponentString;
public class SubCommandHelp extends SubCommandBase
{
public SubCommandHelp(ICommand parent)
{
super(parent, "help");
}
@Override
public String getArgUsage(ICommandSender commandSender)
{
return TextHelper.localize("commands.help.usage");
}
@Override
public String getHelpText()
{
return TextHelper.localizeEffect("commands.help.help");
}
@Override
public void processSubCommand(MinecraftServer server, ICommandSender commandSender, String[] args)
{
super.processSubCommand(server, commandSender, args);
if (args.length > 0)
return;
for (ISubCommand subCommand : ((CommandBloodMagic) getParentCommand()).getSubCommands().values())
commandSender.addChatMessage(new TextComponentString(TextHelper.localizeEffect("commands.format.help", capitalizeFirstLetter(subCommand.getSubCommandName()), subCommand.getArgUsage(commandSender))));
}
}

View file

@ -2,45 +2,32 @@ package WayofTime.bloodmagic.command.sub;
import WayofTime.bloodmagic.api.saving.SoulNetwork; import WayofTime.bloodmagic.api.saving.SoulNetwork;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper; import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.command.SubCommandBase; import WayofTime.bloodmagic.command.CommandBloodMagic;
import WayofTime.bloodmagic.util.Utils; import WayofTime.bloodmagic.util.Utils;
import WayofTime.bloodmagic.util.helper.TextHelper; import WayofTime.bloodmagic.util.helper.TextHelper;
import net.minecraft.command.CommandBase; import net.minecraft.command.*;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.PlayerNotFoundException;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextComponentString;
import java.util.Locale; import java.util.Locale;
public class SubCommandNetwork extends SubCommandBase public class SubCommandNetwork extends CommandBase
{ {
@Override
public SubCommandNetwork(ICommand parent) public String getName() {
{ return "network";
super(parent, "network");
} }
@Override @Override
public String getArgUsage(ICommandSender commandSender) public String getUsage(ICommandSender commandSender)
{ {
return TextHelper.localizeEffect("commands.network.usage"); return TextHelper.localizeEffect("commands.network.usage");
} }
@Override @Override
public String getHelpText() public void execute(MinecraftServer server, ICommandSender commandSender, String[] args) throws CommandException
{ {
return TextHelper.localizeEffect("commands.network.help");
}
@Override
public void processSubCommand(MinecraftServer server, ICommandSender commandSender, String[] args)
{
super.processSubCommand(server, commandSender, args);
if (args.length > 1) if (args.length > 1)
{ {
if (args[0].equalsIgnoreCase("help")) if (args[0].equalsIgnoreCase("help"))
@ -53,18 +40,18 @@ public class SubCommandNetwork extends SubCommandBase
try try
{ {
ValidCommands command = ValidCommands.valueOf(args[0].toUpperCase(Locale.ENGLISH)); ValidCommands command = ValidCommands.valueOf(args[0].toUpperCase(Locale.ENGLISH));
command.run(player, commandSender, isBounded(0, 2, args.length), args); command.run(player, commandSender, args.length > 0 && args.length < 2, args);
} catch (IllegalArgumentException e) } catch (IllegalArgumentException e)
{ {
} }
} catch (PlayerNotFoundException e) } catch (PlayerNotFoundException e)
{ {
displayErrorString(commandSender, e.getLocalizedMessage()); CommandBloodMagic.displayErrorString(commandSender, e.getLocalizedMessage());
} }
} else } else
{ {
displayErrorString(commandSender, "commands.error.arg.missing"); CommandBloodMagic.displayErrorString(commandSender, "commands.error.arg.missing");
} }
} }
@ -77,7 +64,7 @@ public class SubCommandNetwork extends SubCommandBase
{ {
if (displayHelp) if (displayHelp)
{ {
displayHelpString(sender, this.help); CommandBloodMagic.displayHelpString(sender, this.help);
return; return;
} }
@ -87,14 +74,14 @@ public class SubCommandNetwork extends SubCommandBase
{ {
int amount = Integer.parseInt(args[2]); int amount = Integer.parseInt(args[2]);
NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, amount); NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, amount);
displaySuccessString(sender, "commands.network.syphon.success", amount, player.getDisplayName().getFormattedText()); CommandBloodMagic.displaySuccessString(sender, "commands.network.syphon.success", amount, player.getDisplayName().getFormattedText());
} else } else
{ {
displayErrorString(sender, "commands.error.arg.invalid"); CommandBloodMagic.displayErrorString(sender, "commands.error.arg.invalid");
} }
} else } else
{ {
displayErrorString(sender, "commands.error.arg.missing"); CommandBloodMagic.displayErrorString(sender, "commands.error.arg.missing");
} }
} }
}, },
@ -105,7 +92,7 @@ public class SubCommandNetwork extends SubCommandBase
{ {
if (displayHelp) if (displayHelp)
{ {
displayHelpString(sender, this.help); CommandBloodMagic.displayHelpString(sender, this.help);
return; return;
} }
@ -117,14 +104,14 @@ public class SubCommandNetwork extends SubCommandBase
{ {
int amount = Integer.parseInt(args[2]); int amount = Integer.parseInt(args[2]);
int maxOrb = NetworkHelper.getMaximumForTier(network.getOrbTier()); int maxOrb = NetworkHelper.getMaximumForTier(network.getOrbTier());
displaySuccessString(sender, "commands.network.add.success", network.add(amount, maxOrb), player.getDisplayName().getFormattedText()); CommandBloodMagic.displaySuccessString(sender, "commands.network.add.success", network.add(amount, maxOrb), player.getDisplayName().getFormattedText());
} else } else
{ {
displayErrorString(sender, "commands.error.arg.invalid"); CommandBloodMagic.displayErrorString(sender, "commands.error.arg.invalid");
} }
} else } else
{ {
displayErrorString(sender, "commands.error.arg.missing"); CommandBloodMagic.displayErrorString(sender, "commands.error.arg.missing");
} }
} }
}, },
@ -135,7 +122,7 @@ public class SubCommandNetwork extends SubCommandBase
{ {
if (displayHelp) if (displayHelp)
{ {
displayHelpString(sender, this.help); CommandBloodMagic.displayHelpString(sender, this.help);
return; return;
} }
@ -147,14 +134,14 @@ public class SubCommandNetwork extends SubCommandBase
{ {
int amount = Integer.parseInt(args[2]); int amount = Integer.parseInt(args[2]);
network.setCurrentEssence(amount); network.setCurrentEssence(amount);
displaySuccessString(sender, "commands.network.set.success", player.getDisplayName().getFormattedText(), amount); CommandBloodMagic.displaySuccessString(sender, "commands.network.set.success", player.getDisplayName().getFormattedText(), amount);
} else } else
{ {
displayErrorString(sender, "commands.error.arg.invalid"); CommandBloodMagic.displayErrorString(sender, "commands.error.arg.invalid");
} }
} else } else
{ {
displayErrorString(sender, "commands.error.arg.missing"); CommandBloodMagic.displayErrorString(sender, "commands.error.arg.missing");
} }
} }
}, },
@ -165,14 +152,14 @@ public class SubCommandNetwork extends SubCommandBase
{ {
if (displayHelp) if (displayHelp)
{ {
displayHelpString(sender, this.help); CommandBloodMagic.displayHelpString(sender, this.help);
return; return;
} }
SoulNetwork network = NetworkHelper.getSoulNetwork(player); SoulNetwork network = NetworkHelper.getSoulNetwork(player);
if (args.length > 1) if (args.length > 1)
sender.addChatMessage(new TextComponentString(TextHelper.localizeEffect("tooltip.BloodMagic.sigil.divination.currentEssence", network.getCurrentEssence()))); sender.sendMessage(new TextComponentString(TextHelper.localizeEffect("tooltip.bloodmagic.sigil.divination.currentEssence", network.getCurrentEssence())));
} }
}, },
@ -183,7 +170,7 @@ public class SubCommandNetwork extends SubCommandBase
{ {
if (displayHelp) if (displayHelp)
{ {
displayHelpString(sender, this.help, Integer.MAX_VALUE); CommandBloodMagic.displayHelpString(sender, this.help, Integer.MAX_VALUE);
return; return;
} }
@ -192,7 +179,7 @@ public class SubCommandNetwork extends SubCommandBase
if (args.length > 1) if (args.length > 1)
{ {
network.setCurrentEssence(Integer.MAX_VALUE); network.setCurrentEssence(Integer.MAX_VALUE);
displaySuccessString(sender, "commands.network.fill.success", player.getDisplayName().getFormattedText()); CommandBloodMagic.displaySuccessString(sender, "commands.network.fill.success", player.getDisplayName().getFormattedText());
} }
} }
}, },
@ -203,7 +190,7 @@ public class SubCommandNetwork extends SubCommandBase
{ {
if (displayHelp) if (displayHelp)
{ {
displayHelpString(sender, this.help); CommandBloodMagic.displayHelpString(sender, this.help);
return; return;
} }
@ -213,7 +200,7 @@ public class SubCommandNetwork extends SubCommandBase
{ {
int maxOrb = NetworkHelper.getMaximumForTier(network.getOrbTier()); int maxOrb = NetworkHelper.getMaximumForTier(network.getOrbTier());
network.setCurrentEssence(maxOrb); network.setCurrentEssence(maxOrb);
displaySuccessString(sender, "commands.network.cap.success", player.getDisplayName().getFormattedText()); CommandBloodMagic.displaySuccessString(sender, "commands.network.cap.success", player.getDisplayName().getFormattedText());
} }
} }
}, },

View file

@ -3,44 +3,32 @@ package WayofTime.bloodmagic.command.sub;
import WayofTime.bloodmagic.api.saving.SoulNetwork; import WayofTime.bloodmagic.api.saving.SoulNetwork;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper; import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper; import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import WayofTime.bloodmagic.command.SubCommandBase; import WayofTime.bloodmagic.command.CommandBloodMagic;
import WayofTime.bloodmagic.util.Utils; import WayofTime.bloodmagic.util.Utils;
import WayofTime.bloodmagic.util.helper.TextHelper; import WayofTime.bloodmagic.util.helper.TextHelper;
import net.minecraft.command.CommandBase; import net.minecraft.command.*;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.PlayerNotFoundException;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextComponentString;
import java.util.Locale; import java.util.Locale;
public class SubCommandOrb extends SubCommandBase public class SubCommandOrb extends CommandBase
{ {
@Override
public SubCommandOrb(ICommand parent) public String getName() {
{ return "orb";
super(parent, "orb");
} }
@Override @Override
public String getArgUsage(ICommandSender commandSender) public String getUsage(ICommandSender commandSender)
{ {
return TextHelper.localizeEffect("commands.orb.usage"); return TextHelper.localizeEffect("commands.orb.usage");
} }
@Override @Override
public String getHelpText() public void execute(MinecraftServer server, ICommandSender commandSender, String[] args) throws CommandException
{ {
return TextHelper.localizeEffect("commands.orb.help");
}
@Override
public void processSubCommand(MinecraftServer server, ICommandSender commandSender, String[] args)
{
super.processSubCommand(server, commandSender, args);
if (args.length > 0) if (args.length > 0)
{ {
@ -58,7 +46,7 @@ public class SubCommandOrb extends SubCommandBase
String uuid = PlayerHelper.getUUIDFromPlayer(player).toString(); String uuid = PlayerHelper.getUUIDFromPlayer(player).toString();
SoulNetwork network = NetworkHelper.getSoulNetwork(uuid); SoulNetwork network = NetworkHelper.getSoulNetwork(uuid);
boolean displayHelp = isBounded(0, 2, args.length); boolean displayHelp = args.length > 0 && args.length < 2;
try try
{ {
@ -68,7 +56,7 @@ public class SubCommandOrb extends SubCommandBase
{ {
if (displayHelp) if (displayHelp)
{ {
displayHelpString(commandSender, ValidCommands.SET.help); CommandBloodMagic.displayHelpString(commandSender, ValidCommands.SET.help);
break; break;
} }
@ -78,14 +66,14 @@ public class SubCommandOrb extends SubCommandBase
{ {
int amount = Integer.parseInt(args[2]); int amount = Integer.parseInt(args[2]);
network.setOrbTier(amount); network.setOrbTier(amount);
displaySuccessString(commandSender, "commands.success"); CommandBloodMagic.displaySuccessString(commandSender, "commands.success");
} else } else
{ {
displayErrorString(commandSender, "commands.error.arg.invalid"); CommandBloodMagic.displayErrorString(commandSender, "commands.error.arg.invalid");
} }
} else } else
{ {
displayErrorString(commandSender, "commands.error.arg.missing"); CommandBloodMagic.displayErrorString(commandSender, "commands.error.arg.missing");
} }
break; break;
@ -94,23 +82,23 @@ public class SubCommandOrb extends SubCommandBase
{ {
if (displayHelp) if (displayHelp)
{ {
displayHelpString(commandSender, ValidCommands.GET.help); CommandBloodMagic.displayHelpString(commandSender, ValidCommands.GET.help);
break; break;
} }
if (args.length > 1) if (args.length > 1)
commandSender.addChatMessage(new TextComponentString(TextHelper.localizeEffect("message.orb.currenttier", network.getOrbTier()))); commandSender.sendMessage(new TextComponentString(TextHelper.localizeEffect("message.orb.currenttier", network.getOrbTier())));
break; break;
} }
} }
} catch (IllegalArgumentException e) } catch (IllegalArgumentException e)
{ {
displayErrorString(commandSender, "commands.error.404"); CommandBloodMagic.displayErrorString(commandSender, "commands.error.404");
} }
} catch (PlayerNotFoundException e) } catch (PlayerNotFoundException e)
{ {
displayErrorString(commandSender, "commands.error.404"); CommandBloodMagic.displayErrorString(commandSender, "commands.error.404");
} }
} }
} }

View file

@ -1,7 +0,0 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package WayofTime.bloodmagic.command.sub;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View file

@ -14,7 +14,7 @@ import net.minecraftforge.oredict.ShapelessOreRecipe;
public class CompatibilityGuideAPI implements ICompatibility public class CompatibilityGuideAPI implements ICompatibility
{ {
private static IRecipe guideRecipe = null; static IRecipe guideRecipe = null;
private static boolean worldFlag; private static boolean worldFlag;
@Override @Override
@ -46,9 +46,11 @@ public class CompatibilityGuideAPI implements ICompatibility
{ {
if (!worldFlag) { if (!worldFlag) {
GameRegistry.addRecipe(guideRecipe); GameRegistry.addRecipe(guideRecipe);
GuideBloodMagic.handleBookRecipe(true);
worldFlag = true; worldFlag = true;
} else { } else {
CraftingManager.getInstance().getRecipeList().remove(guideRecipe); CraftingManager.getInstance().getRecipeList().remove(guideRecipe);
GuideBloodMagic.handleBookRecipe(false);
worldFlag = false; worldFlag = false;
} }
break; break;

View file

@ -6,7 +6,6 @@ import WayofTime.bloodmagic.registry.ModBlocks;
import WayofTime.bloodmagic.registry.ModItems; import WayofTime.bloodmagic.registry.ModItems;
import amerifrance.guideapi.api.GuideAPI; import amerifrance.guideapi.api.GuideAPI;
import amerifrance.guideapi.api.impl.Book; import amerifrance.guideapi.api.impl.Book;
import amerifrance.guideapi.api.util.NBTBookTags;
import amerifrance.guideapi.category.CategoryItemStack; import amerifrance.guideapi.category.CategoryItemStack;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLCommonHandler;
@ -42,9 +41,13 @@ public class GuideBloodMagic
// guideBook.addCategory(new CategoryItemStack(CategorySpell.buildCategory(), "guide.BloodMagic.category.spell", new ItemStack(ModItems.ritualDiviner))); // guideBook.addCategory(new CategoryItemStack(CategorySpell.buildCategory(), "guide.BloodMagic.category.spell", new ItemStack(ModItems.ritualDiviner)));
} }
public static void initJEIBlacklist() public static void handleBookRecipe(boolean add)
{ {
if (Loader.isModLoaded("JEI")) if (Loader.isModLoaded("JEI")) {
BloodMagicPlugin.jeiHelper.getNbtIgnoreList().ignoreNbtTagNames(GuideAPI.guideBook, NBTBookTags.BOOK_TAG, NBTBookTags.CATEGORY_PAGE_TAG, NBTBookTags.CATEGORY_TAG, NBTBookTags.ENTRY_PAGE_TAG, NBTBookTags.ENTRY_TAG, NBTBookTags.KEY_TAG, NBTBookTags.PAGE_TAG); if (add)
BloodMagicPlugin.jeiRuntime.getRecipeRegistry().addRecipe(CompatibilityGuideAPI.guideRecipe);
else
BloodMagicPlugin.jeiRuntime.getRecipeRegistry().removeRecipe(CompatibilityGuideAPI.guideRecipe);
}
} }
} }

View file

@ -39,6 +39,7 @@ import WayofTime.bloodmagic.registry.ModItems;
public class BloodMagicPlugin extends BlankModPlugin public class BloodMagicPlugin extends BlankModPlugin
{ {
public static IJeiHelpers jeiHelper; public static IJeiHelpers jeiHelper;
public static IJeiRuntime jeiRuntime;
@Override @Override
public void register(@Nonnull IModRegistry registry) public void register(@Nonnull IModRegistry registry)
@ -56,8 +57,8 @@ public class BloodMagicPlugin extends BlankModPlugin
registry.addRecipes(AlchemyTableRecipeMaker.getRecipes()); registry.addRecipes(AlchemyTableRecipeMaker.getRecipes());
registry.addRecipes(ArmourDowngradeRecipeMaker.getRecipes()); registry.addRecipes(ArmourDowngradeRecipeMaker.getRecipes());
registry.addDescription(new ItemStack(ModItems.ALTAR_MAKER), "jei.BloodMagic.desc.altarBuilder"); registry.addDescription(new ItemStack(ModItems.ALTAR_MAKER), "jei.bloodmagic.desc.altarBuilder");
registry.addDescription(new ItemStack(ModItems.MONSTER_SOUL), "jei.BloodMagic.desc.demonicWill"); registry.addDescription(new ItemStack(ModItems.MONSTER_SOUL), "jei.bloodmagic.desc.demonicWill");
jeiHelper.getItemBlacklist().addItemToBlacklist(new ItemStack(ModBlocks.BLOOD_LIGHT)); jeiHelper.getItemBlacklist().addItemToBlacklist(new ItemStack(ModBlocks.BLOOD_LIGHT));
jeiHelper.getItemBlacklist().addItemToBlacklist(new ItemStack(ModBlocks.SPECTRAL_BLOCK)); jeiHelper.getItemBlacklist().addItemToBlacklist(new ItemStack(ModBlocks.SPECTRAL_BLOCK));
@ -78,8 +79,6 @@ public class BloodMagicPlugin extends BlankModPlugin
} }
} }
jeiHelper.getSubtypeRegistry().useNbtForSubtypes(Item.getItemFromBlock(ModBlocks.BLOOD_TANK));
registry.addRecipeClickArea(GuiSoulForge.class, 115, 15, 16, 88, Constants.Compat.JEI_CATEGORY_SOULFORGE); registry.addRecipeClickArea(GuiSoulForge.class, 115, 15, 16, 88, Constants.Compat.JEI_CATEGORY_SOULFORGE);
registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.ALTAR), Constants.Compat.JEI_CATEGORY_ALTAR); registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.ALTAR), Constants.Compat.JEI_CATEGORY_ALTAR);
@ -88,15 +87,15 @@ public class BloodMagicPlugin extends BlankModPlugin
registry.addRecipeCategoryCraftingItem(new ItemStack(ModItems.ARCANE_ASHES), Constants.Compat.JEI_CATEGORY_BINDING); registry.addRecipeCategoryCraftingItem(new ItemStack(ModItems.ARCANE_ASHES), Constants.Compat.JEI_CATEGORY_BINDING);
registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.ALCHEMY_TABLE), Constants.Compat.JEI_CATEGORY_ALCHEMYTABLE); registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.ALCHEMY_TABLE), Constants.Compat.JEI_CATEGORY_ALCHEMYTABLE);
registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.RITUAL_CONTROLLER), Constants.Compat.JEI_CATEGORY_ARMOURDOWNGRADE); registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.RITUAL_CONTROLLER), Constants.Compat.JEI_CATEGORY_ARMOURDOWNGRADE);
}
jeiHelper.getNbtIgnoreList().ignoreNbtTagNames(Constants.NBT.OWNER_UUID); @Override
jeiHelper.getNbtIgnoreList().ignoreNbtTagNames(Constants.NBT.OWNER_NAME); public void registerItemSubtypes(ISubtypeRegistry subtypeRegistry) {
jeiHelper.getNbtIgnoreList().ignoreNbtTagNames(Constants.NBT.USES); subtypeRegistry.useNbtForSubtypes(Item.getItemFromBlock(ModBlocks.BLOOD_TANK));
jeiHelper.getNbtIgnoreList().ignoreNbtTagNames(Constants.NBT.SOULS); }
jeiHelper.getNbtIgnoreList().ignoreNbtTagNames(Constants.NBT.X_COORD);
jeiHelper.getNbtIgnoreList().ignoreNbtTagNames(Constants.NBT.Y_COORD); @Override
jeiHelper.getNbtIgnoreList().ignoreNbtTagNames(Constants.NBT.Z_COORD); public void onRuntimeAvailable(IJeiRuntime runtime) {
jeiHelper.getNbtIgnoreList().ignoreNbtTagNames(Constants.NBT.DIMENSION_ID); jeiRuntime = runtime;
jeiHelper.getNbtIgnoreList().ignoreNbtTagNames(Constants.NBT.ITEM_INVENTORY);
} }
} }

View file

@ -1,24 +0,0 @@
package WayofTime.bloodmagic.compat.jei;
import WayofTime.bloodmagic.compat.ICompatibility;
public class CompatibilityJustEnoughItems implements ICompatibility
{
@Override
public void loadCompatibility(InitializationPhase phase)
{
}
@Override
public String getModId()
{
return "JEI";
}
@Override
public boolean enableCompat()
{
return true;
}
}

View file

@ -1,12 +1,15 @@
package WayofTime.bloodmagic.compat.jei.alchemyArray; package WayofTime.bloodmagic.compat.jei.alchemyArray;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import WayofTime.bloodmagic.api.Constants; import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.compat.jei.BloodMagicPlugin; import WayofTime.bloodmagic.compat.jei.BloodMagicPlugin;
@ -21,7 +24,7 @@ public class AlchemyArrayCraftingCategory implements IRecipeCategory
@Nonnull @Nonnull
private final IDrawable background = BloodMagicPlugin.jeiHelper.getGuiHelper().createDrawable(new ResourceLocation(Constants.Mod.DOMAIN + "gui/jei/binding.png"), 0, 0, 100, 30); private final IDrawable background = BloodMagicPlugin.jeiHelper.getGuiHelper().createDrawable(new ResourceLocation(Constants.Mod.DOMAIN + "gui/jei/binding.png"), 0, 0, 100, 30);
@Nonnull @Nonnull
private final String localizedName = TextHelper.localize("jei.BloodMagic.recipe.alchemyArrayCrafting"); private final String localizedName = TextHelper.localize("jei.bloodmagic.recipe.alchemyArrayCrafting");
@Nonnull @Nonnull
@Override @Override
@ -50,14 +53,15 @@ public class AlchemyArrayCraftingCategory implements IRecipeCategory
} }
@Nullable
@Override @Override
public void drawAnimations(Minecraft minecraft) public IDrawable getIcon()
{ {
return null;
} }
@Override @Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients)
{ {
recipeLayout.getItemStacks().init(INPUT_SLOT, true, 0, 5); recipeLayout.getItemStacks().init(INPUT_SLOT, true, 0, 5);
recipeLayout.getItemStacks().init(CATALYST_SLOT, true, 29, 3); recipeLayout.getItemStacks().init(CATALYST_SLOT, true, 29, 3);
@ -65,10 +69,19 @@ public class AlchemyArrayCraftingCategory implements IRecipeCategory
if (recipeWrapper instanceof AlchemyArrayCraftingRecipeJEI) if (recipeWrapper instanceof AlchemyArrayCraftingRecipeJEI)
{ {
AlchemyArrayCraftingRecipeJEI alchemyArrayWrapper = (AlchemyArrayCraftingRecipeJEI) recipeWrapper; recipeLayout.getItemStacks().set(INPUT_SLOT, ingredients.getInputs(ItemStack.class).get(0));
recipeLayout.getItemStacks().set(INPUT_SLOT, alchemyArrayWrapper.getInputs()); recipeLayout.getItemStacks().set(CATALYST_SLOT, ingredients.getInputs(ItemStack.class).get(ingredients.getInputs(ItemStack.class).size() - 1));
recipeLayout.getItemStacks().set(CATALYST_SLOT, alchemyArrayWrapper.getCatalyst()); recipeLayout.getItemStacks().set(OUTPUT_SLOT, ingredients.getOutputs(ItemStack.class).get(0));
recipeLayout.getItemStacks().set(OUTPUT_SLOT, alchemyArrayWrapper.getOutputs());
} }
} }
@Override
public void drawAnimations(Minecraft minecraft) {
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) {
}
} }

View file

@ -15,14 +15,6 @@ public class AlchemyArrayCraftingRecipeHandler implements IRecipeHandler<Alchemy
return AlchemyArrayCraftingRecipeJEI.class; return AlchemyArrayCraftingRecipeJEI.class;
} }
@Deprecated
@Nonnull
@Override
public String getRecipeCategoryUid()
{
return Constants.Compat.JEI_CATEGORY_ALCHEMYARRAY;
}
@Override @Override
public String getRecipeCategoryUid(@Nonnull AlchemyArrayCraftingRecipeJEI recipe) public String getRecipeCategoryUid(@Nonnull AlchemyArrayCraftingRecipeJEI recipe)
{ {
@ -39,6 +31,11 @@ public class AlchemyArrayCraftingRecipeHandler implements IRecipeHandler<Alchemy
@Override @Override
public boolean isRecipeValid(@Nonnull AlchemyArrayCraftingRecipeJEI recipe) public boolean isRecipeValid(@Nonnull AlchemyArrayCraftingRecipeJEI recipe)
{ {
return recipe.getInputs().size() > 0 && recipe.getOutputs().size() > 0; return true;
}
@Override
public String getRecipeCategoryUid() {
return null;
} }
} }

View file

@ -1,11 +1,12 @@
package WayofTime.bloodmagic.compat.jei.alchemyArray; package WayofTime.bloodmagic.compat.jei.alchemyArray;
import java.util.Collections;
import java.util.List; import java.util.List;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import com.google.common.collect.Lists;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeWrapper; import mezz.jei.api.recipe.BlankRecipeWrapper;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -13,10 +14,8 @@ public class AlchemyArrayCraftingRecipeJEI extends BlankRecipeWrapper
{ {
@Nonnull @Nonnull
private final List<ItemStack> inputs; private final List<ItemStack> inputs;
@Nullable @Nullable
private final ItemStack catalyst; private final ItemStack catalyst;
@Nonnull @Nonnull
private final ItemStack output; private final ItemStack output;
@ -27,22 +26,14 @@ public class AlchemyArrayCraftingRecipeJEI extends BlankRecipeWrapper
this.output = output; this.output = output;
} }
@Override
@Nonnull
public List<ItemStack> getInputs()
{
return inputs;
}
public ItemStack getCatalyst() public ItemStack getCatalyst()
{ {
return catalyst; return catalyst;
} }
@Override @Override
@Nonnull public void getIngredients(IIngredients ingredients) {
public List<ItemStack> getOutputs() ingredients.setInputLists(ItemStack.class, Lists.newArrayList(inputs, Lists.newArrayList(catalyst)));
{ ingredients.setOutput(ItemStack.class, output);
return Collections.singletonList(output);
} }
} }

View file

@ -1,7 +0,0 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package WayofTime.bloodmagic.compat.jei.alchemyArray;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View file

@ -1,14 +1,14 @@
package WayofTime.bloodmagic.compat.jei.alchemyTable; package WayofTime.bloodmagic.compat.jei.alchemyTable;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.google.common.collect.Lists;
import mezz.jei.api.gui.ICraftingGridHelper; import mezz.jei.api.gui.ICraftingGridHelper;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiItemStackGroup; import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -27,7 +27,7 @@ public class AlchemyTableRecipeCategory implements IRecipeCategory
@Nonnull @Nonnull
private final IDrawable background = BloodMagicPlugin.jeiHelper.getGuiHelper().createDrawable(new ResourceLocation(Constants.Mod.DOMAIN + "gui/jei/alchemyTable.png"), 0, 0, 118, 40); private final IDrawable background = BloodMagicPlugin.jeiHelper.getGuiHelper().createDrawable(new ResourceLocation(Constants.Mod.DOMAIN + "gui/jei/alchemyTable.png"), 0, 0, 118, 40);
@Nonnull @Nonnull
private final String localizedName = TextHelper.localize("jei.BloodMagic.recipe.alchemyTable"); private final String localizedName = TextHelper.localize("jei.bloodmagic.recipe.alchemyTable");
@Nonnull @Nonnull
private final ICraftingGridHelper craftingGridHelper; private final ICraftingGridHelper craftingGridHelper;
@ -63,15 +63,16 @@ public class AlchemyTableRecipeCategory implements IRecipeCategory
} }
@Nullable
@Override @Override
public void drawAnimations(Minecraft minecraft) public IDrawable getIcon()
{ {
return null;
} }
@Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) @Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients)
{ {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
@ -89,10 +90,19 @@ public class AlchemyTableRecipeCategory implements IRecipeCategory
if (recipeWrapper instanceof AlchemyTableRecipeJEI) if (recipeWrapper instanceof AlchemyTableRecipeJEI)
{ {
AlchemyTableRecipeJEI recipe = (AlchemyTableRecipeJEI) recipeWrapper; guiItemStacks.set(ORB_SLOT, ingredients.getInputs(ItemStack.class).get(1));
guiItemStacks.set(ORB_SLOT, (ArrayList<ItemStack>) recipe.getInputs().get(1)); craftingGridHelper.setOutput(guiItemStacks, Lists.newArrayList(ingredients.getOutputs(ItemStack.class).get(0)));
craftingGridHelper.setOutput(guiItemStacks, recipe.getOutputs()); craftingGridHelper.setInputStacks(guiItemStacks, ingredients.getInputs(ItemStack.class), 3, 2);
craftingGridHelper.setInput(guiItemStacks, (List) recipe.getInputs().get(0), 3, 2);
} }
} }
@Override
public void drawAnimations(Minecraft minecraft) {
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) {
}
} }

View file

@ -15,14 +15,6 @@ public class AlchemyTableRecipeHandler implements IRecipeHandler<AlchemyTableRec
return AlchemyTableRecipeJEI.class; return AlchemyTableRecipeJEI.class;
} }
@Deprecated
@Nonnull
@Override
public String getRecipeCategoryUid()
{
return Constants.Compat.JEI_CATEGORY_ALCHEMYTABLE;
}
@Override @Override
public String getRecipeCategoryUid(@Nonnull AlchemyTableRecipeJEI recipe) public String getRecipeCategoryUid(@Nonnull AlchemyTableRecipeJEI recipe)
{ {
@ -39,6 +31,11 @@ public class AlchemyTableRecipeHandler implements IRecipeHandler<AlchemyTableRec
@Override @Override
public boolean isRecipeValid(@Nonnull AlchemyTableRecipeJEI recipe) public boolean isRecipeValid(@Nonnull AlchemyTableRecipeJEI recipe)
{ {
return recipe.getInputs().get(0).size() > 0 && recipe.getOutputs().size() > 0; return true;
}
@Override
public String getRecipeCategoryUid() {
return null;
} }
} }

View file

@ -1,18 +1,14 @@
package WayofTime.bloodmagic.compat.jei.alchemyTable; package WayofTime.bloodmagic.compat.jei.alchemyTable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List; import java.util.List;
import javax.annotation.Nonnull; import WayofTime.bloodmagic.compat.jei.BloodMagicPlugin;
import javax.annotation.Nullable;
import lombok.Getter; import lombok.Getter;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeWrapper; import mezz.jei.api.recipe.BlankRecipeWrapper;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import WayofTime.bloodmagic.api.recipe.AlchemyTableRecipe; import WayofTime.bloodmagic.api.recipe.AlchemyTableRecipe;
import WayofTime.bloodmagic.api.registry.OrbRegistry;
import WayofTime.bloodmagic.util.helper.TextHelper; import WayofTime.bloodmagic.util.helper.TextHelper;
public class AlchemyTableRecipeJEI extends BlankRecipeWrapper public class AlchemyTableRecipeJEI extends BlankRecipeWrapper
@ -20,42 +16,27 @@ public class AlchemyTableRecipeJEI extends BlankRecipeWrapper
@Getter @Getter
private AlchemyTableRecipe recipe; private AlchemyTableRecipe recipe;
// @Getter
// private ArrayList<ItemStack> validGems = new ArrayList<ItemStack>();
public AlchemyTableRecipeJEI(AlchemyTableRecipe recipe) public AlchemyTableRecipeJEI(AlchemyTableRecipe recipe)
{ {
this.recipe = recipe; this.recipe = recipe;
} }
@Override @Override
@Nonnull public void getIngredients(IIngredients ingredients) {
public List<Collection> getInputs() List<List<ItemStack>> expanded = BloodMagicPlugin.jeiHelper.getStackHelper().expandRecipeItemStackInputs(recipe.getInput());
{ ingredients.setInputLists(ItemStack.class, expanded);
ArrayList<Collection> ret = new ArrayList<Collection>(); ingredients.setOutput(ItemStack.class, recipe.getRecipeOutput(new ArrayList<ItemStack>()));
ret.add(recipe.getInput());
ret.add(OrbRegistry.getOrbsDownToTier(recipe.getTierRequired()));
return ret;
} }
@Override
@Nonnull
public List<ItemStack> getOutputs()
{
return Collections.singletonList(recipe.getRecipeOutput(new ArrayList<ItemStack>()));
}
@Nullable
@Override @Override
public List<String> getTooltipStrings(int mouseX, int mouseY) public List<String> getTooltipStrings(int mouseX, int mouseY)
{ {
ArrayList<String> ret = new ArrayList<String>(); ArrayList<String> ret = new ArrayList<String>();
if (mouseX >= 58 && mouseX <= 78 && mouseY >= 21 && mouseY <= 34) if (mouseX >= 58 && mouseX <= 78 && mouseY >= 21 && mouseY <= 34)
{ {
ret.add(TextHelper.localize("jei.BloodMagic.recipe.lpDrained", recipe.getLpDrained())); ret.add(TextHelper.localize("jei.bloodmagic.recipe.lpDrained", recipe.getLpDrained()));
ret.add(TextHelper.localize("jei.BloodMagic.recipe.ticksRequired", recipe.getTicksRequired())); ret.add(TextHelper.localize("jei.bloodmagic.recipe.ticksRequired", recipe.getTicksRequired()));
return ret;
} }
return null; return ret;
} }
} }

View file

@ -1,7 +0,0 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package WayofTime.bloodmagic.compat.jei.alchemyTable;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View file

@ -1,11 +1,13 @@
package WayofTime.bloodmagic.compat.jei.altar; package WayofTime.bloodmagic.compat.jei.altar;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List; import java.util.List;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -23,7 +25,7 @@ public class AltarRecipeCategory implements IRecipeCategory
@Nonnull @Nonnull
private final IDrawable background = BloodMagicPlugin.jeiHelper.getGuiHelper().createDrawable(new ResourceLocation(Constants.Mod.DOMAIN + "gui/jei/altar.png"), 3, 4, 155, 65); private final IDrawable background = BloodMagicPlugin.jeiHelper.getGuiHelper().createDrawable(new ResourceLocation(Constants.Mod.DOMAIN + "gui/jei/altar.png"), 3, 4, 155, 65);
@Nonnull @Nonnull
private final String localizedName = TextHelper.localize("jei.BloodMagic.recipe.altar"); private final String localizedName = TextHelper.localize("jei.bloodmagic.recipe.altar");
@Nonnull @Nonnull
@Override @Override
@ -52,24 +54,32 @@ public class AltarRecipeCategory implements IRecipeCategory
} }
@Nullable
@Override @Override
public void drawAnimations(Minecraft minecraft) public IDrawable getIcon() {
{ return null;
} }
@Override @Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients)
{ {
recipeLayout.getItemStacks().init(INPUT_SLOT, true, 31, 0); recipeLayout.getItemStacks().init(INPUT_SLOT, true, 31, 0);
recipeLayout.getItemStacks().init(OUTPUT_SLOT, false, 125, 30); recipeLayout.getItemStacks().init(OUTPUT_SLOT, false, 125, 30);
if (recipeWrapper instanceof AltarRecipeJEI) if (recipeWrapper instanceof AltarRecipeJEI)
{ {
AltarRecipeJEI altarRecipeWrapper = (AltarRecipeJEI) recipeWrapper; recipeLayout.getItemStacks().set(INPUT_SLOT, ingredients.getInputs(ItemStack.class).get(0));
List<List<ItemStack>> inputs = altarRecipeWrapper.getInputs(); recipeLayout.getItemStacks().set(OUTPUT_SLOT, ingredients.getOutputs(ItemStack.class).get(0));
recipeLayout.getItemStacks().set(INPUT_SLOT, inputs.get(0));
recipeLayout.getItemStacks().set(OUTPUT_SLOT, altarRecipeWrapper.getOutputs());
} }
} }
@Override
public void drawAnimations(Minecraft minecraft) {
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) {
}
} }

View file

@ -15,14 +15,6 @@ public class AltarRecipeHandler implements IRecipeHandler<AltarRecipeJEI>
return AltarRecipeJEI.class; return AltarRecipeJEI.class;
} }
@Deprecated
@Nonnull
@Override
public String getRecipeCategoryUid()
{
return Constants.Compat.JEI_CATEGORY_ALTAR;
}
@Override @Override
public String getRecipeCategoryUid(@Nonnull AltarRecipeJEI recipe) public String getRecipeCategoryUid(@Nonnull AltarRecipeJEI recipe)
{ {
@ -39,6 +31,11 @@ public class AltarRecipeHandler implements IRecipeHandler<AltarRecipeJEI>
@Override @Override
public boolean isRecipeValid(@Nonnull AltarRecipeJEI recipe) public boolean isRecipeValid(@Nonnull AltarRecipeJEI recipe)
{ {
return recipe.getInputs().size() > 0 && recipe.getOutputs().size() > 0; return true;
}
@Override
public String getRecipeCategoryUid() {
return null;
} }
} }

View file

@ -2,13 +2,12 @@ package WayofTime.bloodmagic.compat.jei.altar;
import java.awt.Color; import java.awt.Color;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import WayofTime.bloodmagic.util.helper.NumeralHelper; import WayofTime.bloodmagic.util.helper.NumeralHelper;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeWrapper; import mezz.jei.api.recipe.BlankRecipeWrapper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -18,7 +17,6 @@ public class AltarRecipeJEI extends BlankRecipeWrapper
{ {
@Nonnull @Nonnull
private final List<ItemStack> input; private final List<ItemStack> input;
@Nonnull @Nonnull
private final ItemStack output; private final ItemStack output;
@ -31,35 +29,27 @@ public class AltarRecipeJEI extends BlankRecipeWrapper
this.input = input; this.input = input;
this.output = output; this.output = output;
this.infoString = new String[] { TextHelper.localize("jei.BloodMagic.recipe.requiredTier", NumeralHelper.toRoman(tier)), TextHelper.localize("jei.BloodMagic.recipe.requiredLP", requiredLP) }; this.infoString = new String[] { TextHelper.localize("jei.bloodmagic.recipe.requiredTier", NumeralHelper.toRoman(tier)), TextHelper.localize("jei.bloodmagic.recipe.requiredLP", requiredLP) };
this.consumptionRate = consumptionRate; this.consumptionRate = consumptionRate;
this.drainRate = drainRate; this.drainRate = drainRate;
} }
@Override @Override
public List<List<ItemStack>> getInputs() public void getIngredients(IIngredients ingredients) {
{ ingredients.setInputs(ItemStack.class, input);
return Collections.singletonList(input); ingredients.setOutput(ItemStack.class, output);
} }
@Override
public List<ItemStack> getOutputs()
{
return Collections.singletonList(output);
}
@Nullable
@Override @Override
public List<String> getTooltipStrings(int mouseX, int mouseY) public List<String> getTooltipStrings(int mouseX, int mouseY)
{ {
ArrayList<String> ret = new ArrayList<String>(); ArrayList<String> ret = new ArrayList<String>();
if (mouseX >= 13 && mouseX <= 64 && mouseY >= 27 && mouseY <= 58) if (mouseX >= 13 && mouseX <= 64 && mouseY >= 27 && mouseY <= 58)
{ {
ret.add(TextHelper.localize("jei.BloodMagic.recipe.consumptionRate", consumptionRate)); ret.add(TextHelper.localize("jei.bloodmagic.recipe.consumptionRate", consumptionRate));
ret.add(TextHelper.localize("jei.BloodMagic.recipe.drainRate", drainRate)); ret.add(TextHelper.localize("jei.bloodmagic.recipe.drainRate", drainRate));
return ret;
} }
return null; return ret;
} }
@Override @Override

View file

@ -1,7 +0,0 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package WayofTime.bloodmagic.compat.jei.altar;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View file

@ -1,14 +1,13 @@
package WayofTime.bloodmagic.compat.jei.armourDowngrade; package WayofTime.bloodmagic.compat.jei.armourDowngrade;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import mezz.jei.api.gui.ICraftingGridHelper; import mezz.jei.api.gui.ICraftingGridHelper;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiItemStackGroup; import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -27,7 +26,7 @@ public class ArmourDowngradeRecipeCategory implements IRecipeCategory
@Nonnull @Nonnull
private final IDrawable background = BloodMagicPlugin.jeiHelper.getGuiHelper().createDrawable(new ResourceLocation(Constants.Mod.DOMAIN + "gui/jei/alchemyTable.png"), 0, 0, 118, 40); private final IDrawable background = BloodMagicPlugin.jeiHelper.getGuiHelper().createDrawable(new ResourceLocation(Constants.Mod.DOMAIN + "gui/jei/alchemyTable.png"), 0, 0, 118, 40);
@Nonnull @Nonnull
private final String localizedName = TextHelper.localize("jei.BloodMagic.recipe.armourDowngrade"); private final String localizedName = TextHelper.localize("jei.bloodmagic.recipe.armourDowngrade");
@Nonnull @Nonnull
private final ICraftingGridHelper craftingGridHelper; private final ICraftingGridHelper craftingGridHelper;
@ -63,15 +62,15 @@ public class ArmourDowngradeRecipeCategory implements IRecipeCategory
} }
@Nullable
@Override @Override
public void drawAnimations(Minecraft minecraft) public IDrawable getIcon() {
{ return null;
} }
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper, IIngredients ingredients)
{ {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
@ -89,10 +88,20 @@ public class ArmourDowngradeRecipeCategory implements IRecipeCategory
if (recipeWrapper instanceof ArmourDowngradeRecipeJEI) if (recipeWrapper instanceof ArmourDowngradeRecipeJEI)
{ {
ArmourDowngradeRecipeJEI recipe = (ArmourDowngradeRecipeJEI) recipeWrapper; guiItemStacks.set(KEY_SLOT, ingredients.getInputs(ItemStack.class).get(ingredients.getInputs(ItemStack.class).size() - 1));
guiItemStacks.set(KEY_SLOT, (ArrayList<ItemStack>) recipe.getInputs().get(1)); ingredients.getInputs(ItemStack.class).remove(ingredients.getInputs(ItemStack.class).size() - 1);
craftingGridHelper.setOutput(guiItemStacks, recipe.getOutputs()); guiItemStacks.set(OUTPUT_SLOT, ingredients.getOutputs(ItemStack.class).get(0));
craftingGridHelper.setInput(guiItemStacks, (List) recipe.getInputs().get(0), 3, 2); craftingGridHelper.setInputStacks(guiItemStacks, ingredients.getInputs(ItemStack.class), 3, 2);
} }
} }
@Override
public void drawAnimations(Minecraft minecraft) {
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) {
}
} }

View file

@ -15,14 +15,6 @@ public class ArmourDowngradeRecipeHandler implements IRecipeHandler<ArmourDowngr
return ArmourDowngradeRecipeJEI.class; return ArmourDowngradeRecipeJEI.class;
} }
@Deprecated
@Nonnull
@Override
public String getRecipeCategoryUid()
{
return Constants.Compat.JEI_CATEGORY_ARMOURDOWNGRADE;
}
@Nonnull @Nonnull
@Override @Override
public String getRecipeCategoryUid(ArmourDowngradeRecipeJEI recipe) public String getRecipeCategoryUid(ArmourDowngradeRecipeJEI recipe)
@ -40,6 +32,11 @@ public class ArmourDowngradeRecipeHandler implements IRecipeHandler<ArmourDowngr
@Override @Override
public boolean isRecipeValid(@Nonnull ArmourDowngradeRecipeJEI recipe) public boolean isRecipeValid(@Nonnull ArmourDowngradeRecipeJEI recipe)
{ {
return recipe.getInputs().get(0).size() > 0 && recipe.getOutputs().size() > 0; return true;
}
@Override
public String getRecipeCategoryUid() {
return null;
} }
} }

View file

@ -1,65 +1,34 @@
package WayofTime.bloodmagic.compat.jei.armourDowngrade; package WayofTime.bloodmagic.compat.jei.armourDowngrade;
import java.util.ArrayList; import WayofTime.bloodmagic.compat.jei.BloodMagicPlugin;
import java.util.Collection; import com.google.common.collect.Lists;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import lombok.Getter; import lombok.Getter;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeWrapper; import mezz.jei.api.recipe.BlankRecipeWrapper;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import WayofTime.bloodmagic.api.recipe.LivingArmourDowngradeRecipe; import WayofTime.bloodmagic.api.recipe.LivingArmourDowngradeRecipe;
import WayofTime.bloodmagic.api.util.helper.ItemHelper.LivingUpgrades; import WayofTime.bloodmagic.api.util.helper.ItemHelper.LivingUpgrades;
import WayofTime.bloodmagic.registry.ModItems; import WayofTime.bloodmagic.registry.ModItems;
import com.google.common.collect.Lists; import java.util.List;
public class ArmourDowngradeRecipeJEI extends BlankRecipeWrapper public class ArmourDowngradeRecipeJEI extends BlankRecipeWrapper
{ {
@Getter @Getter
private LivingArmourDowngradeRecipe recipe; private LivingArmourDowngradeRecipe recipe;
// @Getter
// private ArrayList<ItemStack> validGems = new ArrayList<ItemStack>();
public ArmourDowngradeRecipeJEI(LivingArmourDowngradeRecipe recipe) public ArmourDowngradeRecipeJEI(LivingArmourDowngradeRecipe recipe)
{ {
this.recipe = recipe; this.recipe = recipe;
} }
@Override @Override
@Nonnull public void getIngredients(IIngredients ingredients) {
public List<Collection> getInputs() List<List<ItemStack>> expanded = BloodMagicPlugin.jeiHelper.getStackHelper().expandRecipeItemStackInputs(recipe.getInput());
{ expanded.add(Lists.newArrayList(recipe.getKey()));
ArrayList<Collection> ret = new ArrayList<Collection>(); ingredients.setInputLists(ItemStack.class, expanded);
ret.add(recipe.getInput());
ret.add(Lists.newArrayList(recipe.getKey()));
return ret;
}
@Override
@Nonnull
public List<ItemStack> getOutputs()
{
ItemStack upgradeStack = new ItemStack(ModItems.UPGRADE_TOME); ItemStack upgradeStack = new ItemStack(ModItems.UPGRADE_TOME);
LivingUpgrades.setUpgrade(upgradeStack, recipe.getRecipeOutput()); LivingUpgrades.setUpgrade(upgradeStack, recipe.getRecipeOutput());
return Collections.singletonList(upgradeStack); ingredients.setOutput(ItemStack.class, upgradeStack);
}
@Nullable
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY)
{
// ArrayList<String> ret = new ArrayList<String>();
// if (mouseX >= 58 && mouseX <= 78 && mouseY >= 21 && mouseY <= 34)
// {
// ret.add(TextHelper.localize("jei.BloodMagic.recipe.lpDrained", recipe.getLpDrained()));
// ret.add(TextHelper.localize("jei.BloodMagic.recipe.ticksRequired", recipe.getTicksRequired()));
// return ret;
// }
return null;
} }
} }

View file

@ -1,7 +0,0 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package WayofTime.bloodmagic.compat.jei.armourDowngrade;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View file

@ -1,9 +1,11 @@
package WayofTime.bloodmagic.compat.jei.binding; package WayofTime.bloodmagic.compat.jei.binding;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -22,7 +24,7 @@ public class BindingRecipeCategory implements IRecipeCategory
@Nonnull @Nonnull
private final IDrawable background = BloodMagicPlugin.jeiHelper.getGuiHelper().createDrawable(new ResourceLocation(Constants.Mod.DOMAIN + "gui/jei/binding.png"), 0, 0, 100, 30); private final IDrawable background = BloodMagicPlugin.jeiHelper.getGuiHelper().createDrawable(new ResourceLocation(Constants.Mod.DOMAIN + "gui/jei/binding.png"), 0, 0, 100, 30);
@Nonnull @Nonnull
private final String localizedName = TextHelper.localize("jei.BloodMagic.recipe.binding"); private final String localizedName = TextHelper.localize("jei.bloodmagic.recipe.binding");
@Nonnull @Nonnull
@Override @Override
@ -51,26 +53,33 @@ public class BindingRecipeCategory implements IRecipeCategory
} }
@Nullable
@Override @Override
public void drawAnimations(Minecraft minecraft) public IDrawable getIcon() {
{ return null;
} }
@Override @Override
@SuppressWarnings("unchecked") public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) {
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper)
{
recipeLayout.getItemStacks().init(INPUT_SLOT, true, 0, 5); recipeLayout.getItemStacks().init(INPUT_SLOT, true, 0, 5);
recipeLayout.getItemStacks().init(CATALYST_SLOT, true, 29, 3); recipeLayout.getItemStacks().init(CATALYST_SLOT, true, 29, 3);
recipeLayout.getItemStacks().init(OUTPUT_SLOT, false, 73, 5); recipeLayout.getItemStacks().init(OUTPUT_SLOT, false, 73, 5);
if (recipeWrapper instanceof BindingRecipeJEI) if (recipeWrapper instanceof BindingRecipeJEI)
{ {
BindingRecipeJEI bindingRecipe = (BindingRecipeJEI) recipeWrapper; recipeLayout.getItemStacks().set(INPUT_SLOT, ingredients.getInputs(ItemStack.class).get(0));
recipeLayout.getItemStacks().set(INPUT_SLOT, bindingRecipe.getInputs()); recipeLayout.getItemStacks().set(CATALYST_SLOT, ingredients.getInputs(ItemStack.class).get(1));
recipeLayout.getItemStacks().set(CATALYST_SLOT, bindingRecipe.getCatalyst()); recipeLayout.getItemStacks().set(OUTPUT_SLOT, ingredients.getOutputs(ItemStack.class).get(0));
recipeLayout.getItemStacks().set(OUTPUT_SLOT, bindingRecipe.getOutputs());
} }
} }
@Override
public void drawAnimations(Minecraft minecraft) {
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) {
}
} }

View file

@ -15,14 +15,6 @@ public class BindingRecipeHandler implements IRecipeHandler<BindingRecipeJEI>
return BindingRecipeJEI.class; return BindingRecipeJEI.class;
} }
@Deprecated
@Nonnull
@Override
public String getRecipeCategoryUid()
{
return Constants.Compat.JEI_CATEGORY_BINDING;
}
@Override @Override
public String getRecipeCategoryUid(@Nonnull BindingRecipeJEI recipe) public String getRecipeCategoryUid(@Nonnull BindingRecipeJEI recipe)
{ {
@ -39,6 +31,11 @@ public class BindingRecipeHandler implements IRecipeHandler<BindingRecipeJEI>
@Override @Override
public boolean isRecipeValid(@Nonnull BindingRecipeJEI recipe) public boolean isRecipeValid(@Nonnull BindingRecipeJEI recipe)
{ {
return recipe.getInputs().size() > 0 && recipe.getOutputs().size() > 0; return true;
}
@Override
public String getRecipeCategoryUid() {
return null;
} }
} }

View file

@ -1,10 +1,11 @@
package WayofTime.bloodmagic.compat.jei.binding; package WayofTime.bloodmagic.compat.jei.binding;
import java.util.Collections;
import java.util.List; import java.util.List;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import com.google.common.collect.Lists;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeWrapper; import mezz.jei.api.recipe.BlankRecipeWrapper;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -28,21 +29,9 @@ public class BindingRecipeJEI extends BlankRecipeWrapper
} }
@Override @Override
@Nonnull public void getIngredients(IIngredients ingredients) {
public List<ItemStack> getInputs()
{
return inputs;
}
public ItemStack getCatalyst() ingredients.setInputLists(ItemStack.class, Lists.newArrayList(inputs, Lists.newArrayList(catalyst)));
{ ingredients.setOutput(ItemStack.class, output);
return catalyst;
}
@Override
@Nonnull
public List<ItemStack> getOutputs()
{
return Collections.singletonList(output);
} }
} }

View file

@ -1,7 +0,0 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package WayofTime.bloodmagic.compat.jei.binding;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View file

@ -1,14 +1,15 @@
package WayofTime.bloodmagic.compat.jei.forge; package WayofTime.bloodmagic.compat.jei.forge;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import mezz.jei.api.gui.ICraftingGridHelper; import mezz.jei.api.gui.ICraftingGridHelper;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiItemStackGroup; import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -27,7 +28,7 @@ public class TartaricForgeRecipeCategory implements IRecipeCategory
@Nonnull @Nonnull
private final IDrawable background = BloodMagicPlugin.jeiHelper.getGuiHelper().createDrawable(new ResourceLocation(Constants.Mod.DOMAIN + "gui/jei/soulForge.png"), 0, 0, 100, 40); private final IDrawable background = BloodMagicPlugin.jeiHelper.getGuiHelper().createDrawable(new ResourceLocation(Constants.Mod.DOMAIN + "gui/jei/soulForge.png"), 0, 0, 100, 40);
@Nonnull @Nonnull
private final String localizedName = TextHelper.localize("jei.BloodMagic.recipe.soulForge"); private final String localizedName = TextHelper.localize("jei.bloodmagic.recipe.soulForge");
@Nonnull @Nonnull
private final ICraftingGridHelper craftingGridHelper; private final ICraftingGridHelper craftingGridHelper;
@ -63,15 +64,15 @@ public class TartaricForgeRecipeCategory implements IRecipeCategory
} }
@Nullable
@Override @Override
public void drawAnimations(Minecraft minecraft) public IDrawable getIcon()
{ {
return null;
} }
@Override @Override
@SuppressWarnings("unchecked") public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients)
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper)
{ {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
@ -87,12 +88,25 @@ public class TartaricForgeRecipeCategory implements IRecipeCategory
} }
} }
List<List<ItemStack>> inputs = ingredients.getInputs(ItemStack.class);
if (recipeWrapper instanceof TartaricForgeRecipeJEI) if (recipeWrapper instanceof TartaricForgeRecipeJEI)
{ {
TartaricForgeRecipeJEI recipe = (TartaricForgeRecipeJEI) recipeWrapper; guiItemStacks.set(GEM_SLOT, ingredients.getInputs(ItemStack.class).get(ingredients.getInputs(ItemStack.class).size() - 1));
guiItemStacks.set(GEM_SLOT, (ArrayList<ItemStack>) recipe.getInputs().get(1)); inputs.remove(ingredients.getInputs(ItemStack.class).size() - 1);
craftingGridHelper.setOutput(guiItemStacks, recipe.getOutputs()); guiItemStacks.set(OUTPUT_SLOT, ingredients.getOutputs(ItemStack.class).get(0));
craftingGridHelper.setInput(guiItemStacks, (List) recipe.getInputs().get(0), 2, 3); guiItemStacks.set(INPUT_SLOT, ingredients.getInputs(ItemStack.class).get(0));
craftingGridHelper.setInputStacks(guiItemStacks, inputs);
} }
} }
@Override
public void drawAnimations(Minecraft minecraft) {
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) {
}
} }

View file

@ -15,14 +15,6 @@ public class TartaricForgeRecipeHandler implements IRecipeHandler<TartaricForgeR
return TartaricForgeRecipeJEI.class; return TartaricForgeRecipeJEI.class;
} }
@Deprecated
@Nonnull
@Override
public String getRecipeCategoryUid()
{
return Constants.Compat.JEI_CATEGORY_SOULFORGE;
}
@Override @Override
public String getRecipeCategoryUid(@Nonnull TartaricForgeRecipeJEI recipe) public String getRecipeCategoryUid(@Nonnull TartaricForgeRecipeJEI recipe)
{ {
@ -39,6 +31,11 @@ public class TartaricForgeRecipeHandler implements IRecipeHandler<TartaricForgeR
@Override @Override
public boolean isRecipeValid(@Nonnull TartaricForgeRecipeJEI recipe) public boolean isRecipeValid(@Nonnull TartaricForgeRecipeJEI recipe)
{ {
return recipe.getInputs().get(0).size() > 0 && recipe.getOutputs().size() > 0; return true;
}
@Override
public String getRecipeCategoryUid() {
return null;
} }
} }

View file

@ -8,7 +8,10 @@ import java.util.List;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import WayofTime.bloodmagic.compat.jei.BloodMagicPlugin;
import com.google.common.collect.Lists;
import lombok.Getter; import lombok.Getter;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeWrapper; import mezz.jei.api.recipe.BlankRecipeWrapper;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import WayofTime.bloodmagic.api.recipe.TartaricForgeRecipe; import WayofTime.bloodmagic.api.recipe.TartaricForgeRecipe;
@ -20,7 +23,7 @@ public class TartaricForgeRecipeJEI extends BlankRecipeWrapper
@Getter @Getter
private TartaricForgeRecipe recipe; private TartaricForgeRecipe recipe;
@Getter @Getter
private ArrayList<ItemStack> validGems = new ArrayList<ItemStack>(); private List<ItemStack> validGems = new ArrayList<ItemStack>();
public TartaricForgeRecipeJEI(TartaricForgeRecipe recipe) public TartaricForgeRecipeJEI(TartaricForgeRecipe recipe)
{ {
@ -32,20 +35,11 @@ public class TartaricForgeRecipeJEI extends BlankRecipeWrapper
} }
@Override @Override
@Nonnull public void getIngredients(IIngredients ingredients) {
public List<Collection> getInputs() List<List<ItemStack>> expandedInputs = BloodMagicPlugin.jeiHelper.getStackHelper().expandRecipeItemStackInputs(recipe.getInput());
{ expandedInputs.add(validGems);
ArrayList<Collection> ret = new ArrayList<Collection>(); ingredients.setInputLists(ItemStack.class, expandedInputs);
ret.add(recipe.getInput()); ingredients.setOutput(ItemStack.class, recipe.getRecipeOutput());
ret.add(validGems);
return ret;
}
@Override
@Nonnull
public List<ItemStack> getOutputs()
{
return Collections.singletonList(recipe.getRecipeOutput());
} }
@Nullable @Nullable
@ -55,8 +49,8 @@ public class TartaricForgeRecipeJEI extends BlankRecipeWrapper
ArrayList<String> ret = new ArrayList<String>(); ArrayList<String> ret = new ArrayList<String>();
if (mouseX >= 40 && mouseX <= 60 && mouseY >= 21 && mouseY <= 34) if (mouseX >= 40 && mouseX <= 60 && mouseY >= 21 && mouseY <= 34)
{ {
ret.add(TextHelper.localize("jei.BloodMagic.recipe.minimumSouls", recipe.getMinimumSouls())); ret.add(TextHelper.localize("jei.bloodmagic.recipe.minimumSouls", recipe.getMinimumSouls()));
ret.add(TextHelper.localize("jei.BloodMagic.recipe.soulsDrained", recipe.getSoulsDrained())); ret.add(TextHelper.localize("jei.bloodmagic.recipe.soulsDrained", recipe.getSoulsDrained()));
return ret; return ret;
} }
return null; return null;

View file

@ -1,7 +0,0 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package WayofTime.bloodmagic.compat.jei.forge;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View file

@ -19,14 +19,6 @@ public class ShapedOrbRecipeHandler implements IRecipeHandler<ShapedBloodOrbReci
return ShapedBloodOrbRecipe.class; return ShapedBloodOrbRecipe.class;
} }
@Deprecated
@Nonnull
@Override
public String getRecipeCategoryUid()
{
return VanillaRecipeCategoryUid.CRAFTING;
}
@Nonnull @Nonnull
public String getRecipeCategoryUid(@Nonnull ShapedBloodOrbRecipe recipe) public String getRecipeCategoryUid(@Nonnull ShapedBloodOrbRecipe recipe)
{ {
@ -45,4 +37,9 @@ public class ShapedOrbRecipeHandler implements IRecipeHandler<ShapedBloodOrbReci
{ {
return recipe.getInput().length > 0; return recipe.getInput().length > 0;
} }
@Override
public String getRecipeCategoryUid() {
return null;
}
} }

View file

@ -2,21 +2,21 @@ package WayofTime.bloodmagic.compat.jei.orb;
import java.awt.Color; import java.awt.Color;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import WayofTime.bloodmagic.compat.jei.BloodMagicPlugin;
import WayofTime.bloodmagic.util.helper.NumeralHelper; import WayofTime.bloodmagic.util.helper.NumeralHelper;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeWrapper;
import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper; import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import WayofTime.bloodmagic.api.registry.OrbRegistry; import WayofTime.bloodmagic.api.registry.OrbRegistry;
import WayofTime.bloodmagic.util.helper.TextHelper; import WayofTime.bloodmagic.util.helper.TextHelper;
public class ShapedOrbRecipeJEI implements IShapedCraftingRecipeWrapper public class ShapedOrbRecipeJEI extends BlankRecipeWrapper implements IShapedCraftingRecipeWrapper
{ {
@Nonnull @Nonnull
@ -54,52 +54,15 @@ public class ShapedOrbRecipeJEI implements IShapedCraftingRecipeWrapper
} }
@Override @Override
public List getInputs() public void getIngredients(IIngredients ingredients) {
{ List<List<ItemStack>> expanded = BloodMagicPlugin.jeiHelper.getStackHelper().expandRecipeItemStackInputs(inputs);
return inputs; ingredients.setInputLists(ItemStack.class, expanded);
ingredients.setOutput(ItemStack.class, output);
} }
@Override @Override
public List<ItemStack> getOutputs() public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
{ String draw = TextHelper.localize("jei.bloodmagic.recipe.requiredTier", NumeralHelper.toRoman(tier));
return Collections.singletonList(output);
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY)
{
String draw = TextHelper.localize("jei.BloodMagic.recipe.requiredTier", NumeralHelper.toRoman(tier));
minecraft.fontRendererObj.drawString(draw, 72 - minecraft.fontRendererObj.getStringWidth(draw) / 2, 10, Color.gray.getRGB()); minecraft.fontRendererObj.drawString(draw, 72 - minecraft.fontRendererObj.getStringWidth(draw) / 2, 10, Color.gray.getRGB());
} }
}
@Override
public List<FluidStack> getFluidInputs()
{
return null;
}
@Override
public List<FluidStack> getFluidOutputs()
{
return null;
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight)
{
}
@Nullable
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY)
{
return null;
}
@Override
public boolean handleClick(@Nonnull Minecraft minecraft, int mouseX, int mouseY, int mouseButton)
{
return false;
}
}

View file

@ -17,14 +17,6 @@ public class ShapelessOrbRecipeHandler implements IRecipeHandler<ShapelessBloodO
return ShapelessBloodOrbRecipe.class; return ShapelessBloodOrbRecipe.class;
} }
@Deprecated
@Nonnull
@Override
public String getRecipeCategoryUid()
{
return VanillaRecipeCategoryUid.CRAFTING;
}
@Override @Override
public String getRecipeCategoryUid(@Nonnull ShapelessBloodOrbRecipe recipe) public String getRecipeCategoryUid(@Nonnull ShapelessBloodOrbRecipe recipe)
{ {
@ -43,4 +35,9 @@ public class ShapelessOrbRecipeHandler implements IRecipeHandler<ShapelessBloodO
{ {
return recipe.getInput().size() > 0; return recipe.getInput().size() > 0;
} }
@Override
public String getRecipeCategoryUid() {
return null;
}
} }

View file

@ -8,7 +8,10 @@ import java.util.List;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import WayofTime.bloodmagic.compat.jei.BloodMagicPlugin;
import WayofTime.bloodmagic.util.helper.NumeralHelper; import WayofTime.bloodmagic.util.helper.NumeralHelper;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeWrapper;
import mezz.jei.api.recipe.wrapper.ICraftingRecipeWrapper; import mezz.jei.api.recipe.wrapper.ICraftingRecipeWrapper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -16,14 +19,12 @@ import net.minecraftforge.fluids.FluidStack;
import WayofTime.bloodmagic.api.registry.OrbRegistry; import WayofTime.bloodmagic.api.registry.OrbRegistry;
import WayofTime.bloodmagic.util.helper.TextHelper; import WayofTime.bloodmagic.util.helper.TextHelper;
public class ShapelessOrbRecipeJEI implements ICraftingRecipeWrapper public class ShapelessOrbRecipeJEI extends BlankRecipeWrapper implements ICraftingRecipeWrapper
{ {
@Nonnull @Nonnull
private final List inputs; private final List inputs;
private final int tier; private final int tier;
@Nonnull @Nonnull
private final ItemStack output; private final ItemStack output;
@ -42,52 +43,16 @@ public class ShapelessOrbRecipeJEI implements ICraftingRecipeWrapper
} }
@Override @Override
public List getInputs() public void getIngredients(IIngredients ingredients) {
{ List<List<ItemStack>> expanded = BloodMagicPlugin.jeiHelper.getStackHelper().expandRecipeItemStackInputs(inputs);
return inputs; ingredients.setInputLists(ItemStack.class, expanded);
} ingredients.setOutput(ItemStack.class, output);
@Override
public List<ItemStack> getOutputs()
{
return Collections.singletonList(output);
} }
@Override @Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY)
{ {
String draw = TextHelper.localize("jei.BloodMagic.recipe.requiredTier", NumeralHelper.toRoman(tier)); String draw = TextHelper.localize("jei.bloodmagic.recipe.requiredTier", NumeralHelper.toRoman(tier));
minecraft.fontRendererObj.drawString(draw, 72 - minecraft.fontRendererObj.getStringWidth(draw) / 2, 10, Color.gray.getRGB()); minecraft.fontRendererObj.drawString(draw, 72 - minecraft.fontRendererObj.getStringWidth(draw) / 2, 10, Color.gray.getRGB());
} }
@Override
public List<FluidStack> getFluidInputs()
{
return null;
}
@Override
public List<FluidStack> getFluidOutputs()
{
return null;
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight)
{
}
@Nullable
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY)
{
return null;
}
@Override
public boolean handleClick(@Nonnull Minecraft minecraft, int mouseX, int mouseY, int mouseButton)
{
return false;
}
} }

View file

@ -1,7 +0,0 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package WayofTime.bloodmagic.compat.jei.orb;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View file

@ -1,7 +0,0 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package WayofTime.bloodmagic.compat.jei;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View file

@ -37,7 +37,7 @@ public class EntityAIAttackStealthMelee extends EntityAIBase
public EntityAIAttackStealthMelee(EntityCorruptedChicken creature, double speedIn, boolean useLongMemory) public EntityAIAttackStealthMelee(EntityCorruptedChicken creature, double speedIn, boolean useLongMemory)
{ {
this.chicken = creature; this.chicken = creature;
this.worldObj = creature.worldObj; this.worldObj = creature.getEntityWorld();
this.speedTowardsTarget = speedIn; this.speedTowardsTarget = speedIn;
this.longMemory = useLongMemory; this.longMemory = useLongMemory;
this.setMutexBits(3); this.setMutexBits(3);

View file

@ -20,7 +20,7 @@ public class EntityAIEatAndCorruptBlock extends EntityAIBase
public EntityAIEatAndCorruptBlock(EntityAspectedDemonBase entity) public EntityAIEatAndCorruptBlock(EntityAspectedDemonBase entity)
{ {
this.grassEaterEntity = entity; this.grassEaterEntity = entity;
this.world = entity.worldObj; this.world = entity.getEntityWorld();
this.setMutexBits(7); this.setMutexBits(7);
} }

View file

@ -29,7 +29,7 @@ public class EntityAIFollowOwner extends EntityAIBase
public EntityAIFollowOwner(EntityDemonBase thePetIn, double followSpeedIn, float minDistIn, float maxDistIn) public EntityAIFollowOwner(EntityDemonBase thePetIn, double followSpeedIn, float minDistIn, float maxDistIn)
{ {
this.thePet = thePetIn; this.thePet = thePetIn;
this.theWorld = thePetIn.worldObj; this.theWorld = thePetIn.getEntityWorld();
this.followSpeed = followSpeedIn; this.followSpeed = followSpeedIn;
this.petPathfinder = thePetIn.getNavigator(); this.petPathfinder = thePetIn.getNavigator();
this.minDist = minDistIn; this.minDist = minDistIn;
@ -122,9 +122,9 @@ public class EntityAIFollowOwner extends EntityAIBase
{ {
if (this.thePet.getDistanceSqToEntity(this.theOwner) >= 144.0D) if (this.thePet.getDistanceSqToEntity(this.theOwner) >= 144.0D)
{ {
int i = MathHelper.floor_double(this.theOwner.posX) - 2; int i = MathHelper.floor(this.theOwner.posX) - 2;
int j = MathHelper.floor_double(this.theOwner.posZ) - 2; int j = MathHelper.floor(this.theOwner.posZ) - 2;
int k = MathHelper.floor_double(this.theOwner.getEntityBoundingBox().minY); int k = MathHelper.floor(this.theOwner.getEntityBoundingBox().minY);
for (int l = 0; l <= 4; ++l) for (int l = 0; l <= 4; ++l)
{ {

View file

@ -32,7 +32,7 @@ public class EntityAIGrabEffectsFromOwner extends EntityAIBase
public EntityAIGrabEffectsFromOwner(EntitySentientSpecter thePetIn, double followSpeedIn, float minDistIn) public EntityAIGrabEffectsFromOwner(EntitySentientSpecter thePetIn, double followSpeedIn, float minDistIn)
{ {
this.thePet = thePetIn; this.thePet = thePetIn;
this.theWorld = thePetIn.worldObj; this.theWorld = thePetIn.getEntityWorld();
this.followSpeed = followSpeedIn; this.followSpeed = followSpeedIn;
this.petPathfinder = thePetIn.getNavigator(); this.petPathfinder = thePetIn.getNavigator();
this.minDist = minDistIn; this.minDist = minDistIn;
@ -135,9 +135,9 @@ public class EntityAIGrabEffectsFromOwner extends EntityAIBase
{ {
if (this.thePet.getDistanceSqToEntity(this.theOwner) >= 144.0D) if (this.thePet.getDistanceSqToEntity(this.theOwner) >= 144.0D)
{ {
int i = MathHelper.floor_double(this.theOwner.posX) - 2; int i = MathHelper.floor(this.theOwner.posX) - 2;
int j = MathHelper.floor_double(this.theOwner.posZ) - 2; int j = MathHelper.floor(this.theOwner.posZ) - 2;
int k = MathHelper.floor_double(this.theOwner.getEntityBoundingBox().minY); int k = MathHelper.floor(this.theOwner.getEntityBoundingBox().minY);
for (int l = 0; l <= 4; ++l) for (int l = 0; l <= 4; ++l)
{ {

View file

@ -40,7 +40,7 @@ public class EntityAIPickUpAlly extends EntityAIBase
public EntityAIPickUpAlly(EntityAspectedDemonBase creature, double speedIn, boolean useLongMemory) public EntityAIPickUpAlly(EntityAspectedDemonBase creature, double speedIn, boolean useLongMemory)
{ {
this.entity = creature; this.entity = creature;
this.worldObj = creature.worldObj; this.worldObj = creature.getEntityWorld();
this.speedTowardsTarget = speedIn; this.speedTowardsTarget = speedIn;
this.longMemory = useLongMemory; this.longMemory = useLongMemory;
this.setMutexBits(3); this.setMutexBits(3);
@ -57,7 +57,7 @@ public class EntityAIPickUpAlly extends EntityAIBase
} }
AxisAlignedBB bb = new AxisAlignedBB(entity.posX - 0.5, entity.posY - 0.5, entity.posZ - 0.5, entity.posX + 0.5, entity.posY + 0.5, entity.posZ + 0.5).expandXyz(5); AxisAlignedBB bb = new AxisAlignedBB(entity.posX - 0.5, entity.posY - 0.5, entity.posZ - 0.5, entity.posX + 0.5, entity.posY + 0.5, entity.posZ + 0.5).expandXyz(5);
List<EntityLivingBase> list = this.entity.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, bb, new EntityAspectedDemonBase.WillTypePredicate(entity.getType())); List<EntityLivingBase> list = this.entity.getEntityWorld().getEntitiesWithinAABB(EntityLivingBase.class, bb, new EntityAspectedDemonBase.WillTypePredicate(entity.getType()));
for (EntityLivingBase testEntity : list) for (EntityLivingBase testEntity : list)
{ {
if (testEntity != this.entity) if (testEntity != this.entity)

View file

@ -21,7 +21,7 @@ public class EntityAIProtectAlly extends EntityAIBase
public EntityAIProtectAlly(EntityCorruptedSheep entity) public EntityAIProtectAlly(EntityCorruptedSheep entity)
{ {
this.entity = entity; this.entity = entity;
this.world = entity.worldObj; this.world = entity.getEntityWorld();
this.setMutexBits(7); this.setMutexBits(7);
} }

View file

@ -69,7 +69,7 @@ public class EntityAIRetreatToHeal<T extends Entity> extends EntityAIBase
} }
//This part almost doesn't matter //This part almost doesn't matter
List<T> list = this.theEntity.worldObj.<T>getEntitiesWithinAABB(this.classToAvoid, this.theEntity.getEntityBoundingBox().expand((double) this.avoidDistance, 3.0D, (double) this.avoidDistance), Predicates.and(new Predicate[] { EntitySelectors.CAN_AI_TARGET, this.canBeSeenSelector, this.avoidTargetSelector })); List<T> list = this.theEntity.getEntityWorld().<T>getEntitiesWithinAABB(this.classToAvoid, this.theEntity.getEntityBoundingBox().expand((double) this.avoidDistance, 3.0D, (double) this.avoidDistance), Predicates.and(new Predicate[] { EntitySelectors.CAN_AI_TARGET, this.canBeSeenSelector, this.avoidTargetSelector }));
if (list.isEmpty()) if (list.isEmpty())
{ {

View file

@ -82,7 +82,7 @@ public class EntityAIStealthRetreat extends EntityAIBase
@Override @Override
public void startExecuting() public void startExecuting()
{ {
ticksLeft = this.entity.worldObj.rand.nextInt(100) + 100; ticksLeft = this.entity.getEntityWorld().rand.nextInt(100) + 100;
this.entityPathNavigate.setPath(this.entityPathEntity, this.farSpeed); this.entityPathNavigate.setPath(this.entityPathEntity, this.farSpeed);
} }

View file

@ -47,7 +47,7 @@ public class EntityAIStealthTowardsTarget extends EntityAIBase
return false; return false;
} else } else
{ {
ticksLeft = this.entity.worldObj.rand.nextInt(200) + 100; ticksLeft = this.entity.getEntityWorld().rand.nextInt(200) + 100;
this.xPosition = vec3d.xCoord; this.xPosition = vec3d.xCoord;
this.yPosition = vec3d.yCoord; this.yPosition = vec3d.yCoord;
this.zPosition = vec3d.zCoord; this.zPosition = vec3d.zCoord;

View file

@ -180,15 +180,15 @@ public abstract class EntityAspectedDemonBase extends EntityDemonBase
float newAmount = amount; float newAmount = amount;
if (source.isProjectile()) if (source.isProjectile())
{ {
newAmount *= MathHelper.clamp_double(1 - getProjectileResist(), 0, 1); newAmount *= MathHelper.clamp(1 - getProjectileResist(), 0, 1);
} else } else
{ {
newAmount *= MathHelper.clamp_double(1 - getMeleeResist(), 0, 1); newAmount *= MathHelper.clamp(1 - getMeleeResist(), 0, 1);
} }
if (source.isMagicDamage()) if (source.isMagicDamage())
{ {
newAmount *= MathHelper.clamp_double(1 - getMagicResist(), 0, 1); newAmount *= MathHelper.clamp(1 - getMagicResist(), 0, 1);
} }
return super.attackEntityFrom(source, newAmount); return super.attackEntityFrom(source, newAmount);

View file

@ -139,7 +139,7 @@ public class EntityCorruptedChicken extends EntityAspectedDemonBase
this.oFlap = this.wingRotation; this.oFlap = this.wingRotation;
this.oFlapSpeed = this.destPos; this.oFlapSpeed = this.destPos;
this.destPos = (float) ((double) this.destPos + (double) (this.onGround ? -1 : 4) * 0.3D); this.destPos = (float) ((double) this.destPos + (double) (this.onGround ? -1 : 4) * 0.3D);
this.destPos = MathHelper.clamp_float(this.destPos, 0.0F, 1.0F); this.destPos = MathHelper.clamp(this.destPos, 0.0F, 1.0F);
if (!this.onGround && this.wingRotDelta < 1.0F) if (!this.onGround && this.wingRotDelta < 1.0F)
{ {
@ -155,7 +155,7 @@ public class EntityCorruptedChicken extends EntityAspectedDemonBase
this.wingRotation += this.wingRotDelta * 2.0F; this.wingRotation += this.wingRotDelta * 2.0F;
if (!this.worldObj.isRemote && !this.isChild() && --this.timeUntilNextEgg <= 0) if (!this.getEntityWorld().isRemote && !this.isChild() && --this.timeUntilNextEgg <= 0)
{ {
this.playSound(SoundEvents.ENTITY_CHICKEN_EGG, 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); this.playSound(SoundEvents.ENTITY_CHICKEN_EGG, 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
this.dropItem(Items.EGG, 1); this.dropItem(Items.EGG, 1);

View file

@ -66,7 +66,7 @@ public class EntityCorruptedSheep extends EntityAspectedDemonBase implements ISh
public static float[] getDyeRgb(EnumDyeColor dyeColor) public static float[] getDyeRgb(EnumDyeColor dyeColor)
{ {
return (float[]) DYE_TO_RGB.get(dyeColor); return DYE_TO_RGB.get(dyeColor);
} }
public EntityCorruptedSheep(World world) public EntityCorruptedSheep(World world)
@ -121,7 +121,7 @@ public class EntityCorruptedSheep extends EntityAspectedDemonBase implements ISh
@Override @Override
public void onLivingUpdate() public void onLivingUpdate()
{ {
if (this.worldObj.isRemote) if (this.getEntityWorld().isRemote)
{ {
this.sheepTimer = Math.max(0, this.sheepTimer - 1); this.sheepTimer = Math.max(0, this.sheepTimer - 1);
this.castTimer = Math.max(0, castTimer - 1); this.castTimer = Math.max(0, castTimer - 1);
@ -359,7 +359,7 @@ public class EntityCorruptedSheep extends EntityAspectedDemonBase implements ISh
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata) public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata)
{ {
livingdata = super.onInitialSpawn(difficulty, livingdata); livingdata = super.onInitialSpawn(difficulty, livingdata);
this.setFleeceColor(getRandomSheepColor(this.worldObj.rand)); this.setFleeceColor(getRandomSheepColor(this.getEntityWorld().rand));
return livingdata; return livingdata;
} }

View file

@ -52,7 +52,7 @@ public class EntityCorruptedSpider extends EntityAspectedDemonBase
this.tasks.addTask(5, new EntityAIWander(this, 0.8D)); this.tasks.addTask(5, new EntityAIWander(this, 0.8D));
this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
this.tasks.addTask(6, new EntityAILookIdle(this)); this.tasks.addTask(6, new EntityAILookIdle(this));
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0])); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
this.targetTasks.addTask(1, new EntityAINearestAttackableTarget<EntityPlayer>(this, EntityPlayer.class, true)); this.targetTasks.addTask(1, new EntityAINearestAttackableTarget<EntityPlayer>(this, EntityPlayer.class, true));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget<EntityLivingBase>(this, EntityLivingBase.class, 10, true, false, new EntityAspectedDemonBase.TeamAttackPredicate(this))); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget<EntityLivingBase>(this, EntityLivingBase.class, 10, true, false, new EntityAspectedDemonBase.TeamAttackPredicate(this)));
@ -95,7 +95,7 @@ public class EntityCorruptedSpider extends EntityAspectedDemonBase
} }
@Override @Override
protected PathNavigate getNewNavigator(World worldIn) protected PathNavigate createNavigator(World worldIn)
{ {
return new PathNavigateClimber(this, worldIn); return new PathNavigateClimber(this, worldIn);
} }
@ -112,7 +112,7 @@ public class EntityCorruptedSpider extends EntityAspectedDemonBase
{ {
super.onUpdate(); super.onUpdate();
if (!this.worldObj.isRemote) if (!this.getEntityWorld().isRemote)
{ {
this.setBesideClimbableBlock(this.isCollidedHorizontally); this.setBesideClimbableBlock(this.isCollidedHorizontally);
} }

View file

@ -73,7 +73,7 @@ public class EntityCorruptedZombie extends EntityAspectedDemonBase
@Override @Override
public void setCombatTask() public void setCombatTask()
{ {
if (this.worldObj != null && !this.worldObj.isRemote) if (this.getEntityWorld() != null && !this.getEntityWorld().isRemote)
{ {
this.tasks.removeTask(this.aiAttackOnCollide); this.tasks.removeTask(this.aiAttackOnCollide);
this.tasks.removeTask(this.aiArrowAttack); this.tasks.removeTask(this.aiArrowAttack);
@ -83,7 +83,7 @@ public class EntityCorruptedZombie extends EntityAspectedDemonBase
{ {
int i = 20; int i = 20;
if (this.worldObj.getDifficulty() != EnumDifficulty.HARD) if (this.getEntityWorld().getDifficulty() != EnumDifficulty.HARD)
{ {
i = 40; i = 40;
} }
@ -128,7 +128,7 @@ public class EntityCorruptedZombie extends EntityAspectedDemonBase
*/ */
public double absorbWillFromAuraToHeal(double toHeal) public double absorbWillFromAuraToHeal(double toHeal)
{ {
if (worldObj.isRemote) if (getEntityWorld().isRemote)
{ {
return 0; return 0;
} }
@ -139,13 +139,13 @@ public class EntityCorruptedZombie extends EntityAspectedDemonBase
return 0; return 0;
} }
double will = WorldDemonWillHandler.getCurrentWill(worldObj, getPosition(), getType()); double will = WorldDemonWillHandler.getCurrentWill(getEntityWorld(), getPosition(), getType());
toHeal = Math.min(healthMissing, Math.min(toHeal, will / getWillToHealth())); toHeal = Math.min(healthMissing, Math.min(toHeal, will / getWillToHealth()));
if (toHeal > 0) if (toHeal > 0)
{ {
this.heal((float) toHeal); this.heal((float) toHeal);
return WorldDemonWillHandler.drainWill(worldObj, getPosition(), getType(), toHeal * getWillToHealth(), true); return WorldDemonWillHandler.drainWill(getEntityWorld(), getPosition(), getType(), toHeal * getWillToHealth(), true);
} }
return 0; return 0;
@ -164,7 +164,7 @@ public class EntityCorruptedZombie extends EntityAspectedDemonBase
public void onUpdate() public void onUpdate()
{ {
if (!this.worldObj.isRemote && this.ticksExisted % 20 == 0) if (!this.getEntityWorld().isRemote && this.ticksExisted % 20 == 0)
{ {
absorbWillFromAuraToHeal(2); absorbWillFromAuraToHeal(2);
} }

View file

@ -51,7 +51,7 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
protected void entityInit() protected void entityInit()
{ {
super.entityInit(); super.entityInit();
this.dataManager.register(TAMED, Byte.valueOf((byte) 0)); this.dataManager.register(TAMED, (byte) 0);
this.dataManager.register(OWNER_UNIQUE_ID, Optional.<UUID>absent()); this.dataManager.register(OWNER_UNIQUE_ID, Optional.<UUID>absent());
} }
@ -84,7 +84,7 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
@Override @Override
public boolean attackEntityFrom(DamageSource source, float amount) public boolean attackEntityFrom(DamageSource source, float amount)
{ {
return this.isEntityInvulnerable(source) ? false : super.attackEntityFrom(source, amount); return !this.isEntityInvulnerable(source) && super.attackEntityFrom(source, amount);
} }
/** /**
@ -133,7 +133,7 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
if (this.rand.nextFloat() < f1) if (this.rand.nextFloat() < f1)
{ {
entityplayer.getCooldownTracker().setCooldown(Items.SHIELD, 100); entityplayer.getCooldownTracker().setCooldown(Items.SHIELD, 100);
this.worldObj.setEntityState(entityplayer, (byte) 30); this.getEntityWorld().setEntityState(entityplayer, (byte) 30);
} }
} }
} }
@ -149,7 +149,7 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
{ {
super.setItemStackToSlot(slotIn, stack); super.setItemStackToSlot(slotIn, stack);
if (!this.worldObj.isRemote && slotIn == EntityEquipmentSlot.MAINHAND) if (!this.getEntityWorld().isRemote && slotIn == EntityEquipmentSlot.MAINHAND)
{ {
this.setCombatTask(); this.setCombatTask();
} }
@ -169,9 +169,9 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
{ {
this.heal((float) toHeal); this.heal((float) toHeal);
if (worldObj instanceof WorldServer) if (getEntityWorld() instanceof WorldServer)
{ {
WorldServer server = (WorldServer) worldObj; WorldServer server = (WorldServer) getEntityWorld();
server.spawnParticle(EnumParticleTypes.HEART, this.posX + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, this.posY + 0.5D + (double) (this.rand.nextFloat() * this.height), this.posZ + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, 7, 0.2, 0.2, 0.2, 0, new int[0]); server.spawnParticle(EnumParticleTypes.HEART, this.posX + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, this.posY + 0.5D + (double) (this.rand.nextFloat() * this.height), this.posZ + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, 7, 0.2, 0.2, 0.2, 0, new int[0]);
} }
} }
@ -248,7 +248,7 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
} }
} }
return attacker instanceof EntityPlayer && owner instanceof EntityPlayer && !((EntityPlayer) owner).canAttackPlayer((EntityPlayer) attacker) ? false : !(attacker instanceof EntityHorse) || !((EntityHorse) attacker).isTame(); return !(attacker instanceof EntityPlayer && owner instanceof EntityPlayer && !((EntityPlayer) owner).canAttackPlayer((EntityPlayer) attacker)) && (!(attacker instanceof EntityHorse) || !((EntityHorse) attacker).isTame());
} else } else
{ {
return false; return false;
@ -262,19 +262,19 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
public boolean isTamed() public boolean isTamed()
{ {
return (((Byte) this.dataManager.get(TAMED)).byteValue() & 4) != 0; return (this.dataManager.get(TAMED) & 4) != 0;
} }
public void setTamed(boolean tamed) public void setTamed(boolean tamed)
{ {
byte b0 = ((Byte) this.dataManager.get(TAMED)).byteValue(); byte b0 = this.dataManager.get(TAMED);
if (tamed) if (tamed)
{ {
this.dataManager.set(TAMED, Byte.valueOf((byte) (b0 | 4))); this.dataManager.set(TAMED, (byte) (b0 | 4));
} else } else
{ {
this.dataManager.set(TAMED, Byte.valueOf((byte) (b0 & -5))); this.dataManager.set(TAMED, (byte) (b0 & -5));
} }
// this.setupTamedAI(); // this.setupTamedAI();
@ -316,7 +316,7 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
@Override @Override
public UUID getOwnerId() public UUID getOwnerId()
{ {
return (UUID) (this.dataManager.get(OWNER_UNIQUE_ID)).orNull(); return this.dataManager.get(OWNER_UNIQUE_ID).orNull();
} }
public void setOwnerId(UUID uuid) public void setOwnerId(UUID uuid)
@ -330,7 +330,7 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
try try
{ {
UUID uuid = this.getOwnerId(); UUID uuid = this.getOwnerId();
return uuid == null ? null : this.worldObj.getPlayerEntityByUUID(uuid); return uuid == null ? null : this.getEntityWorld().getPlayerEntityByUUID(uuid);
} catch (IllegalArgumentException var2) } catch (IllegalArgumentException var2)
{ {
return null; return null;

View file

@ -43,7 +43,7 @@ public class EntityMimic extends EntityDemonBase
/** /**
* Copy of EntitySpider's AI (should be pretty evident...) * Copy of EntitySpider's AI (should be pretty evident...)
*/ */
private static final DataParameter<Byte> CLIMBING = EntityDataManager.<Byte>createKey(EntityMimic.class, DataSerializers.BYTE); private static final DataParameter<Byte> CLIMBING = EntityDataManager.createKey(EntityMimic.class, DataSerializers.BYTE);
public boolean dropItemsOnBreak = true; public boolean dropItemsOnBreak = true;
public NBTTagCompound tileTag = new NBTTagCompound(); public NBTTagCompound tileTag = new NBTTagCompound();
@ -64,7 +64,7 @@ public class EntityMimic extends EntityDemonBase
this.tasks.addTask(8, new EntityAILookIdle(this)); this.tasks.addTask(8, new EntityAILookIdle(this));
this.tasks.addTask(7, new EntityAIMimicReform(this)); this.tasks.addTask(7, new EntityAIMimicReform(this));
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0])); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
this.targetTasks.addTask(2, new EntityMimic.AISpiderTarget(this, EntityPlayer.class)); this.targetTasks.addTask(2, new EntityMimic.AISpiderTarget(this, EntityPlayer.class));
this.targetTasks.addTask(3, new EntityMimic.AISpiderTarget(this, EntityIronGolem.class)); this.targetTasks.addTask(3, new EntityMimic.AISpiderTarget(this, EntityIronGolem.class));
} }
@ -160,7 +160,7 @@ public class EntityMimic extends EntityDemonBase
} }
BlockPos newPos = centerPos.add(i, j, k); BlockPos newPos = centerPos.add(i, j, k);
if (spawnMimicBlockAtPosition(worldObj, newPos)) if (spawnMimicBlockAtPosition(getEntityWorld(), newPos))
{ {
return true; return true;
} }
@ -178,7 +178,7 @@ public class EntityMimic extends EntityDemonBase
{ {
super.onDeath(cause); super.onDeath(cause);
if (!worldObj.isRemote) if (!getEntityWorld().isRemote)
{ {
BlockPos centerPos = this.getPosition(); BlockPos centerPos = this.getPosition();
@ -201,7 +201,7 @@ public class EntityMimic extends EntityDemonBase
} }
BlockPos newPos = centerPos.add(i, j, k); BlockPos newPos = centerPos.add(i, j, k);
if (spawnHeldBlockOnDeath(worldObj, newPos)) if (spawnHeldBlockOnDeath(getEntityWorld(), newPos))
{ {
return; return;
} }
@ -227,7 +227,7 @@ public class EntityMimic extends EntityDemonBase
* Returns new PathNavigateGround instance * Returns new PathNavigateGround instance
*/ */
@Override @Override
protected PathNavigate getNewNavigator(World worldIn) protected PathNavigate createNavigator(World worldIn)
{ {
return new PathNavigateClimber(this, worldIn); return new PathNavigateClimber(this, worldIn);
} }
@ -236,7 +236,7 @@ public class EntityMimic extends EntityDemonBase
protected void entityInit() protected void entityInit()
{ {
super.entityInit(); super.entityInit();
this.dataManager.register(CLIMBING, Byte.valueOf((byte) 0)); this.dataManager.register(CLIMBING, (byte) 0);
// this.dataManager.register(ITEMSTACK, null); // this.dataManager.register(ITEMSTACK, null);
} }
@ -246,7 +246,7 @@ public class EntityMimic extends EntityDemonBase
@Override @Override
public void onUpdate() public void onUpdate()
{ {
if (!this.worldObj.isRemote && this.worldObj.getDifficulty() == EnumDifficulty.PEACEFUL) if (!this.getEntityWorld().isRemote && this.getEntityWorld().getDifficulty() == EnumDifficulty.PEACEFUL)
{ {
if (reformIntoMimicBlock(this.getPosition())) if (reformIntoMimicBlock(this.getPosition()))
{ {
@ -256,7 +256,7 @@ public class EntityMimic extends EntityDemonBase
super.onUpdate(); super.onUpdate();
if (!this.worldObj.isRemote) if (!this.getEntityWorld().isRemote)
{ {
this.setBesideClimbableBlock(this.isCollidedHorizontally); this.setBesideClimbableBlock(this.isCollidedHorizontally);
} }
@ -324,7 +324,7 @@ public class EntityMimic extends EntityDemonBase
@Override @Override
public boolean isPotionApplicable(PotionEffect potioneffectIn) public boolean isPotionApplicable(PotionEffect potioneffectIn)
{ {
return potioneffectIn.getPotion() == MobEffects.POISON ? false : super.isPotionApplicable(potioneffectIn); return potioneffectIn.getPotion() != MobEffects.POISON && super.isPotionApplicable(potioneffectIn);
} }
/** /**
@ -333,7 +333,7 @@ public class EntityMimic extends EntityDemonBase
*/ */
public boolean isBesideClimbableBlock() public boolean isBesideClimbableBlock()
{ {
return (((Byte) this.dataManager.get(CLIMBING)).byteValue() & 1) != 0; return (this.dataManager.get(CLIMBING) & 1) != 0;
} }
/** /**
@ -342,7 +342,7 @@ public class EntityMimic extends EntityDemonBase
*/ */
public void setBesideClimbableBlock(boolean climbing) public void setBesideClimbableBlock(boolean climbing)
{ {
byte b0 = ((Byte) this.dataManager.get(CLIMBING)).byteValue(); byte b0 = this.dataManager.get(CLIMBING);
if (climbing) if (climbing)
{ {
@ -352,7 +352,7 @@ public class EntityMimic extends EntityDemonBase
b0 = (byte) (b0 & -2); b0 = (byte) (b0 & -2);
} }
this.dataManager.set(CLIMBING, Byte.valueOf(b0)); this.dataManager.set(CLIMBING, b0);
} }
public float getEyeHeight() public float getEyeHeight()

View file

@ -107,7 +107,7 @@ public class EntitySentientSpecter extends EntityDemonBase
@Override @Override
public void setCombatTask() public void setCombatTask()
{ {
if (this.worldObj != null && !this.worldObj.isRemote) if (this.getEntityWorld() != null && !this.getEntityWorld().isRemote)
{ {
this.tasks.removeTask(this.aiAttackOnCollide); this.tasks.removeTask(this.aiAttackOnCollide);
this.tasks.removeTask(this.aiArrowAttack); this.tasks.removeTask(this.aiArrowAttack);
@ -117,7 +117,7 @@ public class EntitySentientSpecter extends EntityDemonBase
{ {
int i = 20; int i = 20;
if (this.worldObj.getDifficulty() != EnumDifficulty.HARD) if (this.getEntityWorld().getDifficulty() != EnumDifficulty.HARD)
{ {
i = 40; i = 40;
} }
@ -311,7 +311,7 @@ public class EntitySentientSpecter extends EntityDemonBase
{ {
super.onDeath(cause); super.onDeath(cause);
if (!worldObj.isRemote && getHeldItemMainhand() != null) if (!getEntityWorld().isRemote && getHeldItemMainhand() != null)
{ {
this.entityDropItem(getHeldItemMainhand(), 0); this.entityDropItem(getHeldItemMainhand(), 0);
} }
@ -345,7 +345,7 @@ public class EntitySentientSpecter extends EntityDemonBase
{ {
if (stack == null && player.isSneaking()) //Should return to the entity if (stack == null && player.isSneaking()) //Should return to the entity
{ {
if (!worldObj.isRemote) if (!getEntityWorld().isRemote)
{ {
if (getHeldItemMainhand() != null) if (getHeldItemMainhand() != null)
{ {
@ -380,9 +380,9 @@ public class EntitySentientSpecter extends EntityDemonBase
{ {
this.heal((float) toHeal); this.heal((float) toHeal);
if (worldObj instanceof WorldServer) if (getEntityWorld() instanceof WorldServer)
{ {
WorldServer server = (WorldServer) worldObj; WorldServer server = (WorldServer) getEntityWorld();
server.spawnParticle(EnumParticleTypes.HEART, this.posX + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, this.posY + 0.5D + (double) (this.rand.nextFloat() * this.height), this.posZ + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, 7, 0.2, 0.2, 0.2, 0, new int[0]); server.spawnParticle(EnumParticleTypes.HEART, this.posX + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, this.posY + 0.5D + (double) (this.rand.nextFloat() * this.height), this.posZ + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, 7, 0.2, 0.2, 0.2, 0, new int[0]);
} }
} }
@ -394,7 +394,7 @@ public class EntitySentientSpecter extends EntityDemonBase
*/ */
public double absorbWillFromAuraToHeal(double toHeal) public double absorbWillFromAuraToHeal(double toHeal)
{ {
if (worldObj.isRemote) if (getEntityWorld().isRemote)
{ {
return 0; return 0;
} }
@ -405,13 +405,13 @@ public class EntitySentientSpecter extends EntityDemonBase
return 0; return 0;
} }
double will = WorldDemonWillHandler.getCurrentWill(worldObj, getPosition(), getType()); double will = WorldDemonWillHandler.getCurrentWill(getEntityWorld(), getPosition(), getType());
toHeal = Math.min(healthMissing, Math.min(toHeal, will / getWillToHealth())); toHeal = Math.min(healthMissing, Math.min(toHeal, will / getWillToHealth()));
if (toHeal > 0) if (toHeal > 0)
{ {
this.heal((float) toHeal); this.heal((float) toHeal);
return WorldDemonWillHandler.drainWill(worldObj, getPosition(), getType(), toHeal * getWillToHealth(), true); return WorldDemonWillHandler.drainWill(getEntityWorld(), getPosition(), getType(), toHeal * getWillToHealth(), true);
} }
return 0; return 0;
@ -430,7 +430,7 @@ public class EntitySentientSpecter extends EntityDemonBase
public void onUpdate() public void onUpdate()
{ {
if (!this.worldObj.isRemote && this.ticksExisted % 20 == 0) if (!this.getEntityWorld().isRemote && this.ticksExisted % 20 == 0)
{ {
absorbWillFromAuraToHeal(2); absorbWillFromAuraToHeal(2);
} }
@ -485,7 +485,7 @@ public class EntitySentientSpecter extends EntityDemonBase
ItemStack heldStack = this.getItemStackFromSlot(EntityEquipmentSlot.MAINHAND); ItemStack heldStack = this.getItemStackFromSlot(EntityEquipmentSlot.MAINHAND);
if (heldStack != null && heldStack.getItem() == ModItems.SENTIENT_BOW) if (heldStack != null && heldStack.getItem() == ModItems.SENTIENT_BOW)
{ {
EntityTippedArrow arrowEntity = ((ItemSentientBow) heldStack.getItem()).getArrowEntity(worldObj, heldStack, target, this, velocity); EntityTippedArrow arrowEntity = ((ItemSentientBow) heldStack.getItem()).getArrowEntity(getEntityWorld(), heldStack, target, this, velocity);
if (arrowEntity != null) if (arrowEntity != null)
{ {
List<PotionEffect> effects = getPotionEffectsForArrowRemovingDuration(0.2f); List<PotionEffect> effects = getPotionEffectsForArrowRemovingDuration(0.2f);
@ -495,19 +495,19 @@ public class EntitySentientSpecter extends EntityDemonBase
} }
this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
this.worldObj.spawnEntityInWorld(arrowEntity); this.getEntityWorld().spawnEntity(arrowEntity);
} }
} else } else
{ {
EntityTippedArrow entitytippedarrow = new EntityTippedArrow(this.worldObj, this); //TODO: Change to an arrow created by the Sentient Bow EntityTippedArrow entitytippedarrow = new EntityTippedArrow(this.getEntityWorld(), this); //TODO: Change to an arrow created by the Sentient Bow
double d0 = target.posX - this.posX; double d0 = target.posX - this.posX;
double d1 = target.getEntityBoundingBox().minY + (double) (target.height / 3.0F) - entitytippedarrow.posY; double d1 = target.getEntityBoundingBox().minY + (double) (target.height / 3.0F) - entitytippedarrow.posY;
double d2 = target.posZ - this.posZ; double d2 = target.posZ - this.posZ;
double d3 = (double) MathHelper.sqrt_double(d0 * d0 + d2 * d2); double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
entitytippedarrow.setThrowableHeading(d0, d1 + d3 * 0.2, d2, 1.6F, 0); //TODO: Yes, it is an accurate arrow. Don't be hatin' entitytippedarrow.setThrowableHeading(d0, d1 + d3 * 0.2, d2, 1.6F, 0); //TODO: Yes, it is an accurate arrow. Don't be hatin'
int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.POWER, this); int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.POWER, this);
int j = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.PUNCH, this); int j = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.PUNCH, this);
entitytippedarrow.setDamage((double) (velocity * 2.0F) + this.rand.nextGaussian() * 0.25D + (double) ((float) this.worldObj.getDifficulty().getDifficultyId() * 0.11F)); entitytippedarrow.setDamage((double) (velocity * 2.0F) + this.rand.nextGaussian() * 0.25D + (double) ((float) this.getEntityWorld().getDifficulty().getDifficultyId() * 0.11F));
if (i > 0) if (i > 0)
{ {
@ -533,7 +533,7 @@ public class EntitySentientSpecter extends EntityDemonBase
} }
this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
this.worldObj.spawnEntityInWorld(entitytippedarrow); this.getEntityWorld().spawnEntity(entitytippedarrow);
} }
} }

View file

@ -61,7 +61,7 @@ public class EntityBloodLight extends EntityThrowable implements IThrowableEntit
@Override @Override
public void setThrowableHeading(double var1, double var3, double var5, float var7, float var8) public void setThrowableHeading(double var1, double var3, double var5, float var7, float var8)
{ {
float var9 = MathHelper.sqrt_double(var1 * var1 + var3 * var3 + var5 * var5); float var9 = MathHelper.sqrt(var1 * var1 + var3 * var3 + var5 * var5);
var1 /= var9; var1 /= var9;
var3 /= var9; var3 /= var9;
var5 /= var9; var5 /= var9;
@ -74,7 +74,7 @@ public class EntityBloodLight extends EntityThrowable implements IThrowableEntit
motionX = var1; motionX = var1;
motionY = var3; motionY = var3;
motionZ = var5; motionZ = var5;
float var10 = MathHelper.sqrt_double(var1 * var1 + var5 * var5); float var10 = MathHelper.sqrt(var1 * var1 + var5 * var5);
prevRotationYaw = rotationYaw = (float) (Math.atan2(var1, var5) * 180.0D / Math.PI); prevRotationYaw = rotationYaw = (float) (Math.atan2(var1, var5) * 180.0D / Math.PI);
prevRotationPitch = rotationPitch = (float) (Math.atan2(var3, var10) * 180.0D / Math.PI); prevRotationPitch = rotationPitch = (float) (Math.atan2(var3, var10) * 180.0D / Math.PI);
} }
@ -105,9 +105,9 @@ public class EntityBloodLight extends EntityThrowable implements IThrowableEntit
EnumFacing sideHit = mop.sideHit; EnumFacing sideHit = mop.sideHit;
BlockPos blockPos = mop.getBlockPos().offset(sideHit); BlockPos blockPos = mop.getBlockPos().offset(sideHit);
if (worldObj.isAirBlock(blockPos)) if (getEntityWorld().isAirBlock(blockPos))
{ {
worldObj.setBlockState(blockPos, ModBlocks.BLOOD_LIGHT.getDefaultState()); getEntityWorld().setBlockState(blockPos, ModBlocks.BLOOD_LIGHT.getDefaultState());
} }
} }
@ -129,9 +129,9 @@ public class EntityBloodLight extends EntityThrowable implements IThrowableEntit
} }
} }
if (worldObj.isAirBlock(new BlockPos((int) this.posX, (int) this.posY, (int) this.posZ))) if (getEntityWorld().isAirBlock(new BlockPos((int) this.posX, (int) this.posY, (int) this.posZ)))
{ {
worldObj.setBlockState(new BlockPos((int) this.posX, (int) this.posY, (int) this.posZ), Blocks.FIRE.getDefaultState()); getEntityWorld().setBlockState(new BlockPos((int) this.posX, (int) this.posY, (int) this.posZ), Blocks.FIRE.getDefaultState());
} }
// spawnHitParticles("magicCrit", 8); // spawnHitParticles("magicCrit", 8);

View file

@ -95,7 +95,7 @@ public class EntityMeteor extends EntityThrowable implements IThrowableEntity
public void generateMeteor(BlockPos pos) public void generateMeteor(BlockPos pos)
{ {
MeteorRegistry.generateMeteorForItem(meteorStack, worldObj, pos, Blocks.STONE.getDefaultState(), radiusModifier, explosionModifier, fillerChance); MeteorRegistry.generateMeteorForItem(meteorStack, getEntityWorld(), pos, Blocks.STONE.getDefaultState(), radiusModifier, explosionModifier, fillerChance);
} }
public DamageSource getDamageSource() public DamageSource getDamageSource()

View file

@ -41,7 +41,7 @@ public class EntitySentientArrow extends EntityTippedArrow
{ {
if (this.shootingEntity instanceof EntityPlayer) if (this.shootingEntity instanceof EntityPlayer)
{ {
if (hitEntity.worldObj.getDifficulty() != EnumDifficulty.PEACEFUL && !(hitEntity instanceof IMob)) if (hitEntity.getEntityWorld().getDifficulty() != EnumDifficulty.PEACEFUL && !(hitEntity instanceof IMob))
{ {
return; return;
} }

View file

@ -39,7 +39,7 @@ public class EntitySoulSnare extends EntityThrowable
if (result.entityHit != null && result.entityHit != this.getThrower()) if (result.entityHit != null && result.entityHit != this.getThrower())
{ {
if (result.entityHit instanceof EntityLivingBase && result.entityHit.worldObj.rand.nextDouble() < 0.25) if (result.entityHit instanceof EntityLivingBase && result.entityHit.getEntityWorld().rand.nextDouble() < 0.25)
{ {
((EntityLivingBase) result.entityHit).addPotionEffect(new PotionEffect(ModPotions.soulSnare, 300, 0)); ((EntityLivingBase) result.entityHit).addPotionEffect(new PotionEffect(ModPotions.soulSnare, 300, 0));
} }
@ -49,10 +49,10 @@ public class EntitySoulSnare extends EntityThrowable
for (int j = 0; j < 8; ++j) for (int j = 0; j < 8; ++j)
{ {
this.worldObj.spawnParticle(EnumParticleTypes.SNOWBALL, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); this.getEntityWorld().spawnParticle(EnumParticleTypes.SNOWBALL, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
} }
if (!this.worldObj.isRemote) if (!this.getEntityWorld().isRemote)
{ {
this.setDead(); this.setDead();
} }

Some files were not shown because too many files have changed in this diff Show more