mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
fixed item laser display not working if player is too far away from input point
Closes #765
This commit is contained in:
parent
284cbd897e
commit
51a76ba85a
2 changed files with 12 additions and 6 deletions
|
@ -79,10 +79,8 @@ public final class PacketHandler{
|
|||
double outY = compound.getDouble("OutY")+0.525;
|
||||
double outZ = compound.getDouble("OutZ")+0.5;
|
||||
|
||||
if(mc.player.getDistance(outX, outY, outZ) <= 16){
|
||||
Particle fx = new ParticleLaserItem(mc.world, outX, outY, outZ, stack, 0.025, inX, inY, inZ);
|
||||
mc.effectRenderer.addEffect(fx);
|
||||
}
|
||||
Particle fx = new ParticleLaserItem(mc.world, outX, outY, outZ, stack, 0.025, inX, inY, inZ);
|
||||
mc.effectRenderer.addEffect(fx);
|
||||
}
|
||||
};
|
||||
public static final IDataHandler GUI_BUTTON_TO_TILE_HANDLER = new IDataHandler(){
|
||||
|
|
|
@ -18,13 +18,14 @@ import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
|||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.compat.CommonCapsUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import org.cyclops.commoncapabilities.api.capability.itemhandler.ISlotlessItemHandler;
|
||||
import org.cyclops.commoncapabilities.capability.itemhandler.SlotlessItemHandlerConfig;
|
||||
|
@ -163,7 +164,14 @@ public class TileEntityItemViewer extends TileEntityBase{
|
|||
compound.setDouble("OutY", output.getY());
|
||||
compound.setDouble("OutZ", output.getZ());
|
||||
|
||||
PacketHandler.theNetwork.sendToAllAround(new PacketServerToClient(compound, PacketHandler.LASER_PARTICLE_HANDLER), new TargetPoint(this.world.provider.getDimension(), this.pos.getX(), this.pos.getY(), this.pos.getZ(), 16));
|
||||
int rangeSq = 16*16;
|
||||
for(EntityPlayer player : this.world.playerEntities){
|
||||
if(player instanceof EntityPlayerMP){
|
||||
if(player.getDistanceSq(input) <= rangeSq || player.getDistanceSq(output) <= rangeSq){
|
||||
PacketHandler.theNetwork.sendTo(new PacketServerToClient(compound, PacketHandler.LASER_PARTICLE_HANDLER), (EntityPlayerMP)player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue