mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +01:00
Made Laser Particles render up to a range of 64 instead of the default 16
This commit is contained in:
parent
fa424644c7
commit
b8ba00ed83
1 changed files with 11 additions and 7 deletions
|
@ -14,6 +14,8 @@ import cofh.api.energy.IEnergyReceiver;
|
||||||
import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
|
import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
|
||||||
import ellpeck.actuallyadditions.misc.LaserRelayConnectionHandler;
|
import ellpeck.actuallyadditions.misc.LaserRelayConnectionHandler;
|
||||||
import ellpeck.actuallyadditions.util.WorldPos;
|
import ellpeck.actuallyadditions.util.WorldPos;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.particle.EntityReddustFX;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.network.NetworkManager;
|
import net.minecraft.network.NetworkManager;
|
||||||
import net.minecraft.network.Packet;
|
import net.minecraft.network.Packet;
|
||||||
|
@ -35,19 +37,21 @@ public class TileEntityLaserRelay extends TileEntityBase implements IEnergyRecei
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
if(this.worldObj.isRemote){
|
if(this.worldObj.isRemote){
|
||||||
if(this.worldObj.rand.nextInt(ConfigBoolValues.LESS_LASER_RELAY_PARTICLES.isEnabled() ? 8 : 4) == 0){
|
if(this.worldObj.rand.nextInt(2) == 0){
|
||||||
WorldPos thisPos = new WorldPos(this.getWorldObj(), this.xCoord, this.yCoord, this.zCoord);
|
WorldPos thisPos = new WorldPos(this.getWorldObj(), this.xCoord, this.yCoord, this.zCoord);
|
||||||
ArrayList<LaserRelayConnectionHandler.ConnectionPair> network = LaserRelayConnectionHandler.getInstance().getNetworkFor(thisPos);
|
ArrayList<LaserRelayConnectionHandler.ConnectionPair> network = LaserRelayConnectionHandler.getInstance().getNetworkFor(thisPos);
|
||||||
if(network != null){
|
if(network != null){
|
||||||
for(LaserRelayConnectionHandler.ConnectionPair aPair : network){
|
for(LaserRelayConnectionHandler.ConnectionPair aPair : network){
|
||||||
if(aPair.contains(thisPos) && thisPos.isEqual(aPair.firstRelay)){
|
if(aPair.contains(thisPos) && thisPos.isEqual(aPair.firstRelay)){
|
||||||
int difX = aPair.firstRelay.getX()-aPair.secondRelay.getX();
|
if(Minecraft.getMinecraft().thePlayer.getDistance(aPair.firstRelay.getX(), aPair.firstRelay.getY(), aPair.firstRelay.getZ()) <= 64){
|
||||||
int difY = aPair.firstRelay.getY()-aPair.secondRelay.getY();
|
int difX = aPair.firstRelay.getX()-aPair.secondRelay.getX();
|
||||||
int difZ = aPair.firstRelay.getZ()-aPair.secondRelay.getZ();
|
int difY = aPair.firstRelay.getY()-aPair.secondRelay.getY();
|
||||||
|
int difZ = aPair.firstRelay.getZ()-aPair.secondRelay.getZ();
|
||||||
|
|
||||||
double distance = aPair.firstRelay.toVec().distanceTo(aPair.secondRelay.toVec());
|
double distance = aPair.firstRelay.toVec().distanceTo(aPair.secondRelay.toVec());
|
||||||
for(double i = 0; i <= 1; i += 1/(distance*(ConfigBoolValues.LESS_LASER_RELAY_PARTICLES.isEnabled() ? 2 : 4))){
|
for(double i = 0; i <= 1; i += 1/(distance*(ConfigBoolValues.LESS_LASER_RELAY_PARTICLES.isEnabled() ? 1 : 4))){
|
||||||
this.worldObj.spawnParticle("reddust", (difX*i)+aPair.secondRelay.getX()+0.5, (difY*i)+aPair.secondRelay.getY()+0.5, (difZ*i)+aPair.secondRelay.getZ()+0.5, 0, 0, 0);
|
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityReddustFX(this.worldObj, (difX*i)+aPair.secondRelay.getX()+0.5, (difY*i)+aPair.secondRelay.getY()+0.5, (difZ*i)+aPair.secondRelay.getZ()+0.5, 0, 0, 0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue