mirror of
https://github.com/GTNewHorizons/Gadomancy.git
synced 2026-11-22 21:09:59 +00:00
- AuraPylon added effects
This commit is contained in:
1 parent
6c5032f5d6
commit
5d366d08a4
11 files changed
+151
-52
No files matched your search
@@ -6,7 +6,7 @@ import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import makeo.gadomancy.client.effect.EffectHandler;
|
||||
import makeo.gadomancy.client.events.ClientTickHandler;
|
||||
import makeo.gadomancy.client.events.ClientHandler;
|
||||
import makeo.gadomancy.client.events.RenderEventHandler;
|
||||
import makeo.gadomancy.client.events.ResourceReloadListener;
|
||||
import makeo.gadomancy.client.gui.ArcanePackagerGui;
|
||||
@@ -159,7 +159,7 @@ public class ClientProxy extends CommonProxy {
|
||||
MinecraftForge.EVENT_BUS.register(EffectHandler.getInstance());
|
||||
MinecraftForge.EVENT_BUS.register(new RenderEventHandler());
|
||||
|
||||
FMLCommonHandler.instance().bus().register(new ClientTickHandler());
|
||||
FMLCommonHandler.instance().bus().register(new ClientHandler());
|
||||
|
||||
super.postInitalize();
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ public class EffectHandler {
|
||||
orbitalsRWLock.lock();
|
||||
try {
|
||||
orbitals.add(orbital);
|
||||
orbital.registered = true;
|
||||
} finally {
|
||||
orbitalsRWLock.unlock();
|
||||
}
|
||||
@@ -70,6 +71,7 @@ public class EffectHandler {
|
||||
orbitalsRWLock.lock();
|
||||
try {
|
||||
orbitals.remove(orbital);
|
||||
orbital.registered = false;
|
||||
} finally {
|
||||
orbitalsRWLock.unlock();
|
||||
}
|
||||
@@ -81,6 +83,20 @@ public class EffectHandler {
|
||||
Orbital.tickOrbitals(orbitals);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
orbitalsRWLock.lock();
|
||||
try {
|
||||
orbitals.clear();
|
||||
} finally {
|
||||
orbitalsRWLock.unlock();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
public static class NonReentrantReentrantLock extends ReentrantLock {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,10 +17,12 @@ import java.awt.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* HellFirePvP@Admin
|
||||
* Date: 01.07.2015 / 09:22
|
||||
* on SoulSorcery
|
||||
* EntityFXFlow
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
* <p/>
|
||||
* Created by HellFirePvP @ 17.11.2015 18:45
|
||||
*/
|
||||
public class EntityFXFlow extends EntityThrowable {
|
||||
|
||||
@@ -312,23 +314,23 @@ public class EntityFXFlow extends EntityThrowable {
|
||||
|
||||
private static Queue<FXFlowBase> fxQueue = new ArrayDeque<FXFlowBase>();
|
||||
|
||||
private int partBlue, partGreen, partRed, partAlpha;
|
||||
private float partBlue, partGreen, partRed, partAlpha;
|
||||
|
||||
//Queue variables
|
||||
private float partialTicks;
|
||||
private float rendArg1, rendArg2, rendArg3, rendArg4, rendArg5;
|
||||
private int rendBrightness;
|
||||
|
||||
private ResourceLocation texture = new SimpleResourceLocation("effect/flow_large.png");
|
||||
private float buffQuadLife, buffParticleScale;
|
||||
private ResourceLocation texture = new SimpleResourceLocation("fx/flow_large.png");
|
||||
private float buffHalfLife, buffParticleScale;
|
||||
|
||||
public FXFlowBase(World world, double x, double y, double z, Color color, float size, int multiplier, int brightness) {
|
||||
super(world, x, y, z);
|
||||
if(color != null) {
|
||||
this.partBlue = color.getBlue();
|
||||
this.partGreen = color.getGreen();
|
||||
this.partRed = color.getRed();
|
||||
this.partAlpha = color.getAlpha();
|
||||
this.partBlue = color.getBlue() / 255F;
|
||||
this.partGreen = color.getGreen() / 255F;
|
||||
this.partRed = color.getRed() / 255F;
|
||||
this.partAlpha = color.getAlpha() / 255F;
|
||||
}
|
||||
this.motionX = this.motionY = this.motionZ = 0;
|
||||
this.particleScale *= size;
|
||||
@@ -341,7 +343,7 @@ public class EntityFXFlow extends EntityThrowable {
|
||||
this.prevPosZ = this.posZ;
|
||||
this.particleTextureIndexX = 0;
|
||||
this.particleTextureIndexY = 0;
|
||||
this.buffQuadLife = (this.particleMaxAge / 2);
|
||||
this.buffHalfLife = (this.particleMaxAge / 2);
|
||||
this.buffParticleScale = this.particleScale;
|
||||
this.rendBrightness = brightness;
|
||||
this.noClip = true;
|
||||
@@ -378,11 +380,11 @@ public class EntityFXFlow extends EntityThrowable {
|
||||
|
||||
private void renderEssenceBase(Tessellator tessellator) {
|
||||
tessellator.setBrightness(rendBrightness);
|
||||
GL11.glColor4f(partRed, partGreen, partBlue, partAlpha);
|
||||
GL11.glColor4f(partRed , partGreen, partBlue, partAlpha);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
if(particleAge >= particleMaxAge) return;
|
||||
float agescale = (float) particleAge / buffQuadLife;
|
||||
if(agescale >= 1.0F) agescale = 4 - agescale;
|
||||
float agescale = (float) particleAge / buffHalfLife;
|
||||
if(agescale >= 1.0F) agescale = 2 - agescale;
|
||||
particleScale = buffParticleScale * agescale;
|
||||
float f10 = 0.5F * particleScale;
|
||||
float f11 = (float)(prevPosX + (posX - prevPosX) * partialTicks - interpPosX);
|
||||
|
||||
@@ -7,10 +7,12 @@ import java.awt.*;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* HellFirePvP@Admin
|
||||
* Date: 01.07.2015 / 18:27
|
||||
* on SoulSorcery
|
||||
* EntityFXFlowPolicy
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
* <p/>
|
||||
* Created by HellFirePvP @ 17.11.2015 18:42
|
||||
*/
|
||||
public abstract class EntityFXFlowPolicy {
|
||||
|
||||
|
||||
@@ -12,16 +12,19 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* HellFirePvP@Admin
|
||||
* Date: 01.07.2015 / 19:28
|
||||
* on SoulSorcery
|
||||
* Orbital
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
* <p/>
|
||||
* Created by HellFirePvP @ 17.11.2015 18:41
|
||||
*/
|
||||
public final class Orbital {
|
||||
|
||||
private Vector3 center;
|
||||
private final World world;
|
||||
private int orbitalCounter = 0;
|
||||
public boolean registered = false;
|
||||
|
||||
private List<OrbitalRenderProperties> orbitals = new ArrayList<OrbitalRenderProperties>();
|
||||
|
||||
@@ -40,6 +43,14 @@ public final class Orbital {
|
||||
}
|
||||
}
|
||||
|
||||
public int orbitalsSize() {
|
||||
return orbitals.size();
|
||||
}
|
||||
|
||||
public void clearOrbitals() {
|
||||
orbitals.clear();
|
||||
}
|
||||
|
||||
public void doRender(float partialTicks) {
|
||||
if(MiscUtils.getPositionVector(Minecraft.getMinecraft().renderViewEntity).distance(center) > ModConfig.renderParticleDistance) return;
|
||||
|
||||
|
||||
+8
-2
@@ -2,6 +2,7 @@ package makeo.gadomancy.client.events;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.network.FMLNetworkEvent;
|
||||
import makeo.gadomancy.client.effect.EffectHandler;
|
||||
import makeo.gadomancy.client.util.FamiliarHandlerClient;
|
||||
|
||||
@@ -10,10 +11,10 @@ import makeo.gadomancy.client.util.FamiliarHandlerClient;
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
* <p/>
|
||||
*
|
||||
* Created by HellFirePvP @ 01.11.2015 10:41
|
||||
*/
|
||||
public class ClientTickHandler {
|
||||
public class ClientHandler {
|
||||
|
||||
public static int ticks;
|
||||
|
||||
@@ -27,4 +28,9 @@ public class ClientTickHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDc(FMLNetworkEvent.ClientDisconnectionFromServerEvent event) {
|
||||
EffectHandler.getInstance().clear();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package makeo.gadomancy.client.fx;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
* <p/>
|
||||
* Created by HellFirePvP @ 17.11.2015 18:23
|
||||
*/
|
||||
public class EntityFxFlowPolicy {
|
||||
}
|
||||
@@ -1,11 +1,14 @@
|
||||
package makeo.gadomancy.client.renderers.tile;
|
||||
|
||||
import makeo.gadomancy.client.effect.EffectHandler;
|
||||
import makeo.gadomancy.client.effect.fx.Orbital;
|
||||
import makeo.gadomancy.client.models.ModelAuraPylon;
|
||||
import makeo.gadomancy.client.models.ModelAuraPylonBottom;
|
||||
import makeo.gadomancy.client.models.ModelAuraPylonTop;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileAuraPylon;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileAuraPylonTop;
|
||||
import makeo.gadomancy.common.utils.SimpleResourceLocation;
|
||||
import makeo.gadomancy.common.utils.Vector3;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -17,6 +20,7 @@ import thaumcraft.client.fx.particles.FXEssentiaTrail;
|
||||
import thaumcraft.client.fx.particles.FXWisp;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
@@ -64,27 +68,58 @@ public class RenderTileAuraPylon extends TileEntitySpecialRenderer {
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
|
||||
if(tile instanceof TileAuraPylonTop && ((TileAuraPylonTop) tile).shouldRenderEffect()) {
|
||||
Aspect a = ((TileAuraPylonTop) tile).getAspect();
|
||||
if(a == null) a = Aspect.WEATHER;
|
||||
Color c = new Color(a.getColor());
|
||||
if(tile.getWorldObj().rand.nextInt(12) == 0) {
|
||||
if(a == Aspect.ENTROPY || a == Aspect.DARKNESS || a == Aspect.UNDEAD) {
|
||||
spawnWispParticles((TileAuraPylonTop) tile, 5, 0.5F, false);
|
||||
} else {
|
||||
spawnWispParticles((TileAuraPylonTop) tile, c, 0.5F, false);
|
||||
if(tile instanceof TileAuraPylonTop) {
|
||||
if(((TileAuraPylonTop) tile).orbital == null && tile.getWorldObj() != null) {
|
||||
((TileAuraPylonTop) tile).orbital = new Orbital(new Vector3(tile.xCoord + 0.5, tile.yCoord + 0.7, tile.zCoord + 0.5), tile.getWorldObj());
|
||||
EffectHandler.getInstance().registerOrbital(((TileAuraPylonTop) tile).orbital);
|
||||
}
|
||||
|
||||
if(((TileAuraPylonTop) tile).shouldRenderEffect()) {
|
||||
Aspect a = ((TileAuraPylonTop) tile).getAspect();
|
||||
if(a == null) a = Aspect.WEATHER;
|
||||
Color c = new Color(a.getColor());
|
||||
if(tile.getWorldObj().rand.nextInt(12) == 0) {
|
||||
if(a == Aspect.ENTROPY || a == Aspect.DARKNESS || a == Aspect.UNDEAD) {
|
||||
spawnWispParticles((TileAuraPylonTop) tile, 5, 0.5F, false);
|
||||
} else {
|
||||
spawnWispParticles((TileAuraPylonTop) tile, c, 0.5F, false);
|
||||
}
|
||||
}
|
||||
c = c.darker().darker();
|
||||
if(tile.getWorldObj().rand.nextInt(20) == 0) {
|
||||
if(a == Aspect.ENTROPY || a == Aspect.DARKNESS || a == Aspect.UNDEAD) {
|
||||
spawnWispParticles((TileAuraPylonTop) tile, 5, 0.25F, false);
|
||||
} else {
|
||||
spawnWispParticles((TileAuraPylonTop) tile, c, 0.25F, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
c = c.darker().darker();
|
||||
if(tile.getWorldObj().rand.nextInt(20) == 0) {
|
||||
if(a == Aspect.ENTROPY || a == Aspect.DARKNESS || a == Aspect.UNDEAD) {
|
||||
spawnWispParticles((TileAuraPylonTop) tile, 5, 0.25F, false);
|
||||
} else {
|
||||
spawnWispParticles((TileAuraPylonTop) tile, c, 0.25F, false);
|
||||
|
||||
if(((TileAuraPylonTop) tile).shouldRenderEffect() && ((TileAuraPylonTop) tile).getAspect() != null) {
|
||||
if(((TileAuraPylonTop) tile).orbital != null && ((TileAuraPylonTop) tile).orbital.orbitalsSize() == 0) {
|
||||
Aspect a = ((TileAuraPylonTop) tile).getAspect();
|
||||
if(a != null) {
|
||||
int col = a.getColor();
|
||||
col |= (0x44 << 24);
|
||||
Color c = new Color(col, true);
|
||||
Random rand = tile.getWorldObj().rand;
|
||||
addNewOrbitalPoint(((TileAuraPylonTop) tile).orbital, rand, c);
|
||||
addNewOrbitalPoint(((TileAuraPylonTop) tile).orbital, rand, c);
|
||||
addNewOrbitalPoint(((TileAuraPylonTop) tile).orbital, rand, c);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(((TileAuraPylonTop) tile).orbital != null && ((TileAuraPylonTop) tile).orbital.orbitalsSize() > 0) {
|
||||
((TileAuraPylonTop) tile).orbital.clearOrbitals();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addNewOrbitalPoint(Orbital orbital, Random rand, Color color) {
|
||||
Orbital.OrbitalRenderProperties properties = new Orbital.OrbitalRenderProperties(Orbital.Axis.persisentRandomAxis(), (rand.nextDouble() * 2) + 1);
|
||||
properties.setColor(color).setTicksForFullCircle(80).setOffsetTicks(rand.nextInt(80));
|
||||
orbital.addOrbitalPoint(properties);
|
||||
}
|
||||
|
||||
private void spawnWispParticles(TileAuraPylonTop tile, int type, float size, boolean inner) {
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package makeo.gadomancy.common.blocks.tiles;
|
||||
|
||||
import makeo.gadomancy.client.effect.EffectHandler;
|
||||
import makeo.gadomancy.client.effect.fx.Orbital;
|
||||
import makeo.gadomancy.common.utils.ItemUtils;
|
||||
import makeo.gadomancy.common.utils.Vector3;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -23,6 +26,7 @@ import java.util.ArrayList;
|
||||
*/
|
||||
public class TileAuraPylonTop extends SynchronizedTileEntity implements IAspectContainer {
|
||||
|
||||
public Orbital orbital;
|
||||
private boolean shouldRender = false;
|
||||
|
||||
@Override
|
||||
@@ -55,7 +59,6 @@ public class TileAuraPylonTop extends SynchronizedTileEntity implements IAspectC
|
||||
ArrayList<ItemStack> stacks = pylon.getDrops(worldObj, xCoord, yCoord, zCoord, meta, 0);
|
||||
for(ItemStack i : stacks) {
|
||||
EntityItem item = new EntityItem(worldObj, xCoord, yCoord, zCoord, i);
|
||||
ItemUtils.applyRandomDropOffset(item, worldObj.rand);
|
||||
worldObj.spawnEntityInWorld(item);
|
||||
}
|
||||
}
|
||||
@@ -68,6 +71,14 @@ public class TileAuraPylonTop extends SynchronizedTileEntity implements IAspectC
|
||||
return shouldRender;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
if(orbital != null && orbital.registered) {
|
||||
EffectHandler.getInstance().unregisterOrbital(orbital);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
return true;
|
||||
|
||||
@@ -11,10 +11,12 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* HellFirePvP@Admin
|
||||
* Date: 17.06.2015 / 13:59
|
||||
* on SoulSorcery
|
||||
* MiscUtils
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
* <p/>
|
||||
* Created by HellFirePvP @ 17.11.2015 18:39
|
||||
*/
|
||||
public final class MiscUtils {
|
||||
|
||||
@@ -30,7 +32,7 @@ public final class MiscUtils {
|
||||
return "th";
|
||||
}
|
||||
|
||||
public static EntityPlayer getOnlinePlayerByUUID(UUID playerUUID) {
|
||||
public static EntityPlayer getOnlinePlayerByUUIDClient(UUID playerUUID) {
|
||||
List<EntityPlayerMP> players = Minecraft.getMinecraft().getIntegratedServer().getConfigurationManager().playerEntityList;
|
||||
for(EntityPlayerMP player : players) {
|
||||
if(player.getGameProfile().getId().equals(playerUUID)) {
|
||||
|
||||
@@ -5,10 +5,12 @@ import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* HellFirePvP@Admin
|
||||
* Date: 25.06.2015 / 19:15
|
||||
* on SoulSorcery
|
||||
* Vector3
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
* <p/>
|
||||
* Created by HellFirePvP @ 17.11.2015 18:40
|
||||
*/
|
||||
public class Vector3 {
|
||||
|
||||
|
||||
Reference in new issue
Block a user