mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-23 03:49:22 +01:00
Added a config option to only display the laser relay particles when holding a laser wrench.
Closes #113
This commit is contained in:
parent
ddaadd25d5
commit
75d43d88b4
2 changed files with 16 additions and 6 deletions
|
@ -52,6 +52,7 @@ public enum ConfigBoolValues{
|
|||
BOOKLET_TEXT_TO_FILE("Booklet Text to File", ConfigCategories.OTHER, false, "Should the entire text of the booklet be put into a new file in the Minecraft Folder on startup or resource reload. This is for debug purposes only and shouldn't really ever be needed."),
|
||||
|
||||
WATER_BOWL("Water Bowl", ConfigCategories.OTHER, true, "If right-clicking a bowl on water should create a water bowl"),
|
||||
LASER_WRENCH_HOLDING_PARTICLES("Laser Wrench Holding Particles", ConfigCategories.OTHER, false, "If particles of laser devices should only render when holding a Laser Wrench"),
|
||||
|
||||
LESS_SOUND("Less Sound", ConfigCategories.PERFORMANCE, false, "If blocks in Actually Additions should have less sounds"),
|
||||
LESS_PARTICLES("Less Particles", ConfigCategories.PERFORMANCE, false, "If blocks in Actually Additions should have less particles"),
|
||||
|
|
|
@ -11,12 +11,16 @@
|
|||
package de.ellpeck.actuallyadditions.mod.tile;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||
import de.ellpeck.actuallyadditions.mod.items.ItemLaserWrench;
|
||||
import de.ellpeck.actuallyadditions.mod.misc.LaserRelayConnectionHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.misc.LaserRelayConnectionHandler.ConnectionPair;
|
||||
import de.ellpeck.actuallyadditions.mod.network.PacketParticle;
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||
import io.netty.util.internal.ConcurrentSet;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -83,12 +87,17 @@ public abstract class TileEntityLaserRelay extends TileEntityBase{
|
|||
@SideOnly(Side.CLIENT)
|
||||
public void renderParticles(){
|
||||
if(Util.RANDOM.nextInt(ConfigBoolValues.LESS_PARTICLES.isEnabled() ? 16 : 8) == 0){
|
||||
BlockPos thisPos = this.pos;
|
||||
LaserRelayConnectionHandler.Network network = LaserRelayConnectionHandler.getNetworkFor(thisPos, this.worldObj);
|
||||
if(network != null){
|
||||
for(ConnectionPair aPair : network.connections){
|
||||
if(aPair.contains(thisPos) && PosUtil.areSamePos(thisPos, aPair.positions[0])){
|
||||
PacketParticle.renderParticlesFromAToB(aPair.positions[0].getX(), aPair.positions[0].getY(), aPair.positions[0].getZ(), aPair.positions[1].getX(), aPair.positions[1].getY(), aPair.positions[1].getZ(), ConfigBoolValues.LESS_PARTICLES.isEnabled() ? 1 : Util.RANDOM.nextInt(3)+1, 0.8F, this.isItem ? COLOR_ITEM : COLOR, 1F);
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
if(player != null){
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
if(!ConfigBoolValues.LASER_WRENCH_HOLDING_PARTICLES.isEnabled() || (stack != null && stack.getItem() instanceof ItemLaserWrench)){
|
||||
LaserRelayConnectionHandler.Network network = LaserRelayConnectionHandler.getNetworkFor(this.pos, this.worldObj);
|
||||
if(network != null){
|
||||
for(ConnectionPair aPair : network.connections){
|
||||
if(aPair.contains(this.pos) && PosUtil.areSamePos(this.pos, aPair.positions[0])){
|
||||
PacketParticle.renderParticlesFromAToB(aPair.positions[0].getX(), aPair.positions[0].getY(), aPair.positions[0].getZ(), aPair.positions[1].getX(), aPair.positions[1].getY(), aPair.positions[1].getZ(), ConfigBoolValues.LESS_PARTICLES.isEnabled() ? 1 : Util.RANDOM.nextInt(3)+1, 0.8F, this.isItem ? COLOR_ITEM : COLOR, 1F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue