Initial stab at 1.11

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

View file

@ -6,8 +6,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
import WayofTime.bloodmagic.client.key.KeyBindings;
import WayofTime.bloodmagic.client.render.model.CustomModelFactory;
import net.minecraft.client.Minecraft;
@ -93,14 +91,11 @@ public class ClientHandler
private static EnumFacing mrsHoloDirection;
private static boolean mrsHoloDisplay;
boolean doCrystalRenderTest = true;
public static ResourceLocation crystalResource = new ResourceLocation(Constants.Mod.DOMAIN + "textures/entities/defaultCrystalLayer.png");
@SubscribeEvent
public void onTooltipEvent(ItemTooltipEvent event)
{
ItemStack stack = event.getItemStack();
if (stack == null)
if (stack.isEmpty())
{
return;
}
@ -121,7 +116,7 @@ public class ClientHandler
@SubscribeEvent
public void onSoundEvent(PlaySoundEvent event)
{
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
EntityPlayer player = Minecraft.getMinecraft().player;
if (player != null && player.isPotionActive(ModPotions.deafness))
{
event.setResultSound(null);
@ -152,8 +147,8 @@ public class ClientHandler
@SubscribeEvent
public void render(RenderWorldLastEvent event)
{
EntityPlayerSP player = minecraft.thePlayer;
World world = player.worldObj;
EntityPlayerSP player = minecraft.player;
World world = player.getEntityWorld();
if (mrsHoloTile != null)
{
@ -174,20 +169,20 @@ public class ClientHandler
TileEntity tileEntity = world.getTileEntity(minecraft.objectMouseOver.getBlockPos());
if (tileEntity instanceof TileMasterRitualStone && player.getHeldItemMainhand() != null && player.getHeldItemMainhand().getItem() instanceof ItemRitualDiviner)
if (tileEntity instanceof TileMasterRitualStone && !player.getHeldItemMainhand().isEmpty() && player.getHeldItemMainhand().getItem() instanceof ItemRitualDiviner)
renderRitualStones(player, event.getPartialTicks());
}
@SubscribeEvent
public void onMouseEvent(MouseEvent event)
{
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
EntityPlayerSP player = Minecraft.getMinecraft().player;
if (event.getDwheel() != 0 && player != null && player.isSneaking())
{
ItemStack stack = player.getHeldItemMainhand();
if (stack != null)
if (!stack.isEmpty())
{
Item item = stack.getItem();
@ -226,7 +221,7 @@ public class ClientHandler
ModelResourceLocation location = new ModelResourceLocation("bloodmagic:BlockBloodTank", "inventory");
IBakedModel model = event.getModelRegistry().getObject(location);
if (model instanceof IBakedModel)
if (model != null)
event.getModelRegistry().putObject(location, new CustomModelFactory(model));
if (BloodMagic.isDev() && SUPPRESS_ASSET_ERRORS)
@ -310,8 +305,8 @@ public class ClientHandler
ItemSigilHolding.cycleToNextSigil(stack, mode);
BloodMagicPacketHandler.INSTANCE.sendToServer(new SigilHoldingPacketProcessor(player.inventory.currentItem, mode));
ItemStack newStack = ItemSigilHolding.getItemStackInSlot(stack, ItemSigilHolding.getCurrentItemOrdinal(stack));
if (newStack != null)
Minecraft.getMinecraft().ingameGUI.setRecordPlaying(newStack.getDisplayName(), false);
if (!newStack.isEmpty())
player.sendStatusMessage(newStack.getTextComponent(), true);
}
private static TextureAtlasSprite forName(TextureMap textureMap, String name, String dir)
@ -321,7 +316,7 @@ public class ClientHandler
private void renderRitualStones(EntityPlayerSP player, float partialTicks)
{
World world = player.worldObj;
World world = player.getEntityWorld();
ItemRitualDiviner ritualDiviner = (ItemRitualDiviner) player.inventory.getCurrentItem().getItem();
EnumFacing direction = ritualDiviner.getDirection(player.inventory.getCurrentItem());
Ritual ritual = RitualRegistry.getRitualForId(ritualDiviner.getCurrentRitual(player.inventory.getCurrentItem()));
@ -385,8 +380,8 @@ public class ClientHandler
public static void renderRitualStones(TileMasterRitualStone masterRitualStone, float partialTicks)
{
EntityPlayerSP player = minecraft.thePlayer;
World world = player.worldObj;
EntityPlayerSP player = minecraft.player;
World world = player.world;
EnumFacing direction = mrsHoloDirection;
Ritual ritual = mrsHoloRitual;
@ -462,28 +457,4 @@ public class ClientHandler
mrsHoloRitual = null;
mrsHoloDirection = EnumFacing.NORTH;
}
protected void renderHotbarItem(int x, int y, float partialTicks, EntityPlayer player, @Nullable ItemStack stack)
{
if (stack != null)
{
float animation = (float) stack.animationsToGo - partialTicks;
if (animation > 0.0F)
{
GlStateManager.pushMatrix();
float f1 = 1.0F + animation / 5.0F;
GlStateManager.translate((float) (x + 8), (float) (y + 12), 0.0F);
GlStateManager.scale(1.0F / f1, (f1 + 1.0F) / 2.0F, 1.0F);
GlStateManager.translate((float) (-(x + 8)), (float) (-(y + 12)), 0.0F);
}
minecraft.getRenderItem().renderItemAndEffectIntoGUI(player, stack, x, y);
if (animation > 0.0F)
GlStateManager.popMatrix();
minecraft.getRenderItem().renderItemOverlays(minecraft.fontRendererObj, stack, x, y);
}
}
}

View file

@ -147,8 +147,6 @@ public class CraftingHandler
event.setCost(1);
event.setOutput(outputStack);
return;
}
}
}

View file

@ -3,6 +3,7 @@ package WayofTime.bloodmagic.util.handler.event;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
@ -101,7 +102,7 @@ public class GenericHandler
{
event.setDamageMultiplier(0);
if (player.worldObj.isRemote)
if (player.getEntityWorld().isRemote)
{
player.motionY *= -0.9;
player.fallDistance = 0;
@ -197,14 +198,14 @@ public class GenericHandler
@SubscribeEvent
public void onEntityHurt(LivingHurtEvent event)
{
if (event.getEntity().worldObj.isRemote)
if (event.getEntity().getEntityWorld().isRemote)
return;
if (event.getSource().getEntity() instanceof EntityPlayer && !PlayerHelper.isFakePlayer((EntityPlayer) event.getSource().getEntity()))
{
EntityPlayer player = (EntityPlayer) event.getSource().getEntity();
if (player.getItemStackFromSlot(EntityEquipmentSlot.CHEST) != null && player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).getItem() instanceof ItemPackSacrifice)
if (!player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty() && player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).getItem() instanceof ItemPackSacrifice)
{
ItemPackSacrifice pack = (ItemPackSacrifice) player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).getItem();
@ -240,7 +241,7 @@ public class GenericHandler
@SubscribeEvent
public void onLivingUpdate(LivingUpdateEvent event)
{
if (!event.getEntityLiving().worldObj.isRemote)
if (!event.getEntityLiving().getEntityWorld().isRemote)
{
EntityLivingBase entity = event.getEntityLiving();
if (entity instanceof EntityPlayer && entity.ticksExisted % 50 == 0) //TODO: Change to an incremental counter
@ -265,7 +266,7 @@ public class GenericHandler
if (animal.getAttackTarget() != null && animal.getDistanceSqToEntity(animal.getAttackTarget()) < 4)
{
animal.worldObj.createExplosion(null, animal.posX, animal.posY + (double) (animal.height / 16.0F), animal.posZ, 2 + animal.getActivePotionEffect(ModPotions.sacrificialLamb).getAmplifier() * 1.5f, false);
animal.getEntityWorld().createExplosion(null, animal.posX, animal.posY + (double) (animal.height / 16.0F), animal.posZ, 2 + animal.getActivePotionEffect(ModPotions.sacrificialLamb).getAmplifier() * 1.5f, false);
targetTaskMap.remove(animal);
attackTaskMap.remove(animal);
}
@ -284,7 +285,7 @@ public class GenericHandler
EntityPlayer player = (EntityPlayer) entity;
if (player.isSneaking() && player.isPotionActive(ModPotions.cling) && Utils.isPlayerBesideSolidBlockFace(player) && !player.onGround)
{
if (player.worldObj.isRemote)
if (player.getEntityWorld().isRemote)
{
player.motionY = 0;
player.motionX *= 0.8;
@ -307,14 +308,15 @@ public class GenericHandler
if (entity.isPotionActive(ModPotions.fireFuse))
{
entity.worldObj.spawnParticle(EnumParticleTypes.FLAME, entity.posX + entity.worldObj.rand.nextDouble() * 0.3, entity.posY + entity.worldObj.rand.nextDouble() * 0.3, entity.posZ + entity.worldObj.rand.nextDouble() * 0.3, 0, 0.06d, 0);
Random random = entity.getEntityWorld().rand;
entity.getEntityWorld().spawnParticle(EnumParticleTypes.FLAME, entity.posX + random.nextDouble() * 0.3, entity.posY + random.nextDouble() * 0.3, entity.posZ + random.nextDouble() * 0.3, 0, 0.06d, 0);
int r = entity.getActivePotionEffect(ModPotions.fireFuse).getAmplifier();
int radius = 1 * r + 1;
if (entity.getActivePotionEffect(ModPotions.fireFuse).getDuration() <= 3)
{
entity.worldObj.createExplosion(null, entity.posX, entity.posY, entity.posZ, radius, false);
entity.getEntityWorld().createExplosion(null, entity.posX, entity.posY, entity.posZ, radius, false);
}
}
@ -335,7 +337,7 @@ public class GenericHandler
if (player instanceof EntityPlayerMP)
{
BlockPos pos = player.getPosition();
DemonWillHolder holder = WorldDemonWillHandler.getWillHolder(player.worldObj.provider.getDimension(), pos.getX() >> 4, pos.getZ() >> 4);
DemonWillHolder holder = WorldDemonWillHandler.getWillHolder(player.getEntityWorld().provider.getDimension(), pos.getX() >> 4, pos.getZ() >> 4);
if (holder != null)
{
BloodMagicPacketHandler.sendTo(new DemonAuraPacketProcessor(holder), (EntityPlayerMP) player);
@ -352,7 +354,7 @@ public class GenericHandler
{
IBlockState state = event.getTargetBlock();
Block block = state.getBlock();
if (block != null && block instanceof BlockAltar && event.getEntityPlayer() != null && event.getEntityPlayer() instanceof EntityPlayerMP && event.getEntityPlayer().getHeldItemMainhand() != null && event.getEntityPlayer().getHeldItemMainhand().getItem() instanceof ItemAltarMaker)
if (block instanceof BlockAltar && event.getEntityPlayer() != null && event.getEntityPlayer() instanceof EntityPlayerMP && !event.getEntityPlayer().getHeldItemMainhand().isEmpty() && event.getEntityPlayer().getHeldItemMainhand().getItem() instanceof ItemAltarMaker)
{
ItemAltarMaker altarMaker = (ItemAltarMaker) event.getEntityPlayer().getHeldItemMainhand().getItem();
ChatUtil.sendNoSpam(event.getEntityPlayer(), TextHelper.localizeEffect("chat.BloodMagic.altarMaker.destroy", altarMaker.destroyAltar(event.getEntityPlayer())));
@ -398,7 +400,7 @@ public class GenericHandler
return;
ItemStack held = event.getItemStack();
if (held != null && held.getItem() instanceof IBindable)
if (!held.isEmpty() && held.getItem() instanceof IBindable)
{
held = NBTHelper.checkNBT(held);
IBindable bindable = (IBindable) held.getItem();
@ -418,7 +420,7 @@ public class GenericHandler
BindableHelper.setItemOwnerName(held, player.getDisplayNameString());
}
if (held != null && held.getItem() instanceof IBloodOrb)
if (!held.isEmpty() && held.getItem() instanceof IBloodOrb)
{
held = NBTHelper.checkNBT(held);
IBloodOrb bloodOrb = (IBloodOrb) held.getItem();
@ -466,10 +468,10 @@ public class GenericHandler
EntityPlayer player = (EntityPlayer) entity;
ItemStack heldStack = player.getHeldItemMainhand();
if (heldStack != null && heldStack.getItem() == ModItems.BOUND_SWORD && !(attackedEntity instanceof EntityAnimal))
if (!heldStack.isEmpty() && heldStack.getItem() == ModItems.BOUND_SWORD && !(attackedEntity instanceof EntityAnimal))
for (int i = 0; i <= EnchantmentHelper.getLootingModifier(player); i++)
if (attackedEntity.getEntityWorld().rand.nextDouble() < 0.2)
event.getDrops().add(new EntityItem(attackedEntity.worldObj, attackedEntity.posX, attackedEntity.posY, attackedEntity.posZ, new ItemStack(ModItems.BLOOD_SHARD, 1, 0)));
event.getDrops().add(new EntityItem(attackedEntity.getEntityWorld(), attackedEntity.posX, attackedEntity.posY, attackedEntity.posZ, new ItemStack(ModItems.BLOOD_SHARD, 1, 0)));
}
}
@ -480,14 +482,14 @@ public class GenericHandler
EntityPlayer player = event.getEntityPlayer();
ItemStack itemstack = EnchantmentHelper.getEnchantedItem(Enchantments.MENDING, player);
if (itemstack != null && itemstack.isItemDamaged())
if (!itemstack.isEmpty() && itemstack.isItemDamaged())
{
int i = Math.min(xpToDurability(event.getOrb().xpValue), itemstack.getItemDamage());
event.getOrb().xpValue -= durabilityToXp(i);
itemstack.setItemDamage(itemstack.getItemDamage() - i);
}
if (!player.worldObj.isRemote)
if (!player.getEntityWorld().isRemote)
{
for (ItemStack stack : player.inventory.mainInventory)
{

View file

@ -308,7 +308,7 @@ public class LivingArmourHandler
@SubscribeEvent
public void onArrowFire(ArrowLooseEvent event)
{
World world = event.getEntityPlayer().worldObj;
World world = event.getEntityPlayer().getEntityWorld();
ItemStack stack = event.getBow();
EntityPlayer player = event.getEntityPlayer();
@ -368,7 +368,7 @@ public class LivingArmourHandler
entityarrow.pickupStatus = EntityArrow.PickupStatus.CREATIVE_ONLY;
world.spawnEntityInWorld(entityarrow);
world.spawnEntity(entityarrow);
}
}
}

View file

@ -87,7 +87,7 @@ public class StatTrackerHandler
if (armour != null)
{
StatTrackerHealthboost.incrementCounter(armour, event.getAmount());
if (player.worldObj.canSeeSky(player.getPosition()) && player.worldObj.provider.isDaytime())
if (player.getEntityWorld().canSeeSky(player.getPosition()) && player.getEntityWorld().provider.isDaytime())
{
StatTrackerSolarPowered.incrementCounter(armour, event.getAmount());
}
@ -124,7 +124,7 @@ public class StatTrackerHandler
if (sourceEntity != null && !source.isMagicDamage() && !source.isProjectile())
StatTrackerPhysicalProtect.incrementCounter(armour, amount);
if (source.equals(DamageSource.fall))
if (source.equals(DamageSource.FALL))
StatTrackerFallProtect.incrementCounter(armour, amount);
if (source.isProjectile())
@ -162,7 +162,7 @@ public class StatTrackerHandler
{
StatTrackerMeleeDamage.incrementCounter(armour, amount);
if (player.worldObj.getLight(player.getPosition()) <= 9)
if (player.getEntityWorld().getLight(player.getPosition()) <= 9)
StatTrackerNightSight.incrementCounter(armour, amount);
if (mainWeapon != null && mainWeapon.getItem() instanceof ItemSpade)

View file

@ -56,7 +56,7 @@ public class WillHandler
if (remainder == null || ((IDemonWill) stack.getItem()).getWill(pickupType, stack) < 0.0001 || PlayerDemonWillHandler.isDemonWillFull(pickupType, player))
{
stack.stackSize = 0;
stack.setCount(0);
event.setResult(Event.Result.ALLOW);
}
}
@ -67,7 +67,7 @@ public class WillHandler
{
if (event.getSource() instanceof EntityDamageSourceIndirect)
{
Entity sourceEntity = ((EntityDamageSourceIndirect) event.getSource()).getSourceOfDamage();
Entity sourceEntity = event.getSource().getSourceOfDamage();
if (sourceEntity instanceof EntitySentientArrow)
{
@ -84,21 +84,21 @@ public class WillHandler
DamageSource source = event.getSource();
Entity entity = source.getEntity();
if (attackedEntity.isPotionActive(ModPotions.soulSnare) && (attackedEntity instanceof EntityMob || attackedEntity.worldObj.getDifficulty() == EnumDifficulty.PEACEFUL))
if (attackedEntity.isPotionActive(ModPotions.soulSnare) && (attackedEntity instanceof EntityMob || attackedEntity.getEntityWorld().getDifficulty() == EnumDifficulty.PEACEFUL))
{
PotionEffect eff = attackedEntity.getActivePotionEffect(ModPotions.soulSnare);
int lvl = eff.getAmplifier();
double amountOfSouls = attackedEntity.getEntityWorld().rand.nextDouble() * (lvl + 1) * (lvl + 1) * 5;
ItemStack soulStack = ((IDemonWill) ModItems.MONSTER_SOUL).createWill(0, amountOfSouls);
event.getDrops().add(new EntityItem(attackedEntity.worldObj, attackedEntity.posX, attackedEntity.posY, attackedEntity.posZ, soulStack));
event.getDrops().add(new EntityItem(attackedEntity.getEntityWorld(), attackedEntity.posX, attackedEntity.posY, attackedEntity.posZ, soulStack));
}
if (entity != null && entity instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) entity;
ItemStack heldStack = player.getHeldItemMainhand();
if (heldStack != null && heldStack.getItem() instanceof IDemonWillWeapon && !player.worldObj.isRemote)
if (heldStack != null && heldStack.getItem() instanceof IDemonWillWeapon && !player.getEntityWorld().isRemote)
{
IDemonWillWeapon demonWillWeapon = (IDemonWillWeapon) heldStack.getItem();
List<ItemStack> droppedSouls = demonWillWeapon.getRandomDemonWillDrop(attackedEntity, player, heldStack, event.getLootingLevel());
@ -114,7 +114,7 @@ public class WillHandler
EnumDemonWillType pickupType = ((IDemonWill) remainder.getItem()).getType(remainder);
if (((IDemonWill) remainder.getItem()).getWill(pickupType, remainder) >= 0.0001)
{
event.getDrops().add(new EntityItem(attackedEntity.worldObj, attackedEntity.posX, attackedEntity.posY, attackedEntity.posZ, remainder));
event.getDrops().add(new EntityItem(attackedEntity.getEntityWorld(), attackedEntity.posX, attackedEntity.posY, attackedEntity.posZ, remainder));
}
}
}