mirror of
https://github.com/GTNewHorizons/Gadomancy.git
synced 2026-11-21 12:32:09 +00:00
- EssentiaCompressor: <init> (uncapped for now)
This commit is contained in:
1 parent
97476abb2b
commit
68773b0681
31 files changed
+1754
-69
No files matched your search
@@ -30,12 +30,14 @@ import makeo.gadomancy.client.util.MultiTickEffectDispatcher;
|
||||
import makeo.gadomancy.common.CommonProxy;
|
||||
import makeo.gadomancy.common.blocks.tiles.*;
|
||||
import makeo.gadomancy.common.entities.EntityAuraCore;
|
||||
import makeo.gadomancy.common.entities.EntityItemElement;
|
||||
import makeo.gadomancy.common.entities.EntityPermNoClipItem;
|
||||
import makeo.gadomancy.common.registration.RegisteredBlocks;
|
||||
import makeo.gadomancy.common.registration.RegisteredItems;
|
||||
import makeo.gadomancy.common.utils.Injector;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.client.resources.SimpleReloadableResourceManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -56,8 +58,11 @@ import thaumcraft.common.tiles.TileEldritchAltar;
|
||||
import thaumcraft.common.tiles.TileEldritchCap;
|
||||
import thaumcraft.common.tiles.TileEldritchObelisk;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
@@ -108,6 +113,8 @@ public class ClientProxy extends CommonProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEldritchObelisk.class, new RenderTileObelisk());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEldritchAltar.class, new RenderTileCapEldritch("textures/models/obelisk_cap_altar.png"));
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEldritchCap.class, new RenderTileCapEldritch("textures/models/obelisk_cap.png"));
|
||||
RenderTileEssentiaCompressor renderTileEssentiaCompressor = new RenderTileEssentiaCompressor();
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEssentiaCompressor.class, renderTileEssentiaCompressor);
|
||||
|
||||
RenderTileAuraPylon renderTileAuraPylon = new RenderTileAuraPylon();
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileAuraPylon.class, renderTileAuraPylon);
|
||||
@@ -129,6 +136,8 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockInfusionClaw), new ItemRenderTileEntity<TileInfusionClaw>(renderTileInfusionClaw, new TileInfusionClaw()));
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockEssentiaCompressor), new ItemRenderTileEntity<TileEssentiaCompressor>(renderTileEssentiaCompressor, new TileEssentiaCompressor()));
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ConfigBlocks.blockAiry), new ItemExNodeRenderer());
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockKnowledgeBook), new ItemRenderTEKnowledgeBook(bookRender));
|
||||
@@ -240,7 +249,7 @@ public class ClientProxy extends CommonProxy {
|
||||
return null;
|
||||
}
|
||||
|
||||
public final List<Runnable> clientActions = new ArrayList<Runnable>();
|
||||
public final Queue<Runnable> clientActions = new ArrayDeque<Runnable>();
|
||||
|
||||
@Override
|
||||
public void runDelayedClientSide(Runnable run) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package makeo.gadomancy.client.effect;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import makeo.gadomancy.client.effect.fx.FXFlow;
|
||||
import makeo.gadomancy.client.effect.fx.FXVortex;
|
||||
import makeo.gadomancy.client.effect.fx.Orbital;
|
||||
import makeo.gadomancy.common.utils.Vector3;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
@@ -9,6 +10,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
@@ -25,11 +27,12 @@ public class EffectHandler {
|
||||
|
||||
public static final EffectHandler instance = new EffectHandler();
|
||||
|
||||
public static List<Orbital> orbitals = new ArrayList<Orbital>();
|
||||
public static List<FXFlow> fxFlows = new ArrayList<FXFlow>();
|
||||
public static List<Orbital> orbitals = new LinkedList<Orbital>();
|
||||
public static List<FXFlow> fxFlows = new LinkedList<FXFlow>();
|
||||
public static List<FXVortex> fxVortexes = new LinkedList<FXVortex>();
|
||||
|
||||
public static Lock orbitalsRWLock = new NonReentrantReentrantLock();
|
||||
public static Lock flowRWLock = new NonReentrantReentrantLock();
|
||||
//Object that the EffectHandler locks on.
|
||||
public static final Object lockEffects = new Object();
|
||||
|
||||
public static EffectHandler getInstance() {
|
||||
return instance;
|
||||
@@ -41,6 +44,7 @@ public class EffectHandler {
|
||||
|
||||
FXFlow.FXFlowBase.sheduleRender(tessellator);
|
||||
Orbital.sheduleRenders(orbitals, event.partialTicks);
|
||||
FXVortex.sheduleRender(fxVortexes, tessellator, event.partialTicks);
|
||||
}
|
||||
|
||||
public FXFlow effectFlow(World world, Vector3 origin, FXFlow.EntityFlowProperties properties) {
|
||||
@@ -50,15 +54,38 @@ public class EffectHandler {
|
||||
return flow;
|
||||
}
|
||||
|
||||
public void registerVortex(final FXVortex vortex) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
//System.out.println("register");
|
||||
synchronized (lockEffects) {
|
||||
fxVortexes.add(vortex);
|
||||
vortex.registered = true;
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
public void unregisterVortex(final FXVortex vortex) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
//System.out.println("unregister");
|
||||
synchronized (lockEffects) {
|
||||
fxVortexes.remove(vortex);
|
||||
vortex.registered = false;
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
public void registerFlow(final FXFlow flow) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
flowRWLock.lock();
|
||||
try {
|
||||
synchronized (lockEffects) {
|
||||
fxFlows.add(flow);
|
||||
} finally {
|
||||
flowRWLock.unlock();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
@@ -68,11 +95,8 @@ public class EffectHandler {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
flowRWLock.lock();
|
||||
try {
|
||||
synchronized (lockEffects) {
|
||||
fxFlows.remove(flow);
|
||||
} finally {
|
||||
flowRWLock.unlock();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
@@ -82,12 +106,9 @@ public class EffectHandler {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
orbitalsRWLock.lock();
|
||||
try {
|
||||
synchronized (lockEffects) {
|
||||
orbitals.add(orbital);
|
||||
orbital.registered = true;
|
||||
} finally {
|
||||
orbitalsRWLock.unlock();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
@@ -97,12 +118,9 @@ public class EffectHandler {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
orbitalsRWLock.lock();
|
||||
try {
|
||||
synchronized (lockEffects) {
|
||||
orbitals.remove(orbital);
|
||||
orbital.registered = false;
|
||||
} finally {
|
||||
orbitalsRWLock.unlock();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
@@ -111,17 +129,17 @@ public class EffectHandler {
|
||||
public void tick() {
|
||||
Orbital.tickOrbitals(orbitals);
|
||||
FXFlow.tickFlows(fxFlows);
|
||||
FXVortex.tickVortexes(fxVortexes);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
orbitalsRWLock.lock();
|
||||
try {
|
||||
synchronized (lockEffects) {
|
||||
orbitals.clear();
|
||||
} finally {
|
||||
orbitalsRWLock.unlock();
|
||||
fxFlows.clear();
|
||||
fxVortexes.clear();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
|
||||
@@ -259,16 +259,13 @@ public class FXFlow {
|
||||
}
|
||||
|
||||
public static void tickFlows(List<FXFlow> fxFlows) {
|
||||
EffectHandler.flowRWLock.lock();
|
||||
try {
|
||||
synchronized (EffectHandler.lockEffects) {
|
||||
for(FXFlow flow : fxFlows) {
|
||||
if((System.currentTimeMillis() - flow.lastUpdateCall) > 1000L) {
|
||||
EffectHandler.getInstance().unregisterFlow(flow);
|
||||
}
|
||||
flow.tick();
|
||||
}
|
||||
} finally {
|
||||
EffectHandler.flowRWLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
package makeo.gadomancy.client.effect.fx;
|
||||
|
||||
import makeo.gadomancy.client.effect.EffectHandler;
|
||||
import makeo.gadomancy.client.events.ClientHandler;
|
||||
import makeo.gadomancy.common.utils.MiscUtils;
|
||||
import makeo.gadomancy.common.utils.Vector3;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Vec3;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.client.lib.QuadHelper;
|
||||
import thaumcraft.client.lib.UtilsFX;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* HellFirePvP@Admin
|
||||
* Date: 24.04.2016 / 00:45
|
||||
* on Gadomancy
|
||||
* FXVortex
|
||||
*/
|
||||
public class FXVortex {
|
||||
|
||||
public static final ResourceLocation TC_VORTEX_TEXTURE = new ResourceLocation("thaumcraft", "textures/misc/vortex.png");
|
||||
private static final float RAD = (float) (Math.PI * 2);
|
||||
|
||||
private long lastUpdateCall;
|
||||
private double x, y, z;
|
||||
public boolean registered = false;
|
||||
|
||||
public FXVortex(double x, double y, double z) {
|
||||
this.lastUpdateCall = System.currentTimeMillis();
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
private void render(Tessellator tessellator, float pTicks) {
|
||||
float arX = ActiveRenderInfo.rotationX;
|
||||
float arXZ = ActiveRenderInfo.rotationXZ;
|
||||
float arZ = ActiveRenderInfo.rotationZ;
|
||||
float arYZ = ActiveRenderInfo.rotationYZ;
|
||||
float arXY = ActiveRenderInfo.rotationXY;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
//GL11.glDepthMask(true);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
float agescale = (float) (ClientHandler.ticks % 800) / 400F;
|
||||
if(agescale >= 1.0F) agescale = 2 - agescale;
|
||||
float size = 0.2F + 0.1F * agescale;
|
||||
|
||||
float anglePerc = (float) (ClientHandler.ticks % 300) / 300F;
|
||||
float angle = RAD - RAD * anglePerc;
|
||||
|
||||
Vector3 iV = MiscUtils.interpolateEntityPosition(Minecraft.getMinecraft().renderViewEntity, pTicks);
|
||||
|
||||
GL11.glTranslated(-iV.getX(), -iV.getY(), -iV.getZ());
|
||||
|
||||
UtilsFX.bindTexture(TC_VORTEX_TEXTURE);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setBrightness(220);
|
||||
tessellator.setColorRGBA_F(1F, 1F, 1F, 1F);
|
||||
|
||||
Vec3 v1 = Vec3.createVectorHelper(-arX * size - arYZ * size, -arXZ * size, -arZ * size - arXY * size);
|
||||
Vec3 v2 = Vec3.createVectorHelper(-arX * size + arYZ * size, arXZ * size, -arZ * size + arXY * size);
|
||||
Vec3 v3 = Vec3.createVectorHelper(arX * size + arYZ * size, arXZ * size, arZ * size + arXY * size);
|
||||
Vec3 v4 = Vec3.createVectorHelper(arX * size - arYZ * size, -arXZ * size, arZ * size - arXY * size);
|
||||
if (angle != 0.0F) {
|
||||
Vec3 pvec = Vec3.createVectorHelper(iV.getX(), iV.getY(), iV.getZ());
|
||||
Vec3 tvec = Vec3.createVectorHelper(x, y, z);
|
||||
Vec3 qvec = pvec.subtract(tvec).normalize();
|
||||
QuadHelper.setAxis(qvec, angle).rotate(v1);
|
||||
QuadHelper.setAxis(qvec, angle).rotate(v2);
|
||||
QuadHelper.setAxis(qvec, angle).rotate(v3);
|
||||
QuadHelper.setAxis(qvec, angle).rotate(v4);
|
||||
}
|
||||
tessellator.setNormal(0.0F, 0.0F, -1.0F);
|
||||
tessellator.addVertexWithUV(x + v1.xCoord, y + v1.yCoord, z + v1.zCoord, 0, 1);
|
||||
tessellator.addVertexWithUV(x + v2.xCoord, y + v2.yCoord, z + v2.zCoord, 1, 1);
|
||||
tessellator.addVertexWithUV(x + v3.xCoord, y + v3.yCoord, z + v3.zCoord, 1, 0);
|
||||
tessellator.addVertexWithUV(x + v4.xCoord, y + v4.yCoord, z + v4.zCoord, 0, 0);
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||
//GL11.glDepthMask(false);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public static void sheduleRender(List<FXVortex> vortexes, Tessellator tessellator, float partialTicks) {
|
||||
synchronized (EffectHandler.lockEffects) {
|
||||
for (FXVortex vortex : vortexes) {
|
||||
GL11.glPushMatrix();
|
||||
vortex.render(tessellator, partialTicks);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void tickVortexes(List<FXVortex> vortexes) {
|
||||
synchronized (EffectHandler.lockEffects) {
|
||||
for(FXVortex vortex : vortexes) {
|
||||
if((System.currentTimeMillis() - vortex.lastUpdateCall) > 100L) {
|
||||
//System.out.println("tickTimeout");
|
||||
EffectHandler.getInstance().unregisterVortex(vortex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void notify(long timeMillis) {
|
||||
this.lastUpdateCall = timeMillis;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -123,29 +123,19 @@ public final class Orbital {
|
||||
}
|
||||
|
||||
public static void sheduleRenders(List<Orbital> orbitals, float partialTicks) {
|
||||
EffectHandler.orbitalsRWLock.lock();
|
||||
try {
|
||||
for(Orbital orbital : orbitals) {
|
||||
orbital.doRender(partialTicks);
|
||||
}
|
||||
} finally {
|
||||
EffectHandler.orbitalsRWLock.unlock();
|
||||
for(Orbital orbital : orbitals) {
|
||||
orbital.doRender(partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
public static void tickOrbitals(List<Orbital> orbitals) {
|
||||
EffectHandler.orbitalsRWLock.lock();
|
||||
try {
|
||||
for(Orbital orbital : orbitals) {
|
||||
if((System.currentTimeMillis() - orbital.lastRenderCall) > 1000L) {
|
||||
orbital.clearOrbitals();
|
||||
EffectHandler.getInstance().unregisterOrbital(orbital);
|
||||
} else {
|
||||
orbital.orbitalCounter++;
|
||||
}
|
||||
for(Orbital orbital : orbitals) {
|
||||
if((System.currentTimeMillis() - orbital.lastRenderCall) > 1000L) {
|
||||
orbital.clearOrbitals();
|
||||
EffectHandler.getInstance().unregisterOrbital(orbital);
|
||||
} else {
|
||||
orbital.orbitalCounter++;
|
||||
}
|
||||
} finally {
|
||||
EffectHandler.orbitalsRWLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import makeo.gadomancy.common.Gadomancy;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
@@ -32,10 +33,9 @@ public class ClientHandler {
|
||||
EffectHandler.getInstance().tick();
|
||||
}
|
||||
|
||||
List<Runnable> actions = ((ClientProxy)Gadomancy.proxy).clientActions;
|
||||
while(actions.size() > 0) {
|
||||
actions.get(0).run();
|
||||
actions.remove(0);
|
||||
Queue<Runnable> actions = ((ClientProxy)Gadomancy.proxy).clientActions;
|
||||
while(actions.peek() != null) {
|
||||
actions.poll().run();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,256 @@
|
||||
package makeo.gadomancy.client.models;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
/**
|
||||
* HellFirePvP@Admin
|
||||
* Date: 22.04.2016 / 21:36
|
||||
* on Gadomancy
|
||||
* ModelEssentiaCompressor
|
||||
*/
|
||||
public class ModelEssentiaCompressor extends ModelBase {
|
||||
|
||||
//Ugh techne...
|
||||
ModelRenderer Plate1;
|
||||
ModelRenderer Plate2;
|
||||
ModelRenderer Plate3;
|
||||
ModelRenderer EdgePillar1;
|
||||
ModelRenderer EdgePillar2;
|
||||
ModelRenderer EdgePillar3;
|
||||
ModelRenderer EdgePillar4;
|
||||
ModelRenderer InnerLL1;
|
||||
ModelRenderer InnerLL2;
|
||||
ModelRenderer InnerLSh1;
|
||||
ModelRenderer InnerLSH2;
|
||||
ModelRenderer InnerUp1;
|
||||
ModelRenderer InnerUp2;
|
||||
ModelRenderer InnerUp3;
|
||||
ModelRenderer InnerUp4;
|
||||
ModelRenderer InnerEdgePiece1;
|
||||
ModelRenderer InnerEdgePiece2;
|
||||
ModelRenderer InnerEdgePiece3;
|
||||
ModelRenderer InnerEdgePiece4;
|
||||
ModelRenderer InnerPeak1;
|
||||
ModelRenderer InnerPeak2;
|
||||
ModelRenderer InnerPeak3;
|
||||
ModelRenderer InnerPeak4;
|
||||
ModelRenderer InnerPillar1;
|
||||
ModelRenderer InnerPillar2;
|
||||
ModelRenderer InnerPillar3;
|
||||
ModelRenderer InnerPillar4;
|
||||
|
||||
public ModelEssentiaCompressor() {
|
||||
textureWidth = 128;
|
||||
textureHeight = 32;
|
||||
|
||||
Plate1 = new ModelRenderer(this, 64, 0);
|
||||
Plate1.addBox(0F, 0F, 0F, 16, 2, 16);
|
||||
Plate1.setRotationPoint(-8F, 22F, -8F);
|
||||
Plate1.setTextureSize(128, 32);
|
||||
Plate1.mirror = true;
|
||||
setRotation(Plate1, 0F, 0F, 0F);
|
||||
Plate2 = new ModelRenderer(this, 4, 0);
|
||||
Plate2.addBox(0F, 0F, 0F, 14, 2, 14);
|
||||
Plate2.setRotationPoint(-7F, 20F, -7F);
|
||||
Plate2.setTextureSize(128, 32);
|
||||
Plate2.mirror = true;
|
||||
setRotation(Plate2, 0F, 0F, 0F);
|
||||
Plate3 = new ModelRenderer(this, 4, 16);
|
||||
Plate3.addBox(0F, 0F, 0F, 12, 3, 12);
|
||||
Plate3.setRotationPoint(-6F, 17F, -6F);
|
||||
Plate3.setTextureSize(128, 32);
|
||||
Plate3.mirror = true;
|
||||
setRotation(Plate3, 0F, 0F, 0F);
|
||||
EdgePillar1 = new ModelRenderer(this, 0, 0);
|
||||
EdgePillar1.addBox(0F, 0F, 0F, 1, 22, 1);
|
||||
EdgePillar1.setRotationPoint(-8F, 0F, -8F);
|
||||
EdgePillar1.setTextureSize(128, 32);
|
||||
EdgePillar1.mirror = true;
|
||||
setRotation(EdgePillar1, 0F, 0F, 0F);
|
||||
EdgePillar2 = new ModelRenderer(this, 0, 0);
|
||||
EdgePillar2.addBox(0F, 0F, 0F, 1, 22, 1);
|
||||
EdgePillar2.setRotationPoint(7F, 0F, -8F);
|
||||
EdgePillar2.setTextureSize(128, 32);
|
||||
EdgePillar2.mirror = true;
|
||||
setRotation(EdgePillar2, 0F, 0F, 0F);
|
||||
EdgePillar3 = new ModelRenderer(this, 0, 0);
|
||||
EdgePillar3.addBox(0F, 0F, 0F, 1, 22, 1);
|
||||
EdgePillar3.setRotationPoint(7F, 0F, 7F);
|
||||
EdgePillar3.setTextureSize(128, 32);
|
||||
EdgePillar3.mirror = true;
|
||||
setRotation(EdgePillar3, 0F, 0F, 0F);
|
||||
EdgePillar4 = new ModelRenderer(this, 0, 0);
|
||||
EdgePillar4.addBox(0F, 0F, 0F, 1, 22, 1);
|
||||
EdgePillar4.setRotationPoint(-8F, 0F, 7F);
|
||||
EdgePillar4.setTextureSize(128, 32);
|
||||
EdgePillar4.mirror = true;
|
||||
setRotation(EdgePillar4, 0F, 0F, 0F);
|
||||
InnerLL1 = new ModelRenderer(this, 100, 18);
|
||||
InnerLL1.addBox(0F, 0F, 0F, 2, 3, 10);
|
||||
InnerLL1.setRotationPoint(-5F, 14F, -5F);
|
||||
InnerLL1.setTextureSize(128, 32);
|
||||
InnerLL1.mirror = true;
|
||||
setRotation(InnerLL1, 0F, 0F, 0F);
|
||||
InnerLL2 = new ModelRenderer(this, 100, 18);
|
||||
InnerLL2.addBox(0F, 0F, 0F, 2, 3, 10);
|
||||
InnerLL2.setRotationPoint(3F, 14F, -5F);
|
||||
InnerLL2.setTextureSize(128, 32);
|
||||
InnerLL2.mirror = true;
|
||||
setRotation(InnerLL2, 0F, 0F, 0F);
|
||||
InnerLSh1 = new ModelRenderer(this, 84, 18);
|
||||
InnerLSh1.addBox(0F, 0F, 0F, 6, 3, 2);
|
||||
InnerLSh1.setRotationPoint(-3F, 14F, -5F);
|
||||
InnerLSh1.setTextureSize(128, 32);
|
||||
InnerLSh1.mirror = true;
|
||||
setRotation(InnerLSh1, 0F, 0F, 0F);
|
||||
InnerLSH2 = new ModelRenderer(this, 84, 18);
|
||||
InnerLSH2.addBox(0F, 0F, 0F, 6, 3, 2);
|
||||
InnerLSH2.setRotationPoint(-3F, 14F, 3F);
|
||||
InnerLSH2.setTextureSize(128, 32);
|
||||
InnerLSH2.mirror = true;
|
||||
setRotation(InnerLSH2, 0F, 0F, 0F);
|
||||
InnerUp1 = new ModelRenderer(this, 64, 18);
|
||||
InnerUp1.addBox(0F, 0F, 0F, 1, 2, 6);
|
||||
InnerUp1.setRotationPoint(-5F, 12F, -3F);
|
||||
InnerUp1.setTextureSize(128, 32);
|
||||
InnerUp1.mirror = true;
|
||||
setRotation(InnerUp1, 0F, 0F, 0F);
|
||||
InnerUp2 = new ModelRenderer(this, 64, 18);
|
||||
InnerUp2.addBox(0F, 0F, 0F, 1, 2, 6);
|
||||
InnerUp2.setRotationPoint(4F, 12F, -3F);
|
||||
InnerUp2.setTextureSize(128, 32);
|
||||
InnerUp2.mirror = true;
|
||||
setRotation(InnerUp2, 0F, 0F, 0F);
|
||||
InnerUp3 = new ModelRenderer(this, 64, 18);
|
||||
InnerUp3.addBox(0F, 0F, 0F, 6, 2, 1);
|
||||
InnerUp3.setRotationPoint(-3F, 12F, 4F);
|
||||
InnerUp3.setTextureSize(128, 32);
|
||||
InnerUp3.mirror = true;
|
||||
setRotation(InnerUp3, 0F, 0F, 0F);
|
||||
InnerUp4 = new ModelRenderer(this, 64, 18);
|
||||
InnerUp4.addBox(0F, 0F, 0F, 6, 2, 1);
|
||||
InnerUp4.setRotationPoint(-3F, 12F, -5F);
|
||||
InnerUp4.setTextureSize(128, 32);
|
||||
InnerUp4.mirror = true;
|
||||
setRotation(InnerUp4, 0F, 0F, 0F);
|
||||
InnerEdgePiece1 = new ModelRenderer(this, 52, 18);
|
||||
InnerEdgePiece1.addBox(0F, 0F, 0F, 2, 5, 2);
|
||||
InnerEdgePiece1.setRotationPoint(3F, 9F, -5F);
|
||||
InnerEdgePiece1.setTextureSize(128, 32);
|
||||
InnerEdgePiece1.mirror = true;
|
||||
setRotation(InnerEdgePiece1, 0F, 0F, 0F);
|
||||
InnerEdgePiece2 = new ModelRenderer(this, 52, 18);
|
||||
InnerEdgePiece2.addBox(0F, 0F, 0F, 2, 5, 2);
|
||||
InnerEdgePiece2.setRotationPoint(3F, 9F, 3F);
|
||||
InnerEdgePiece2.setTextureSize(128, 32);
|
||||
InnerEdgePiece2.mirror = true;
|
||||
setRotation(InnerEdgePiece2, 0F, 0F, 0F);
|
||||
InnerEdgePiece3 = new ModelRenderer(this, 52, 18);
|
||||
InnerEdgePiece3.addBox(0F, 0F, 0F, 2, 5, 2);
|
||||
InnerEdgePiece3.setRotationPoint(-5F, 9F, 3F);
|
||||
InnerEdgePiece3.setTextureSize(128, 32);
|
||||
InnerEdgePiece3.mirror = true;
|
||||
setRotation(InnerEdgePiece3, 0F, 0F, 0F);
|
||||
InnerEdgePiece4 = new ModelRenderer(this, 52, 18);
|
||||
InnerEdgePiece4.addBox(0F, 0F, 0F, 2, 5, 2);
|
||||
InnerEdgePiece4.setRotationPoint(-5F, 9F, -5F);
|
||||
InnerEdgePiece4.setTextureSize(128, 32);
|
||||
InnerEdgePiece4.mirror = true;
|
||||
setRotation(InnerEdgePiece4, 0F, 0F, 0F);
|
||||
InnerPeak1 = new ModelRenderer(this, 124, 18);
|
||||
InnerPeak1.addBox(0F, 0F, 0F, 1, 5, 1);
|
||||
InnerPeak1.setRotationPoint(-5F, 4F, -5F);
|
||||
InnerPeak1.setTextureSize(128, 32);
|
||||
InnerPeak1.mirror = true;
|
||||
setRotation(InnerPeak1, 0F, 0F, 0F);
|
||||
InnerPeak2 = new ModelRenderer(this, 124, 18);
|
||||
InnerPeak2.addBox(0F, 0F, 0F, 1, 5, 1);
|
||||
InnerPeak2.setRotationPoint(-5F, 4F, 4F);
|
||||
InnerPeak2.setTextureSize(128, 32);
|
||||
InnerPeak2.mirror = true;
|
||||
setRotation(InnerPeak2, 0F, 0F, 0F);
|
||||
InnerPeak3 = new ModelRenderer(this, 124, 18);
|
||||
InnerPeak3.addBox(0F, 0F, 0F, 1, 5, 1);
|
||||
InnerPeak3.setRotationPoint(4F, 4F, -5F);
|
||||
InnerPeak3.setTextureSize(128, 32);
|
||||
InnerPeak3.mirror = true;
|
||||
setRotation(InnerPeak3, 0F, 0F, 0F);
|
||||
InnerPeak4 = new ModelRenderer(this, 124, 18);
|
||||
InnerPeak4.addBox(0F, 0F, 0F, 1, 5, 1);
|
||||
InnerPeak4.setRotationPoint(4F, 4F, 4F);
|
||||
InnerPeak4.setTextureSize(128, 32);
|
||||
InnerPeak4.mirror = true;
|
||||
setRotation(InnerPeak4, 0F, 0F, 0F);
|
||||
InnerPillar1 = new ModelRenderer(this, 0, 0);
|
||||
InnerPillar1.addBox(0F, 0F, 0F, 1, 17, 1);
|
||||
InnerPillar1.setRotationPoint(5F, 0F, 5F);
|
||||
InnerPillar1.setTextureSize(128, 32);
|
||||
InnerPillar1.mirror = true;
|
||||
setRotation(InnerPillar1, 0F, 0F, 0F);
|
||||
InnerPillar2 = new ModelRenderer(this, 0, 0);
|
||||
InnerPillar2.addBox(0F, 0F, 0F, 1, 17, 1);
|
||||
InnerPillar2.setRotationPoint(5F, 0F, -6F);
|
||||
InnerPillar2.setTextureSize(128, 32);
|
||||
InnerPillar2.mirror = true;
|
||||
setRotation(InnerPillar2, 0F, 0F, 0F);
|
||||
InnerPillar3 = new ModelRenderer(this, 0, 0);
|
||||
InnerPillar3.addBox(0F, 0F, 0F, 1, 17, 1);
|
||||
InnerPillar3.setRotationPoint(-6F, 0F, -6F);
|
||||
InnerPillar3.setTextureSize(128, 32);
|
||||
InnerPillar3.mirror = true;
|
||||
setRotation(InnerPillar3, 0F, 0F, 0F);
|
||||
InnerPillar4 = new ModelRenderer(this, 0, 0);
|
||||
InnerPillar4.addBox(0F, 0F, 0F, 1, 17, 1);
|
||||
InnerPillar4.setRotationPoint(-6F, 0F, 5F);
|
||||
InnerPillar4.setTextureSize(128, 32);
|
||||
InnerPillar4.mirror = true;
|
||||
setRotation(InnerPillar4, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
Plate1.render(f5);
|
||||
Plate2.render(f5);
|
||||
Plate3.render(f5);
|
||||
EdgePillar1.render(f5);
|
||||
EdgePillar2.render(f5);
|
||||
EdgePillar3.render(f5);
|
||||
EdgePillar4.render(f5);
|
||||
InnerLL1.render(f5);
|
||||
InnerLL2.render(f5);
|
||||
InnerLSh1.render(f5);
|
||||
InnerLSH2.render(f5);
|
||||
InnerUp1.render(f5);
|
||||
InnerUp2.render(f5);
|
||||
InnerUp3.render(f5);
|
||||
InnerUp4.render(f5);
|
||||
InnerEdgePiece1.render(f5);
|
||||
InnerEdgePiece2.render(f5);
|
||||
InnerEdgePiece3.render(f5);
|
||||
InnerEdgePiece4.render(f5);
|
||||
InnerPeak1.render(f5);
|
||||
InnerPeak2.render(f5);
|
||||
InnerPeak3.render(f5);
|
||||
InnerPeak4.render(f5);
|
||||
InnerPillar1.render(f5);
|
||||
InnerPillar2.render(f5);
|
||||
InnerPillar3.render(f5);
|
||||
InnerPillar4.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) {
|
||||
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package makeo.gadomancy.client.models;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
/**
|
||||
* HellFirePvP@Admin
|
||||
* Date: 22.04.2016 / 22:59
|
||||
* on Gadomancy
|
||||
* ModelPackedCompressorBlock
|
||||
*/
|
||||
public class ModelPackedCompressorBlock extends ModelBase {
|
||||
|
||||
ModelRenderer block;
|
||||
|
||||
public ModelPackedCompressorBlock() {
|
||||
textureHeight = 16;
|
||||
textureWidth = 16;
|
||||
|
||||
block = new ModelRenderer(this, 0, 0);
|
||||
block.addBox(0F, 0F, 0F, 16, 16, 16);
|
||||
block.setRotationPoint(-8F, 22F, -8F);
|
||||
//block.setTextureSize(16, 16);
|
||||
block.mirror = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
block.render(f5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) {
|
||||
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import makeo.gadomancy.common.utils.Vector3;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
@@ -45,12 +46,21 @@ public class RenderTileAuraPylon extends TileEntitySpecialRenderer {
|
||||
GL11.glTranslated(x + 0.5, y - 0.5, z + 0.5);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
ResourceLocation textureToBind;
|
||||
if(tile instanceof TileAuraPylonTop) {
|
||||
textureToBind = PYLON_TEXTURE_TOP;
|
||||
} else if(((TileAuraPylon) tile).isInputTile() || ((TileAuraPylon) tile).isLowestTile()) {
|
||||
textureToBind = PYLON_TEXTURE_BOTTOM;
|
||||
} else {
|
||||
textureToBind = PYLON_TEXTURE;
|
||||
}
|
||||
bindTexture(textureToBind);
|
||||
for(int i = 0; i < 4; i++) {
|
||||
if(tile instanceof TileAuraPylonTop) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(180, 1, 0, 0);
|
||||
GL11.glTranslatef(0, -2F, 0);
|
||||
bindTexture(PYLON_TEXTURE_TOP);
|
||||
//bindTexture(PYLON_TEXTURE_TOP);
|
||||
MODEL_AURA_PYLON_TOP.render(null, 0, 0, 0, 0, 0, 0.0625f);
|
||||
GL11.glPopMatrix();
|
||||
} else {
|
||||
@@ -58,11 +68,11 @@ public class RenderTileAuraPylon extends TileEntitySpecialRenderer {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(180, 1, 0, 0);
|
||||
GL11.glTranslatef(0, -2F, 0);
|
||||
bindTexture(PYLON_TEXTURE_BOTTOM);
|
||||
//bindTexture(PYLON_TEXTURE_BOTTOM);
|
||||
MODEL_AURA_PYLON_BOTTOM.render(null, 0, 0, 0, 0, 0, 0.0625f);
|
||||
GL11.glPopMatrix();
|
||||
} else {
|
||||
bindTexture(PYLON_TEXTURE);
|
||||
//bindTexture(PYLON_TEXTURE);
|
||||
MODEL_AURA_PYLON.render(null, 0, 0, 0, 0, 0, 0.0625f);
|
||||
}
|
||||
}
|
||||
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
package makeo.gadomancy.client.renderers.tile;
|
||||
|
||||
import makeo.gadomancy.client.effect.EffectHandler;
|
||||
import makeo.gadomancy.client.effect.fx.FXVortex;
|
||||
import makeo.gadomancy.client.events.ClientHandler;
|
||||
import makeo.gadomancy.client.models.ModelPackedCompressorBlock;
|
||||
import makeo.gadomancy.client.models.ModelEssentiaCompressor;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileEssentiaCompressor;
|
||||
import makeo.gadomancy.common.utils.MiscUtils;
|
||||
import makeo.gadomancy.common.utils.SimpleResourceLocation;
|
||||
import makeo.gadomancy.common.utils.Vector3;
|
||||
import makeo.gadomancy.common.utils.world.fake.FakeWorld;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Vec3;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.client.fx.ParticleEngine;
|
||||
import thaumcraft.client.lib.QuadHelper;
|
||||
import thaumcraft.client.lib.UtilsFX;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* HellFirePvP@Admin
|
||||
* Date: 22.04.2016 / 21:39
|
||||
* on Gadomancy
|
||||
* RenderTileEssentiaCompressor
|
||||
*/
|
||||
public class RenderTileEssentiaCompressor extends TileEntitySpecialRenderer {
|
||||
|
||||
public static final ModelBase MODEL_ESSENTIA_COMPRESSOR = new ModelEssentiaCompressor();
|
||||
public static final ModelBase MODEL_PACKED_COMPRESSOR = new ModelPackedCompressorBlock();
|
||||
public static final SimpleResourceLocation COMPRESSOR_TEXTURE = new SimpleResourceLocation("models/essentia_compressor.png");
|
||||
public static final SimpleResourceLocation PACKED_COMPRESSOR_TEXTURE = new SimpleResourceLocation("blocks/block_packed_compressor.png");
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
if(tileEntity == null || !(tileEntity instanceof TileEssentiaCompressor)) return;
|
||||
|
||||
boolean isRenderedAsItem = false;
|
||||
if(tileEntity.getWorldObj() instanceof FakeWorld) { //LUL
|
||||
isRenderedAsItem = true;
|
||||
}
|
||||
|
||||
if(!isRenderedAsItem && ((TileEssentiaCompressor) tileEntity).isMultiblockFormed()) {
|
||||
int yOffset = ((TileEssentiaCompressor) tileEntity).getMultiblockYIndex();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y - yOffset - 0.5, z + 0.5);
|
||||
bindTexture(COMPRESSOR_TEXTURE);
|
||||
GL11.glRotatef(180, 1, 0, 0);
|
||||
GL11.glTranslatef(0, -2F, 0);
|
||||
MODEL_ESSENTIA_COMPRESSOR.render(null, 0, 0, 0, 0, 0, 0.0625f);
|
||||
GL11.glRotatef(180, 1, 0, 0);
|
||||
MODEL_ESSENTIA_COMPRESSOR.render(null, 0, 0, 0, 0, 0, 0.0625f);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
if(yOffset == 1) { //The middle one. - well. the one where the blackhole is.
|
||||
renderBlackHoleEffect(tileEntity.xCoord + 0.5, tileEntity.yCoord + 0.5, tileEntity.zCoord + 0.5);
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
} else {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y - 0.5, z + 0.5);
|
||||
GL11.glRotatef(180, 1, 0, 0);
|
||||
if(isRenderedAsItem) {
|
||||
GL11.glTranslatef(0, -2.9F, 0);
|
||||
} else {
|
||||
GL11.glTranslatef(0, -2.877F, 0); //Magic number FeelsBadMan
|
||||
}
|
||||
bindTexture(PACKED_COMPRESSOR_TEXTURE);
|
||||
MODEL_PACKED_COMPRESSOR.render(null, 0, 0, 0, 0, 0, 0.0625f);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Map<ChunkCoordinates, FXVortex> ownedVortex = new HashMap<ChunkCoordinates, FXVortex>();
|
||||
|
||||
private void renderBlackHoleEffect(double x, double y, double z) {
|
||||
ChunkCoordinates cc = new ChunkCoordinates((int) x, (int) y, (int) z);
|
||||
FXVortex v;
|
||||
if (ownedVortex.containsKey(cc)) {
|
||||
v = ownedVortex.get(cc);
|
||||
} else {
|
||||
v = new FXVortex(x, y, z);
|
||||
ownedVortex.put(cc, v);
|
||||
v.registered = true;
|
||||
EffectHandler.getInstance().registerVortex(v);
|
||||
}
|
||||
if(!v.registered) {
|
||||
EffectHandler.getInstance().registerVortex(v);
|
||||
}
|
||||
v.notify(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
package makeo.gadomancy.common.blocks;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileEssentiaCompressor;
|
||||
import makeo.gadomancy.common.network.PacketHandler;
|
||||
import makeo.gadomancy.common.network.packets.PacketStartAnimation;
|
||||
import makeo.gadomancy.common.registration.RegisteredBlocks;
|
||||
import makeo.gadomancy.common.registration.RegisteredItems;
|
||||
import makeo.gadomancy.common.registration.RegisteredRecipes;
|
||||
import makeo.gadomancy.common.research.SimpleResearchItem;
|
||||
import makeo.gadomancy.common.utils.ExplosionHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
import thaumcraft.common.lib.research.ResearchManager;
|
||||
|
||||
/**
|
||||
* HellFirePvP@Admin
|
||||
* Date: 22.04.2016 / 21:42
|
||||
* on Gadomancy
|
||||
* BlockEssentiaCompressor
|
||||
*/
|
||||
public class BlockEssentiaCompressor extends BlockContainer implements IBlockTransparent {
|
||||
|
||||
private IIcon icon;
|
||||
|
||||
public BlockEssentiaCompressor() {
|
||||
super(Material.wood);
|
||||
setHardness(5F);
|
||||
setResistance(20F);
|
||||
setHarvestLevel("axe", 1);
|
||||
setBlockBounds(0, 0, 0, 1, 1, 1);
|
||||
setCreativeTab(RegisteredItems.creativeTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTextureName() {
|
||||
return "gadomancy:block_packed_compressor";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RegisteredBlocks.rendererTransparentBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister ir) {
|
||||
icon = ir.registerIcon(Gadomancy.MODID + ":transparent");
|
||||
super.registerBlockIcons(ir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTransparentIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te == null || !(te instanceof TileEssentiaCompressor)) {
|
||||
return 0;
|
||||
} else {
|
||||
if(((TileEssentiaCompressor) te).isMultiblockFormed() &&
|
||||
((TileEssentiaCompressor) te).isMasterTile()) {
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te == null || !(te instanceof TileEssentiaCompressor)) return;
|
||||
TileEssentiaCompressor compressor = (TileEssentiaCompressor) te;
|
||||
if(compressor.isMultiblockFormed()) {
|
||||
AspectList al = compressor.getAspects();
|
||||
if(al.visSize() > 0) {
|
||||
ExplosionHelper.taintplosion(world, x, y, z, true, 2, 2.0F, 4, 20);
|
||||
world.setBlockToAir(x, y, z);
|
||||
} else {
|
||||
ExplosionHelper.taintplosion(world, x, y, z, false, 2, 2.0F, 4, 20);
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te == null || !(te instanceof TileEssentiaCompressor)) {
|
||||
super.setBlockBoundsBasedOnState(world, x, y, z);
|
||||
return;
|
||||
}
|
||||
if(((TileEssentiaCompressor) te).isMultiblockFormed()) {
|
||||
if(((TileEssentiaCompressor) te).isMasterTile()) {
|
||||
setBlockBounds(0, 0, 0, 1, 3, 1); //master is lowest tile here.
|
||||
} else {
|
||||
int yM = ((TileEssentiaCompressor) te).getMultiblockYIndex();
|
||||
setBlockBounds(0, -yM, 0, 1, 3 - yM, 1);
|
||||
}
|
||||
} else {
|
||||
setBlockBounds(0, 0, 0, 1, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int these, float are, float some, float variables) { //LUL side, hitx, hity, hitz
|
||||
if(world.isRemote) return false;
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te == null || !(te instanceof TileEssentiaCompressor)) return false;
|
||||
if(((TileEssentiaCompressor) te).isMultiblockFormed()) {
|
||||
if(!((TileEssentiaCompressor) te).isMasterTile()) {
|
||||
int yOffset = ((TileEssentiaCompressor) te).getMultiblockYIndex();
|
||||
return RegisteredBlocks.blockEssentiaCompressor.onBlockActivated(world, x, y - yOffset, z, player, these, are, some, variables);
|
||||
}
|
||||
} else {
|
||||
ItemStack heldItem = player.getHeldItem();
|
||||
if(heldItem != null && heldItem.getItem() instanceof ItemWandCasting &&
|
||||
ResearchManager.isResearchComplete(player.getCommandSenderName(), SimpleResearchItem.getFullName("ESSENTIA_COMPRESSOR"))) {
|
||||
ChunkCoordinates lowest = findLowestCompressorBlock(world, x, y, z);
|
||||
boolean canForm = lowest != null && isMuliblockPossible(world, lowest);
|
||||
if(canForm && ThaumcraftApiHelper.consumeVisFromWandCrafting(player.getCurrentEquippedItem(), player, RegisteredRecipes.costsCompressorMultiblock, true)) {
|
||||
int multiblockID = TileEssentiaCompressor.getAndIncrementNewMultiblockId();
|
||||
TileEssentiaCompressor compressor = (TileEssentiaCompressor) world.getTileEntity(lowest.posX, lowest.posY, lowest.posZ);
|
||||
compressor.setInMultiblock(true, 0, multiblockID);
|
||||
PacketStartAnimation pkt = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, lowest.posX, lowest.posY, lowest.posZ);
|
||||
NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint(world.provider.dimensionId, lowest.posX, lowest.posY, lowest.posZ, 32);
|
||||
PacketHandler.INSTANCE.sendToAllAround(pkt, point);
|
||||
compressor = (TileEssentiaCompressor) world.getTileEntity(lowest.posX, lowest.posY + 1, lowest.posZ);
|
||||
compressor.setInMultiblock(false, 1, multiblockID);
|
||||
pkt = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, lowest.posX, lowest.posY + 1, lowest.posZ);
|
||||
point = new NetworkRegistry.TargetPoint(world.provider.dimensionId, lowest.posX, lowest.posY + 1, lowest.posZ, 32);
|
||||
PacketHandler.INSTANCE.sendToAllAround(pkt, point);
|
||||
compressor = (TileEssentiaCompressor) world.getTileEntity(lowest.posX, lowest.posY + 2, lowest.posZ);
|
||||
compressor.setInMultiblock(false, 2, multiblockID);
|
||||
pkt = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, lowest.posX, lowest.posY + 2, lowest.posZ);
|
||||
point = new NetworkRegistry.TargetPoint(world.provider.dimensionId, lowest.posX, lowest.posY + 2, lowest.posZ, 32);
|
||||
PacketHandler.INSTANCE.sendToAllAround(pkt, point);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isMuliblockPossible(World world, ChunkCoordinates lowest) {
|
||||
return lowest != null &&
|
||||
isMultiblockable(world, lowest.posX, lowest.posY , lowest.posZ) &&
|
||||
isMultiblockable(world, lowest.posX, lowest.posY + 1, lowest.posZ) &&
|
||||
isMultiblockable(world, lowest.posX, lowest.posY + 2, lowest.posZ);
|
||||
}
|
||||
|
||||
private ChunkCoordinates findLowestCompressorBlock(World world, int x, int y, int z) {
|
||||
ChunkCoordinates result = null;
|
||||
for (int i = 0; i <= y; i++) {
|
||||
if(!isMultiblockable(world, x, y - i, z)) break;
|
||||
result = new ChunkCoordinates(x, y - i, z);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean isMultiblockable(World world, int x, int y, int z) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(!block.equals(RegisteredBlocks.blockEssentiaCompressor)) return false;
|
||||
if(te == null || !(te instanceof TileEssentiaCompressor)) return false;
|
||||
TileEssentiaCompressor compressor = (TileEssentiaCompressor) te;
|
||||
return !compressor.isMultiblockFormed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileEssentiaCompressor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,582 @@
|
||||
package makeo.gadomancy.common.blocks.tiles;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import makeo.gadomancy.client.events.ClientHandler;
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.data.config.ModConfig;
|
||||
import makeo.gadomancy.common.network.packets.PacketTCNodeBolt;
|
||||
import makeo.gadomancy.common.registration.RegisteredBlocks;
|
||||
import makeo.gadomancy.common.utils.ExplosionHelper;
|
||||
import makeo.gadomancy.common.utils.Injector;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
import thaumcraft.api.WorldCoordinates;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.aspects.IAspectContainer;
|
||||
import thaumcraft.api.aspects.IAspectSource;
|
||||
import thaumcraft.api.aspects.IEssentiaContainerItem;
|
||||
import thaumcraft.api.aspects.IEssentiaTransport;
|
||||
import thaumcraft.client.fx.ParticleEngine;
|
||||
import thaumcraft.client.fx.bolt.FXLightningBolt;
|
||||
import thaumcraft.client.fx.particles.FXEssentiaTrail;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.lib.events.EssentiaHandler;
|
||||
import thaumcraft.common.lib.network.PacketHandler;
|
||||
import thaumcraft.common.lib.network.fx.PacketFXEssentiaSource;
|
||||
import thaumcraft.common.tiles.TileJarFillable;
|
||||
import thaumcraft.common.tiles.TileMirrorEssentia;
|
||||
|
||||
import java.awt.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* HellFirePvP@Admin
|
||||
* Date: 22.04.2016 / 21:42
|
||||
* on Gadomancy
|
||||
* TileEssentiaCompressor
|
||||
*/
|
||||
public class TileEssentiaCompressor extends SynchronizedTileEntity implements IAspectSource, IEssentiaTransport {
|
||||
|
||||
private static Injector injEssentiaHandler = new Injector(EssentiaHandler.class);
|
||||
private static int multiblockIDCounter = 0;
|
||||
|
||||
//Standard multiblock stuff
|
||||
private boolean isMasterTile = true; //For debugging
|
||||
private int multiblockYIndex = -1, multiblockId = -1;
|
||||
|
||||
private boolean isMultiblockPresent = false;
|
||||
|
||||
private AspectList al = new AspectList();
|
||||
private int ticksExisted = 0;
|
||||
private boolean prevFound = false;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
ticksExisted++;
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
if(isMultiblockFormed()) {
|
||||
checkMultiblock();
|
||||
}
|
||||
|
||||
if(!isMultiblockFormed()) return;
|
||||
|
||||
if (isMasterTile() && (prevFound || (ticksExisted % 100) == 0)) {
|
||||
List<WorldCoordinates> coords = searchAndGetSources();
|
||||
if (coords == null || coords.isEmpty()) {
|
||||
prevFound = false;
|
||||
} else {
|
||||
prevFound = searchForEssentia(coords);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(isMasterTile() && isMultiblockFormed()) {
|
||||
playLightningEffects();
|
||||
playVortexEffects();
|
||||
if(al.visSize() > 0) {
|
||||
playEssentiaEffects();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(isMasterTile() && isMultiblockFormed()) {
|
||||
vortexEntities();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean searchForEssentia(List<WorldCoordinates> coordinates) {
|
||||
if(ticksExisted % 10 != 0) return prevFound;
|
||||
for (Aspect a : Aspect.aspects.values()) {
|
||||
if (doDrain(a, coordinates)) {
|
||||
al.add(a, 1);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
markDirty();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean doDrain(Aspect a, List<WorldCoordinates> coordinates) {
|
||||
for (WorldCoordinates coordinate : coordinates) {
|
||||
TileEntity sourceTile = worldObj.getTileEntity(coordinate.x, coordinate.y, coordinate.z);
|
||||
if ((sourceTile == null) || (!(sourceTile instanceof IAspectSource))) {
|
||||
continue;
|
||||
}
|
||||
if(sourceTile instanceof TileEssentiaCompressor) continue;
|
||||
IAspectSource as = (IAspectSource)sourceTile;
|
||||
if (as.takeFromContainer(a, 1)) {
|
||||
PacketHandler.INSTANCE.sendToAllAround(new PacketFXEssentiaSource(xCoord, yCoord + 1, zCoord,
|
||||
(byte)(xCoord - coordinate.x), (byte)(yCoord - coordinate.y + 1), (byte)(zCoord - coordinate.z),
|
||||
a.getColor()), new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord + 1, zCoord, 32.0D));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
float tr = 1.0F;
|
||||
float tri = 0.0F;
|
||||
float tg = 1.0F;
|
||||
float tgi = 0.0F;
|
||||
float tb = 1.0F;
|
||||
float tbi = 0.0F;
|
||||
public float cr = 1.0F;
|
||||
public float cg = 1.0F;
|
||||
public float cb = 1.0F;
|
||||
public Aspect displayAspect = null;
|
||||
|
||||
//Thanks @TileEssentiaReservoir :P
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void playEssentiaEffects() {
|
||||
if ((ClientHandler.ticks % 20 == 0) && (al.size() > 0)) {
|
||||
this.displayAspect = al.getAspects()[(ClientHandler.ticks / 20 % al.size())];
|
||||
Color c = new Color(this.displayAspect.getColor());
|
||||
this.tr = (c.getRed() / 255.0F);
|
||||
this.tg = (c.getGreen() / 255.0F);
|
||||
this.tb = (c.getBlue() / 255.0F);
|
||||
this.tri = ((this.cr - this.tr) / 20.0F);
|
||||
this.tgi = ((this.cg - this.tg) / 20.0F);
|
||||
this.tbi = ((this.cb - this.tb) / 20.0F);
|
||||
}
|
||||
if (this.displayAspect == null) {
|
||||
this.tr = (this.tg = this.tb = 1.0F);
|
||||
this.tri = (this.tgi = this.tbi = 0.0F);
|
||||
} else {
|
||||
this.cr -= this.tri;
|
||||
this.cg -= this.tgi;
|
||||
this.cb -= this.tbi;
|
||||
}
|
||||
int count = 1;
|
||||
if(cr < 0) cr = 0;
|
||||
if(cg < 0) cg = 0;
|
||||
if(cb < 0) cb = 0;
|
||||
FXEssentiaTrail essentiaTrail = new FXEssentiaTrail(worldObj, xCoord + 0.5, yCoord + 0.4, zCoord + 0.5, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, count, new Color(cr, cg, cb).getRGB(), 0.8F);
|
||||
essentiaTrail.noClip = true;
|
||||
essentiaTrail.motionY = (0.01F + MathHelper.sin(count / 3.0F) * 0.001F);
|
||||
essentiaTrail.motionX = (MathHelper.sin(count / 10.0F) * 0.01F + worldObj.rand.nextGaussian() * 0.01D);
|
||||
essentiaTrail.motionZ = (MathHelper.sin(count / 10.0F) * 0.01F + worldObj.rand.nextGaussian() * 0.01D);
|
||||
ParticleEngine.instance.addEffect(worldObj, essentiaTrail);
|
||||
|
||||
essentiaTrail = new FXEssentiaTrail(worldObj, xCoord + 0.5, yCoord + 2.6, zCoord + 0.5, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, count, new Color(cr, cg, cb).getRGB(), 0.8F);
|
||||
essentiaTrail.noClip = true;
|
||||
essentiaTrail.motionY = -(0.01F + MathHelper.sin(count / 3.0F) * 0.001F);
|
||||
essentiaTrail.motionX = (MathHelper.sin(count / 10.0F) * 0.01F + worldObj.rand.nextGaussian() * 0.01D);
|
||||
essentiaTrail.motionZ = (MathHelper.sin(count / 10.0F) * 0.01F + worldObj.rand.nextGaussian() * 0.01D);
|
||||
ParticleEngine.instance.addEffect(worldObj, essentiaTrail);
|
||||
}
|
||||
|
||||
private List<WorldCoordinates> searchAndGetSources() {
|
||||
WorldCoordinates thisCoordinates = new WorldCoordinates(this);
|
||||
Map<WorldCoordinates, List<WorldCoordinates>> teSources = new HashMap<WorldCoordinates, List<WorldCoordinates>>();
|
||||
getSourcesField(teSources);
|
||||
if(!teSources.containsKey(thisCoordinates)) {
|
||||
searchSources();
|
||||
getSourcesField(teSources);
|
||||
if(teSources.containsKey(thisCoordinates)) {
|
||||
return searchAndGetSources();
|
||||
}
|
||||
return new ArrayList<WorldCoordinates>();
|
||||
}
|
||||
List<WorldCoordinates> result = teSources.get(thisCoordinates);
|
||||
((Map<WorldCoordinates, List<WorldCoordinates>>) injEssentiaHandler.getField("sources")).remove(thisCoordinates);
|
||||
return result;
|
||||
}
|
||||
|
||||
private void searchSources() {
|
||||
WorldCoordinates thisCoord = new WorldCoordinates(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
|
||||
List<WorldCoordinates> coords = new LinkedList<WorldCoordinates>();
|
||||
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
|
||||
unsafe_search(thisCoord, direction, coords);
|
||||
}
|
||||
|
||||
((Map<WorldCoordinates, List<WorldCoordinates>>) injEssentiaHandler.getField("sources")).put(thisCoord, coords);
|
||||
}
|
||||
|
||||
private void unsafe_search(WorldCoordinates coord, ForgeDirection direction, List<WorldCoordinates> out) {
|
||||
((HashMap<WorldCoordinates, Long>) injEssentiaHandler.getField("sourcesDelay")).remove(coord);
|
||||
injEssentiaHandler.invokeMethod("getSources", new Class[]{ World.class, WorldCoordinates.class, ForgeDirection.class, int.class }, worldObj, coord, direction, 5);
|
||||
List<WorldCoordinates> coords = ((Map<WorldCoordinates, List<WorldCoordinates>>) injEssentiaHandler.getField("sources")).get(coord);
|
||||
if(coords != null) {
|
||||
out.addAll(((Map<WorldCoordinates, List<WorldCoordinates>>) injEssentiaHandler.getField("sources")).get(coord));
|
||||
((Map<WorldCoordinates, List<WorldCoordinates>>) injEssentiaHandler.getField("sources")).remove(coord);
|
||||
}
|
||||
}
|
||||
|
||||
private void getSourcesField(Map<WorldCoordinates, List<WorldCoordinates>> out) {
|
||||
out.clear();
|
||||
out.putAll((Map<? extends WorldCoordinates, ? extends List<WorldCoordinates>>) injEssentiaHandler.getField("sources"));
|
||||
}
|
||||
|
||||
private void playVortexEffects() {
|
||||
for (int a = 0; a < Thaumcraft.proxy.particleCount(1); a++) {
|
||||
int tx = this.xCoord + this.worldObj.rand.nextInt(4) - this.worldObj.rand.nextInt(4);
|
||||
int ty = this.yCoord + 1 + this.worldObj.rand.nextInt(4) - this.worldObj.rand.nextInt(4);
|
||||
int tz = this.zCoord + this.worldObj.rand.nextInt(4) - this.worldObj.rand.nextInt(4);
|
||||
if (ty > this.worldObj.getHeightValue(tx, tz)) {
|
||||
ty = this.worldObj.getHeightValue(tx, tz);
|
||||
}
|
||||
Vec3 v1 = Vec3.createVectorHelper(this.xCoord + 0.5D, this.yCoord + 1.5D, this.zCoord + 0.5D);
|
||||
Vec3 v2 = Vec3.createVectorHelper(tx + 0.5D, ty + 0.5D, tz + 0.5D);
|
||||
|
||||
MovingObjectPosition mop = ThaumcraftApiHelper.rayTraceIgnoringSource(this.worldObj, v1, v2, true, false, false);
|
||||
if ((mop != null) && (getDistanceFrom(mop.blockX, mop.blockY, mop.blockZ) < 16.0D)) {
|
||||
tx = mop.blockX;
|
||||
ty = mop.blockY;
|
||||
tz = mop.blockZ;
|
||||
Block bi = this.worldObj.getBlock(tx, ty, tz);
|
||||
int md = this.worldObj.getBlockMetadata(tx, ty, tz);
|
||||
if (!bi.isAir(this.worldObj, tx, ty, tz)) {
|
||||
Thaumcraft.proxy.hungryNodeFX(this.worldObj, tx, ty, tz, this.xCoord, this.yCoord + 1, this.zCoord, bi, md);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void playLightningEffects() {
|
||||
if(worldObj.rand.nextBoolean()) {
|
||||
double originX = xCoord + 0.5;
|
||||
double originY = yCoord + 1.5;
|
||||
double originZ = zCoord + 0.5;
|
||||
double targetX = xCoord + 0.4 + worldObj.rand.nextFloat() * 0.2;
|
||||
double targetY = yCoord + 0.4 + (worldObj.rand.nextBoolean() ? 2.2 : 0);
|
||||
double targetZ = zCoord + 0.4 + worldObj.rand.nextFloat() * 0.2;
|
||||
FXLightningBolt bolt = new FXLightningBolt(Minecraft.getMinecraft().theWorld, originX, originY, originZ,
|
||||
targetX, targetY, targetZ, Minecraft.getMinecraft().theWorld.rand.nextLong(), 10, 4.0F, 5);
|
||||
bolt.defaultFractal();
|
||||
bolt.setType(5);
|
||||
bolt.finalizeBolt();
|
||||
}
|
||||
}
|
||||
|
||||
private void vortexEntities() {
|
||||
List entities = worldObj.getEntitiesWithinAABB(Entity.class,
|
||||
AxisAlignedBB.getBoundingBox(xCoord - 0.5, yCoord - 0.5, zCoord - 0.5,
|
||||
xCoord + 0.5, yCoord + 0.5, zCoord + 0.5).expand(4, 4, 4));
|
||||
for (Object o : entities) {
|
||||
if(o == null ||
|
||||
!(o instanceof Entity) ||
|
||||
((Entity) o).isDead) continue;
|
||||
applyMovementVectors((Entity) o);
|
||||
}
|
||||
}
|
||||
|
||||
private void applyMovementVectors(Entity entity) {
|
||||
double var3 = (xCoord + 0.5D - entity.posX) / 8.0D;
|
||||
double var5 = (yCoord + 1.5D - entity.posY) / 8.0D;
|
||||
double var7 = (zCoord + 0.5D - entity.posZ) / 8.0D;
|
||||
double var9 = Math.sqrt(var3 * var3 + var5 * var5 + var7 * var7);
|
||||
double var11 = 1.0D - var9;
|
||||
if (var11 > 0.0D) {
|
||||
var11 *= var11;
|
||||
entity.motionX += var3 / var9 * var11 * 0.05D;
|
||||
entity.motionY += var5 / var9 * var11 * 0.08D;
|
||||
entity.motionZ += var7 / var9 * var11 * 0.05D;
|
||||
}
|
||||
}
|
||||
|
||||
public void checkMultiblock() {
|
||||
if(isMasterTile) {
|
||||
boolean canSustain = isMultiblockableBlock(1);
|
||||
if(!isMultiblockableBlock(2)) canSustain = false;
|
||||
if(!canSustain) {
|
||||
breakMultiblock();
|
||||
isMultiblockPresent = false;
|
||||
}
|
||||
} else {
|
||||
TileEssentiaCompressor master = tryFindMasterTile();
|
||||
if(master != null) {
|
||||
if(!master.isMultiblockPresent) {
|
||||
breakMultiblock();
|
||||
}
|
||||
} else {
|
||||
breakMultiblock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public TileEssentiaCompressor tryFindMasterTile() {
|
||||
if(!isMultiblockFormed()) return null;
|
||||
if(isMasterTile()) return this; //lul.. check before plz.
|
||||
Block down = worldObj.getBlock(xCoord, yCoord - multiblockYIndex, zCoord);
|
||||
if(!down.equals(RegisteredBlocks.blockEssentiaCompressor)) return null;
|
||||
TileEntity te = worldObj.getTileEntity(xCoord, yCoord - multiblockYIndex, zCoord);
|
||||
if(te == null || !(te instanceof TileEssentiaCompressor)) return null;
|
||||
TileEssentiaCompressor compressor = (TileEssentiaCompressor) te;
|
||||
if(compressor.multiblockId != multiblockId || !compressor.isMasterTile()) return null;
|
||||
return compressor;
|
||||
}
|
||||
|
||||
private boolean isMultiblockableBlock(int yOffset) {
|
||||
Block block = worldObj.getBlock(xCoord, yCoord + yOffset, zCoord);
|
||||
TileEntity te = worldObj.getTileEntity(xCoord, yCoord + yOffset, zCoord);
|
||||
if(!block.equals(RegisteredBlocks.blockEssentiaCompressor)) return false;
|
||||
if(te == null || !(te instanceof TileEssentiaCompressor)) return false;
|
||||
TileEssentiaCompressor compressor = (TileEssentiaCompressor) te;
|
||||
return compressor.multiblockId == multiblockId;
|
||||
}
|
||||
|
||||
public void breakMultiblock() {
|
||||
doExplosion();
|
||||
this.multiblockId = -1;
|
||||
this.isMasterTile = false;
|
||||
this.multiblockYIndex = -1;
|
||||
this.al = new AspectList();
|
||||
markDirty();
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
private void doExplosion() {
|
||||
AspectList al = getAspects();
|
||||
if(al.visSize() > 0) {
|
||||
ExplosionHelper.taintplosion(worldObj, xCoord, yCoord, zCoord, true, 2, 2.0F, 4, 20);
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
} else {
|
||||
ExplosionHelper.taintplosion(worldObj, xCoord, yCoord, zCoord, false, 0, 2.0F, 4, 20);
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getAndIncrementNewMultiblockId() {
|
||||
multiblockIDCounter++;
|
||||
return multiblockIDCounter;
|
||||
}
|
||||
|
||||
public void setInMultiblock(boolean isMaster, int yIndex, int multiblockId) {
|
||||
this.multiblockId = multiblockId;
|
||||
this.isMasterTile = isMaster;
|
||||
this.multiblockYIndex = yIndex;
|
||||
if(isMaster) {
|
||||
this.isMultiblockPresent = true; //Initial state.
|
||||
}
|
||||
this.al = new AspectList();
|
||||
markDirty();
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
public boolean isMultiblockFormed() {
|
||||
return multiblockId != -1;
|
||||
}
|
||||
|
||||
public boolean isMasterTile() {
|
||||
return isMasterTile;
|
||||
}
|
||||
|
||||
public int getMultiblockYIndex() {
|
||||
return multiblockYIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readCustomNBT(NBTTagCompound compound) {
|
||||
super.readCustomNBT(compound);
|
||||
|
||||
this.multiblockYIndex = compound.getInteger("multiblockYIndex");
|
||||
this.isMasterTile = compound.getBoolean("isMasterTile");
|
||||
this.multiblockId = compound.getInteger("multiblockId");
|
||||
this.isMultiblockPresent = compound.getBoolean("multiblockPresent");
|
||||
AspectList al = new AspectList();
|
||||
NBTTagCompound cmp = compound.getCompoundTag("aspects");
|
||||
for (Object tag : cmp.func_150296_c()) {
|
||||
String strTag = (String) tag;
|
||||
int amt = cmp.getInteger(strTag);
|
||||
al.add(Aspect.getAspect(strTag), amt);
|
||||
}
|
||||
this.al = al;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeCustomNBT(NBTTagCompound compound) {
|
||||
super.writeCustomNBT(compound);
|
||||
|
||||
compound.setBoolean("isMasterTile", this.isMasterTile);
|
||||
compound.setInteger("multiblockId", this.multiblockId);
|
||||
compound.setInteger("multiblockYIndex", this.multiblockYIndex);
|
||||
compound.setBoolean("multiblockPresent", this.isMasterTile);
|
||||
NBTTagCompound aspects = new NBTTagCompound();
|
||||
for (Aspect a : al.aspects.keySet()) {
|
||||
aspects.setInteger(a.getTag(), al.aspects.get(a));
|
||||
}
|
||||
compound.setTag("aspects", aspects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AspectList getAspects() {
|
||||
if(!isMultiblockFormed()) {
|
||||
return new AspectList();
|
||||
} else {
|
||||
if(isMasterTile()) {
|
||||
return al;
|
||||
} else {
|
||||
TileEssentiaCompressor master = tryFindMasterTile();
|
||||
if(master == null) return new AspectList();
|
||||
return master.getAspects();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAspects(AspectList list) {}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerAccept(Aspect aspect) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addToContainer(Aspect aspect, int i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean takeFromContainer(Aspect aspect, int i) {
|
||||
if(isMultiblockFormed() && multiblockYIndex == 1) {
|
||||
TileEssentiaCompressor master = tryFindMasterTile();
|
||||
if(master == null) return false;
|
||||
boolean couldTake = master.al.reduce(aspect, i);
|
||||
master.al.remove(aspect, 0);
|
||||
worldObj.markBlockForUpdate(master.xCoord, master.yCoord, master.zCoord);
|
||||
markDirty();
|
||||
return couldTake;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean takeFromContainer(AspectList list) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerContainAmount(Aspect aspect, int i) {
|
||||
if(isMultiblockFormed() && multiblockYIndex == 1) {
|
||||
TileEssentiaCompressor master = tryFindMasterTile();
|
||||
if(master == null) return false;
|
||||
return master.al.getAmount(aspect) >= i;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerContain(AspectList list) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int containerContains(Aspect aspect) {
|
||||
if(isMultiblockFormed() && multiblockYIndex == 1) {
|
||||
TileEssentiaCompressor master = tryFindMasterTile();
|
||||
if(master == null) return 0;
|
||||
return master.al.getAmount(aspect);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isConnectable(ForgeDirection direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInputFrom(ForgeDirection direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canOutputTo(ForgeDirection direction) {
|
||||
if(isMultiblockFormed() && multiblockYIndex == 1) { //The middle one
|
||||
return direction == ForgeDirection.SOUTH ||
|
||||
direction == ForgeDirection.NORTH ||
|
||||
direction == ForgeDirection.EAST ||
|
||||
direction == ForgeDirection.WEST;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSuction(Aspect aspect, int i) {}
|
||||
|
||||
@Override
|
||||
public Aspect getSuctionType(ForgeDirection direction) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSuctionAmount(ForgeDirection direction) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int takeEssentia(Aspect aspect, int i, ForgeDirection direction) {
|
||||
if(isMultiblockFormed() && multiblockYIndex == 1) {
|
||||
if(!canOutputTo(direction)) return 0;
|
||||
TileEssentiaCompressor master = tryFindMasterTile();
|
||||
if(master == null) return 0;
|
||||
int amt = master.al.getAmount(aspect);
|
||||
int taken = amt - master.al.remove(aspect, i).getAmount(aspect);
|
||||
worldObj.markBlockForUpdate(master.xCoord, master.yCoord, master.zCoord);
|
||||
markDirty();
|
||||
return taken;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addEssentia(Aspect aspect, int i, ForgeDirection direction) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Aspect getEssentiaType(ForgeDirection direction) {
|
||||
if(isMultiblockFormed() && multiblockYIndex == 1) {
|
||||
TileEssentiaCompressor master = tryFindMasterTile();
|
||||
if(master == null) return null;
|
||||
return new ArrayList<Aspect>(master.al.aspects.keySet()).get(worldObj.rand.nextInt(master.al.size()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEssentiaAmount(ForgeDirection direction) {
|
||||
if(isMultiblockFormed() && multiblockYIndex == 1) {
|
||||
TileEssentiaCompressor master = tryFindMasterTile();
|
||||
if(master == null) return 0;
|
||||
return master.al.visSize();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinimumSuction() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderExtendedTube() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package makeo.gadomancy.common.entities;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import makeo.gadomancy.common.items.ItemElement;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntityFlameFX;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.client.fx.bolt.FXLightningBolt;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* HellFirePvP@Admin
|
||||
* Date: 23.04.2016 / 13:45
|
||||
* on Gadomancy
|
||||
* EntityItemElement
|
||||
*/
|
||||
public class EntityItemElement extends EntityItem {
|
||||
|
||||
public EntityItemElement(World world, double x, double y, double z) {
|
||||
super(world, x, y, z);
|
||||
}
|
||||
|
||||
public EntityItemElement(World world, double x, double y, double z, ItemStack itemStack) {
|
||||
super(world, x, y, z, itemStack);
|
||||
}
|
||||
|
||||
public EntityItemElement(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
ItemStack stack = getEntityItem();
|
||||
if(stack == null || !(stack.getItem() instanceof ItemElement)) return;
|
||||
int meta = stack.getItemDamage();
|
||||
ItemElement.EnumElementType element = ItemElement.EnumElementType.values()[meta % ItemElement.EnumElementType.values().length];
|
||||
|
||||
if(!worldObj.isRemote && (ticksExisted & 15) == 0) {
|
||||
doElementServerEffects(element, worldObj, posX, posY, posZ);
|
||||
}
|
||||
|
||||
if (this.age + 5 >= this.lifespan) {
|
||||
this.age = 0;
|
||||
}
|
||||
|
||||
if(worldObj.isRemote && worldObj.rand.nextInt(4) == 0) {
|
||||
playClientElementEffect(element, worldObj, posX, posY, posZ);
|
||||
}
|
||||
}
|
||||
|
||||
public static void doElementServerEffects(ItemElement.EnumElementType type, World world, double posX, double posY, double posZ) {
|
||||
List entities = world.getEntitiesWithinAABB(EntityLivingBase.class,
|
||||
AxisAlignedBB.getBoundingBox(posX - 0.5, posY - 0.5, posZ - 0.5,
|
||||
posX + 0.5, posY + 0.5, posZ + 0.5).expand(8, 8, 8));
|
||||
for (Object o : entities) {
|
||||
if(o == null ||
|
||||
!(o instanceof EntityLivingBase) ||
|
||||
((EntityLivingBase) o).isDead) continue;
|
||||
type.getRunnable().affectEntity((EntityLivingBase) o);
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void playClientElementEffect(ItemElement.EnumElementType element, World worldObj, double posX, double posY, double posZ) {
|
||||
float randOffsetX = worldObj.rand.nextFloat() * (worldObj.rand.nextBoolean() ? 1 : -1);
|
||||
float randOffsetY = worldObj.rand.nextFloat() * (worldObj.rand.nextBoolean() ? 1 : -1);
|
||||
float randOffsetZ = worldObj.rand.nextFloat() * (worldObj.rand.nextBoolean() ? 1 : -1);
|
||||
switch (element) {
|
||||
case DARKNESS:
|
||||
FXLightningBolt bolt = new FXLightningBolt(Minecraft.getMinecraft().theWorld, posX, posY + 0.2F, posZ,
|
||||
posX + randOffsetX / 2, posY + randOffsetY / 2, posZ + randOffsetZ / 2, Minecraft.getMinecraft().theWorld.rand.nextLong(), 10, 4.0F, 5);
|
||||
bolt.defaultFractal();
|
||||
bolt.setType(5);
|
||||
bolt.finalizeBolt();
|
||||
break;
|
||||
/*case ORDER:
|
||||
Thaumcraft.proxy.wispFX(worldObj, posX + randOffsetX / 4, posY + 0.2F + randOffsetY / 4, posZ + randOffsetZ / 4, 0.1F, 0xFF, 0xFF, 0xFF);
|
||||
break;
|
||||
case FIRE:
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(
|
||||
new EntityFlameFX(worldObj, posX + randOffsetX / 4, posY + 0.2F + randOffsetY / 4, posZ + randOffsetZ / 4, 0, 0, 0));
|
||||
break;*/
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,6 +9,8 @@ import makeo.gadomancy.common.blocks.tiles.TileNodeManipulator;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileStickyJar;
|
||||
import makeo.gadomancy.common.data.SyncDataHolder;
|
||||
import makeo.gadomancy.common.data.config.ModConfig;
|
||||
import makeo.gadomancy.common.entities.EntityItemElement;
|
||||
import makeo.gadomancy.common.items.ItemElement;
|
||||
import makeo.gadomancy.common.registration.RegisteredBlocks;
|
||||
import makeo.gadomancy.common.registration.RegisteredItems;
|
||||
import makeo.gadomancy.common.utils.GolemEnumHelper;
|
||||
@@ -59,10 +61,23 @@ public class EventHandlerWorld {
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.LOW)
|
||||
public void on(EntityJoinWorldEvent event) {
|
||||
if(!event.world.isRemote && event.entity instanceof EntityItem
|
||||
&& isDisguised(((EntityItem) event.entity).getEntityItem())) {
|
||||
long time = event.world.getTotalWorldTime() + event.world.rand.nextInt(60) + 40;
|
||||
trackedItems.put((EntityItem) event.entity, time);
|
||||
if(!event.world.isRemote && event.entity instanceof EntityItem) {
|
||||
ItemStack stack = ((EntityItem) event.entity).getEntityItem();
|
||||
if(isDisguised(stack)) {
|
||||
long time = event.world.getTotalWorldTime() + event.world.rand.nextInt(60) + 40;
|
||||
trackedItems.put((EntityItem) event.entity, time);
|
||||
}
|
||||
if(stack.getItem() instanceof ItemElement && !(event.entity instanceof EntityItemElement)) {
|
||||
event.setCanceled(true);
|
||||
EntityItem newItem = new EntityItemElement(event.world,
|
||||
event.entity.posX, event.entity.posY, event.entity.posZ,
|
||||
((EntityItem) event.entity).getEntityItem());
|
||||
newItem.delayBeforeCanPickup = ((EntityItem) event.entity).delayBeforeCanPickup;
|
||||
newItem.motionX = event.entity.motionX;
|
||||
newItem.motionY = event.entity.motionY;
|
||||
newItem.motionZ = event.entity.motionZ;
|
||||
event.world.spawnEntityInWorld(newItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ public class ItemAuraCore extends Item {
|
||||
|
||||
AIR(Aspect.AIR),
|
||||
FIRE(Aspect.FIRE),
|
||||
WATER(Aspect.WATER, true),
|
||||
WATER(Aspect.WATER),
|
||||
EARTH(Aspect.EARTH, true),
|
||||
ORDER(Aspect.ORDER),
|
||||
ENTROPY(Aspect.ENTROPY, true);
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package makeo.gadomancy.common.items;
|
||||
|
||||
import makeo.gadomancy.common.registration.RegisteredItems;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* HellFirePvP@Admin
|
||||
* Date: 22.04.2016 / 21:58
|
||||
* on Gadomancy
|
||||
* ItemBlockEssentiaCompressor
|
||||
*/
|
||||
public class ItemBlockEssentiaCompressor extends ItemBlock {
|
||||
|
||||
public ItemBlockEssentiaCompressor(Block block) {
|
||||
super(block);
|
||||
setMaxDamage(0);
|
||||
setCreativeTab(RegisteredItems.creativeTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack p_77613_1_) {
|
||||
return RegisteredItems.raritySacred;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package makeo.gadomancy.common.items;
|
||||
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.entities.EntityItemElement;
|
||||
import makeo.gadomancy.common.registration.RegisteredItems;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* HellFirePvP@Admin
|
||||
* Date: 23.04.2016 / 01:52
|
||||
* on Gadomancy
|
||||
* ItemElementVoid
|
||||
*/
|
||||
public class ItemElement extends Item {
|
||||
|
||||
public ItemElement() {
|
||||
setMaxStackSize(1);
|
||||
setHasSubtypes(true);
|
||||
setUnlocalizedName("ItemElement");
|
||||
setTextureName(Gadomancy.MODID + ":element");
|
||||
setCreativeTab(RegisteredItems.creativeTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return getUnlocalizedName() + "." + stack.getItemDamage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int metadata) {
|
||||
return metadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean isHolding) {
|
||||
if(stack == null || !(stack.getItem() instanceof ItemElement)) return;
|
||||
int meta = stack.getItemDamage();
|
||||
ItemElement.EnumElementType element = ItemElement.EnumElementType.values()[meta % ItemElement.EnumElementType.values().length];
|
||||
|
||||
if(!world.isRemote) {
|
||||
if((world.getTotalWorldTime() & 15) == 0) {
|
||||
EntityItemElement.doElementServerEffects(element, world, entity.posX, entity.posY, entity.posZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list) {
|
||||
for (EnumElementType type : EnumElementType.values()) {
|
||||
list.add(new ItemStack(this, 1, type.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack p_77613_1_) {
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColorFromItemStack(ItemStack stack, int pass) {
|
||||
int dmg = stack.getItemDamage();
|
||||
if(dmg < EnumElementType.values().length) {
|
||||
return EnumElementType.values()[dmg].getRenderColor();
|
||||
}
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
|
||||
public static abstract class ElementRunnable {
|
||||
|
||||
public abstract void affectEntity(EntityLivingBase livingBase);
|
||||
|
||||
}
|
||||
|
||||
public static enum EnumElementType {
|
||||
|
||||
DARKNESS(0x000000, new ElementRunnable() {
|
||||
@Override
|
||||
public void affectEntity(EntityLivingBase livingBase) {
|
||||
livingBase.addPotionEffect(new PotionEffect(Potion.blindness.getId(), 100, 0, true));
|
||||
}
|
||||
});
|
||||
/*ORDER(0xFFFFFF, new ElementRunnable() {
|
||||
@Override
|
||||
public void affectEntity(EntityLivingBase livingBase) {
|
||||
livingBase.addPotionEffect(new PotionEffect(Potion.nightVision.getId(), 300, 0, true));
|
||||
}
|
||||
}),
|
||||
FIRE(0x970000, new ElementRunnable() {
|
||||
@Override
|
||||
public void affectEntity(EntityLivingBase livingBase) {
|
||||
livingBase.setFire(10);
|
||||
}
|
||||
});*/
|
||||
|
||||
private final int renderColor;
|
||||
private final ElementRunnable runnable;
|
||||
|
||||
private EnumElementType(int color, ElementRunnable runnable) {
|
||||
this.renderColor = color;
|
||||
this.runnable = runnable;
|
||||
}
|
||||
|
||||
public ElementRunnable getRunnable() {
|
||||
return runnable;
|
||||
}
|
||||
|
||||
public int getRenderColor() {
|
||||
return renderColor;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -47,6 +47,17 @@ public class PacketTCNodeBolt implements IMessage, IMessageHandler<PacketTCNodeB
|
||||
this.mightGetLong = mightGetLong;
|
||||
}
|
||||
|
||||
public PacketTCNodeBolt(double posX, double posY, double posZ, double targetX, double targetY, double targetZ, int type, boolean mightGetLong) {
|
||||
this.x = (float) posX;
|
||||
this.y = (float) posY;
|
||||
this.z = (float) posZ;
|
||||
this.targetX = (float) targetX;
|
||||
this.targetY = (float) targetY;
|
||||
this.targetZ = (float) targetZ;
|
||||
this.type = type;
|
||||
this.mightGetLong = mightGetLong;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
this.x = buf.readFloat();
|
||||
|
||||
@@ -5,6 +5,7 @@ import makeo.gadomancy.api.ClickBehavior;
|
||||
import makeo.gadomancy.common.blocks.BlockAdditionalEldritchPortal;
|
||||
import makeo.gadomancy.common.blocks.BlockArcaneDropper;
|
||||
import makeo.gadomancy.common.blocks.BlockAuraPylon;
|
||||
import makeo.gadomancy.common.blocks.BlockEssentiaCompressor;
|
||||
import makeo.gadomancy.common.blocks.BlockExtendedNodeJar;
|
||||
import makeo.gadomancy.common.blocks.BlockInfusionClaw;
|
||||
import makeo.gadomancy.common.blocks.BlockKnowledgeBook;
|
||||
@@ -17,6 +18,7 @@ import makeo.gadomancy.common.blocks.tiles.*;
|
||||
import makeo.gadomancy.common.data.config.ModConfig;
|
||||
import makeo.gadomancy.common.items.ItemBlockAdditionalEldritchPortal;
|
||||
import makeo.gadomancy.common.items.ItemBlockAuraPylon;
|
||||
import makeo.gadomancy.common.items.ItemBlockEssentiaCompressor;
|
||||
import makeo.gadomancy.common.items.ItemBlockKnowledgeBook;
|
||||
import makeo.gadomancy.common.items.ItemBlockRemoteJar;
|
||||
import makeo.gadomancy.common.items.ItemBlockStoneMachine;
|
||||
@@ -59,6 +61,7 @@ public class RegisteredBlocks {
|
||||
public static BlockAdditionalEldritchPortal blockAdditionalEldrichPortal;
|
||||
public static BlockAuraPylon blockAuraPylon;
|
||||
public static BlockKnowledgeBook blockKnowledgeBook;
|
||||
public static BlockEssentiaCompressor blockEssentiaCompressor;
|
||||
|
||||
public static void init() {
|
||||
registerBlocks();
|
||||
@@ -82,6 +85,7 @@ public class RegisteredBlocks {
|
||||
blockAdditionalEldrichPortal = registerBlock(new BlockAdditionalEldritchPortal(), ItemBlockAdditionalEldritchPortal.class);
|
||||
blockAuraPylon = registerBlock(new BlockAuraPylon(), ItemBlockAuraPylon.class);
|
||||
blockKnowledgeBook = registerBlock(new BlockKnowledgeBook(), ItemBlockKnowledgeBook.class);
|
||||
blockEssentiaCompressor = registerBlock(new BlockEssentiaCompressor(), ItemBlockEssentiaCompressor.class);
|
||||
}
|
||||
|
||||
private static <T extends Block> T registerBlock(String name, T block) {
|
||||
@@ -123,6 +127,7 @@ public class RegisteredBlocks {
|
||||
registerTile(TileAuraPylonTop.class);
|
||||
registerTile(TileArcanePackager.class);
|
||||
registerTile(TileKnowledgeBook.class);
|
||||
registerTile(TileEssentiaCompressor.class);
|
||||
}
|
||||
|
||||
private static void registerTile(Class<? extends TileEntity> tile, String name) {
|
||||
|
||||
@@ -3,6 +3,7 @@ package makeo.gadomancy.common.registration;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.entities.EntityAuraCore;
|
||||
import makeo.gadomancy.common.entities.EntityItemElement;
|
||||
import makeo.gadomancy.common.entities.EntityPermNoClipItem;
|
||||
import makeo.gadomancy.common.entities.player.FakePlayerEntity;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -21,6 +22,7 @@ public class RegisteredEntities {
|
||||
registerEntity(EntityPermNoClipItem.class, "EntityPermItem", 32, 40, false);
|
||||
registerEntity(EntityAuraCore.class, "EntityAuraCore", 32, 10, true);
|
||||
registerEntity(FakePlayerEntity.class, "FakePlayerEntity", 32, 20, true);
|
||||
registerEntity(EntityItemElement.class, "EntityItemElement", 32, 40, true);
|
||||
}
|
||||
|
||||
private static void registerEntity(Class<? extends Entity> entityClass, String name, int trackingRange, int updateFreq, boolean sendVelUpdates) {
|
||||
|
||||
@@ -56,6 +56,7 @@ public class RegisteredItems {
|
||||
public static ItemArcanePackage itemPackage;
|
||||
public static ItemFakeLootbag itemFakeLootbag;
|
||||
public static ItemAuraCore itemAuraCore;
|
||||
public static ItemElement itemElement;
|
||||
|
||||
public static void preInit() {
|
||||
creativeTab = new CreativeTabs(Gadomancy.MODID) {
|
||||
@@ -83,6 +84,7 @@ public class RegisteredItems {
|
||||
itemFamiliar_old = registerItem(new ItemFamiliar_Old(), "ItemFamiliar");
|
||||
itemEtherealFamiliar = registerItem(new ItemEtherealFamiliar());
|
||||
itemAuraCore = registerItem(new ItemAuraCore());
|
||||
itemElement = registerItem(new ItemElement());
|
||||
|
||||
itemCreativeNode = registerItem(new ItemCreativeNode());
|
||||
itemPackage = registerItem(new ItemArcanePackage());
|
||||
|
||||
@@ -11,6 +11,7 @@ import makeo.gadomancy.common.crafting.RecipeStickyJar;
|
||||
import makeo.gadomancy.common.data.config.ModConfig;
|
||||
import makeo.gadomancy.common.familiar.FamiliarAugment;
|
||||
import makeo.gadomancy.common.items.ItemAuraCore;
|
||||
import makeo.gadomancy.common.items.ItemElement;
|
||||
import makeo.gadomancy.common.items.baubles.ItemEtherealFamiliar;
|
||||
import makeo.gadomancy.common.research.SimpleResearchItem;
|
||||
import makeo.gadomancy.common.utils.RandomizedAspectList;
|
||||
@@ -47,11 +48,13 @@ public class RegisteredRecipes {
|
||||
public static AspectList costsNodeManipulatorMultiblock = new AspectList().add(Aspect.FIRE, 100).add(Aspect.WATER, 100).add(Aspect.EARTH, 100).add(Aspect.AIR, 100).add(Aspect.ORDER, 100).add(Aspect.ENTROPY, 100);
|
||||
public static AspectList costsEldritchPortalCreatorMultiblock = new AspectList().add(Aspect.FIRE, 150).add(Aspect.WATER, 150).add(Aspect.EARTH, 150).add(Aspect.AIR, 150).add(Aspect.ORDER, 150).add(Aspect.ENTROPY, 150);
|
||||
public static AspectList costsAuraPylonMultiblock = new AspectList().add(Aspect.FIRE, 150).add(Aspect.WATER, 150).add(Aspect.EARTH, 150).add(Aspect.AIR, 150).add(Aspect.ORDER, 150).add(Aspect.ENTROPY, 150);
|
||||
public static AspectList costsCompressorMultiblock = new AspectList().add(Aspect.WATER, 140).add(Aspect.EARTH, 80).add(Aspect.AIR, 150).add(Aspect.ORDER, 20).add(Aspect.ENTROPY, 140);
|
||||
//public static AspectList costsAuraCoreStart = new AspectList().add(Aspect.FIRE, 70).add(Aspect.WATER, 70).add(Aspect.EARTH, 70).add(Aspect.AIR, 70).add(Aspect.ORDER, 70).add(Aspect.ENTROPY, 70);
|
||||
|
||||
public static List multiblockNodeManipulator;
|
||||
public static List multiblockEldritchPortalCreator;
|
||||
public static List multiblockAuraPylon;
|
||||
public static List multiblockEssentiaCompressor;
|
||||
public static List[] auraCoreRecipes;
|
||||
|
||||
public static InfusionRecipe recipeGolemSilverwood;
|
||||
@@ -63,6 +66,7 @@ public class RegisteredRecipes {
|
||||
public static InfusionRecipe[] recipesFamiliar;
|
||||
public static InfusionRecipe recipeGolemCoreBodyguard;
|
||||
public static InfusionRecipe recipePortalFocus;
|
||||
public static InfusionRecipe recipeElementVoid;
|
||||
|
||||
//For indexing, look below...
|
||||
public static InfusionRecipe[][] recipesFamiliarAugmentation;
|
||||
@@ -83,6 +87,7 @@ public class RegisteredRecipes {
|
||||
public static IArcaneRecipe recipeAuraPylonPeak;
|
||||
public static IArcaneRecipe recipeArcanePackager;
|
||||
public static IArcaneRecipe recipeKnowledgeBook;
|
||||
public static IArcaneRecipe recipeEssentiaCompressor;
|
||||
|
||||
public static InfusionEnchantmentRecipe recipeRevealer;
|
||||
|
||||
@@ -243,6 +248,34 @@ public class RegisteredRecipes {
|
||||
'B', new ItemStack(Items.book), 'O', ordoCore,
|
||||
'M', new ItemStack(ConfigBlocks.blockMetalDevice, 1, 12), 'G', new ItemStack(ConfigItems.itemGoggles));
|
||||
|
||||
ItemStack voidMetalIngot = new ItemStack(ConfigItems.itemResource, 1, 16);
|
||||
ItemStack salisMundus = new ItemStack(ConfigItems.itemResource, 1, 14);
|
||||
ItemStack alumentum = new ItemStack(ConfigItems.itemResource);
|
||||
recipeElementVoid = ThaumcraftApi.addInfusionCraftingRecipe(Gadomancy.MODID.toUpperCase() + ".ESSENTIA_COMPRESSOR", new ItemStack(RegisteredItems.itemElement, 1, ItemElement.EnumElementType.DARKNESS.ordinal()), 6,
|
||||
new RandomizedAspectList().setHalfCap(true).addAspectRandomBase(Aspect.VOID, 22).addAspectRandomBase(Aspect.DARKNESS, 18).addAspectRandomBase(Aspect.ELDRITCH, 20).addAspectRandomBase(Aspect.AURA, 10),
|
||||
new ItemStack(ConfigItems.itemResource, 1, 17),
|
||||
new ItemStack[] { alumentum, voidMetalIngot, voidMetalIngot, salisMundus, alumentum, voidMetalIngot, voidMetalIngot, salisMundus });
|
||||
|
||||
ItemStack waterCore = new ItemStack(RegisteredItems.itemAuraCore);
|
||||
RegisteredItems.itemAuraCore.setCoreType(waterCore, ItemAuraCore.AuraCoreType.WATER);
|
||||
|
||||
recipeEssentiaCompressor = ThaumcraftApi.addArcaneCraftingRecipe(Gadomancy.MODID.toUpperCase() + ".ESSENTIA_COMPRESSOR", new ItemStack(RegisteredBlocks.blockEssentiaCompressor, 3),
|
||||
new AspectList().add(Aspect.WATER, 190).add(Aspect.ORDER, 150).add(Aspect.ENTROPY, 120).add(Aspect.FIRE, 100).add(Aspect.AIR, 160).add(Aspect.EARTH, 60),
|
||||
"LRL", "TET", "LCL",
|
||||
'L', new ItemStack(ConfigBlocks.blockMagicalLog),
|
||||
'R', new ItemStack(ConfigBlocks.blockEssentiaReservoir),
|
||||
'T', new ItemStack(ConfigBlocks.blockTube, 1, 6),
|
||||
'E', new ItemStack(RegisteredItems.itemElement, 1, ItemElement.EnumElementType.DARKNESS.ordinal()),
|
||||
'C', waterCore);
|
||||
|
||||
multiblockEssentiaCompressor = Arrays.asList(costsCompressorMultiblock, 1, 3, 1,
|
||||
Arrays.asList(
|
||||
new ItemStack(RegisteredBlocks.blockEssentiaCompressor),
|
||||
new ItemStack(RegisteredBlocks.blockEssentiaCompressor),
|
||||
new ItemStack(RegisteredBlocks.blockEssentiaCompressor)
|
||||
));
|
||||
|
||||
|
||||
auraCoreRecipes = createAuraCoreRecipes();
|
||||
|
||||
ThaumcraftApi.getCraftingRecipes().add(new InfusionDisguiseArmor());
|
||||
|
||||
@@ -51,6 +51,7 @@ public class RegisteredResearches {
|
||||
public static ResearchItem researchNodeManipulator;
|
||||
public static ResearchItem researchEldritchPortalCreator;
|
||||
public static ResearchItem researchBlockProtector;
|
||||
public static ResearchItem researchEssentiaCompressor;
|
||||
|
||||
//Enchantment stuff
|
||||
public static ResearchItem researchRevealer;
|
||||
@@ -317,6 +318,18 @@ public class RegisteredResearches {
|
||||
.setItemTriggers(new ItemStack(RegisteredItems.itemAuraCore, 1, ItemAuraCore.AuraCoreType.ORDER.ordinal()))
|
||||
.setPages(new ResearchPage("gadomancy.research_page.KNOWLEDGE_BOOK.1"), new ResearchPage(RegisteredRecipes.recipeKnowledgeBook)).registerResearchItem();
|
||||
|
||||
ResearchItem researchVReservoir = PseudoResearchItem.create("ESSENTIARESERVOIR", -5, 9).registerResearchItem();
|
||||
|
||||
researchEssentiaCompressor = new SimpleResearchItem("ESSENTIA_COMPRESSOR",
|
||||
-4, 7, 2, new ItemStack(RegisteredBlocks.blockEssentiaCompressor),
|
||||
new AspectList().add(Aspect.VOID, 12).add(Aspect.WATER, 10).add(Aspect.ENTROPY, 12).add(Aspect.MAGIC, 6).add(Aspect.MECHANISM, 12))
|
||||
.setHidden()
|
||||
.setParents(researchAuraCore.key, researchVReservoir.key)
|
||||
.setItemTriggers(new ItemStack(RegisteredItems.itemAuraCore, 1, ItemAuraCore.AuraCoreType.WATER.ordinal()))
|
||||
.setPages(new ResearchPage("gadomancy.research_page.ESSENTIA_COMPRESSOR.1"), new ResearchPage(RegisteredRecipes.recipeElementVoid),
|
||||
new ResearchPage("gadomancy.research_page.ESSENTIA_COMPRESSOR.3"), new ResearchPage(RegisteredRecipes.recipeEssentiaCompressor),
|
||||
new ResearchPage("gadomancy.research_page.ESSENTIA_COMPRESSOR.5"), new ResearchPage(RegisteredRecipes.multiblockEssentiaCompressor)).registerResearchItem();
|
||||
|
||||
String[] packagerParents = Config.wardedStone ? new String[] { researchAuraCore.key, "WARDEDARCANA" } : new String[] { researchAuraCore.key };
|
||||
researchArcanePackager = new SimpleResearchItem("ARCANE_PACKAGER",
|
||||
2, 7, 2, new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 4),
|
||||
@@ -343,7 +356,8 @@ public class RegisteredResearches {
|
||||
ThaumcraftApi.addWarpToResearch(Gadomancy.MODID.toUpperCase() + ".NODE_MANIPULATOR", 4);
|
||||
ThaumcraftApi.addWarpToResearch(Gadomancy.MODID.toUpperCase() + ".GROWING_GROWTHCLUE", 3);
|
||||
ThaumcraftApi.addWarpToResearch(Gadomancy.MODID.toUpperCase() + ".E_PORTAL_CREATOR", 4);
|
||||
ThaumcraftApi.addWarpToResearch(Gadomancy.MODID.toUpperCase() + ".KNOWLEDGE_BOOK", 2);
|
||||
ThaumcraftApi.addWarpToResearch(Gadomancy.MODID.toUpperCase() + ".KNOWLEDGE_BOOK", 1);
|
||||
ThaumcraftApi.addWarpToResearch(Gadomancy.MODID.toUpperCase() + ".ESSENTIA_COMPRESSOR", 2);
|
||||
}
|
||||
|
||||
public static void postInit() {
|
||||
|
||||
@@ -36,12 +36,16 @@ import java.util.List;
|
||||
public class ExplosionHelper {
|
||||
|
||||
public static void taintplosion(World world, int x, int y, int z, boolean taintBiome, int chanceToTaint) {
|
||||
taintplosion(world, x, y, z, taintBiome, chanceToTaint, 3.0F, 10, 80);
|
||||
}
|
||||
|
||||
public static void taintplosion(World world, int x, int y, int z, boolean taintBiome, int chanceToTaint, float str, int size, int blocksAffected) {
|
||||
if(chanceToTaint < 1) chanceToTaint = 1;
|
||||
world.createExplosion(null, x + 0.5D, y + 0.5D, z + 0.5D, 3.0F, false);
|
||||
for (int a = 0; a < 80; a++) {
|
||||
int xx = x + world.rand.nextInt(10) - world.rand.nextInt(10);
|
||||
int yy = y + world.rand.nextInt(10) - world.rand.nextInt(10);
|
||||
int zz = z + world.rand.nextInt(10) - world.rand.nextInt(10);
|
||||
world.createExplosion(null, x + 0.5D, y + 0.5D, z + 0.5D, str, false);
|
||||
for (int a = 0; a < blocksAffected; a++) {
|
||||
int xx = x + world.rand.nextInt(size) - world.rand.nextInt(size);
|
||||
int yy = y + world.rand.nextInt(size) - world.rand.nextInt(size);
|
||||
int zz = z + world.rand.nextInt(size) - world.rand.nextInt(size);
|
||||
if (world.isAirBlock(xx, yy, zz)) {
|
||||
if (yy < y) {
|
||||
world.setBlock(xx, yy, zz, ConfigBlocks.blockFluxGoo, 8, 3);
|
||||
|
||||
@@ -44,6 +44,13 @@ public final class MiscUtils {
|
||||
}
|
||||
return roman;
|
||||
}
|
||||
|
||||
public static Vector3 interpolateEntityPosition(Entity entity, float partialTicks) {
|
||||
double iPx = entity.prevPosX + (entity.posX - entity.prevPosX) * partialTicks;
|
||||
double iPy = entity.prevPosY + (entity.posY - entity.prevPosY) * partialTicks;
|
||||
double iPz = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * partialTicks;
|
||||
return new Vector3(iPx, iPy, iPz);
|
||||
}
|
||||
|
||||
public static int ticksForDays(int days) {
|
||||
return ticksForHours(days * 24);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package makeo.gadomancy.common.utils;
|
||||
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
import java.util.Formatter;
|
||||
import java.util.Locale;
|
||||
@@ -48,6 +49,12 @@ public class Vector3 {
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public Vector3(Vec3 vec3) {
|
||||
this.x = vec3.xCoord;
|
||||
this.y = vec3.yCoord;
|
||||
this.z = vec3.zCoord;
|
||||
}
|
||||
|
||||
public Vector3 add(Vector3 vec) {
|
||||
this.x += vec.x;
|
||||
this.y += vec.y;
|
||||
|
||||
@@ -75,8 +75,8 @@ public class GadomancyTransformer extends AccessTransformer {
|
||||
}
|
||||
}
|
||||
} else if(name.equalsIgnoreCase(NAME_NODE_RENDERER)) {
|
||||
for(MethodNode mn : node.methods) {
|
||||
if(mn.name.equals("renderTileEntityAt")) {
|
||||
for (MethodNode mn : node.methods) {
|
||||
if (mn.name.equals("renderTileEntityAt")) {
|
||||
InsnList setBefore = new InsnList();
|
||||
setBefore.add(new VarInsnNode(Opcodes.ALOAD, 1));
|
||||
setBefore.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "makeo/gadomancy/common/events/EventHandlerRedirect",
|
||||
@@ -85,11 +85,11 @@ public class GadomancyTransformer extends AccessTransformer {
|
||||
mn.instructions.insertBefore(mn.instructions.get(0), setBefore);
|
||||
|
||||
AbstractInsnNode next = mn.instructions.get(0);
|
||||
while(next != null) {
|
||||
while (next != null) {
|
||||
AbstractInsnNode insnNode = next;
|
||||
next = insnNode.getNext();
|
||||
|
||||
if(insnNode.getOpcode() == Opcodes.RETURN) {
|
||||
if (insnNode.getOpcode() == Opcodes.RETURN) {
|
||||
InsnList setAfter = new InsnList();
|
||||
setAfter.add(new VarInsnNode(Opcodes.ALOAD, 1));
|
||||
setAfter.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "makeo/gadomancy/common/events/EventHandlerRedirect",
|
||||
|
||||
Reference in new issue
Block a user