mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-20 20:22:33 +00:00
Fix a bunch of smaller compile errors
This commit is contained in:
1 parent
15ad0ed530
commit
d9f444eab4
16 files changed
+89
-103
No files matched your search
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
package vazkii.botania.api.internal;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -32,10 +33,10 @@ public class DummyMethodHandler implements IInternalMethodHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawSimpleManaHUD(int color, int mana, int maxMana, String name) {}
|
||||
public void drawSimpleManaHUD(MatrixStack ms, int color, int mana, int maxMana, String name) {}
|
||||
|
||||
@Override
|
||||
public void drawComplexManaHUD(int color, int mana, int maxMana, String name, ItemStack bindDisplay, boolean properlyBound) {}
|
||||
public void drawComplexManaHUD(MatrixStack ms, int color, int mana, int maxMana, String name, ItemStack bindDisplay, boolean properlyBound) {}
|
||||
|
||||
@Override
|
||||
public ItemStack getBindDisplayForFlowerType(TileEntitySpecialFlower e) {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
package vazkii.botania.api.internal;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -48,10 +49,10 @@ public interface IInternalMethodHandler {
|
||||
public boolean hasSolegnoliaAround(Entity e);
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void drawSimpleManaHUD(int color, int mana, int maxMana, String name);
|
||||
public void drawSimpleManaHUD(MatrixStack ms, int color, int mana, int maxMana, String name);
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void drawComplexManaHUD(int color, int mana, int maxMana, String name, ItemStack bindDisplay, boolean properlyBound);
|
||||
public void drawComplexManaHUD(MatrixStack ms, int color, int mana, int maxMana, String name, ItemStack bindDisplay, boolean properlyBound);
|
||||
|
||||
public ItemStack getBindDisplayForFlowerType(TileEntitySpecialFlower e);
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@ public class TileEntityFunctionalFlower extends TileEntitySpecialFlower {
|
||||
public void renderHUD(MatrixStack ms, Minecraft mc) {
|
||||
String name = I18n.format(getBlockState().getBlock().getTranslationKey());
|
||||
int color = getColor();
|
||||
BotaniaAPI.instance().internalHandler().drawComplexManaHUD(color, getMana(), getMaxMana(), name, BotaniaAPI.instance().internalHandler().getBindDisplayForFlowerType(this), isValidBinding());
|
||||
BotaniaAPI.instance().internalHandler().drawComplexManaHUD(ms, color, getMana(), getMaxMana(), name, BotaniaAPI.instance().internalHandler().getBindDisplayForFlowerType(this), isValidBinding());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -293,7 +293,7 @@ public class TileEntityGeneratingFlower extends TileEntitySpecialFlower {
|
||||
public void renderHUD(MatrixStack ms, Minecraft mc) {
|
||||
String name = I18n.format(getBlockState().getBlock().getTranslationKey());
|
||||
int color = getColor();
|
||||
BotaniaAPI.instance().internalHandler().drawComplexManaHUD(color, getMana(), getMaxMana(), name, BotaniaAPI.instance().internalHandler().getBindDisplayForFlowerType(this), isValidBinding());
|
||||
BotaniaAPI.instance().internalHandler().drawComplexManaHUD(ms, color, getMana(), getMaxMana(), name, BotaniaAPI.instance().internalHandler().getBindDisplayForFlowerType(this), isValidBinding());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,7 +13,10 @@ import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.BreakableBlock;
|
||||
import net.minecraft.block.StainedGlassPaneBlock;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.AbstractGui;
|
||||
import net.minecraft.client.renderer.*;
|
||||
@@ -24,6 +27,7 @@ import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.Direction;
|
||||
@@ -32,6 +36,7 @@ import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.vector.Matrix4f;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -306,15 +311,15 @@ public final class RenderHelper {
|
||||
if (model == null) {
|
||||
model = Minecraft.getInstance().getItemRenderer().getItemModelWithOverrides(stack, entity.world, entity);
|
||||
}
|
||||
model = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ms, model, ItemCameraTransforms.TransformType.NONE, false);
|
||||
model = ForgeHooksClient.handleCameraTransforms(ms, model, ItemCameraTransforms.TransformType.NONE, false);
|
||||
ms.translate(-0.5D, -0.5D, -0.5D);
|
||||
if (!model.isBuiltInRenderer()) {
|
||||
RenderType rendertype = RenderTypeLookup.getRenderType(stack);
|
||||
|
||||
IVertexBuilder ivertexbuilder = ItemRenderer.getBuffer(buffers, rendertype, true, stack.hasEffect());
|
||||
if (!model.isBuiltInRenderer() && (stack.getItem() != Items.TRIDENT)) {
|
||||
RenderType rendertype = RenderTypeLookup.func_239219_a_(stack, true);
|
||||
IVertexBuilder ivertexbuilder = ItemRenderer.func_239391_c_(buffers, rendertype, true, stack.hasEffect());
|
||||
renderBakedItemModel(model, stack, color, light, overlay, ms, ivertexbuilder);
|
||||
} else {
|
||||
stack.getItem().getItemStackTileEntityRenderer().render(stack, ms, buffers, light, overlay);
|
||||
stack.getItem().getItemStackTileEntityRenderer().func_239207_a_(stack, ItemCameraTransforms.TransformType.NONE, ms, buffers, light, overlay);
|
||||
}
|
||||
|
||||
ms.pop();
|
||||
|
||||
@@ -150,8 +150,8 @@ public class BlockPistonRelay extends BlockMod implements IWandable {
|
||||
for (int i = 0; i < list.size(); i += 2) {
|
||||
INBT from = list.get(i);
|
||||
INBT to = list.get(i + 1);
|
||||
BlockPos fromPos = BlockPos.deserialize(new Dynamic<>(NBTDynamicOps.INSTANCE, from));
|
||||
BlockPos toPos = BlockPos.deserialize(new Dynamic<>(NBTDynamicOps.INSTANCE, to));
|
||||
BlockPos fromPos = BlockPos.field_239578_a_.decode(NBTDynamicOps.INSTANCE, from).result().get().getFirst();
|
||||
BlockPos toPos = BlockPos.field_239578_a_.decode(NBTDynamicOps.INSTANCE, to).result().get().getFirst();
|
||||
|
||||
mapping.put(fromPos, toPos);
|
||||
}
|
||||
@@ -162,8 +162,10 @@ public class BlockPistonRelay extends BlockMod implements IWandable {
|
||||
public CompoundNBT write(@Nonnull CompoundNBT cmp) {
|
||||
ListNBT list = new ListNBT();
|
||||
for (Map.Entry<BlockPos, BlockPos> e : mapping.entrySet()) {
|
||||
list.add(e.getKey().serialize(NBTDynamicOps.INSTANCE));
|
||||
list.add(e.getValue().serialize(NBTDynamicOps.INSTANCE));
|
||||
INBT from = BlockPos.field_239578_a_.encodeStart(NBTDynamicOps.INSTANCE, e.getKey()).result().get();
|
||||
INBT to = BlockPos.field_239578_a_.encodeStart(NBTDynamicOps.INSTANCE, e.getValue()).result().get();
|
||||
list.add(from);
|
||||
list.add(to);
|
||||
}
|
||||
cmp.put("list", list);
|
||||
return cmp;
|
||||
|
||||
@@ -114,7 +114,7 @@ public class BlockPool extends BlockModWaterloggable implements ITileEntityProvi
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public void renderHUD(MatrixStack ms, Minecraft mc, World world, BlockPos pos) {
|
||||
((TilePool) world.getTileEntity(pos)).renderHUD(mc);
|
||||
((TilePool) world.getTileEntity(pos)).renderHUD(ms, mc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
package vazkii.botania.common.block.tile.mana;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -391,7 +392,7 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void renderHUD(Minecraft mc) {
|
||||
public void renderHUD(MatrixStack ms, Minecraft mc) {
|
||||
ItemStack pool = new ItemStack(getBlockState().getBlock());
|
||||
String name = pool.getDisplayName().getString();
|
||||
int color = 0x4444FF;
|
||||
|
||||
@@ -104,11 +104,11 @@ public abstract class EquipmentHandler {
|
||||
|
||||
if (!ItemStack.areItemStacksEqual(old, current)) {
|
||||
if (old.getItem() instanceof ItemBauble) {
|
||||
player.getAttributes().removeAttributeModifiers(((ItemBauble) old.getItem()).getEquippedAttributeModifiers(old));
|
||||
player.func_233645_dx_().func_233785_a_(((ItemBauble) old.getItem()).getEquippedAttributeModifiers(old));
|
||||
((ItemBauble) old.getItem()).onUnequipped(old, player);
|
||||
}
|
||||
if (canEquip(current, player)) {
|
||||
player.getAttributes().applyAttributeModifiers(((ItemBauble) current.getItem()).getEquippedAttributeModifiers(current));
|
||||
player.func_233645_dx_().func_233793_b_(((ItemBauble) old.getItem()).getEquippedAttributeModifiers(old));
|
||||
((ItemBauble) current.getItem()).onEquipped(current, player);
|
||||
}
|
||||
oldStacks[i] = current.copy(); // shift-clicking mutates the stack we stored,
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
package vazkii.botania.common.core.handler;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -59,12 +60,12 @@ public class InternalMethodHandler extends DummyMethodHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawSimpleManaHUD(int color, int mana, int maxMana, String name) {
|
||||
public void drawSimpleManaHUD(MatrixStack ms, int color, int mana, int maxMana, String name) {
|
||||
HUDHandler.drawSimpleManaHUD(ms, color, mana, maxMana, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawComplexManaHUD(int color, int mana, int maxMana, String name, ItemStack bindDisplay, boolean properlyBound) {
|
||||
public void drawComplexManaHUD(MatrixStack ms, int color, int mana, int maxMana, String name, ItemStack bindDisplay, boolean properlyBound) {
|
||||
HUDHandler.drawComplexManaHUD(color, ms, mana, maxMana, name, bindDisplay, properlyBound);
|
||||
}
|
||||
|
||||
|
||||
@@ -71,10 +71,12 @@ public final class PixieHandler {
|
||||
// Want to do this as early as possible -- doing it at entity join world means attribute modifiers are ignored when loading
|
||||
public static void attachAttribute(AttachCapabilitiesEvent<Entity> evt) {
|
||||
if (evt.getObject() instanceof PlayerEntity) {
|
||||
/* todo 1.16 impossible rn?
|
||||
AbstractAttributeMap attributes = ((PlayerEntity) evt.getObject()).getAttributes();
|
||||
if (attributes.getAttributeInstance(PIXIE_SPAWN_CHANCE) == null) {
|
||||
attributes.registerAttribute(PIXIE_SPAWN_CHANCE);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.projectile.ProjectileHelper;
|
||||
import net.minecraft.entity.projectile.ThrowableEntity;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.network.IPacket;
|
||||
@@ -21,8 +22,11 @@ import net.minecraft.network.datasync.DataParameter;
|
||||
import net.minecraft.network.datasync.DataSerializers;
|
||||
import net.minecraft.network.datasync.EntityDataManager;
|
||||
import net.minecraft.particles.ParticleTypes;
|
||||
import net.minecraft.tags.ITag;
|
||||
import net.minecraft.tileentity.EndGatewayTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.*;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -134,8 +138,7 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
|
||||
}
|
||||
|
||||
private void superUpdate() {
|
||||
super.tick();
|
||||
// Botania - inline supersuperclass.tick()
|
||||
// Botania: inline Entity.tick()
|
||||
{
|
||||
if (!this.world.isRemote) {
|
||||
this.setFlag(6, this.isGlowing());
|
||||
@@ -143,95 +146,53 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
|
||||
|
||||
this.baseTick();
|
||||
}
|
||||
if (this.throwableShake > 0) {
|
||||
--this.throwableShake;
|
||||
}
|
||||
|
||||
if (this.inGround) {
|
||||
this.inGround = false;
|
||||
this.setMotion(this.getMotion().mul((double) (this.rand.nextFloat() * 0.2F), (double) (this.rand.nextFloat() * 0.2F), (double) (this.rand.nextFloat() * 0.2F)));
|
||||
}
|
||||
RayTraceResult raytraceresult = ProjectileHelper.func_234618_a_(this, this::func_230298_a_, RayTraceContext.BlockMode.OUTLINE);
|
||||
boolean flag = false;
|
||||
if (raytraceresult.getType() == RayTraceResult.Type.BLOCK) {
|
||||
BlockPos blockpos = ((BlockRayTraceResult)raytraceresult).getPos();
|
||||
BlockState blockstate = this.world.getBlockState(blockpos);
|
||||
if (blockstate.isIn(Blocks.NETHER_PORTAL)) {
|
||||
this.setPortal(blockpos);
|
||||
flag = true;
|
||||
} else if (blockstate.isIn(Blocks.END_GATEWAY)) {
|
||||
TileEntity tileentity = this.world.getTileEntity(blockpos);
|
||||
if (tileentity instanceof EndGatewayTileEntity) {
|
||||
((EndGatewayTileEntity)tileentity).teleportEntity(this);
|
||||
}
|
||||
|
||||
AxisAlignedBB axisalignedbb = this.getBoundingBox().expand(this.getMotion()).grow(1.0D);
|
||||
|
||||
/* Botania - no ignoreEntity stuff at all
|
||||
for(Entity entity : this.world.getEntitiesInAABBexcluding(this, axisalignedbb, (p_213881_0_) -> {
|
||||
return !p_213881_0_.isSpectator() && p_213881_0_.canBeCollidedWith();
|
||||
})) {
|
||||
if (entity == this.ignoreEntity) {
|
||||
++this.ignoreTime;
|
||||
break;
|
||||
}
|
||||
|
||||
if (this.owner != null && this.ticksExisted < 2 && this.ignoreEntity == null) {
|
||||
this.ignoreEntity = entity;
|
||||
this.ignoreTime = 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
RayTraceResult raytraceresult = ProjectileHelper.rayTrace(this, axisalignedbb, (p_213880_1_) -> {
|
||||
return !p_213880_1_.isSpectator() && p_213880_1_.canBeCollidedWith(); // && p_213880_1_ != this.ignoreEntity;
|
||||
}, RayTraceContext.BlockMode.OUTLINE, true);
|
||||
/*
|
||||
if (this.ignoreEntity != null && this.ignoreTime-- <= 0) {
|
||||
this.ignoreEntity = null;
|
||||
}
|
||||
*/
|
||||
|
||||
if (raytraceresult.getType() != RayTraceResult.Type.MISS) {
|
||||
if (raytraceresult.getType() == RayTraceResult.Type.BLOCK && this.world.getBlockState(((BlockRayTraceResult) raytraceresult).getPos()).getBlock() == Blocks.NETHER_PORTAL) {
|
||||
this.setPortal(((BlockRayTraceResult) raytraceresult).getPos());
|
||||
} else if (!net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) {
|
||||
this.onImpact(raytraceresult);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
Vector3d Vector3d = this.getMotion();
|
||||
double d0 = this.getPosX() + Vector3d.x;
|
||||
double d1 = this.getPosY() + Vector3d.y;
|
||||
double d2 = this.getPosZ() + Vector3d.z;
|
||||
float f = MathHelper.sqrt(horizontalMag(Vector3d));
|
||||
this.rotationYaw = (float) (MathHelper.atan2(Vector3d.x, Vector3d.z) * (double) (180F / (float) Math.PI));
|
||||
|
||||
for (this.rotationPitch = (float) (MathHelper.atan2(Vector3d.y, (double) f) * (double) (180F / (float) Math.PI)); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) {
|
||||
;
|
||||
if (raytraceresult.getType() != RayTraceResult.Type.MISS && !flag && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) {
|
||||
this.onImpact(raytraceresult);
|
||||
}
|
||||
|
||||
while (this.rotationPitch - this.prevRotationPitch >= 180.0F) {
|
||||
this.prevRotationPitch += 360.0F;
|
||||
}
|
||||
|
||||
while (this.rotationYaw - this.prevRotationYaw < -180.0F) {
|
||||
this.prevRotationYaw -= 360.0F;
|
||||
}
|
||||
|
||||
while (this.rotationYaw - this.prevRotationYaw >= 180.0F) {
|
||||
this.prevRotationYaw += 360.0F;
|
||||
}
|
||||
|
||||
this.rotationPitch = MathHelper.lerp(0.2F, this.prevRotationPitch, this.rotationPitch);
|
||||
this.rotationYaw = MathHelper.lerp(0.2F, this.prevRotationYaw, this.rotationYaw);
|
||||
float f1;
|
||||
Vector3d vector3d = this.getMotion();
|
||||
double d2 = this.getPosX() + vector3d.x;
|
||||
double d0 = this.getPosY() + vector3d.y;
|
||||
double d1 = this.getPosZ() + vector3d.z;
|
||||
this.func_234617_x_();
|
||||
float f;
|
||||
if (this.isInWater()) {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
float f2 = 0.25F;
|
||||
this.world.addParticle(ParticleTypes.BUBBLE, d0 - Vector3d.x * 0.25D, d1 - Vector3d.y * 0.25D, d2 - Vector3d.z * 0.25D, Vector3d.x, Vector3d.y, Vector3d.z);
|
||||
for(int i = 0; i < 4; ++i) {
|
||||
float f1 = 0.25F;
|
||||
this.world.addParticle(ParticleTypes.BUBBLE, d2 - vector3d.x * 0.25D, d0 - vector3d.y * 0.25D, d1 - vector3d.z * 0.25D, vector3d.x, vector3d.y, vector3d.z);
|
||||
}
|
||||
|
||||
f1 = 0.8F;
|
||||
f = 0.8F;
|
||||
} else {
|
||||
f1 = 0.99F;
|
||||
f = 0.99F;
|
||||
}
|
||||
|
||||
// Botania - no drag this.setMotion(Vector3d.scale((double)f1));
|
||||
// Botania: no drag this.setMotion(vector3d.scale((double)f));
|
||||
if (!this.hasNoGravity()) {
|
||||
Vector3d Vector3d1 = this.getMotion();
|
||||
this.setMotion(Vector3d1.x, Vector3d1.y - (double) this.getGravityVelocity(), Vector3d1.z);
|
||||
Vector3d vector3d1 = this.getMotion();
|
||||
this.setMotion(vector3d1.x, vector3d1.y - (double)this.getGravityVelocity(), vector3d1.z);
|
||||
}
|
||||
|
||||
this.setPosition(d0, d1, d2);
|
||||
this.setPosition(d2, d0, d1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -287,13 +248,12 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleWaterMovement() {
|
||||
public boolean handleFluidAcceleration(ITag<Fluid> fluid, double mag) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInLava() {
|
||||
//Avoids expensive getBlockState check in Entity#onEntityUpdate (see super impl)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,8 @@ public class ItemWorldSeed extends Item {
|
||||
}
|
||||
|
||||
BlockPos coords = ((ServerWorld) world).func_241135_u_();
|
||||
if (world.getDimension().canRespawnHere() && MathHelper.pointDistanceSpace(coords.getX() + 0.5, coords.getY() + 0.5, coords.getZ() + 0.5, player.getPosX(), player.getPosY(), player.getPosZ()) > 24) {
|
||||
// todo 1.16 only make it work in dimensions with a conceptual spawn point
|
||||
if (MathHelper.pointDistanceSpace(coords.getX() + 0.5, coords.getY() + 0.5, coords.getZ() + 0.5, player.getPosX(), player.getPosY(), player.getPosZ()) > 24) {
|
||||
player.rotationPitch = 0F;
|
||||
player.rotationYaw = 0F;
|
||||
player.setPositionAndUpdate(coords.getX() + 0.5, coords.getY() + 0.5, coords.getZ() + 0.5);
|
||||
|
||||
@@ -83,7 +83,7 @@ public class ItemLivingwoodBow extends BowItem implements IManaUsingItem {
|
||||
if (!worldIn.isRemote) {
|
||||
ArrowItem arrowitem = (ArrowItem) (itemstack.getItem() instanceof ArrowItem ? itemstack.getItem() : Items.ARROW);
|
||||
AbstractArrowEntity abstractarrowentity = arrowitem.createArrow(worldIn, itemstack, playerentity);
|
||||
abstractarrowentity = customeArrow(abstractarrowentity);
|
||||
abstractarrowentity = customArrow(abstractarrowentity);
|
||||
abstractarrowentity.func_234612_a_(playerentity, playerentity.rotationPitch, playerentity.rotationYaw, 0.0F, f * 3.0F, 1.0F);
|
||||
if (f == 1.0F) {
|
||||
abstractarrowentity.setIsCritical(true);
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
package vazkii.botania.common.item.relic;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
@@ -32,6 +33,7 @@ import vazkii.botania.common.network.PacketBotaniaEffect;
|
||||
import vazkii.botania.common.network.PacketHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Optional;
|
||||
|
||||
public class ItemFlugelEye extends ItemRelic implements ICoordBoundItem, IManaUsingItem {
|
||||
|
||||
@@ -60,7 +62,8 @@ public class ItemFlugelEye extends ItemRelic implements ICoordBoundItem, IManaUs
|
||||
} else {
|
||||
ItemStack stack = ctx.getItem();
|
||||
GlobalPos loc = GlobalPos.func_239648_a_(world.func_234923_W_(), pos);
|
||||
ItemNBTHelper.set(stack, TAG_LOCATION, loc.serialize(NBTDynamicOps.INSTANCE));
|
||||
INBT nbt = GlobalPos.field_239645_a_.encodeStart(NBTDynamicOps.INSTANCE, loc).result().get();
|
||||
ItemNBTHelper.set(stack, TAG_LOCATION, nbt);
|
||||
world.playSound(null, player.getPosX(), player.getPosY(), player.getPosZ(), SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.PLAYERS, 1F, 5F);
|
||||
}
|
||||
|
||||
@@ -93,7 +96,12 @@ public class ItemFlugelEye extends ItemRelic implements ICoordBoundItem, IManaUs
|
||||
if (nbt == null) {
|
||||
return stack;
|
||||
}
|
||||
GlobalPos loc = GlobalPos.deserialize(new Dynamic<>(NBTDynamicOps.INSTANCE, nbt));
|
||||
Optional<GlobalPos> maybeLoc = GlobalPos.field_239645_a_.decode(NBTDynamicOps.INSTANCE, nbt).result().map(Pair::getFirst);
|
||||
if (!maybeLoc.isPresent()) {
|
||||
ItemNBTHelper.removeEntry(stack, TAG_LOCATION);
|
||||
return stack;
|
||||
}
|
||||
GlobalPos loc = maybeLoc.get();
|
||||
int x = loc.getPos().getX();
|
||||
int y = loc.getPos().getY();
|
||||
int z = loc.getPos().getZ();
|
||||
@@ -130,7 +138,9 @@ public class ItemFlugelEye extends ItemRelic implements ICoordBoundItem, IManaUs
|
||||
public BlockPos getBinding(ItemStack stack) {
|
||||
INBT nbt = ItemNBTHelper.get(stack, TAG_LOCATION);
|
||||
if (nbt != null) {
|
||||
return GlobalPos.deserialize(new Dynamic<>(NBTDynamicOps.INSTANCE, nbt)).getPos();
|
||||
return GlobalPos.field_239645_a_.decode(NBTDynamicOps.INSTANCE, nbt).result()
|
||||
.map(Pair::getFirst)
|
||||
.map(GlobalPos::getPos).orElse(null);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user