Merge branch 'master' into flattening_test

This commit is contained in:
Vincent Lee committed 2017-12-17 21:23:08 -06:00
commit c3324c64e4
44 files changed
+246 -371

No files matched your search

@@ -1,28 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Aug 6, 2014, 6:02:29 PM (GMT)]
*/
package vazkii.botania.api.item;
/**
* An interface that defines an instance of PlayerControllerMP with
* the ability to modify reach. See vazkii.botania.client.core.handler.BotaniaPlayerController
*/
public interface IExtendedPlayerController {
/**
* Sets the extra reach the player should have.
*/
public void setReachDistanceExtension(float f);
/**
* Gets the current reach extension.
*/
public float getReachDistanceExtension();
}
@@ -1,44 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jul 22, 2014, 3:33:25 PM (GMT)]
*/
package vazkii.botania.client.core.handler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.item.IExtendedPlayerController;
@SideOnly(Side.CLIENT)
public class BotaniaPlayerController extends PlayerControllerMP implements IExtendedPlayerController {
private float distance = 0F;
public BotaniaPlayerController(Minecraft mc, NetHandlerPlayClient netHandler) {
super(mc, netHandler);
}
@Override
public float getBlockReachDistance() {
return super.getBlockReachDistance() + distance;
}
@Override
public void setReachDistanceExtension(float f) {
distance = f;
}
@Override
public float getReachDistanceExtension() {
return distance;
}
}
@@ -141,7 +141,7 @@ public final class ColorHandler {
items.registerItemColorHandler((s, t) -> {
ItemStack lens = ItemManaGun.getLens(s);
if(!lens.isEmpty() && t == 0)
return Minecraft.getMinecraft().getItemColors().getColorFromItemstack(lens, t);
return Minecraft.getMinecraft().getItemColors().colorMultiplier(lens, t);
if(t == 2) {
EntityManaBurst burst = ((ItemManaGun) s.getItem()).getBurst(Minecraft.getMinecraft().player, s, false);
@@ -12,10 +12,7 @@ package vazkii.botania.client.core.proxy;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer;
@@ -23,7 +20,6 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
@@ -37,10 +33,8 @@ import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import net.minecraftforge.fml.relauncher.Side;
import vazkii.botania.api.boss.IBotaniaBoss;
import vazkii.botania.api.item.IExtendedPlayerController;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.multiblock.IMultiblockRenderHook;
import vazkii.botania.api.lexicon.multiblock.Multiblock;
@@ -49,25 +43,16 @@ import vazkii.botania.api.lexicon.multiblock.component.AnyComponent;
import vazkii.botania.api.wiki.IWikiProvider;
import vazkii.botania.api.wiki.WikiHooks;
import vazkii.botania.client.challenge.ModChallenges;
import vazkii.botania.client.core.handler.AstrolabePreviewHandler;
import vazkii.botania.client.core.handler.BaubleRenderHandler;
import vazkii.botania.client.core.handler.BlockHighlightRenderHandler;
import vazkii.botania.client.core.handler.BossBarHandler;
import vazkii.botania.client.core.handler.BotaniaPlayerController;
import vazkii.botania.client.core.handler.BoundTileRenderer;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.handler.ColorHandler;
import vazkii.botania.client.core.handler.ContributorFancinessHandler;
import vazkii.botania.client.core.handler.CorporeaAutoCompleteHandler;
import vazkii.botania.client.core.handler.DebugHandler;
import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.client.core.handler.LightningHandler;
import vazkii.botania.client.core.handler.MiscellaneousIcons;
import vazkii.botania.client.core.handler.MultiblockRenderHandler;
import vazkii.botania.client.core.handler.PersistentVariableHelper;
import vazkii.botania.client.core.handler.RenderLexicon;
import vazkii.botania.client.core.handler.TooltipAdditionDisplayHandler;
import vazkii.botania.client.core.handler.TooltipHandler;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.client.fx.FXLightning;
import vazkii.botania.client.fx.FXSparkle;
@@ -86,10 +71,8 @@ import vazkii.botania.client.render.entity.RenderPoolMinecart;
import vazkii.botania.client.render.entity.RenderSnowballStack;
import vazkii.botania.client.render.entity.RenderSpark;
import vazkii.botania.client.render.tile.*;
import vazkii.botania.client.render.world.SkyblockRenderEvents;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.subtile.functional.BergamuteEventHandler;
import vazkii.botania.common.block.tile.*;
import vazkii.botania.common.block.tile.corporea.TileCorporeaCrystalCube;
import vazkii.botania.common.block.tile.corporea.TileCorporeaIndex;
@@ -104,7 +87,6 @@ import vazkii.botania.common.core.helper.MathHelper;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.core.proxy.IProxy;
import vazkii.botania.common.core.version.AdaptorNotifier;
import vazkii.botania.common.core.version.VersionChecker;
import vazkii.botania.common.entity.EntityBabylonWeapon;
import vazkii.botania.common.entity.EntityCorporeaSpark;
import vazkii.botania.common.entity.EntityDoppleganger;
@@ -120,7 +102,6 @@ import vazkii.botania.common.item.ItemSextant.MultiblockSextant;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.bauble.ItemMonocle;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibObfuscation;
import java.awt.Desktop;
import java.io.File;
@@ -292,31 +273,6 @@ public class ClientProxy implements IProxy {
return ItemMonocle.hasMonocle(Minecraft.getMinecraft().player);
}
@Override
public void setExtraReach(EntityLivingBase entity, float reach) {
if(!entity.world.isRemote) {
if(entity instanceof EntityPlayerMP)
((EntityPlayerMP) entity).interactionManager.setBlockReachDistance(Math.max(5, ((EntityPlayerMP) entity).interactionManager.getBlockReachDistance() + reach));
} else {
Minecraft mc = Minecraft.getMinecraft();
EntityPlayerSP player = mc.player;
if(entity == player) {
if(!(mc.playerController instanceof IExtendedPlayerController)) {
NetHandlerPlayClient net = player.connection;
BotaniaPlayerController controller = new BotaniaPlayerController(mc, net);
boolean isFlying = player.capabilities.isFlying;
boolean allowFlying = player.capabilities.allowFlying;
controller.setGameType(mc.playerController.getCurrentGameType());
player.capabilities.isFlying = isFlying;
player.capabilities.allowFlying = allowFlying;
mc.playerController = controller;
}
((IExtendedPlayerController) mc.playerController).setReachDistanceExtension(Math.max(0, ((IExtendedPlayerController) mc.playerController).getReachDistanceExtension() + reach));
}
}
}
@Override
public boolean openWikiPage(World world, Block block, RayTraceResult pos) {
IWikiProvider wiki = WikiHooks.getWikiFor(block);
@@ -15,6 +15,12 @@ import vazkii.botania.api.corporea.ICorporeaSpark;
import vazkii.botania.common.block.tile.TileSimpleInventory;
public abstract class TileCorporeaBase extends TileSimpleInventory {
// These TE's only extend TileSimpleInventory to give sparks an inventory to attach to
// TODO make sparks able to detect corporea blocks and not require them to have an inventory
@Override
public final int getSizeInventory() {
return 0;
}
public ICorporeaSpark getSpark() {
return CorporeaHelper.getSparkForBlock(world, getPos());
@@ -132,22 +132,12 @@ public class TileCorporeaCrystalCube extends TileCorporeaBase implements ICorpor
itemCount = par1nbtTagCompound.getInteger(TAG_ITEM_COUNT);
}
@Override
public int getSizeInventory() {
return 1;
}
public int getComparatorValue() {
if(itemCount == 0)
return 0;
return Math.min(15, (int) Math.floor(Math.log(itemCount) / LOG_2) + 1);
}
@Override
protected SimpleItemStackHandler createItemHandler() {
return new SimpleItemStackHandler(this, false);
}
@Override
public void doCorporeaRequest(Object request, int count, ICorporeaSpark spark) {
if(!(request instanceof ItemStack))
@@ -66,16 +66,6 @@ public class TileCorporeaFunnel extends TileCorporeaBase implements ICorporeaReq
return filter;
}
@Override
public int getSizeInventory() {
return 1;
}
@Override
protected SimpleItemStackHandler createItemHandler() {
return new SimpleItemStackHandler(this, false);
}
@Override
public void doCorporeaRequest(Object request, int count, ICorporeaSpark spark) {
if(!(request instanceof ItemStack))
@@ -190,11 +190,6 @@ public class TileCorporeaIndex extends TileCorporeaBase implements ICorporeaRequ
removeIndex(this);
}
@Override
public int getSizeInventory() {
return 0;
}
@Override
public void doCorporeaRequest(Object request, int count, ICorporeaSpark spark) {
if(!(request instanceof String))
@@ -26,16 +26,6 @@ import java.util.List;
public class TileCorporeaInterceptor extends TileCorporeaBase implements ICorporeaInterceptor {
@Override
protected SimpleItemStackHandler createItemHandler() {
return new SimpleItemStackHandler(this, false);
}
@Override
public int getSizeInventory() {
return 1;
}
@Override
public void interceptRequest(Object request, int count, ICorporeaSpark spark, ICorporeaSpark source, List<ItemStack> stacks, List<InvWithLocation> inventories, boolean doit) {}
@@ -34,8 +34,6 @@ public interface IProxy {
String getLastVersion();
void setExtraReach(EntityLivingBase entity, float reach);
boolean openWikiPage(World world, Block block, RayTraceResult pos);
void setMultiblock(World world, int x, int y, int z, double radius, Block block);
@@ -13,7 +13,6 @@ package vazkii.botania.common.core.proxy;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
@@ -66,12 +65,6 @@ public class ServerProxy implements IProxy {
return LibMisc.BUILD;
}
@Override
public void setExtraReach(EntityLivingBase entity, float reach) {
if(entity instanceof EntityPlayerMP)
((EntityPlayerMP) entity).interactionManager.setBlockReachDistance(Math.max(5, ((EntityPlayerMP) entity).interactionManager.getBlockReachDistance() + reach));
}
@Override
public boolean openWikiPage(World world, Block block, RayTraceResult pos) {
return false;
@@ -25,7 +25,7 @@ import javax.annotation.Nonnull;
public class AncientWillRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe {
@Override
public boolean isHidden() {
public boolean isDynamic() {
return true;
}
@@ -26,7 +26,7 @@ import javax.annotation.Nonnull;
public class BlackHoleTalismanExtractRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe {
@Override
public boolean isHidden() {
public boolean isDynamic() {
return true;
}
@@ -27,7 +27,7 @@ import javax.annotation.Nonnull;
public class CompositeLensRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe {
@Override
public boolean isHidden() {
public boolean isDynamic() {
return true;
}
@@ -25,7 +25,7 @@ import javax.annotation.Nonnull;
public class CosmeticAttachRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe {
@Override
public boolean isHidden() {
public boolean isDynamic() {
return true;
}
@@ -25,7 +25,7 @@ import javax.annotation.Nonnull;
public class CosmeticRemoveRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe {
@Override
public boolean isHidden() {
public boolean isDynamic() {
return true;
}
@@ -26,7 +26,7 @@ import javax.annotation.Nonnull;
public class KeepIvyRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe {
@Override
public boolean isHidden() {
public boolean isDynamic() {
return true;
}
@@ -31,7 +31,7 @@ public class LensDyeingRecipe extends IForgeRegistryEntry.Impl<IRecipe> implemen
private static final List<String> DYES = Arrays.asList("dyeWhite", "dyeOrange", "dyeMagenta", "dyeLightBlue", "dyeYellow", "dyeLime", "dyePink", "dyeGray", "dyeLightGray", "dyeCyan", "dyePurple", "dyeBlue", "dyeBrown", "dyeGreen", "dyeRed", "dyeBlack", LibOreDict.MANA_PEARL);
@Override
public boolean isHidden() {
public boolean isDynamic() {
return true;
}
@@ -25,7 +25,7 @@ import javax.annotation.Nonnull;
public class ManaGunClipRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe {
@Override
public boolean isHidden() {
public boolean isDynamic() {
return true;
}
@@ -26,7 +26,7 @@ import javax.annotation.Nonnull;
public class ManaGunLensRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe {
@Override
public boolean isHidden() {
public boolean isDynamic() {
return true;
}
@@ -24,7 +24,7 @@ import javax.annotation.Nonnull;
public class ManaGunRemoveLensRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe {
@Override
public boolean isHidden() {
public boolean isDynamic() {
return true;
}
@@ -25,7 +25,7 @@ import javax.annotation.Nonnull;
public class PhantomInkRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe {
@Override
public boolean isHidden() {
public boolean isDynamic() {
return true;
}
@@ -26,7 +26,7 @@ import javax.annotation.Nonnull;
public class SpecialFloatingFlowerRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe {
@Override
public boolean isHidden() {
public boolean isDynamic() {
return true;
}
@@ -25,7 +25,7 @@ import javax.annotation.Nonnull;
public class SpellClothRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe {
@Override
public boolean isHidden() {
public boolean isDynamic() {
return true;
}
@@ -25,7 +25,7 @@ import javax.annotation.Nonnull;
public class TerraPickTippingRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe {
@Override
public boolean isHidden() {
public boolean isDynamic() {
return true;
}
@@ -110,7 +110,7 @@ public class EntityThornChakram extends EntityThrowable {
dropAndKill();
} else {
setEntityToReturnTo(thrower.getEntityId());
if(getDistanceSqToEntity(thrower) < 2)
if(getDistanceSq(thrower) < 2)
dropAndKill();
}
}
@@ -1,15 +1,8 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Aug 16, 2015, 4:01:43 PM (GMT)]
*/
package vazkii.botania.common.entity;
import java.util.List;
import java.util.UUID;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@@ -19,6 +12,7 @@ import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.datafix.DataFixer;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
@@ -29,10 +23,6 @@ import net.minecraft.world.WorldServer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.util.List;
import java.util.UUID;
// A copy of the vanilla EntityThrowable class
// Doing this because if I didn't do this it'd be an EntityThrowable
// And we all know how much mods like deflecting EntityThrowables
@@ -45,47 +35,45 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
protected boolean inGround;
public int throwableShake;
/** The entity that threw this throwable item. */
private EntityLivingBase thrower;
protected EntityLivingBase thrower;
private String throwerName;
private int ticksInGround;
public Entity field_184539_c;
private int field_184540_av;
private int ticksInAir;
public Entity ignoreEntity;
private int ignoreTime;
public EntityThrowableCopy(World worldIn)
{
super(worldIn);
xTile = -1;
yTile = -1;
zTile = -1;
setSize(0.25F, 0.25F);
this.xTile = -1;
this.yTile = -1;
this.zTile = -1;
this.setSize(0.25F, 0.25F);
}
public EntityThrowableCopy(World worldIn, double x, double y, double z)
{
this(worldIn);
setPosition(x, y, z);
this.setPosition(x, y, z);
}
public EntityThrowableCopy(World worldIn, EntityLivingBase throwerIn)
{
this(worldIn, throwerIn.posX, throwerIn.posY + throwerIn.getEyeHeight() - 0.10000000149011612D, throwerIn.posZ);
thrower = throwerIn;
this(worldIn, throwerIn.posX, throwerIn.posY + (double)throwerIn.getEyeHeight() - 0.10000000149011612D, throwerIn.posZ);
this.thrower = throwerIn;
}
@Override
protected void entityInit()
{
}
/**
* Checks if the entity is in range to render by using the past in distance and comparing it to its average edge
* length * 64 * renderDistanceWeight Args: distance
* Checks if the entity is in range to render.
*/
@Override
@SideOnly(Side.CLIENT)
public boolean isInRangeToRenderDist(double distance)
{
double d0 = getEntityBoundingBox().getAverageEdgeLength() * 4.0D;
double d0 = this.getEntityBoundingBox().getAverageEdgeLength() * 4.0D;
if (Double.isNaN(d0))
{
@@ -96,110 +84,116 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
return distance < d0 * d0;
}
public void func_184538_a(Entity p_184538_1_, float p_184538_2_, float p_184538_3_, float p_184538_4_, float p_184538_5_, float p_184538_6_)
/**
* Sets throwable heading based on an entity that's throwing it
*/
public void shoot(Entity entityThrower, float rotationPitchIn, float rotationYawIn, float pitchOffset, float velocity, float inaccuracy)
{
float f = -MathHelper.sin(p_184538_3_ * 0.017453292F) * MathHelper.cos(p_184538_2_ * 0.017453292F);
float f1 = -MathHelper.sin((p_184538_2_ + p_184538_4_) * 0.017453292F);
float f2 = MathHelper.cos(p_184538_3_ * 0.017453292F) * MathHelper.cos(p_184538_2_ * 0.017453292F);
setThrowableHeading(f, f1, f2, p_184538_5_, p_184538_6_);
motionX += p_184538_1_.motionX;
motionZ += p_184538_1_.motionZ;
float f = -MathHelper.sin(rotationYawIn * 0.017453292F) * MathHelper.cos(rotationPitchIn * 0.017453292F);
float f1 = -MathHelper.sin((rotationPitchIn + pitchOffset) * 0.017453292F);
float f2 = MathHelper.cos(rotationYawIn * 0.017453292F) * MathHelper.cos(rotationPitchIn * 0.017453292F);
this.shoot((double)f, (double)f1, (double)f2, velocity, inaccuracy);
this.motionX += entityThrower.motionX;
this.motionZ += entityThrower.motionZ;
if (!p_184538_1_.onGround)
if (!entityThrower.onGround)
{
motionY += p_184538_1_.motionY;
this.motionY += entityThrower.motionY;
}
}
/**
* Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction.
*/
@Override
public void setThrowableHeading(double x, double y, double z, float velocity, float inaccuracy)
public void shoot(double x, double y, double z, float velocity, float inaccuracy)
{
float f = MathHelper.sqrt(x * x + y * y + z * z);
x = x / f;
y = y / f;
z = z / f;
x = x + rand.nextGaussian() * 0.007499999832361937D * inaccuracy;
y = y + rand.nextGaussian() * 0.007499999832361937D * inaccuracy;
z = z + rand.nextGaussian() * 0.007499999832361937D * inaccuracy;
x = x * velocity;
y = y * velocity;
z = z * velocity;
motionX = x;
motionY = y;
motionZ = z;
x = x / (double)f;
y = y / (double)f;
z = z / (double)f;
x = x + this.rand.nextGaussian() * 0.007499999832361937D * (double)inaccuracy;
y = y + this.rand.nextGaussian() * 0.007499999832361937D * (double)inaccuracy;
z = z + this.rand.nextGaussian() * 0.007499999832361937D * (double)inaccuracy;
x = x * (double)velocity;
y = y * (double)velocity;
z = z * (double)velocity;
this.motionX = x;
this.motionY = y;
this.motionZ = z;
float f1 = MathHelper.sqrt(x * x + z * z);
prevRotationYaw = rotationYaw = (float)(MathHelper.atan2(x, z) * (180D / Math.PI));
prevRotationPitch = rotationPitch = (float)(MathHelper.atan2(y, f1) * (180D / Math.PI));
ticksInGround = 0;
this.rotationYaw = (float)(MathHelper.atan2(x, z) * (180D / Math.PI));
this.rotationPitch = (float)(MathHelper.atan2(y, (double)f1) * (180D / Math.PI));
this.prevRotationYaw = this.rotationYaw;
this.prevRotationPitch = this.rotationPitch;
this.ticksInGround = 0;
}
/**
* Updates the velocity of the entity to a new value.
* Updates the entity motion clientside, called by packets from the server
*/
@Override
@SideOnly(Side.CLIENT)
public void setVelocity(double x, double y, double z)
{
motionX = x;
motionY = y;
motionZ = z;
this.motionX = x;
this.motionY = y;
this.motionZ = z;
if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F)
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
{
float f = MathHelper.sqrt(x * x + z * z);
prevRotationYaw = rotationYaw = (float)(MathHelper.atan2(x, z) * (180D / Math.PI));
prevRotationPitch = rotationPitch = (float)(MathHelper.atan2(y, f) * (180D / Math.PI));
this.rotationYaw = (float)(MathHelper.atan2(x, z) * (180D / Math.PI));
this.rotationPitch = (float)(MathHelper.atan2(y, (double)f) * (180D / Math.PI));
this.prevRotationYaw = this.rotationYaw;
this.prevRotationPitch = this.rotationPitch;
}
}
/**
* Called to update the entity's position/logic.
*/
@Override
public void onUpdate()
{
lastTickPosX = posX;
lastTickPosY = posY;
lastTickPosZ = posZ;
this.lastTickPosX = this.posX;
this.lastTickPosY = this.posY;
this.lastTickPosZ = this.posZ;
super.onUpdate();
if (throwableShake > 0)
if (this.throwableShake > 0)
{
--throwableShake;
--this.throwableShake;
}
if (inGround)
if (this.inGround)
{
if (world.getBlockState(new BlockPos(xTile, yTile, zTile)).getBlock() == inTile)
if (this.world.getBlockState(new BlockPos(this.xTile, this.yTile, this.zTile)).getBlock() == this.inTile)
{
++ticksInGround;
++this.ticksInGround;
if (ticksInGround == 1200)
if (this.ticksInGround == 1200)
{
setDead();
this.setDead();
}
return;
}
inGround = false;
motionX *= rand.nextFloat() * 0.2F;
motionY *= rand.nextFloat() * 0.2F;
motionZ *= rand.nextFloat() * 0.2F;
ticksInGround = 0;
this.inGround = false;
this.motionX *= (double)(this.rand.nextFloat() * 0.2F);
this.motionY *= (double)(this.rand.nextFloat() * 0.2F);
this.motionZ *= (double)(this.rand.nextFloat() * 0.2F);
this.ticksInGround = 0;
this.ticksInAir = 0;
}
else
{
++this.ticksInAir;
}
Vec3d vec3d = new Vec3d(posX, posY, posZ);
Vec3d vec3d1 = new Vec3d(posX + motionX, posY + motionY, posZ + motionZ);
RayTraceResult raytraceresult = world.rayTraceBlocks(vec3d, vec3d1);
vec3d = new Vec3d(posX, posY, posZ);
vec3d1 = new Vec3d(posX + motionX, posY + motionY, posZ + motionZ);
Vec3d vec3d = new Vec3d(this.posX, this.posY, this.posZ);
Vec3d vec3d1 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
RayTraceResult raytraceresult = this.world.rayTraceBlocks(vec3d, vec3d1);
vec3d = new Vec3d(this.posX, this.posY, this.posZ);
vec3d1 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
if (raytraceresult != null)
{
@@ -207,7 +201,7 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
}
Entity entity = null;
List<Entity> list = world.getEntitiesWithinAABBExcludingEntity(this, getEntityBoundingBox().offset(motionX, motionY, motionZ).grow(1.0D));
List<Entity> list = this.world.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().expand(this.motionX, this.motionY, this.motionZ).grow(1.0D));
double d0 = 0.0D;
boolean flag = false;
@@ -217,13 +211,13 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
if (entity1.canBeCollidedWith())
{
if (entity1 == field_184539_c)
if (entity1 == this.ignoreEntity)
{
flag = true;
}
else if (ticksExisted < 2 && field_184539_c == null)
else if (this.thrower != null && this.ticksExisted < 2 && this.ignoreEntity == null)
{
field_184539_c = entity1;
this.ignoreEntity = entity1;
flag = true;
}
else
@@ -246,15 +240,15 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
}
}
if (field_184539_c != null)
if (this.ignoreEntity != null)
{
if (flag)
{
field_184540_av = 2;
this.ignoreTime = 2;
}
else if (field_184540_av-- <= 0)
else if (this.ignoreTime-- <= 0)
{
field_184539_c = null;
this.ignoreEntity = null;
}
}
@@ -265,63 +259,68 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
if (raytraceresult != null)
{
if (raytraceresult.typeOfHit == RayTraceResult.Type.BLOCK && world.getBlockState(raytraceresult.getBlockPos()).getBlock() == Blocks.PORTAL)
if (raytraceresult.typeOfHit == RayTraceResult.Type.BLOCK && this.world.getBlockState(raytraceresult.getBlockPos()).getBlock() == Blocks.PORTAL)
{
setPortal(raytraceresult.getBlockPos());
this.setPortal(raytraceresult.getBlockPos());
}
else
else if (!net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult))
{
onImpact(raytraceresult);
this.onImpact(raytraceresult);
}
}
posX += motionX;
posY += motionY;
posZ += motionZ;
float f = MathHelper.sqrt(motionX * motionX + motionZ * motionZ);
rotationYaw = (float)(MathHelper.atan2(motionX, motionZ) * (180D / Math.PI));
this.posX += this.motionX;
this.posY += this.motionY;
this.posZ += this.motionZ;
float f = MathHelper.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.rotationYaw = (float)(MathHelper.atan2(this.motionX, this.motionZ) * (180D / Math.PI));
for (rotationPitch = (float)(MathHelper.atan2(motionY, f) * (180D / Math.PI)); rotationPitch - prevRotationPitch < -180.0F; prevRotationPitch -= 360.0F)
for (this.rotationPitch = (float)(MathHelper.atan2(this.motionY, (double)f) * (180D / Math.PI)); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F)
{
;
}
while (rotationPitch - prevRotationPitch >= 180.0F)
while (this.rotationPitch - this.prevRotationPitch >= 180.0F)
{
prevRotationPitch += 360.0F;
this.prevRotationPitch += 360.0F;
}
while (rotationYaw - prevRotationYaw < -180.0F)
while (this.rotationYaw - this.prevRotationYaw < -180.0F)
{
prevRotationYaw -= 360.0F;
this.prevRotationYaw -= 360.0F;
}
while (rotationYaw - prevRotationYaw >= 180.0F)
while (this.rotationYaw - this.prevRotationYaw >= 180.0F)
{
prevRotationYaw += 360.0F;
this.prevRotationYaw += 360.0F;
}
rotationPitch = prevRotationPitch + (rotationPitch - prevRotationPitch) * 0.2F;
rotationYaw = prevRotationYaw + (rotationYaw - prevRotationYaw) * 0.2F;
this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
float f1 = 0.99F;
float f2 = getGravityVelocity();
float f2 = this.getGravityVelocity();
if (isInWater())
if (this.isInWater())
{
for (int j = 0; j < 4; ++j)
{
float f3 = 0.25F;
world.spawnParticle(EnumParticleTypes.WATER_BUBBLE, posX - motionX * f3, posY - motionY * f3, posZ - motionZ * f3, motionX, motionY, motionZ);
this.world.spawnParticle(EnumParticleTypes.WATER_BUBBLE, this.posX - this.motionX * 0.25D, this.posY - this.motionY * 0.25D, this.posZ - this.motionZ * 0.25D, this.motionX, this.motionY, this.motionZ);
}
f1 = 0.8F;
}
motionX *= f1;
motionY *= f1;
motionZ *= f1;
motionY -= f2;
setPosition(posX, posY, posZ);
this.motionX *= (double)f1;
this.motionY *= (double)f1;
this.motionZ *= (double)f1;
if (!this.hasNoGravity())
{
this.motionY -= (double)f2;
}
this.setPosition(this.posX, this.posY, this.posZ);
}
/**
@@ -337,84 +336,87 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
*/
protected abstract void onImpact(RayTraceResult result);
public static void registerFixesThrowable(DataFixer fixer, String name)
{
}
/**
* (abstract) Protected helper method to write subclass entity data to NBT.
*/
@Override
public void writeEntityToNBT(@Nonnull NBTTagCompound compound)
public void writeEntityToNBT(NBTTagCompound compound)
{
compound.setInteger("xTile", xTile);
compound.setInteger("yTile", yTile);
compound.setInteger("zTile", zTile);
ResourceLocation resourcelocation = Block.REGISTRY.getNameForObject(inTile);
compound.setInteger("xTile", this.xTile);
compound.setInteger("yTile", this.yTile);
compound.setInteger("zTile", this.zTile);
ResourceLocation resourcelocation = Block.REGISTRY.getNameForObject(this.inTile);
compound.setString("inTile", resourcelocation == null ? "" : resourcelocation.toString());
compound.setByte("shake", (byte)throwableShake);
compound.setByte("inGround", (byte)(inGround ? 1 : 0));
compound.setByte("shake", (byte)this.throwableShake);
compound.setByte("inGround", (byte)(this.inGround ? 1 : 0));
if ((throwerName == null || throwerName.isEmpty()) && thrower instanceof EntityPlayer)
if ((this.throwerName == null || this.throwerName.isEmpty()) && this.thrower instanceof EntityPlayer)
{
throwerName = thrower.getName();
this.throwerName = this.thrower.getName();
}
compound.setString("ownerName", throwerName == null ? "" : throwerName);
compound.setString("ownerName", this.throwerName == null ? "" : this.throwerName);
}
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
@Override
public void readEntityFromNBT(@Nonnull NBTTagCompound compound)
public void readEntityFromNBT(NBTTagCompound compound)
{
xTile = compound.getInteger("xTile");
yTile = compound.getInteger("yTile");
zTile = compound.getInteger("zTile");
this.xTile = compound.getInteger("xTile");
this.yTile = compound.getInteger("yTile");
this.zTile = compound.getInteger("zTile");
if (compound.hasKey("inTile", 8))
{
inTile = Block.getBlockFromName(compound.getString("inTile"));
this.inTile = Block.getBlockFromName(compound.getString("inTile"));
}
else
{
inTile = Block.getBlockById(compound.getByte("inTile") & 255);
this.inTile = Block.getBlockById(compound.getByte("inTile") & 255);
}
throwableShake = compound.getByte("shake") & 255;
inGround = compound.getByte("inGround") == 1;
thrower = null;
throwerName = compound.getString("ownerName");
this.throwableShake = compound.getByte("shake") & 255;
this.inGround = compound.getByte("inGround") == 1;
this.thrower = null;
this.throwerName = compound.getString("ownerName");
if (throwerName != null && throwerName.isEmpty())
if (this.throwerName != null && this.throwerName.isEmpty())
{
throwerName = null;
this.throwerName = null;
}
thrower = getThrower();
this.thrower = this.getThrower();
}
@Nullable
public EntityLivingBase getThrower()
{
if (thrower == null && throwerName != null && !throwerName.isEmpty())
if (this.thrower == null && this.throwerName != null && !this.throwerName.isEmpty())
{
thrower = world.getPlayerEntityByName(throwerName);
this.thrower = this.world.getPlayerEntityByName(this.throwerName);
if (thrower == null && world instanceof WorldServer)
if (this.thrower == null && this.world instanceof WorldServer)
{
try
{
Entity entity = ((WorldServer)world).getEntityFromUuid(UUID.fromString(throwerName));
Entity entity = ((WorldServer)this.world).getEntityFromUuid(UUID.fromString(this.throwerName));
if (entity instanceof EntityLivingBase)
{
thrower = (EntityLivingBase)entity;
this.thrower = (EntityLivingBase)entity;
}
}
catch (Throwable var2)
{
thrower = null;
this.thrower = null;
}
}
}
return thrower;
return this.thrower;
}
}
@@ -33,7 +33,7 @@ public class EntityThrownItem extends EntityItem {
public EntityThrownItem(World world, double x,
double y, double z, EntityItem item) {
super(world, x, y, z, item.getItem());
setPickupDelay(item.delayBeforeCanPickup);
setPickupDelay(item.pickupDelay);
motionX = item.motionX;
motionY = item.motionY;
motionZ = item.motionZ;
@@ -60,7 +60,7 @@ public class EntityThrownItem extends EntityItem {
double d0 = 0.0D;
for (Entity entity1 : list) {
if (entity1.canBeCollidedWith() && (!(entity1 instanceof EntityPlayer) || delayBeforeCanPickup == 0)) {
if (entity1.canBeCollidedWith() && (!(entity1 instanceof EntityPlayer) || pickupDelay == 0)) {
float f = 1.0F;
AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().grow(f);
RayTraceResult RayTraceResult1 = axisalignedbb.calculateIntercept(vec3, vec31);
@@ -51,7 +51,7 @@ public class ItemSlingshot extends ItemMod {
PlayerHelper.consumeAmmo((EntityPlayer) living, AMMO_FUNC);
EntityVineBall ball = new EntityVineBall(living, false);
ball.setHeadingFromThrower(living, living.rotationPitch, living.rotationYaw, 0F, 1.5F, 1F);
ball.shoot(living, living.rotationPitch, living.rotationYaw, 0F, 1.5F, 1F);
ball.motionX *= 1.6;
ball.motionY *= 1.6;
ball.motionZ *= 1.6;
@@ -38,7 +38,7 @@ public class ItemThornChakram extends ItemMod {
ItemStack copy = stack.copy();
copy.setCount(1);
EntityThornChakram c = new EntityThornChakram(world, player, copy);
c.setHeadingFromThrower(player, player.rotationPitch, player.rotationYaw, 0.0F, 1.5F, 1.0F);
c.shoot(player, player.rotationPitch, player.rotationYaw, 0.0F, 1.5F, 1.0F);
if(stack.getItem() == ModItems.flareChakram)
c.setFire(true);
world.spawnEntity(c);
@@ -39,7 +39,7 @@ public class ItemVineBall extends ItemMod {
if(!world.isRemote) {
EntityVineBall ball = new EntityVineBall(player, true);
ball.setHeadingFromThrower(player, player.rotationPitch, player.rotationYaw, 0.0F, 1.5F, 1.0F);
ball.shoot(player, player.rotationPitch, player.rotationYaw, 0.0F, 1.5F, 1.0F);
world.spawnEntity(ball);
}
@@ -27,9 +27,13 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Optional;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemHandlerHelper;
import thaumcraft.api.items.IRunicArmor;
import vazkii.botania.api.item.ICosmeticAttachable;
@@ -46,6 +50,7 @@ import java.util.List;
import java.util.UUID;
@Optional.Interface(modid = "Thaumcraft", iface = "thaumcraft.api.items.IRunicArmor")
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
public abstract class ItemBauble extends ItemMod implements IBauble, ICosmeticAttachable, IPhantomInkable, IRunicArmor {
private static final String TAG_HASHCODE = "playerHashcode";
@@ -59,6 +64,26 @@ public abstract class ItemBauble extends ItemMod implements IBauble, ICosmeticAt
setMaxStackSize(1);
}
// Apparently baubles doesn't unequip on death, which causes attribute modifiers to get weird/desync on respawn
// See Baubles#236
// Do it for our baubles if they're going to drop
// TODO there is still some weirdness going on when dying/returning in the End, figure that out
@SubscribeEvent
public static void onDeath(LivingDeathEvent evt) {
if(!evt.getEntityLiving().world.isRemote
&& evt.getEntityLiving() instanceof EntityPlayer
&& !evt.getEntityLiving().world.getGameRules().getBoolean("keepInventory")
&& !((EntityPlayer) evt.getEntityLiving()).isSpectator()) {
IItemHandler inv = BaublesApi.getBaublesHandler((EntityPlayer) evt.getEntityLiving());
for(int i = 0; i < inv.getSlots(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if (!stack.isEmpty() && stack.getItem().getRegistryName().getResourceDomain().equals(LibMisc.MOD_ID)) {
((ItemBauble) stack.getItem()).onUnequipped(stack, evt.getEntityLiving());
}
}
}
}
@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
@@ -79,6 +104,8 @@ public abstract class ItemBauble extends ItemMod implements IBauble, ICosmeticAt
ItemStack stackInSlot = baubles.getStackInSlot(i);
if(stackInSlot.isEmpty() || ((IBauble) stackInSlot.getItem()).canUnequip(stackInSlot, player)) {
baubles.setStackInSlot(i, toEquip);
((IBauble) toEquip.getItem()).onEquipped(toEquip, player);
stack.shrink(1);
PlayerHelper.grantCriterion((EntityPlayerMP) player, new ResourceLocation(LibMisc.MOD_ID, "main/bauble_wear"), "code_triggered");
@@ -361,7 +361,7 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
if (flag && bakedquad.hasTintIndex())
{
k = Minecraft.getMinecraft().getItemColors().getColorFromItemstack(stack, bakedquad.getTintIndex());
k = Minecraft.getMinecraft().getItemColors().colorMultiplier(stack, bakedquad.getTintIndex());
if (EntityRenderer.anaglyphEnable)
{
@@ -17,25 +17,26 @@ import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.item.ItemStack;
public abstract class ItemBaubleModifier extends ItemBauble {
final Multimap<String, AttributeModifier> attributes = HashMultimap.create();
public ItemBaubleModifier(String name) {
super(name);
}
@Override
public void onEquippedOrLoadedIntoWorld(ItemStack stack, EntityLivingBase player) {
attributes.clear();
fillModifiers(attributes, stack);
player.getAttributeMap().applyAttributeModifiers(attributes);
if(!player.world.isRemote) {
Multimap<String, AttributeModifier> attributes = HashMultimap.create();
fillModifiers(attributes, stack);
player.getAttributeMap().applyAttributeModifiers(attributes);
}
}
@Override
public void onUnequipped(ItemStack stack, EntityLivingBase player) {
attributes.clear();
fillModifiers(attributes, stack);
player.getAttributeMap().removeAttributeModifiers(attributes);
if(!player.world.isRemote) {
Multimap<String, AttributeModifier> attributes = HashMultimap.create();
fillModifiers(attributes, stack);
player.getAttributeMap().removeAttributeModifiers(attributes);
}
}
abstract void fillModifiers(Multimap<String, AttributeModifier> attributes, ItemStack stack);
@@ -165,7 +165,7 @@ public class ItemBloodPendant extends ItemBauble implements IBrewContainer, IBre
float f3 = icon.getMaxV();
IconHelper.renderIconIn3D(Tessellator.getInstance(), f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 32F);
Color color = new Color(Minecraft.getMinecraft().getItemColors().getColorFromItemstack(stack, 1));
Color color = new Color(Minecraft.getMinecraft().getItemColors().colorMultiplier(stack, 1));
GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
int light = 15728880;
int lightmapX = light % 65536;
@@ -12,6 +12,7 @@ package vazkii.botania.common.item.equipment.bauble;
import baubles.api.BaubleType;
import baubles.api.BaublesApi;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
@@ -477,7 +478,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub
int xo = resolution.getScaledWidth() / 2 + 10;
int x = xo;
int y = resolution.getScaledHeight() - ConfigHandler.flightBarHeight;
if(player.getAir() < 300)
if(player.isInsideOfMaterial(Material.WATER))
y = resolution.getScaledHeight() - ConfigHandler.flightBarBreathHeight;
int left = ItemNBTHelper.getInt(stack, TAG_TIME_LEFT, MAX_FLY_TIME);
@@ -45,7 +45,7 @@ public class ItemKnockbackBelt extends ItemBaubleModifier implements IBaubleRend
if(stack.isEmpty()) // workaround for Azanor/Baubles#156
return;
attributes.put(SharedMonsterAttributes.KNOCKBACK_RESISTANCE.getName(), new AttributeModifier(getBaubleUUID(stack), "Bauble modifier", 1, 0));
attributes.put(SharedMonsterAttributes.KNOCKBACK_RESISTANCE.getName(), new AttributeModifier(getBaubleUUID(stack), "Knockback Belt", 1, 0).setSaved(false));
}
@Override
@@ -11,25 +11,21 @@
package vazkii.botania.common.item.equipment.bauble;
import baubles.api.BaubleType;
import net.minecraft.entity.EntityLivingBase;
import com.google.common.collect.Multimap;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import vazkii.botania.common.Botania;
import vazkii.botania.common.lib.LibItemNames;
public class ItemReachRing extends ItemBauble {
public class ItemReachRing extends ItemBaubleModifier {
public ItemReachRing() {
super(LibItemNames.REACH_RING);
}
@Override
public void onEquippedOrLoadedIntoWorld(ItemStack stack, EntityLivingBase player) {
Botania.proxy.setExtraReach(player, 3.5F);
}
@Override
public void onUnequipped(ItemStack stack, EntityLivingBase player) {
Botania.proxy.setExtraReach(player, -3.5F);
void fillModifiers(Multimap<String, AttributeModifier> attributes, ItemStack stack) {
attributes.put(EntityPlayer.REACH_DISTANCE.getName(), new AttributeModifier(getBaubleUUID(stack), "Reach Ring", 3.5, 0).setSaved(false));
}
@Override
@@ -130,7 +130,7 @@ public class ItemLivingwoodBow extends ItemBow implements IManaUsingItem, IModel
{
ItemArrow itemarrow = (ItemArrow) (itemstack.getItem() instanceof ItemArrow ? itemstack.getItem() : Items.ARROW);
EntityArrow entityarrow = itemarrow.createArrow(world, itemstack, shooter);
entityarrow.setAim(shooter, shooter.rotationPitch, shooter.rotationYaw, 0.0F, f * 3.0F, 1.0F);
entityarrow.shoot(shooter, shooter.rotationPitch, shooter.rotationYaw, 0.0F, f * 3.0F, 1.0F);
if (f == 1.0F)
{
@@ -125,7 +125,7 @@ public class ItemTerraSword extends ItemManasteelSword implements ILensEffect {
int mana = burst.getMana();
if(mana >= cost) {
burst.setMana(mana - cost);
float damage = 4F + BotaniaAPI.terrasteelToolMaterial.getDamageVsEntity();
float damage = 4F + BotaniaAPI.terrasteelToolMaterial.getAttackDamage();
if(!burst.isFake() && !entity.world.isRemote) {
EntityPlayer player = living.world.getPlayerEntityByName(attacker);
living.attackEntityFrom(player == null ? DamageSource.MAGIC : DamageSource.causePlayerDamage(player), damage);
@@ -94,7 +94,7 @@ public class ItemManaResource extends ItemMod implements IFlowerComponent, IElve
if(!world.isRemote) {
EntityEnderAirBottle b = new EntityEnderAirBottle(world, player);
b.setHeadingFromThrower(player, player.rotationPitch, player.rotationYaw, 0F, 1.5F, 1F);
b.shoot(player, player.rotationPitch, player.rotationYaw, 0F, 1.5F, 1F);
world.spawnEntity(b);
}
else player.swingArm(hand);
@@ -39,8 +39,6 @@ public class ItemOdinRing extends ItemRelicBauble {
private static final List<String> damageNegations = new ArrayList<>();
private final Multimap<String, AttributeModifier> attributes = HashMultimap.create();
public ItemOdinRing() {
super(LibItemNames.ODIN_RING);
@@ -89,23 +87,27 @@ public class ItemOdinRing extends ItemRelicBauble {
@Override
public void onEquippedOrLoadedIntoWorld(ItemStack stack, EntityLivingBase player) {
attributes.clear();
fillModifiers(attributes, stack);
player.getAttributeMap().applyAttributeModifiers(attributes);
if(!player.world.isRemote) {
Multimap<String, AttributeModifier> attributes = HashMultimap.create();
fillModifiers(attributes, stack);
player.getAttributeMap().applyAttributeModifiers(attributes);
}
}
@Override
public void onUnequipped(ItemStack stack, EntityLivingBase player) {
attributes.clear();
fillModifiers(attributes, stack);
player.getAttributeMap().removeAttributeModifiers(attributes);
if(!player.world.isRemote) {
Multimap<String, AttributeModifier> attributes = HashMultimap.create();
fillModifiers(attributes, stack);
player.getAttributeMap().removeAttributeModifiers(attributes);
}
}
private void fillModifiers(Multimap<String, AttributeModifier> attributes, ItemStack stack) {
if(stack.isEmpty()) // workaround for Azanor/Baubles#156
return;
attributes.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier(getBaubleUUID(stack), "Bauble modifier", 20, 0));
attributes.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier(getBaubleUUID(stack), "Odin Ring", 20, 0).setSaved(false));
}
@Override
@@ -89,7 +89,7 @@ public class PageEntity extends LexiconPage{
GlStateManager.rotate(rotation, 0.0F, 1.0F, 0.0F);
RenderHelper.enableStandardItemLighting();
Minecraft.getMinecraft().getRenderManager().playerViewY = 180.0F;
Minecraft.getMinecraft().getRenderManager().doRenderEntity(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false);
Minecraft.getMinecraft().getRenderManager().renderEntity(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false);
GlStateManager.popMatrix();
RenderHelper.disableStandardItemLighting();
GlStateManager.disableRescaleNormal();