brief pass through trinkets

This commit is contained in:
Vincent Lee committed 2019-06-24 19:51:18 -07:00
1 parent 815e4f9e92
commit e7dc900634
32 files changed
+221 -200

No files matched your search

@@ -85,7 +85,7 @@ public class RenderPixie extends MobRenderer<EntityPixie> {
}
/*@Override
protected int shouldRenderPass(EntityLivingBase par1EntityLivingBase, int par2, float par3) {
protected int shouldRenderPass(LivingEntity par1EntityLivingBase, int par2, float par3) {
return setPixieBrightness((EntityPixie)par1EntityLivingBase, par2, par3);
}*/
}
@@ -69,7 +69,7 @@ public class BlockPlatform extends BlockCamo implements ILexiconable, IWandable,
/* todo 1.13
@Override
public void addCollisionBoxToList(IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull AxisAlignedBB par5AxisAlignedBB, @Nonnull List<AxisAlignedBB> stacks, Entity par7Entity, boolean isActualState) {
if(variant == Variant.INFRANGIBLE || variant == Variant.ABSTRUSE && par7Entity != null && par7Entity.posY > pos.getY() + 0.9 && (!(par7Entity instanceof EntityPlayer) || !par7Entity.isSneaking()))
if(variant == Variant.INFRANGIBLE || variant == Variant.ABSTRUSE && par7Entity != null && par7Entity.posY > pos.getY() + 0.9 && (!(par7Entity instanceof PlayerEntity) || !par7Entity.isSneaking()))
super.addCollisionBoxToList(state, world, pos, par5AxisAlignedBB, stacks, par7Entity, isActualState);
}
*/
@@ -4,7 +4,7 @@ package vazkii.botania.common.integration.buildcraft;
import buildcraft.api.core.render.ISprite;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.texture.AtlasTexture;
*/
/**
@@ -20,7 +20,7 @@ public class TASprite implements ISprite {
@Override
public void bindTexture() {
Minecraft.getInstance().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
Minecraft.getInstance().getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
}
@Override
@@ -24,8 +24,8 @@ public class ItemAuraRing extends ItemBauble implements IManaGivingItem {
}
@Override
public void onWornTick(ItemStack stack, EntityLivingBase player) {
if (player instanceof EntityPlayer && player.ticksExisted % 10 == 0)
ManaItemHandler.dispatchManaExact(stack, (EntityPlayer) player, 1, true);
public void onWornTick(ItemStack stack, LivingEntity player) {
if (player instanceof PlayerEntity && player.ticksExisted % 10 == 0)
ManaItemHandler.dispatchManaExact(stack, (PlayerEntity) player, 1, true);
}
}
@@ -73,9 +73,9 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
@Override
@OnlyIn(Dist.CLIENT)
public void doRender(ItemStack stack, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
public void doRender(ItemStack stack, LivingEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
Variant variant = ((ItemBaubleCosmetic) stack.getItem()).variant;
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
Minecraft.getInstance().textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
AccessoryRenderHelper.translateToHeadLevel(player);
AccessoryRenderHelper.translateToFace();
AccessoryRenderHelper.defaultTransforms();
@@ -95,18 +95,18 @@ public class ItemBloodPendant extends ItemBauble implements IBrewContainer, IBre
}
@Override
public void onWornTick(ItemStack stack, EntityLivingBase player) {
public void onWornTick(ItemStack stack, LivingEntity player) {
Brew brew = ((IBrewItem) stack.getItem()).getBrew(stack);
if (brew != BotaniaAPI.fallbackBrew && player instanceof EntityPlayer && !player.world.isRemote) {
EntityPlayer eplayer = (EntityPlayer) player;
PotionEffect effect = brew.getPotionEffects(stack).get(0);
if (brew != BotaniaAPI.fallbackBrew && player instanceof PlayerEntity && !player.world.isRemote) {
PlayerEntity eplayer = (PlayerEntity) player;
EffectInstance effect = brew.getPotionEffects(stack).get(0);
float cost = (float) brew.getManaCost(stack) / effect.getDuration() / (1 + effect.getAmplifier()) * 2.5F;
boolean doRand = cost < 1;
if (ManaItemHandler.requestManaExact(stack, eplayer, (int) Math.ceil(cost), false)) {
PotionEffect currentEffect = player.getActivePotionEffect(effect.getPotion());
boolean nightVision = effect.getPotion() == MobEffects.NIGHT_VISION;
EffectInstance currentEffect = player.getActivePotionEffect(effect.getPotion());
boolean nightVision = effect.getPotion() == Effects.NIGHT_VISION;
if (currentEffect == null || currentEffect.getDuration() < (nightVision ? 305 : 3)) {
PotionEffect applyEffect = new PotionEffect(effect.getPotion(), nightVision ? 385 : 80, effect.getAmplifier(), true, true);
EffectInstance applyEffect = new EffectInstance(effect.getPotion(), nightVision ? 385 : 80, effect.getAmplifier(), true, true);
player.addPotionEffect(applyEffect);
}
@@ -118,10 +118,10 @@ public class ItemBloodPendant extends ItemBauble implements IBrewContainer, IBre
@Override
@OnlyIn(Dist.CLIENT)
public void doRender(ItemStack stack, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
public void doRender(ItemStack stack, LivingEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
Minecraft.getInstance().textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
AccessoryRenderHelper.rotateIfSneaking(player);
boolean armor = !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty();
boolean armor = !player.getItemStackFromSlot(EquipmentSlotType.CHEST).isEmpty();
GlStateManager.rotatef(180F, 1F, 0F, 0F);
GlStateManager.translatef(-0.26F, -0.4F, armor ? 0.2F : 0.15F);
GlStateManager.scalef(0.5F, 0.5F, 0.5F);
@@ -42,7 +42,7 @@ public class ItemCloudPendant extends ItemBauble {
}
@Override
public void onWornTick(ItemStack stack, EntityLivingBase player) {
public void onWornTick(ItemStack stack, LivingEntity player) {
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
if(player instanceof EntityPlayerSP && player == Minecraft.getInstance().player) {
EntityPlayerSP playerSp = (EntityPlayerSP) player;
@@ -65,10 +65,10 @@ public class ItemCloudPendant extends ItemBauble {
@Override
@OnlyIn(Dist.CLIENT)
public void doRender(ItemStack stack, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
public void doRender(ItemStack stack, LivingEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
Minecraft.getInstance().textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
AccessoryRenderHelper.rotateIfSneaking(player);
boolean armor = !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty();
boolean armor = !player.getItemStackFromSlot(EquipmentSlotType.CHEST).isEmpty();
GlStateManager.rotatef(180F, 1F, 0F, 0F);
GlStateManager.translatef(-0.2F, -0.3F, armor ? 0.2F : 0.15F);
GlStateManager.scalef(0.5F, 0.5F, 0.5F);
@@ -55,10 +55,10 @@ public class ItemDivaCharm extends ItemBauble implements IManaUsingItem {
}
private void onEntityDamaged(LivingHurtEvent event) {
if(event.getSource().getImmediateSource() instanceof EntityPlayer && event.getEntityLiving() instanceof EntityLiving && !event.getEntityLiving().world.isRemote && Math.random() < 0.6F) {
if(event.getSource().getImmediateSource() instanceof PlayerEntity && event.getEntityLiving() instanceof EntityLiving && !event.getEntityLiving().world.isRemote && Math.random() < 0.6F) {
Runnable lambda = () -> {
EntityLiving target = (EntityLiving) event.getEntityLiving();
EntityPlayer player = (EntityPlayer) event.getSource().getImmediateSource();
PlayerEntity player = (PlayerEntity) event.getSource().getImmediateSource();
ItemStack amulet = EquipmentHandler.findOrEmpty(ModItems.divaCharm, player);
if(!amulet.isEmpty()) {
@@ -99,9 +99,9 @@ public class ItemDivaCharm extends ItemBauble implements IManaUsingItem {
@Override
@OnlyIn(Dist.CLIENT)
public void doRender(ItemStack stack, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
public void doRender(ItemStack stack, LivingEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
AccessoryRenderHelper.translateToHeadLevel(player);
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
Minecraft.getInstance().textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
GlStateManager.scaled(0.8, 0.8, 0.8);
GlStateManager.rotatef(-90, 0, 1, 0);
GlStateManager.rotatef(180, 1, 0, 0);
@@ -76,7 +76,7 @@ public class ItemDodgeRing extends ItemBauble {
@Override
public void onWornTick(ItemStack stack, EntityLivingBase player) {
public void onWornTick(ItemStack stack, LivingEntity player) {
int cd = ItemNBTHelper.getInt(stack, TAG_DODGE_COOLDOWN, 0);
if(cd > 0)
ItemNBTHelper.setInt(stack, TAG_DODGE_COOLDOWN, cd - 1);
@@ -92,9 +92,7 @@ public class ItemDodgeRing extends ItemBauble {
Vector3 lookVec = new Vector3(x, 0, z);
Vector3 sideVec = lookVec.crossProduct(new Vector3(0, left ? 1 : -1, 0)).multiply(1.25);
player.motionX = sideVec.x;
player.motionY = sideVec.y;
player.motionZ = sideVec.z;
player.setMotion(sideVec.toVec3D());
PacketHandler.sendToServer(new PacketDodge());
}
@@ -109,8 +107,8 @@ public class ItemDodgeRing extends ItemBauble {
int width = Math.min((int) ((cd - pticks) * 2), 40);
GlStateManager.color4f(1F, 1F, 1F, 1F);
if(width > 0) {
AbstractGui.drawRect(xo, y - 2, xo + 40, y - 1, 0x88000000);
AbstractGui.drawRect(xo, y - 2, xo + width, y - 1, 0xFFFFFFFF);
AbstractGui.fill(xo, y - 2, xo + 40, y - 1, 0x88000000);
AbstractGui.fill(xo, y - 2, xo + width, y - 1, 0xFFFFFFFF);
}
}
@@ -30,6 +30,7 @@ import net.minecraft.tags.FluidTags;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.util.text.TranslationTextComponent;
@@ -109,8 +110,8 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
@SubscribeEvent
public void updatePlayerFlyStatus(LivingUpdateEvent event) {
if(event.getEntityLiving() instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
if(event.getEntityLiving() instanceof PlayerEntity) {
PlayerEntity player = (PlayerEntity) event.getEntityLiving();
ItemStack tiara = EquipmentHandler.findOrEmpty(ModItems.flightTiara, player);
int left = ItemNBTHelper.getInt(tiara, TAG_TIME_LEFT, MAX_FLY_TIME);
@@ -120,7 +121,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
if(player.abilities.isFlying) {
if(!player.world.isRemote)
ManaItemHandler.requestManaExact(tiara, player, getCost(tiara, left), true);
else if(Math.abs(player.motionX) > 0.1 || Math.abs(player.motionZ) > 0.1) {
else if(Math.abs(player.getMotion().getX()) > 0.1 || Math.abs(player.getMotion().getZ()) > 0.1) {
double x = event.getEntityLiving().posX - 0.5;
double y = event.getEntityLiving().posY - 0.5;
double z = event.getEntityLiving().posZ - 0.5;
@@ -180,7 +181,9 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
}
for(int i = 0; i < 2; i++)
Botania.proxy.sparkleFX(x + Math.random() * event.getEntityLiving().width, y + Math.random() * 0.4, z + Math.random() * event.getEntityLiving().width, r, g, b, 2F * (float) Math.random(), 20);
Botania.proxy.sparkleFX(x + Math.random() * event.getEntityLiving().getWidth(),
y + Math.random() * 0.4, z + Math.random() * event.getEntityLiving().getWidth(),
r, g, b, 2F * (float) Math.random(), 20);
}
}
} else {
@@ -209,7 +212,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
return player.getGameProfile().getName() + ":" + player.world.isRemote;
}
private boolean shouldPlayerHaveFlight(EntityPlayer player) {
private boolean shouldPlayerHaveFlight(PlayerEntity player) {
ItemStack armor = EquipmentHandler.findOrEmpty(ModItems.flightTiara, player);
if(!armor.isEmpty()) {
int left = ItemNBTHelper.getInt(armor, TAG_TIME_LEFT, MAX_FLY_TIME);
@@ -230,7 +233,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
}
@Override
public void onEquipped(ItemStack stack, EntityLivingBase living) {
public void onEquipped(ItemStack stack, LivingEntity living) {
super.onEquipped(stack, living);
int variant = ItemNBTHelper.getInt(stack, TAG_VARIANT, 0);
if(variant != WING_TYPES && StringObfuscator.matchesHash(stack.getDisplayName().getString(), SUPER_AWESOME_HASH)) {
@@ -240,9 +243,9 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
}
@Override
public void onWornTick(ItemStack stack, EntityLivingBase player) {
if(player instanceof EntityPlayer) {
EntityPlayer p = (EntityPlayer) player;
public void onWornTick(ItemStack stack, LivingEntity player) {
if(player instanceof PlayerEntity) {
PlayerEntity p = (PlayerEntity) player;
boolean flying = p.abilities.isFlying;
boolean wasSprting = ItemNBTHelper.getBoolean(stack, TAG_IS_SPRINTING, false);
@@ -260,27 +263,26 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
final int maxCd = 80;
int cooldown = ItemNBTHelper.getInt(stack, TAG_DASH_COOLDOWN, 0);
if(!wasSprting && isSprinting && cooldown == 0) {
p.motionX += look.x;
p.motionZ += look.z;
p.setMotion(p.getMotion().add(look.x, 0, look.z));
p.world.playSound(null, p.posX, p.posY, p.posZ, ModSounds.dash, SoundCategory.PLAYERS, 1F, 1F);
ItemNBTHelper.setInt(stack, TAG_DASH_COOLDOWN, maxCd);
} else if(cooldown > 0) {
if(maxCd - cooldown < 2)
player.moveRelative(0F, 0F, 1F, 5F);
player.moveRelative(5F, new Vec3d(0F, 0F, 1F));
else if(maxCd - cooldown < 10)
player.setSprinting(false);
ItemNBTHelper.setInt(stack, TAG_DASH_COOLDOWN, cooldown - 2);
}
} else if(!flying) {
} else {
boolean doGlide = player.isSneaking() && !player.onGround && player.fallDistance >= 2F;
if(time < MAX_FLY_TIME && player.ticksExisted % (doGlide ? 6 : 2) == 0)
newTime++;
if(doGlide) {
player.motionY = Math.max(-0.15F, player.motionY);
float mul = 0.6F;
player.motionX = look.x * mul;
player.motionZ = look.z * mul;
player.setMotion(player.getMotion().getX() * mul,
Math.max(-0.15F, player.getMotion().getY()),
player.getMotion().getZ() * mul);
player.fallDistance = 2F;
}
}
@@ -292,24 +294,24 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
}
@Override
public boolean shouldSyncToTracking(ItemStack stack, EntityLivingBase living) {
public boolean shouldSyncToTracking(ItemStack stack, LivingEntity living) {
return true;
}
@Override
public boolean hasRender(ItemStack stack, EntityLivingBase living) {
return super.hasRender(stack, living) && living instanceof EntityPlayer;
public boolean hasRender(ItemStack stack, LivingEntity living) {
return super.hasRender(stack, living) && living instanceof PlayerEntity;
}
@Override
@OnlyIn(Dist.CLIENT)
public void doRender(ItemStack stack, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
public void doRender(ItemStack stack, LivingEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
int meta = ItemNBTHelper.getInt(stack, TAG_VARIANT, 0);
if(meta > 0 && meta <= MiscellaneousIcons.INSTANCE.tiaraWingIcons.length) {
TextureAtlasSprite icon = MiscellaneousIcons.INSTANCE.tiaraWingIcons[meta - 1];
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
Minecraft.getInstance().textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
boolean flying = ((EntityPlayer) player).abilities.isFlying;
boolean flying = ((PlayerEntity) player).abilities.isFlying;
float rz = 120F;
float rx = 20F + (float) ((Math.sin((double) (player.ticksExisted + partialTicks) * (flying ? 0.4F : 0.2F)) + 0.5F) * (flying ? 30F : 5F));
@@ -327,8 +329,8 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
int lightmapX = light % 65536;
int lightmapY = light / 65536;
float lbx = OpenGlHelper.lastBrightnessX;
float lby = OpenGlHelper.lastBrightnessY;
float lbx = GLX.lastBrightnessX;
float lby = GLX.lastBrightnessY;
switch (meta) {
case 1: { // Jibril
@@ -351,7 +353,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
h = 0.5F;
rx = 20F;
ry = -(float) ((Math.sin((double) (player.ticksExisted + partialTicks) * (flying ? 0.4F : 0.2F)) + 0.6F) * (flying ? 30F : 5F));
OpenGlHelper.glMultiTexCoord2f(OpenGlHelper.GL_TEXTURE1, lightmapX, lightmapY);
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, lightmapX, lightmapY);
break;
}
case 5: { // Kuroyukihime
@@ -367,7 +369,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
break;
}
case 7: { // Lyfa
OpenGlHelper.glMultiTexCoord2f(OpenGlHelper.GL_TEXTURE1, lightmapX, lightmapY);
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, lightmapX, lightmapY);
h = -0.1F;
rz = 0F;
ry = -rx;
@@ -380,7 +382,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
break;
}
case 9: { // The One
OpenGlHelper.glMultiTexCoord2f(OpenGlHelper.GL_TEXTURE1, lightmapX, lightmapY);
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, lightmapX, lightmapY);
rz = 180F;
rx = 0F;
h = 1.1F;
@@ -429,7 +431,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
GlStateManager.color3f(1F, 1F, 1F);
GlStateManager.popMatrix();
OpenGlHelper.glMultiTexCoord2f(OpenGlHelper.GL_TEXTURE1, lbx, lby);
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, lbx, lby);
if(meta == 1)
renderHalo(player, partialTicks);
@@ -509,12 +511,12 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
int width = ItemNBTHelper.getInt(stack, TAG_DASH_COOLDOWN, 0);
GlStateManager.color4f(1F, 1F, 1F, 1F);
if(width > 0)
AbstractGui.drawRect(xo, y - 2, xo + 80, y - 1, 0x88000000);
AbstractGui.drawRect(xo, y - 2, xo + width, y - 1, 0xFFFFFFFF);
AbstractGui.fill(xo, y - 2, xo + 80, y - 1, 0x88000000);
AbstractGui.fill(xo, y - 2, xo + width, y - 1, 0xFFFFFFFF);
}
GlStateManager.enableAlphaTest();
GlStateManager.color4f(1F, 1F, 1F, 1F);
mc.textureManager.bindTexture(AbstractGui.ICONS);
mc.textureManager.bindTexture(AbstractGui.GUI_ICONS_LOCATION);
}
}
@@ -50,7 +50,7 @@ public class ItemGoddessCharm extends ItemBauble implements IManaUsingItem {
Vec3d vec = e.getPosition();
List<PlayerEntity> players = event.getWorld().getEntitiesWithinAABB(PlayerEntity.class, new AxisAlignedBB(vec.x, vec.y, vec.z, vec.x, vec.y, vec.z).grow(8));
for(EntityPlayer player : players) {
for(PlayerEntity player : players) {
ItemStack charm = EquipmentHandler.findOrEmpty(ModItems.goddessCharm, player);
if(!charm.isEmpty() && ManaItemHandler.requestManaExact(charm, player, COST, true)) {
event.getAffectedBlocks().clear();
@@ -61,7 +61,7 @@ public class ItemGoddessCharm extends ItemBauble implements IManaUsingItem {
@Override
@OnlyIn(Dist.CLIENT)
public void doRender(ItemStack stack, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
public void doRender(ItemStack stack, LivingEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
GlStateManager.pushMatrix();
AccessoryRenderHelper.translateToHeadLevel(player);
AccessoryRenderHelper.translateToFace();
@@ -23,8 +23,8 @@ public class ItemGreaterAuraRing extends ItemBauble implements IManaGivingItem {
}
@Override
public void onWornTick(ItemStack stack, EntityLivingBase player) {
if (player instanceof EntityPlayer && player.ticksExisted % 2 == 0)
ManaItemHandler.dispatchManaExact(stack, (EntityPlayer) player, 1, true);
public void onWornTick(ItemStack stack, LivingEntity player) {
if (player instanceof PlayerEntity && player.ticksExisted % 2 == 0)
ManaItemHandler.dispatchManaExact(stack, (PlayerEntity) player, 1, true);
}
}
@@ -49,8 +49,8 @@ public class ItemHolyCloak extends ItemBauble {
}
private void onPlayerDamage(LivingHurtEvent event) {
if(event.getEntityLiving() instanceof EntityPlayer && !event.getSource().canHarmInCreative()) {
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
if(event.getEntityLiving() instanceof PlayerEntity && !event.getSource().canHarmInCreative()) {
PlayerEntity player = (PlayerEntity) event.getEntityLiving();
ItemStack stack = EquipmentHandler.findOrEmpty(this, player);
if(!stack.isEmpty() && !isInEffect(stack)) {
@@ -67,7 +67,7 @@ public class ItemHolyCloak extends ItemBauble {
}
@Override
public void onWornTick(ItemStack stack, EntityLivingBase living) {
public void onWornTick(ItemStack stack, LivingEntity living) {
int cooldown = getCooldown(stack);
if(cooldown > 0)
setCooldown(stack, cooldown - 1);
@@ -75,10 +75,10 @@ public class ItemHolyCloak extends ItemBauble {
@Override
@OnlyIn(Dist.CLIENT)
public void doRender(ItemStack stack, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
public void doRender(ItemStack stack, LivingEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
ItemHolyCloak item = ((ItemHolyCloak) stack.getItem());
AccessoryRenderHelper.rotateIfSneaking(player);
boolean armor = !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty();
boolean armor = !player.getItemStackFromSlot(EquipmentSlotType.CHEST).isEmpty();
GlStateManager.translatef(0F, armor ? -0.07F : -0.01F, 0F);
float s = 1F / 16F;
@@ -95,7 +95,7 @@ public class ItemHolyCloak extends ItemBauble {
int light = 15728880;
int lightmapX = light % 65536;
int lightmapY = light / 65536;
OpenGlHelper.glMultiTexCoord2f(OpenGlHelper.GL_TEXTURE1, lightmapX, lightmapY);
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, lightmapX, lightmapY);
Minecraft.getInstance().textureManager.bindTexture(item.getCloakGlowTexture());
model.render(1F);
}
@@ -105,9 +105,9 @@ public class ItemHolyCloak extends ItemBauble {
event.setCanceled(true);
player.world.playSound(null, player.posX, player.posY, player.posZ, ModSounds.holyCloak, SoundCategory.PLAYERS, 1F, 1F);
for(int i = 0; i < 30; i++) {
double x = player.posX + Math.random() * player.width * 2 - player.width;
double y = player.posY + Math.random() * player.height;
double z = player.posZ + Math.random() * player.width * 2 - player.width;
double x = player.posX + Math.random() * player.getWidth() * 2 - player.getWidth();
double y = player.posY + Math.random() * player.getHeight();
double z = player.posZ + Math.random() * player.getWidth() * 2 - player.getWidth();
boolean yellow = Math.random() > 0.5;
Botania.proxy.sparkleFX(x, y, z, yellow ? 1F : 0.3F, yellow ? 1F : 0.3F, yellow ? 0.3F : 1F, 0.8F + (float) Math.random() * 0.4F, 3);
}
@@ -35,20 +35,20 @@ public class ItemIcePendant extends ItemBauble {
}
@Override
public void onWornTick(ItemStack stack, EntityLivingBase entity) {
public void onWornTick(ItemStack stack, LivingEntity entity) {
if(!entity.world.isRemote) {
boolean lastOnGround = entity.onGround;
entity.onGround = true;
EnchantmentFrostWalker.freezeNearby(entity, entity.world, new BlockPos(entity), 8);
FrostWalkerEnchantment.freezeNearby(entity, entity.world, new BlockPos(entity), 8);
entity.onGround = lastOnGround;
}
}
@Override
@OnlyIn(Dist.CLIENT)
public void doRender(ItemStack stack, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
boolean armor = !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty();
public void doRender(ItemStack stack, LivingEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
Minecraft.getInstance().textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
boolean armor = !player.getItemStackFromSlot(EquipmentSlotType.CHEST).isEmpty();
GlStateManager.rotatef(180F, 1F, 0F, 0F);
GlStateManager.translatef(-0.36F, -0.3F, armor ? 0.2F : 0.15F);
GlStateManager.rotatef(-45F, 0F, 0F, 1F);
@@ -28,24 +28,24 @@ public class ItemInvisibilityCloak extends ItemBauble implements IManaUsingItem
}
@Override
public void onUnequipped(ItemStack stack, EntityLivingBase player) {
PotionEffect effect = player.getActivePotionEffect(MobEffects.INVISIBILITY);
if(effect != null && player instanceof EntityPlayer && effect.getAmplifier() == -42)
player.removePotionEffect(MobEffects.INVISIBILITY);
public void onUnequipped(ItemStack stack, LivingEntity player) {
EffectInstance effect = player.getActivePotionEffect(Effects.INVISIBILITY);
if(effect != null && player instanceof PlayerEntity && effect.getAmplifier() == -42)
player.removePotionEffect(Effects.INVISIBILITY);
}
@Override
public void onWornTick(ItemStack stack, EntityLivingBase player) {
if(player instanceof EntityPlayer && !player.world.isRemote) {
public void onWornTick(ItemStack stack, LivingEntity player) {
if(player instanceof PlayerEntity && !player.world.isRemote) {
int manaCost = 2;
boolean hasMana = ManaItemHandler.requestManaExact(stack, (EntityPlayer) player, manaCost, false);
boolean hasMana = ManaItemHandler.requestManaExact(stack, (PlayerEntity) player, manaCost, false);
if(!hasMana)
onUnequipped(stack, player);
else {
if(player.getActivePotionEffect(MobEffects.INVISIBILITY) != null)
player.removePotionEffect(MobEffects.INVISIBILITY);
if(player.getActivePotionEffect(Effects.INVISIBILITY) != null)
player.removePotionEffect(Effects.INVISIBILITY);
player.addPotionEffect(new PotionEffect(MobEffects.INVISIBILITY, Integer.MAX_VALUE, -42, true, true));
player.addPotionEffect(new EffectInstance(Effects.INVISIBILITY, Integer.MAX_VALUE, -42, true, true));
}
}
}
@@ -28,6 +28,7 @@ import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.MerchantOffer;
import net.minecraft.nbt.ListNBT;
import net.minecraft.nbt.LongNBT;
import net.minecraft.nbt.LongNBT;
@@ -65,31 +66,31 @@ public class ItemItemFinder extends ItemBauble {
}
@Override
public void onWornTick(ItemStack stack, EntityLivingBase player) {
if(!(player instanceof EntityPlayer))
public void onWornTick(ItemStack stack, LivingEntity player) {
if(!(player instanceof PlayerEntity))
return;
if(player.world.isRemote)
this.tickClient(stack, (EntityPlayer) player);
else this.tickServer(stack, (EntityPlayer) player);
this.tickClient(stack, (PlayerEntity) player);
else this.tickServer(stack, (PlayerEntity) player);
}
@Override
public boolean shouldSyncToTracking(ItemStack stack, EntityLivingBase living) {
public boolean shouldSyncToTracking(ItemStack stack, LivingEntity living) {
return true;
}
@Override
@OnlyIn(Dist.CLIENT)
public void doRender(ItemStack stack, EntityLivingBase living, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
public void doRender(ItemStack stack, LivingEntity living, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
TextureAtlasSprite gemIcon = MiscellaneousIcons.INSTANCE.itemFinderGem;
float f = gemIcon.getMinU();
float f1 = gemIcon.getMaxU();
float f2 = gemIcon.getMinV();
float f3 = gemIcon.getMaxV();
boolean armor = !living.getItemStackFromSlot(EntityEquipmentSlot.HEAD).isEmpty();
boolean armor = !living.getItemStackFromSlot(EquipmentSlotType.HEAD).isEmpty();
AccessoryRenderHelper.translateToHeadLevel(living);
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
Minecraft.getInstance().textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
GlStateManager.rotatef(90F, 0F, 1F, 0F);
GlStateManager.rotatef(180F, 1F, 0F, 0F);
GlStateManager.translatef(-0.4F, -1.4F, armor ? -0.3F : -0.25F);
@@ -115,7 +116,7 @@ public class ItemItemFinder extends ItemBauble {
Entity e = player.world.getEntityByID(i);
if(e != null && Math.random() < 0.6) {
Botania.proxy.setWispFXDepthTest(Math.random() < 0.6);
Botania.proxy.wispFX(e.posX + (float) (Math.random() * 0.5 - 0.25) * 0.45F, e.posY + e.height, e.posZ + (float) (Math.random() * 0.5 - 0.25) * 0.45F, (float) Math.random(), (float) Math.random(), (float) Math.random(), 0.15F + 0.05F * (float) Math.random(), -0.05F - 0.03F * (float) Math.random());
Botania.proxy.wispFX(e.posX + (float) (Math.random() * 0.5 - 0.25) * 0.45F, e.posY + e.getHeight(), e.posZ + (float) (Math.random() * 0.5 - 0.25) * 0.45F, (float) Math.random(), (float) Math.random(), (float) Math.random(), 0.15F + 0.05F * (float) Math.random(), -0.05F - 0.03F * (float) Math.random());
}
}
@@ -167,14 +168,13 @@ public class ItemItemFinder extends ItemBauble {
} else if(e instanceof VillagerEntity) {
VillagerEntity villager = (VillagerEntity) e;
ArrayList<MerchantRecipe> recipes = villager.getRecipes(player);
if(!pstack.isEmpty() && recipes != null)
for(MerchantRecipe recipe : recipes)
if(recipe != null && !recipe.isRecipeDisabled() && (equalStacks(pstack, recipe.getItemToBuy()) || equalStacks(pstack, recipe.getItemToSell()))) {
entIdBuilder.add(villager.getEntityId());
break;
}
for(MerchantOffer offer : villager.getOffers()) {
if (equalStacks(pstack, offer.func_222218_a())
|| equalStacks(pstack, offer.func_222202_c())
|| equalStacks(pstack, offer.func_222200_d())) {
entIdBuilder.add(villager.getEntityId());
}
}
}
}
@@ -36,13 +36,13 @@ public class ItemKnockbackBelt extends ItemBauble {
@Override
public Multimap<String, AttributeModifier> getEquippedAttributeModifiers(ItemStack stack) {
Multimap<String, AttributeModifier> attributes = HashMultimap.create();
attributes.put(SharedMonsterAttributes.KNOCKBACK_RESISTANCE.getName(), new AttributeModifier(getBaubleUUID(stack), "Knockback Belt", 1, 0).setSaved(false));
attributes.put(SharedMonsterAttributes.KNOCKBACK_RESISTANCE.getName(), new AttributeModifier(getBaubleUUID(stack), "Knockback Belt", 1, AttributeModifier.Operation.ADDITION).setSaved(false));
return attributes;
}
@Override
@OnlyIn(Dist.CLIENT)
public void doRender(ItemStack stack, EntityLivingBase living, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
public void doRender(ItemStack stack, LivingEntity living, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
Minecraft.getInstance().textureManager.bindTexture(texture);
GlStateManager.translatef(0F, 0.2F, 0F);
@@ -32,17 +32,17 @@ public class ItemLavaPendant extends ItemBauble {
}
@Override
public void onWornTick(ItemStack stack, EntityLivingBase player) {
public void onWornTick(ItemStack stack, LivingEntity player) {
if(player.isBurning())
player.extinguish();
}
@Override
@OnlyIn(Dist.CLIENT)
public void doRender(ItemStack stack, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
public void doRender(ItemStack stack, LivingEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
Minecraft.getInstance().textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
AccessoryRenderHelper.rotateIfSneaking(player);
boolean armor = !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty();
boolean armor = !player.getItemStackFromSlot(EquipmentSlotType.CHEST).isEmpty();
GlStateManager.scalef(0.5F, 0.5F, 0.5F);
GlStateManager.rotatef(180, 0, 0, 1);
GlStateManager.translated(-0.5, -0.90, armor ? -0.4 : -0.25);
@@ -67,7 +67,7 @@ public class ItemMagnetRing extends ItemBauble {
}
@Override
public void onWornTick(ItemStack stack, EntityLivingBase player) {
public void onWornTick(ItemStack stack, LivingEntity player) {
int cooldown = getCooldown(stack);
if(SubTileSolegnolia.hasSolegnoliaAround(player)) {
@@ -83,9 +83,9 @@ public class ItemMagnetRing extends ItemBauble {
double z = player.posZ;
int range = ((ItemMagnetRing) stack.getItem()).range;
List<EntityItem> items = player.world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(x - range, y - range, z - range, x + range, y + range, z + range));
List<ItemEntity> items = player.world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(x - range, y - range, z - range, x + range, y + range, z + range));
int pulled = 0;
for(EntityItem item : items)
for(ItemEntity item : items)
if(((ItemMagnetRing) stack.getItem()).canPullItem(item)) {
if(pulled > 200)
break;
@@ -26,29 +26,29 @@ public class ItemMiningRing extends ItemBauble implements IManaUsingItem {
}
@Override
public void onWornTick(ItemStack stack, EntityLivingBase player) {
if(player instanceof EntityPlayer && !player.world.isRemote) {
public void onWornTick(ItemStack stack, LivingEntity player) {
if(player instanceof PlayerEntity && !player.world.isRemote) {
int manaCost = 5;
boolean hasMana = ManaItemHandler.requestManaExact(stack, (EntityPlayer) player, manaCost, false);
boolean hasMana = ManaItemHandler.requestManaExact(stack, (PlayerEntity) player, manaCost, false);
if(!hasMana)
onUnequipped(stack, player);
else {
if(player.getActivePotionEffect(MobEffects.HASTE) != null)
player.removePotionEffect(MobEffects.HASTE);
if(player.getActivePotionEffect(Effects.HASTE) != null)
player.removePotionEffect(Effects.HASTE);
player.addPotionEffect(new PotionEffect(MobEffects.HASTE, Integer.MAX_VALUE, 1, true, true));
player.addPotionEffect(new EffectInstance(Effects.HASTE, Integer.MAX_VALUE, 1, true, true));
}
if(player.swingProgress == 0.25F)
ManaItemHandler.requestManaExact(stack, (EntityPlayer) player, manaCost, true);
ManaItemHandler.requestManaExact(stack, (PlayerEntity) player, manaCost, true);
}
}
@Override
public void onUnequipped(ItemStack stack, EntityLivingBase player) {
PotionEffect effect = player.getActivePotionEffect(MobEffects.HASTE);
public void onUnequipped(ItemStack stack, LivingEntity player) {
EffectInstance effect = player.getActivePotionEffect(Effects.HASTE);
if(effect != null && effect.getAmplifier() == 1)
player.removePotionEffect(MobEffects.HASTE);
player.removePotionEffect(Effects.HASTE);
}
@Override
@@ -19,11 +19,16 @@ import net.minecraft.block.RepeaterBlock;
import net.minecraft.client.Minecraft;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.state.properties.ComparatorMode;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist;
@@ -43,9 +48,9 @@ public class ItemMonocle extends ItemBauble implements IBurstViewerBauble, ICosm
@Override
@OnlyIn(Dist.CLIENT)
public void doRender(ItemStack stack, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
boolean armor = !player.getItemStackFromSlot(EntityEquipmentSlot.HEAD).isEmpty();
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
public void doRender(ItemStack stack, LivingEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
boolean armor = !player.getItemStackFromSlot(EquipmentSlotType.HEAD).isEmpty();
Minecraft.getInstance().textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
AccessoryRenderHelper.translateToHeadLevel(player);
AccessoryRenderHelper.translateToFace();
@@ -59,12 +64,13 @@ public class ItemMonocle extends ItemBauble implements IBurstViewerBauble, ICosm
@OnlyIn(Dist.CLIENT)
public static void renderHUD(PlayerEntity player) {
Minecraft mc = Minecraft.getInstance();
RayTraceResult pos = mc.objectMouseOver;
if(pos == null || pos.getBlockPos() == null)
RayTraceResult ray = mc.objectMouseOver;
if(ray == null || ray.getType() != RayTraceResult.Type.BLOCK)
return;
BlockState state = player.world.getBlockState(pos.getBlockPos());
BlockPos pos = ((BlockRayTraceResult) ray).getPos();
BlockState state = player.world.getBlockState(pos);
Block block = state.getBlock();
player.world.getTileEntity(pos.getBlockPos());
player.world.getTileEntity(pos);
ItemStack dispStack = ItemStack.EMPTY;
String text = "";
@@ -93,7 +99,7 @@ public class ItemMonocle extends ItemBauble implements IBurstViewerBauble, ICosm
mc.fontRenderer.drawStringWithShadow(text, x + 20, y + 4, 0xFFFFFF);
}
public static boolean hasMonocle(EntityPlayer player) {
public static boolean hasMonocle(PlayerEntity player) {
ItemStack stack = EquipmentHandler.findOrEmpty(ModItems.monocle, player);
if(!stack.isEmpty()) {
Item item = stack.getItem();
@@ -25,7 +25,7 @@ public class ItemReachRing extends ItemBauble {
@Override
public Multimap<String, AttributeModifier> getEquippedAttributeModifiers(ItemStack stack) {
Multimap<String, AttributeModifier> attributes = HashMultimap.create();
attributes.put(EntityPlayer.REACH_DISTANCE.getName(), new AttributeModifier(getBaubleUUID(stack), "Reach Ring", 3.5, 0).setSaved(false));
attributes.put(PlayerEntity.REACH_DISTANCE.getName(), new AttributeModifier(getBaubleUUID(stack), "Reach Ring", 3.5, AttributeModifier.Operation.ADDITION).setSaved(false));
return attributes;
}
}
@@ -34,21 +34,21 @@ public class ItemSuperLavaPendant extends ItemBauble {
@Override
public void onWornTick(ItemStack stack, EntityLivingBase living) {
public void onWornTick(ItemStack stack, LivingEntity living) {
living.isImmuneToFire = true;
}
@Override
public void onUnequipped(ItemStack stack, EntityLivingBase living) {
public void onUnequipped(ItemStack stack, LivingEntity living) {
living.isImmuneToFire = false;
}
@Override
@OnlyIn(Dist.CLIENT)
public void doRender(ItemStack stack, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
public void doRender(ItemStack stack, LivingEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
Minecraft.getInstance().textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
AccessoryRenderHelper.rotateIfSneaking(player);
boolean armor = !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty();
boolean armor = !player.getItemStackFromSlot(EquipmentSlotType.CHEST).isEmpty();
GlStateManager.scaled(0.5, 0.5, 0.5);
GlStateManager.rotatef(180, 0, 0, 1);
GlStateManager.translated(-0.5, -0.90, armor ? -0.4 : -0.25);
@@ -10,8 +10,14 @@
*/
package vazkii.botania.common.item.equipment.bauble;
import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.EntityRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import vazkii.botania.api.item.ISortableTool;
import vazkii.botania.api.item.ISortableTool.ToolType;
@@ -24,11 +30,11 @@ public class ItemSwapRing extends ItemBauble {
}
@Override
public void onWornTick(ItemStack stack, EntityLivingBase entity) {
if(!(entity instanceof EntityPlayer))
public void onWornTick(ItemStack stack, LivingEntity entity) {
if(!(entity instanceof PlayerEntity))
return;
EntityPlayer player = (EntityPlayer) entity;
PlayerEntity player = (PlayerEntity) entity;
ItemStack currentStack = player.getHeldItemMainhand();
if(currentStack.isEmpty() || !(currentStack.getItem() instanceof ISortableTool))
return;
@@ -38,8 +44,8 @@ public class ItemSwapRing extends ItemBauble {
RayTraceResult pos = ToolCommons.raytraceFromEntity(entity.world, entity, true, 4.5F);
ToolType typeToFind = null;
if(player.isSwingInProgress && pos != null && pos.getBlockPos() != null) {
IBlockState state = entity.world.getBlockState(pos.getBlockPos());
if(player.isSwingInProgress && pos.getType() == RayTraceResult.Type.BLOCK) {
BlockState state = entity.world.getBlockState(((BlockRayTraceResult) pos).getPos());
Material mat = state.getMaterial();
if(ToolCommons.materialsPick.contains(mat))
@@ -73,7 +79,7 @@ public class ItemSwapRing extends ItemBauble {
}
if(bestSlot != -1) {
player.setHeldItem(EnumHand.MAIN_HAND, bestTool);
player.setHeldItem(Hand.MAIN_HAND, bestTool);
player.inventory.setInventorySlotContents(bestSlot, currentStack);
}
}
@@ -46,27 +46,27 @@ public class ItemThirdEye extends ItemBauble implements IManaUsingItem {
}
@Override
public void onWornTick(ItemStack stack, EntityLivingBase living) {
if(!(living instanceof EntityPlayer))
public void onWornTick(ItemStack stack, LivingEntity living) {
if(!(living instanceof PlayerEntity))
return;
EntityPlayer eplayer = (EntityPlayer) living;
PlayerEntity eplayer = (PlayerEntity) living;
double range = 24;
AxisAlignedBB aabb = new AxisAlignedBB(living.posX, living.posY, living.posZ, living.posX, living.posY, living.posZ).grow(range);
List<EntityLivingBase> mobs = living.world.getEntitiesWithinAABB(EntityLivingBase.class, aabb, (Entity e) -> e instanceof IMob);
List<LivingEntity> mobs = living.world.getEntitiesWithinAABB(LivingEntity.class, aabb, (Entity e) -> e instanceof IMob);
for(EntityLivingBase e : mobs) {
PotionEffect potion = e.getActivePotionEffect(MobEffects.GLOWING);
for(LivingEntity e : mobs) {
EffectInstance potion = e.getActivePotionEffect(Effects.GLOWING);
if((potion == null || potion.getDuration() <= 2) && ManaItemHandler.requestManaExact(stack, eplayer, COST, true))
e.addPotionEffect(new PotionEffect(MobEffects.GLOWING, 12, 0));
e.addPotionEffect(new EffectInstance(Effects.GLOWING, 12, 0));
}
}
@Override
@OnlyIn(Dist.CLIENT)
public void doRender(ItemStack stack, EntityLivingBase living, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
boolean armor = !living.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty();
public void doRender(ItemStack stack, LivingEntity living, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
Minecraft.getInstance().textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
boolean armor = !living.getItemStackFromSlot(EquipmentSlotType.CHEST).isEmpty();
GlStateManager.rotatef(180, 0, 0, 1);
GlStateManager.translated(-0.3, -0.6, armor ? -0.18 : -0.12);
GlStateManager.scaled(0.6, 0.6, 0.6);
@@ -11,6 +11,7 @@
package vazkii.botania.common.item.equipment.bauble;
import com.google.common.base.Predicates;
import com.sun.prism.AtlasTexture;
import net.minecraft.client.Minecraft;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.renderer.texture.AtlasTexture;
@@ -39,7 +40,7 @@ public class ItemTinyPlanet extends ItemBauble {
}
@Override
public void onWornTick(ItemStack stack, EntityLivingBase player) {
public void onWornTick(ItemStack stack, LivingEntity player) {
double x = player.posX;
double y = player.posY + player.getEyeHeight();
double z = player.posZ;
@@ -49,8 +50,8 @@ public class ItemTinyPlanet extends ItemBauble {
@Override
@OnlyIn(Dist.CLIENT)
public void doRender(ItemStack stack, EntityLivingBase living, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
public void doRender(ItemStack stack, LivingEntity living, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
Minecraft.getInstance().textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
GlStateManager.scalef(0.5F, 0.5F, 0.5F);
GlStateManager.translatef(0, -1.5F, 0.5F);
Minecraft.getInstance().getBlockRendererDispatcher().renderBlockBrightness(ModBlocks.tinyPlanet.getDefaultState(), 1.0F);
@@ -17,6 +17,7 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.MinecraftForge;
@@ -62,8 +63,8 @@ public class ItemTravelBelt extends ItemBauble implements IManaUsingItem {
@SubscribeEvent
public void updatePlayerStepStatus(LivingUpdateEvent event) {
if(event.getEntityLiving() instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
if(event.getEntityLiving() instanceof PlayerEntity) {
PlayerEntity player = (PlayerEntity) event.getEntityLiving();
ItemStack belt = EquipmentHandler.findOrEmpty(s -> s.getItem() instanceof ItemTravelBelt, player);
String s = playerStr(player);
@@ -74,7 +75,7 @@ public class ItemTravelBelt extends ItemBauble implements IManaUsingItem {
if(player.world.isRemote) {
if((player.onGround || player.abilities.isFlying) && player.moveForward > 0F && !player.isInWaterOrBubbleColumn()) {
float speed = beltItem.getSpeed(belt);
player.moveRelative(0F, 0F, 1F, player.abilities.isFlying ? speed : speed);
player.moveRelative(player.abilities.isFlying ? speed : speed, new Vec3d(0, 0, 1));
beltItem.onMovedTick(belt, player);
if(player.ticksExisted % COST_INTERVAL == 0)
@@ -107,18 +108,18 @@ public class ItemTravelBelt extends ItemBauble implements IManaUsingItem {
@SubscribeEvent
public void onPlayerJump(LivingJumpEvent event) {
if(event.getEntityLiving() instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
if(event.getEntityLiving() instanceof PlayerEntity) {
PlayerEntity player = (PlayerEntity) event.getEntityLiving();
ItemStack belt = EquipmentHandler.findOrEmpty(s -> s.getItem() instanceof ItemTravelBelt, player);
if(!belt.isEmpty() && ManaItemHandler.requestManaExact(belt, player, COST, false)) {
player.motionY += ((ItemTravelBelt) belt.getItem()).jump;
player.setMotion(player.getMotion().add(0, ((ItemTravelBelt) belt.getItem()).jump, 0));
player.fallDistance = -((ItemTravelBelt) belt.getItem()).fallBuffer;
}
}
}
private boolean shouldPlayerHaveStepup(EntityPlayer player) {
private boolean shouldPlayerHaveStepup(PlayerEntity player) {
ItemStack result = EquipmentHandler.findOrEmpty(s -> s.getItem() instanceof ItemTravelBelt, player);
return !result.isEmpty() && ManaItemHandler.requestManaExact(result, player, COST, false);
}
@@ -142,7 +143,7 @@ public class ItemTravelBelt extends ItemBauble implements IManaUsingItem {
@Override
@OnlyIn(Dist.CLIENT)
public void doRender(ItemStack stack, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
public void doRender(ItemStack stack, LivingEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
Minecraft.getInstance().textureManager.bindTexture(((ItemTravelBelt) stack.getItem()).getRenderTexture());
AccessoryRenderHelper.rotateIfSneaking(player);
@@ -151,7 +152,7 @@ public class ItemTravelBelt extends ItemBauble implements IManaUsingItem {
float s = 1.05F / 16F;
GlStateManager.scalef(s, s, s);
if(model == null)
model = new ModelBiped();
model = new BipedModel();
model.bipedBody.render(1F);
}
@@ -10,8 +10,11 @@
*/
package vazkii.botania.common.item.equipment.bauble;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.potion.EffectInstance;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Effects;
import vazkii.botania.api.mana.IManaUsingItem;
import vazkii.botania.api.mana.ManaItemHandler;
import vazkii.botania.common.core.handler.EquipmentHandler;
@@ -27,36 +30,40 @@ public class ItemWaterRing extends ItemBauble implements IManaUsingItem {
}
@Override
public void onWornTick(ItemStack stack, EntityLivingBase living) {
public void onWornTick(ItemStack stack, LivingEntity living) {
if(living.isInWaterOrBubbleColumn()) {
if(living instanceof EntityPlayer) {
if(living instanceof LivingEntity) {
// only activate for one ring at a time
ItemStack result = EquipmentHandler.findOrEmpty(ModItems.waterRing, living);
if(result != stack)
return;
}
double motionX = living.motionX * SPEED_MULT;
double motionY = living.motionY * SPEED_MULT;
double motionZ = living.motionZ * SPEED_MULT;
double motionX = living.getMotion().getX() * SPEED_MULT;
double motionY = living.getMotion().getY() * SPEED_MULT;
double motionZ = living.getMotion().getZ() * SPEED_MULT;
double newMX = living.getMotion().getX();
double newMY = living.getMotion().getY();
double newMZ = living.getMotion().getZ();
boolean flying = living instanceof EntityPlayer && ((EntityPlayer) living).abilities.isFlying;
boolean flying = living instanceof PlayerEntity && ((PlayerEntity) living).abilities.isFlying;
if(Math.abs(motionX) < MAX_SPEED && !flying)
living.motionX = motionX;
newMX = motionX;
if(Math.abs(motionY) < MAX_SPEED && !flying)
living.motionY = motionY;
newMY = motionY;
if(Math.abs(motionZ) < MAX_SPEED && !flying)
living.motionZ = motionZ;
newMZ = motionZ;
living.setMotion(newMX, newMY, newMZ);
EffectInstance effect = living.getActivePotionEffect(MobEffects.NIGHT_VISION);
EffectInstance effect = living.getActivePotionEffect(Effects.NIGHT_VISION);
if(effect == null) {
EffectInstance neweffect = new EffectInstance(MobEffects.NIGHT_VISION, Integer.MAX_VALUE, -42, true, true);
EffectInstance neweffect = new EffectInstance(Effects.NIGHT_VISION, Integer.MAX_VALUE, -42, true, true);
living.addPotionEffect(neweffect);
}
if(living.getAir() <= 1 && living instanceof EntityPlayer) {
int mana = ManaItemHandler.requestMana(stack, (EntityPlayer) living, 300, true);
if(living.getAir() <= 1 && living instanceof PlayerEntity) {
int mana = ManaItemHandler.requestMana(stack, (PlayerEntity) living, 300, true);
if(mana > 0)
living.setAir(mana);
}
@@ -64,10 +71,10 @@ public class ItemWaterRing extends ItemBauble implements IManaUsingItem {
}
@Override
public void onUnequipped(ItemStack stack, EntityLivingBase living) {
EffectInstance effect = living.getActivePotionEffect(MobEffects.NIGHT_VISION);
public void onUnequipped(ItemStack stack, LivingEntity living) {
EffectInstance effect = living.getActivePotionEffect(Effects.NIGHT_VISION);
if(effect != null && effect.getAmplifier() == -42)
living.removePotionEffect(MobEffects.NIGHT_VISION);
living.removePotionEffect(Effects.NIGHT_VISION);
}
@Override
@@ -133,12 +133,12 @@ public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinat
}
@Override
public boolean shouldSyncToTracking(ItemStack stack, EntityLivingBase entity) {
public boolean shouldSyncToTracking(ItemStack stack, LivingEntity entity) {
return true;
}
@Override
public void onUnequipped(ItemStack stack, EntityLivingBase living) {
public void onUnequipped(ItemStack stack, LivingEntity living) {
setCursorList(stack, null);
}
@@ -173,7 +173,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinat
return getLokiRing(player) == stack ? getOriginPos(stack) : null;
}
private static ItemStack getLokiRing(EntityPlayer player) {
private static ItemStack getLokiRing(PlayerEntity player) {
return EquipmentHandler.findOrEmpty(ModItems.lokiRing, player);
}
@@ -49,7 +49,7 @@ public class ItemOdinRing extends ItemRelicBauble {
}
@Override
public void onValidPlayerWornTick(EntityPlayer player) {
public void onValidPlayerWornTick(PlayerEntity player) {
if(player.isBurning() && ConfigHandler.COMMON.ringOfOdinFireResist.get())
player.extinguish();
}
@@ -63,8 +63,8 @@ public class ItemOdinRing extends ItemRelicBauble {
@SubscribeEvent
public static void onPlayerAttacked(LivingAttackEvent event) {
if(event.getEntityLiving() instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
if(event.getEntityLiving() instanceof PlayerEntity) {
PlayerEntity player = (PlayerEntity) event.getEntityLiving();
boolean negate = damageNegations.contains(event.getSource().damageType)
|| (ConfigHandler.COMMON.ringOfOdinFireResist.get() && fireNegations.contains(event.getSource().damageType));
boolean hasRing = !EquipmentHandler.findOrEmpty(ModItems.odinRing, player).isEmpty();
@@ -82,19 +82,19 @@ public abstract class ItemRelicBauble extends ItemBauble implements IRelic {
}
@Override
public void onWornTick(ItemStack stack, EntityLivingBase entity) {
if(entity instanceof EntityPlayer) {
EntityPlayer ePlayer = (EntityPlayer) entity;
public void onWornTick(ItemStack stack, LivingEntity entity) {
if(entity instanceof PlayerEntity) {
PlayerEntity ePlayer = (PlayerEntity) entity;
dummy.updateRelic(stack, ePlayer);
if(dummy.isRightPlayer(ePlayer, stack))
onValidPlayerWornTick(ePlayer);
}
}
public void onValidPlayerWornTick(EntityPlayer player) { }
public void onValidPlayerWornTick(PlayerEntity player) { }
@Override
public boolean canEquip(ItemStack stack, EntityLivingBase entity) {
return entity instanceof EntityPlayer && dummy.isRightPlayer((EntityPlayer) entity, stack);
public boolean canEquip(ItemStack stack, LivingEntity entity) {
return entity instanceof PlayerEntity && dummy.isRightPlayer((PlayerEntity) entity, stack);
}
}
@@ -29,7 +29,7 @@ public class ItemThorRing extends ItemRelicBauble {
return new ResourceLocation(LibMisc.MOD_ID, "challenge/thor_ring");
}
public static ItemStack getThorRing(EntityPlayer player) {
public static ItemStack getThorRing(PlayerEntity player) {
return EquipmentHandler.findOrEmpty(ModItems.thorRing, player);
}
}