mirror of
https://github.com/GTNewHorizons/Gadomancy.git
synced 2026-11-27 15:23:22 +00:00
update BS+SA
This commit is contained in:
262 files changed
+8101
-4674
No files matched your search
@@ -1,12 +1,11 @@
|
||||
package makeo.gadomancy.api;
|
||||
|
||||
import java.util.Random;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -137,14 +136,10 @@ public abstract class AuraEffect {
|
||||
|
||||
@Override
|
||||
public final void doEntityEffect(ChunkCoordinates originTile, Entity e) {}
|
||||
|
||||
}
|
||||
|
||||
public enum EffectType {
|
||||
|
||||
ENTITY_EFFECT,
|
||||
BLOCK_EFFECT
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -44,7 +44,7 @@ public abstract class ClickBehavior {
|
||||
*/
|
||||
public abstract boolean isValidForBlock();
|
||||
|
||||
//TODO not handled as expected.
|
||||
// TODO not handled as expected.
|
||||
public boolean hasVisCost() {
|
||||
return this.hasVisCost;
|
||||
}
|
||||
@@ -53,5 +53,5 @@ public abstract class ClickBehavior {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void addInstability(int instability) { }
|
||||
public void addInstability(int instability) {}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package makeo.gadomancy.api;
|
||||
|
||||
import java.util.List;
|
||||
import makeo.gadomancy.api.golems.AdditionalGolemType;
|
||||
import makeo.gadomancy.api.golems.cores.AdditionalGolemCore;
|
||||
import makeo.gadomancy.api.internal.IApiHandler;
|
||||
@@ -8,8 +9,6 @@ import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.common.entities.golems.EntityGolemBase;
|
||||
import thaumcraft.common.entities.golems.EnumGolemType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -20,12 +19,13 @@ import java.util.List;
|
||||
*/
|
||||
public abstract class GadomancyApi {
|
||||
private static IApiHandler handler;
|
||||
|
||||
public static void setInstance(IApiHandler handler) {
|
||||
GadomancyApi.handler = handler;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static boolean registerAdditionalGolemType(String name, String modId, AdditionalGolemType newType){
|
||||
public static boolean registerAdditionalGolemType(String name, String modId, AdditionalGolemType newType) {
|
||||
return GadomancyApi.handler.registerAdditionalGolemType(name, modId, newType);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,15 @@ public abstract class AdditionalGolemType {
|
||||
public final int regenDelay;
|
||||
public final int strength;
|
||||
|
||||
public AdditionalGolemType(int maxHealth, int armor, float movementSpeed, boolean fireResist, int upgradeAmount, int carryLimit, int regenDelay, int strength) {
|
||||
public AdditionalGolemType(
|
||||
int maxHealth,
|
||||
int armor,
|
||||
float movementSpeed,
|
||||
boolean fireResist,
|
||||
int upgradeAmount,
|
||||
int carryLimit,
|
||||
int regenDelay,
|
||||
int strength) {
|
||||
this.maxHealth = maxHealth;
|
||||
this.armor = armor;
|
||||
this.movementSpeed = movementSpeed;
|
||||
@@ -43,9 +51,12 @@ public abstract class AdditionalGolemType {
|
||||
public abstract String getUnlocalizedName();
|
||||
|
||||
public abstract void registerIcons(IIconRegister ir);
|
||||
|
||||
public abstract IIcon getIcon(ItemStack stack, int pass);
|
||||
|
||||
public int getRenderPasses() { return 1; }
|
||||
public int getRenderPasses() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public abstract ResourceLocation getEntityTexture();
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package makeo.gadomancy.api.internal;
|
||||
|
||||
import java.util.List;
|
||||
import makeo.gadomancy.api.AuraEffect;
|
||||
import makeo.gadomancy.api.ClickBehavior;
|
||||
import makeo.gadomancy.api.golems.AdditionalGolemType;
|
||||
@@ -8,8 +9,6 @@ import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.common.entities.golems.EntityGolemBase;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
|
||||
@@ -5,6 +5,9 @@ import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
import makeo.gadomancy.client.effect.EffectHandler;
|
||||
import makeo.gadomancy.client.events.ClientHandler;
|
||||
import makeo.gadomancy.client.events.RenderEventHandler;
|
||||
@@ -48,10 +51,6 @@ import thaumcraft.common.tiles.TileEldritchAltar;
|
||||
import thaumcraft.common.tiles.TileEldritchCap;
|
||||
import thaumcraft.common.tiles.TileEldritchObelisk;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -72,7 +71,7 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
ClientProxy.injectGolemTextures();
|
||||
|
||||
//Tiles
|
||||
// Tiles
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileStickyJar.class, new RenderTileStickyJar());
|
||||
|
||||
RenderTileRemoteJar renderTileRemoteJar = new RenderTileRemoteJar();
|
||||
@@ -96,15 +95,18 @@ public class ClientProxy extends CommonProxy {
|
||||
RenderTileManipulationFocus renderTileManipulationFocus = new RenderTileManipulationFocus();
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileManipulationFocus.class, renderTileManipulationFocus);
|
||||
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileAdditionalEldritchPortal.class, new TileEldritchPortalRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(
|
||||
TileAdditionalEldritchPortal.class, new TileEldritchPortalRenderer());
|
||||
|
||||
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"));
|
||||
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);
|
||||
|
||||
//ClientRegistry.bindTileEntitySpecialRenderer(TileAIShutdown.class, new RenderTileAIShutdown());
|
||||
// ClientRegistry.bindTileEntitySpecialRenderer(TileAIShutdown.class, new RenderTileAIShutdown());
|
||||
|
||||
RenderTileAuraPylon renderTileAuraPylon = new RenderTileAuraPylon();
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileAuraPylon.class, renderTileAuraPylon);
|
||||
@@ -119,28 +121,41 @@ public class ClientProxy extends CommonProxy {
|
||||
RenderTileKnowledgeBook bookRender = new RenderTileKnowledgeBook();
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileKnowledgeBook.class, bookRender);
|
||||
|
||||
//Items
|
||||
// Items
|
||||
TileArcaneDropper fakeTile = new TileArcaneDropper();
|
||||
fakeTile.blockMetadata = 8 | ForgeDirection.SOUTH.ordinal();
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockArcaneDropper), new ItemRenderTileEntity<TileArcaneDropper>(renderTileArcaneDropper, fakeTile));
|
||||
MinecraftForgeClient.registerItemRenderer(
|
||||
Item.getItemFromBlock(RegisteredBlocks.blockArcaneDropper),
|
||||
new ItemRenderTileEntity<TileArcaneDropper>(renderTileArcaneDropper, fakeTile));
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockInfusionClaw), new ItemRenderTileEntity<TileInfusionClaw>(renderTileInfusionClaw, new TileInfusionClaw()));
|
||||
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(RegisteredBlocks.blockEssentiaCompressor),
|
||||
new ItemRenderTileEntity<TileEssentiaCompressor>(
|
||||
renderTileEssentiaCompressor, new TileEssentiaCompressor()));
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ConfigBlocks.blockAiry), new ItemExNodeRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(
|
||||
Item.getItemFromBlock(ConfigBlocks.blockAiry), new ItemExNodeRenderer());
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockKnowledgeBook), new ItemRenderTEKnowledgeBook(bookRender));
|
||||
MinecraftForgeClient.registerItemRenderer(
|
||||
Item.getItemFromBlock(RegisteredBlocks.blockKnowledgeBook), new ItemRenderTEKnowledgeBook(bookRender));
|
||||
|
||||
ItemRenderTileEntityMulti multi = new ItemRenderTileEntityMulti(new ItemRenderTileEntityMulti.RenderSet(renderTileAuraPylon, new TileAuraPylon(), 0),
|
||||
new ItemRenderTileEntityMulti.RenderSet(renderTileAuraPylon, new TileAuraPylonTop(), 1));
|
||||
ItemRenderTileEntityMulti multi = new ItemRenderTileEntityMulti(
|
||||
new ItemRenderTileEntityMulti.RenderSet(renderTileAuraPylon, new TileAuraPylon(), 0),
|
||||
new ItemRenderTileEntityMulti.RenderSet(renderTileAuraPylon, new TileAuraPylonTop(), 1));
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockAuraPylon), multi);
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(RegisteredItems.itemExtendedNodeJar, new ItemJarExtendedNodeRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockRemoteJar), new ItemRenderRemoteJar(renderTileRemoteJar));
|
||||
MinecraftForgeClient.registerItemRenderer(
|
||||
RegisteredItems.itemExtendedNodeJar, new ItemJarExtendedNodeRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(
|
||||
Item.getItemFromBlock(RegisteredBlocks.blockRemoteJar), new ItemRenderRemoteJar(renderTileRemoteJar));
|
||||
|
||||
ItemRenderStoneMachine itemRenderStoneMachine = new ItemRenderStoneMachine();
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockStoneMachine), itemRenderStoneMachine);
|
||||
MinecraftForgeClient.registerItemRenderer(
|
||||
Item.getItemFromBlock(RegisteredBlocks.blockStoneMachine), itemRenderStoneMachine);
|
||||
itemRenderStoneMachine.registerRenderer(0, new TileManipulationFocus(), renderTileManipulationFocus);
|
||||
TileManipulationFocus tileManipulationFocus = new TileManipulationFocus();
|
||||
tileManipulationFocus.blockMetadata = 3;
|
||||
@@ -153,11 +168,11 @@ public class ClientProxy extends CommonProxy {
|
||||
MinecraftForgeClient.registerItemRenderer(RegisteredItems.itemEtherealFamiliar, new ItemRenderFamiliar());
|
||||
MinecraftForgeClient.registerItemRenderer(RegisteredItems.itemCreativeNode, new ItemCreativeNodeRenderer());
|
||||
|
||||
//Entities
|
||||
// Entities
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityPermNoClipItem.class, new RenderSpecialItem());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityAuraCore.class, new RenderEntityAuraCore());
|
||||
|
||||
//Blocks
|
||||
// Blocks
|
||||
RegisteredBlocks.rendererTransparentBlock = this.registerBlockRenderer(new RenderBlockTransparent());
|
||||
RegisteredBlocks.rendererExtendedNodeJarBlock = this.registerBlockRenderer(new BlockExtendedNodeJarRenderer());
|
||||
RegisteredBlocks.rendererBlockStoneMachine = this.registerBlockRenderer(new RenderBlockStoneMachine());
|
||||
@@ -166,7 +181,7 @@ public class ClientProxy extends CommonProxy {
|
||||
@Override
|
||||
public void postInitalize() {
|
||||
IResourceManager manager = Minecraft.getMinecraft().getResourceManager();
|
||||
if(manager instanceof SimpleReloadableResourceManager) {
|
||||
if (manager instanceof SimpleReloadableResourceManager) {
|
||||
SimpleReloadableResourceManager rm = (SimpleReloadableResourceManager) manager;
|
||||
rm.registerReloadListener(ResourceReloadListener.getInstance());
|
||||
}
|
||||
@@ -188,9 +203,8 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
@Override
|
||||
public void spawnBubbles(World world, float posX, float posY, float posZ, float rangeAroundItem) {
|
||||
MultiTickEffectDispatcher.BubbleFXInfo bubbles =
|
||||
new MultiTickEffectDispatcher.BubbleFXInfo(Minecraft.getMinecraft().theWorld.provider.dimensionId,
|
||||
posX, posY, posZ, 10, rangeAroundItem);
|
||||
MultiTickEffectDispatcher.BubbleFXInfo bubbles = new MultiTickEffectDispatcher.BubbleFXInfo(
|
||||
Minecraft.getMinecraft().theWorld.provider.dimensionId, posX, posY, posZ, 10, rangeAroundItem);
|
||||
MultiTickEffectDispatcher.registerBubbles(bubbles);
|
||||
}
|
||||
|
||||
@@ -199,7 +213,7 @@ public class ClientProxy extends CommonProxy {
|
||||
switch (ID) {
|
||||
case 0:
|
||||
return new GuiGolem(player, (EntityGolemBase) world.getEntityByID(x));
|
||||
//return new AdditionalGolemGui(player, (EntityGolemBase)world.getEntityByID(x));
|
||||
// return new AdditionalGolemGui(player, (EntityGolemBase)world.getEntityByID(x));
|
||||
case 1:
|
||||
return new InfusionClawGui(player.inventory, (IInventory) world.getTileEntity(x, y, z));
|
||||
case 2:
|
||||
@@ -210,7 +224,7 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
public static void injectGolemTextures() {
|
||||
RenderGolemBase render = ClientProxy.unregisterRenderer(EntityGolemBase.class, RenderGolemBase.class);
|
||||
if(render != null) {
|
||||
if (render != null) {
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityGolemBase.class, new RenderAdditionalGolemBase());
|
||||
}
|
||||
}
|
||||
@@ -219,21 +233,21 @@ public class ClientProxy extends CommonProxy {
|
||||
Injector registry = new Injector(RenderingRegistry.instance());
|
||||
List entityRenderers = registry.getField("entityRenderers");
|
||||
|
||||
if(entityRenderers == null) {
|
||||
if (entityRenderers == null) {
|
||||
FMLLog.severe("Failed to get entityRenderers field in RenderingRegistry!");
|
||||
return null;
|
||||
}
|
||||
|
||||
for(int i = 0; i < entityRenderers.size(); i++) {
|
||||
for (int i = 0; i < entityRenderers.size(); i++) {
|
||||
Injector pair = new Injector(entityRenderers.get(i));
|
||||
|
||||
Class<? extends Entity> target = pair.getField("target");
|
||||
|
||||
if(entityClass.equals(target)) {
|
||||
if (entityClass.equals(target)) {
|
||||
Render render = pair.getField("renderer");
|
||||
if(renderClass.isInstance(render)) {
|
||||
if (renderClass.isInstance(render)) {
|
||||
entityRenderers.remove(i);
|
||||
return (T)render;
|
||||
return (T) render;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,8 +59,7 @@ class CheckpointingSet<E> implements Iterable<E> {
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
if (!initialized)
|
||||
throw new IllegalStateException();
|
||||
if (!initialized) throw new IllegalStateException();
|
||||
toRemove.add(cur);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package makeo.gadomancy.client.effect.fx;
|
||||
|
||||
import makeo.gadomancy.common.utils.Vector3;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Random;
|
||||
import makeo.gadomancy.common.utils.Vector3;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
@@ -17,10 +16,17 @@ import java.util.Random;
|
||||
*/
|
||||
public abstract class EntityFXFlowPolicy {
|
||||
|
||||
public abstract void doSubParticles(FXFlow fxFlow, int policyCounter, double posX, double posY, double posZ, double lastPosX, double lastPosY, double lastPosZ);
|
||||
public abstract void doSubParticles(
|
||||
FXFlow fxFlow,
|
||||
int policyCounter,
|
||||
double posX,
|
||||
double posY,
|
||||
double posZ,
|
||||
double lastPosX,
|
||||
double lastPosY,
|
||||
double lastPosZ);
|
||||
|
||||
public enum Policies {
|
||||
|
||||
NO_OP(null),
|
||||
CIRCLE_MIX(new CircularMixPolicy()),
|
||||
CIRCLE(new CircularPolicy()),
|
||||
@@ -35,22 +41,40 @@ public abstract class EntityFXFlowPolicy {
|
||||
public EntityFXFlowPolicy getPolicy() {
|
||||
return this.policy;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static class DefaultPolicy extends EntityFXFlowPolicy {
|
||||
|
||||
@Override
|
||||
public void doSubParticles(FXFlow fxFlow, int policyCounter, double posX, double posY, double posZ, double lastPosX, double lastPosY, double lastPosZ) {
|
||||
this.doParticles(fxFlow, policyCounter, posX, posY, posZ, fxFlow.getRand().nextInt(3) + 1);
|
||||
public void doSubParticles(
|
||||
FXFlow fxFlow,
|
||||
int policyCounter,
|
||||
double posX,
|
||||
double posY,
|
||||
double posZ,
|
||||
double lastPosX,
|
||||
double lastPosY,
|
||||
double lastPosZ) {
|
||||
this.doParticles(
|
||||
fxFlow, policyCounter, posX, posY, posZ, fxFlow.getRand().nextInt(3) + 1);
|
||||
}
|
||||
|
||||
public void doParticles(FXFlow fxFlow, int policyCounter, double posX, double posY, double posZ, int count) {
|
||||
Random rand = fxFlow.getOriginWorld().rand;
|
||||
for (int i = 0; i < count; i++) {
|
||||
Vector3 subOffset = this.genSubOffset(rand, fxFlow.getSurroundingDistance());
|
||||
Color c = (fxFlow.getFadingColor() != null && rand.nextBoolean()) ? fxFlow.getFadingColor() : fxFlow.getColor();
|
||||
FXFlow.FXFlowBase flow = new FXFlow.FXFlowBase(fxFlow.getOriginWorld(), posX + subOffset.getX(), posY + subOffset.getY(), posZ + subOffset.getZ(), c, rand.nextInt(1) + fxFlow.getSurroundingParticleSize(), 6, 240);
|
||||
Color c = (fxFlow.getFadingColor() != null && rand.nextBoolean())
|
||||
? fxFlow.getFadingColor()
|
||||
: fxFlow.getColor();
|
||||
FXFlow.FXFlowBase flow = new FXFlow.FXFlowBase(
|
||||
fxFlow.getOriginWorld(),
|
||||
posX + subOffset.getX(),
|
||||
posY + subOffset.getY(),
|
||||
posZ + subOffset.getZ(),
|
||||
c,
|
||||
rand.nextInt(1) + fxFlow.getSurroundingParticleSize(),
|
||||
6,
|
||||
240);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(flow);
|
||||
}
|
||||
}
|
||||
@@ -68,14 +92,24 @@ public abstract class EntityFXFlowPolicy {
|
||||
public static final int TICKS_PER_FULL_TURN = 40;
|
||||
|
||||
@Override
|
||||
public void doSubParticles(FXFlow fxFlow, int policyCounter, double posX, double posY, double posZ, double lastPosX, double lastPosY, double lastPosZ) {
|
||||
public void doSubParticles(
|
||||
FXFlow fxFlow,
|
||||
int policyCounter,
|
||||
double posX,
|
||||
double posY,
|
||||
double posZ,
|
||||
double lastPosX,
|
||||
double lastPosY,
|
||||
double lastPosZ) {
|
||||
Vector3 rotationAxis = fxFlow.getMovementVector();
|
||||
|
||||
Vector3 perpendicular = rotationAxis.clone().perpendicular().normalize().multiply(fxFlow.getSurroundingDistance());
|
||||
Vector3 perpendicular =
|
||||
rotationAxis.clone().perpendicular().normalize().multiply(fxFlow.getSurroundingDistance());
|
||||
Vector3 counterSide = perpendicular.clone().rotate(Math.toRadians(180), rotationAxis);
|
||||
|
||||
int currentDividedPolicyTick = policyCounter % CircularPolicy.TICKS_PER_FULL_TURN;
|
||||
float currentDegree = 360F * (((float) currentDividedPolicyTick) / ((float) CircularPolicy.TICKS_PER_FULL_TURN));
|
||||
float currentDegree =
|
||||
360F * (((float) currentDividedPolicyTick) / ((float) CircularPolicy.TICKS_PER_FULL_TURN));
|
||||
double currentRad = Math.toRadians(currentDegree);
|
||||
|
||||
perpendicular = perpendicular.rotate(currentRad, rotationAxis);
|
||||
@@ -83,22 +117,51 @@ public abstract class EntityFXFlowPolicy {
|
||||
|
||||
World w = fxFlow.getOriginWorld();
|
||||
Color c = (fxFlow.getFadingColor() != null) ? fxFlow.getFadingColor() : fxFlow.getColor();
|
||||
FXFlow.FXFlowBase flow = new FXFlow.FXFlowBase(w, posX + perpendicular.getX(), posY + perpendicular.getY(), posZ + perpendicular.getZ(), c, fxFlow.getSurroundingParticleSize(), 6, 240);
|
||||
FXFlow.FXFlowBase flow = new FXFlow.FXFlowBase(
|
||||
w,
|
||||
posX + perpendicular.getX(),
|
||||
posY + perpendicular.getY(),
|
||||
posZ + perpendicular.getZ(),
|
||||
c,
|
||||
fxFlow.getSurroundingParticleSize(),
|
||||
6,
|
||||
240);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(flow);
|
||||
FXFlow.FXFlowBase flow2 = new FXFlow.FXFlowBase(w, posX + counterSide.getX(), posY + counterSide.getY(), posZ + counterSide.getZ(), c, fxFlow.getSurroundingParticleSize(), 6, 240);
|
||||
FXFlow.FXFlowBase flow2 = new FXFlow.FXFlowBase(
|
||||
w,
|
||||
posX + counterSide.getX(),
|
||||
posY + counterSide.getY(),
|
||||
posZ + counterSide.getZ(),
|
||||
c,
|
||||
fxFlow.getSurroundingParticleSize(),
|
||||
6,
|
||||
240);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(flow2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static class CircularMixPolicy extends CircularPolicy {
|
||||
|
||||
@Override
|
||||
public void doSubParticles(FXFlow fxFlow, int policyCounter, double posX, double posY, double posZ, double lastPosX, double lastPosY, double lastPosZ) {
|
||||
public void doSubParticles(
|
||||
FXFlow fxFlow,
|
||||
int policyCounter,
|
||||
double posX,
|
||||
double posY,
|
||||
double posZ,
|
||||
double lastPosX,
|
||||
double lastPosY,
|
||||
double lastPosZ) {
|
||||
super.doSubParticles(fxFlow, policyCounter, posX, posY, posZ, lastPosX, lastPosY, lastPosZ);
|
||||
|
||||
((DefaultPolicy) Policies.DEFAULT.getPolicy()).doParticles(fxFlow, policyCounter, posX, posY, posZ, fxFlow.getRand().nextInt(2));
|
||||
((DefaultPolicy) Policies.DEFAULT.getPolicy())
|
||||
.doParticles(
|
||||
fxFlow,
|
||||
policyCounter,
|
||||
posX,
|
||||
posY,
|
||||
posZ,
|
||||
fxFlow.getRand().nextInt(2));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
package makeo.gadomancy.client.effect.fx;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Queue;
|
||||
import java.util.Random;
|
||||
import makeo.gadomancy.client.effect.EffectHandler;
|
||||
import makeo.gadomancy.common.data.config.ModConfig;
|
||||
import makeo.gadomancy.common.utils.MiscUtils;
|
||||
@@ -12,11 +16,6 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Queue;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -135,7 +134,7 @@ public class FXFlow {
|
||||
|
||||
private void calculateVelocity() {
|
||||
if (this.target == null) return;
|
||||
if (this.livingTicks <= 0) return; //Never happens..
|
||||
if (this.livingTicks <= 0) return; // Never happens..
|
||||
|
||||
Vector3 pos = this.getPositionVector();
|
||||
double motDirX = this.target.getX() - pos.getX();
|
||||
@@ -167,16 +166,19 @@ public class FXFlow {
|
||||
return;
|
||||
}
|
||||
|
||||
FXFlowBase flow = new FXFlowBase(this.origin, this.posX, this.posY, this.posZ, this.color, this.mainParticleSize, 9, 240);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(flow); //Initial position.
|
||||
FXFlowBase flow =
|
||||
new FXFlowBase(this.origin, this.posX, this.posY, this.posZ, this.color, this.mainParticleSize, 9, 240);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(flow); // Initial position.
|
||||
double lastPosX = this.posX - (this.posX - this.lastTickPosX) / 2.0D;
|
||||
double lastPosY = this.posY - (this.posY - this.lastTickPosY) / 2.0D;
|
||||
double lastPosZ = this.posZ - (this.posZ - this.lastTickPosZ) / 2.0D;
|
||||
FXFlowBase flow2 = new FXFlowBase(this.origin, lastPosX, lastPosY, lastPosZ, this.color, (float) (this.mainParticleSize * 0.8), 8, 240);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(flow2); //Consistency to last position
|
||||
FXFlowBase flow2 = new FXFlowBase(
|
||||
this.origin, lastPosX, lastPosY, lastPosZ, this.color, (float) (this.mainParticleSize * 0.8), 8, 240);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(flow2); // Consistency to last position
|
||||
|
||||
if (this.policy != null)
|
||||
this.policy.doSubParticles(this, this.policyCounter, this.posX, this.posY, this.posZ, lastPosX, lastPosY, lastPosZ);
|
||||
this.policy.doSubParticles(
|
||||
this, this.policyCounter, this.posX, this.posY, this.posZ, lastPosX, lastPosY, lastPosZ);
|
||||
}
|
||||
|
||||
public Color getColor() {
|
||||
@@ -242,12 +244,9 @@ public class FXFlow {
|
||||
this.setColor(properties.fading);
|
||||
}
|
||||
}
|
||||
if (properties.livingTicks != -1)
|
||||
this.setLivingTicks(properties.livingTicks);
|
||||
if (properties.mainParticleSize != -1)
|
||||
this.setMainParticleSize(properties.mainParticleSize);
|
||||
if (properties.surroundingDistance != -1)
|
||||
this.setSurroundingDistance(properties.surroundingDistance);
|
||||
if (properties.livingTicks != -1) this.setLivingTicks(properties.livingTicks);
|
||||
if (properties.mainParticleSize != -1) this.setMainParticleSize(properties.mainParticleSize);
|
||||
if (properties.surroundingDistance != -1) this.setSurroundingDistance(properties.surroundingDistance);
|
||||
if (properties.surroundingParticleSize != -1)
|
||||
this.setSurroundingParticleSize(properties.surroundingParticleSize);
|
||||
if (properties.motionMultiplier != Float.MAX_VALUE) {
|
||||
@@ -279,8 +278,7 @@ public class FXFlow {
|
||||
protected int livingTicks = -1;
|
||||
protected float motionMultiplier = Float.MAX_VALUE;
|
||||
|
||||
public EntityFlowProperties() {
|
||||
}
|
||||
public EntityFlowProperties() {}
|
||||
|
||||
public EntityFlowProperties setTarget(Vector3 target) {
|
||||
this.hasTarget = target != null;
|
||||
@@ -332,7 +330,6 @@ public class FXFlow {
|
||||
this.livingTicks = livingTicks;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class FXFlowBase extends EntityFX {
|
||||
@@ -341,7 +338,7 @@ public class FXFlow {
|
||||
|
||||
private float partBlue, partGreen, partRed, partAlpha;
|
||||
|
||||
//Queue variables
|
||||
// Queue variables
|
||||
private float partialTicks;
|
||||
private float rendArg1, rendArg2, rendArg3, rendArg4, rendArg5;
|
||||
private int rendBrightness;
|
||||
@@ -349,7 +346,8 @@ public class FXFlow {
|
||||
private ResourceLocation texture = new SimpleResourceLocation("fx/flow_large.png");
|
||||
private float buffHalfLife, buffParticleScale;
|
||||
|
||||
public FXFlowBase(World world, double x, double y, double z, Color color, float size, int multiplier, int brightness) {
|
||||
public FXFlowBase(
|
||||
World world, double x, double y, double z, Color color, float size, int multiplier, int brightness) {
|
||||
super(world, x, y, z);
|
||||
if (color != null) {
|
||||
this.partBlue = color.getBlue() / 255F;
|
||||
@@ -381,8 +379,7 @@ public class FXFlow {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
|
||||
if (isLightingEnabled)
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
if (isLightingEnabled) GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);
|
||||
|
||||
@@ -394,8 +391,7 @@ public class FXFlow {
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);
|
||||
|
||||
if (isLightingEnabled)
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
if (isLightingEnabled) GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDepthMask(true);
|
||||
@@ -416,16 +412,44 @@ public class FXFlow {
|
||||
float f12 = (float) (this.prevPosY + (this.posY - this.prevPosY) * this.partialTicks - EntityFX.interpPosY);
|
||||
float f13 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * this.partialTicks - EntityFX.interpPosZ);
|
||||
|
||||
tessellator.addVertexWithUV(f11 - this.rendArg1 * f10 - this.rendArg4 * f10, f12 - this.rendArg2 * f10, f13 - this.rendArg3 * f10 - this.rendArg5 * f10, 0, 1);
|
||||
tessellator.addVertexWithUV(f11 - this.rendArg1 * f10 + this.rendArg4 * f10, f12 + this.rendArg2 * f10, f13 - this.rendArg3 * f10 + this.rendArg5 * f10, 1, 1);
|
||||
tessellator.addVertexWithUV(f11 + this.rendArg1 * f10 + this.rendArg4 * f10, f12 + this.rendArg2 * f10, f13 + this.rendArg3 * f10 + this.rendArg5 * f10, 1, 0);
|
||||
tessellator.addVertexWithUV(f11 + this.rendArg1 * f10 - this.rendArg4 * f10, f12 - this.rendArg2 * f10, f13 + this.rendArg3 * f10 - this.rendArg5 * f10, 0, 0);
|
||||
tessellator.addVertexWithUV(
|
||||
f11 - this.rendArg1 * f10 - this.rendArg4 * f10,
|
||||
f12 - this.rendArg2 * f10,
|
||||
f13 - this.rendArg3 * f10 - this.rendArg5 * f10,
|
||||
0,
|
||||
1);
|
||||
tessellator.addVertexWithUV(
|
||||
f11 - this.rendArg1 * f10 + this.rendArg4 * f10,
|
||||
f12 + this.rendArg2 * f10,
|
||||
f13 - this.rendArg3 * f10 + this.rendArg5 * f10,
|
||||
1,
|
||||
1);
|
||||
tessellator.addVertexWithUV(
|
||||
f11 + this.rendArg1 * f10 + this.rendArg4 * f10,
|
||||
f12 + this.rendArg2 * f10,
|
||||
f13 + this.rendArg3 * f10 + this.rendArg5 * f10,
|
||||
1,
|
||||
0);
|
||||
tessellator.addVertexWithUV(
|
||||
f11 + this.rendArg1 * f10 - this.rendArg4 * f10,
|
||||
f12 - this.rendArg2 * f10,
|
||||
f13 + this.rendArg3 * f10 - this.rendArg5 * f10,
|
||||
0,
|
||||
0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(Tessellator tessellator, float partialTicks, float par3, float par4, float par5, float par6, float par7) {
|
||||
if (MiscUtils.getPositionVector(Minecraft.getMinecraft().renderViewEntity).distance(new Vector3(this.posX, this.posY, this.posZ)) > ModConfig.renderParticleDistance)
|
||||
return;
|
||||
public void renderParticle(
|
||||
Tessellator tessellator,
|
||||
float partialTicks,
|
||||
float par3,
|
||||
float par4,
|
||||
float par5,
|
||||
float par6,
|
||||
float par7) {
|
||||
if (MiscUtils.getPositionVector(Minecraft.getMinecraft().renderViewEntity)
|
||||
.distance(new Vector3(this.posX, this.posY, this.posZ))
|
||||
> ModConfig.renderParticleDistance) return;
|
||||
|
||||
this.partialTicks = partialTicks;
|
||||
this.rendArg1 = par3;
|
||||
@@ -436,7 +460,5 @@ public class FXFlow {
|
||||
|
||||
FXFlowBase.fxQueue.add(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package makeo.gadomancy.client.effect.fx;
|
||||
|
||||
import java.util.Random;
|
||||
import makeo.gadomancy.client.effect.EffectHandler;
|
||||
import makeo.gadomancy.client.events.ClientHandler;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileEssentiaCompressor;
|
||||
@@ -14,8 +15,6 @@ import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.client.lib.QuadHelper;
|
||||
import thaumcraft.client.lib.UtilsFX;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* HellFirePvP@Admin
|
||||
* Date: 24.04.2016 / 00:45
|
||||
@@ -25,7 +24,8 @@ import java.util.Random;
|
||||
public class FXVortex {
|
||||
|
||||
private static final Random RAND = new Random();
|
||||
public static final ResourceLocation TC_VORTEX_TEXTURE = new ResourceLocation("thaumcraft", "textures/misc/vortex.png");
|
||||
public static final ResourceLocation TC_VORTEX_TEXTURE =
|
||||
new ResourceLocation("thaumcraft", "textures/misc/vortex.png");
|
||||
private static final float RAD = (float) (Math.PI * 2);
|
||||
|
||||
private TileEssentiaCompressor parent;
|
||||
@@ -124,7 +124,7 @@ public class FXVortex {
|
||||
public static void tickVortexes(Iterable<FXVortex> vortexes) {
|
||||
for (FXVortex vortex : vortexes) {
|
||||
if ((System.currentTimeMillis() - vortex.lastUpdateCall) > 100L) {
|
||||
//System.out.println("tickTimeout");
|
||||
// System.out.println("tickTimeout");
|
||||
EffectHandler.getInstance().unregisterVortex(vortex);
|
||||
}
|
||||
}
|
||||
@@ -133,5 +133,4 @@ public class FXVortex {
|
||||
public void notify(long timeMillis) {
|
||||
this.lastUpdateCall = timeMillis;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
package makeo.gadomancy.client.effect.fx;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import makeo.gadomancy.client.effect.EffectHandler;
|
||||
import makeo.gadomancy.common.data.config.ModConfig;
|
||||
import makeo.gadomancy.common.utils.MiscUtils;
|
||||
@@ -7,11 +11,6 @@ import makeo.gadomancy.common.utils.Vector3;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -26,7 +25,7 @@ public final class Orbital {
|
||||
private final World world;
|
||||
private int orbitalCounter;
|
||||
public boolean registered;
|
||||
//INFO: Needs to be updated when its "owner" gets rendered.
|
||||
// INFO: Needs to be updated when its "owner" gets rendered.
|
||||
public long lastRenderCall = System.currentTimeMillis();
|
||||
|
||||
private List<OrbitalRenderProperties> orbitals = new ArrayList<OrbitalRenderProperties>();
|
||||
@@ -55,8 +54,9 @@ public final class Orbital {
|
||||
}
|
||||
|
||||
public void doRender(float partialTicks) {
|
||||
if (MiscUtils.getPositionVector(Minecraft.getMinecraft().renderViewEntity).distance(this.center) > ModConfig.renderParticleDistance)
|
||||
return;
|
||||
if (MiscUtils.getPositionVector(Minecraft.getMinecraft().renderViewEntity)
|
||||
.distance(this.center)
|
||||
> ModConfig.renderParticleDistance) return;
|
||||
if (Minecraft.getMinecraft().isGamePaused()) return;
|
||||
|
||||
for (OrbitalRenderProperties orbitalNode : this.orbitals) {
|
||||
@@ -64,10 +64,17 @@ public final class Orbital {
|
||||
int counterOffset = orbitalNode.getOffsetTicks() % orbitalNode.getTicksForFullCircle();
|
||||
|
||||
int currentDividedPolicyTick = (this.orbitalCounter + counterOffset) % orbitalNode.getTicksForFullCircle();
|
||||
float currentDegree = 360F * (((float) currentDividedPolicyTick) / ((float) orbitalNode.getTicksForFullCircle()));
|
||||
float currentDegree =
|
||||
360F * (((float) currentDividedPolicyTick) / ((float) orbitalNode.getTicksForFullCircle()));
|
||||
double currentRad = Math.toRadians(currentDegree);
|
||||
|
||||
Vector3 point = axis.getAxis().clone().perpendicular().normalize().multiply(orbitalNode.getOffset()).rotate(currentRad, axis.getAxis()).add(this.center);
|
||||
Vector3 point = axis.getAxis()
|
||||
.clone()
|
||||
.perpendicular()
|
||||
.normalize()
|
||||
.multiply(orbitalNode.getOffset())
|
||||
.rotate(currentRad, axis.getAxis())
|
||||
.add(this.center);
|
||||
|
||||
if (orbitalNode.getRunnable() != null) {
|
||||
orbitalNode.getRunnable().onRender(this.world, point, orbitalNode, this.orbitalCounter, partialTicks);
|
||||
@@ -75,15 +82,28 @@ public final class Orbital {
|
||||
|
||||
if (orbitalNode.getParticleSize() <= 0) continue;
|
||||
|
||||
FXFlow.FXFlowBase flow = new FXFlow.FXFlowBase(this.world, point.getX(), point.getY(), point.getZ(),
|
||||
orbitalNode.getColor(), orbitalNode.getParticleSize(), orbitalNode.getMultiplier(), orbitalNode.getBrightness());
|
||||
FXFlow.FXFlowBase flow = new FXFlow.FXFlowBase(
|
||||
this.world,
|
||||
point.getX(),
|
||||
point.getY(),
|
||||
point.getZ(),
|
||||
orbitalNode.getColor(),
|
||||
orbitalNode.getParticleSize(),
|
||||
orbitalNode.getMultiplier(),
|
||||
orbitalNode.getBrightness());
|
||||
|
||||
if (orbitalNode.getSubParticleColor() != null && this.world.rand.nextInt(3) == 0) {
|
||||
Vector3 subOffset = this.genSubOffset(this.world.rand, 0.8F);
|
||||
Color c = (this.world.rand.nextBoolean()) ? orbitalNode.getSubParticleColor() : orbitalNode.getColor();
|
||||
FXFlow.FXFlowBase flow2 = new FXFlow.FXFlowBase(this.world,
|
||||
point.getX() + subOffset.getX(), point.getY() + subOffset.getY(), point.getZ() + subOffset.getZ(),
|
||||
c, orbitalNode.getSubSizeRunnable().getSubParticleSize(this.world.rand, this.orbitalCounter), 6, 240);
|
||||
FXFlow.FXFlowBase flow2 = new FXFlow.FXFlowBase(
|
||||
this.world,
|
||||
point.getX() + subOffset.getX(),
|
||||
point.getY() + subOffset.getY(),
|
||||
point.getZ() + subOffset.getZ(),
|
||||
c,
|
||||
orbitalNode.getSubSizeRunnable().getSubParticleSize(this.world.rand, this.orbitalCounter),
|
||||
6,
|
||||
240);
|
||||
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(flow2);
|
||||
}
|
||||
@@ -118,10 +138,17 @@ public final class Orbital {
|
||||
int counterOffset = property.getOffsetTicks() % property.getTicksForFullCircle();
|
||||
|
||||
int currentDividedPolicyTick = (this.orbitalCounter + counterOffset) % property.getTicksForFullCircle();
|
||||
float currentDegree = 360F * (((float) currentDividedPolicyTick) / ((float) property.getTicksForFullCircle()));
|
||||
float currentDegree =
|
||||
360F * (((float) currentDividedPolicyTick) / ((float) property.getTicksForFullCircle()));
|
||||
double currentRad = Math.toRadians(currentDegree);
|
||||
|
||||
arr[i] = axis.getAxis().clone().perpendicular().normalize().multiply(property.getOffset()).rotate(currentRad, axis.getAxis()).add(this.center);
|
||||
arr[i] = axis.getAxis()
|
||||
.clone()
|
||||
.perpendicular()
|
||||
.normalize()
|
||||
.multiply(property.getOffset())
|
||||
.rotate(currentRad, axis.getAxis())
|
||||
.add(this.center);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
@@ -217,7 +244,7 @@ public final class Orbital {
|
||||
return this;
|
||||
}
|
||||
|
||||
//Percent from 0.0F to 1.0F
|
||||
// Percent from 0.0F to 1.0F
|
||||
public void reduceOffset(float percent) {
|
||||
this.offset = this.originalOffset * percent;
|
||||
}
|
||||
@@ -272,7 +299,12 @@ public final class Orbital {
|
||||
}
|
||||
|
||||
public abstract static class OrbitalRenderRunnable {
|
||||
public abstract void onRender(World world, Vector3 selectedPosition, OrbitalRenderProperties properties, int orbitalExisted, float partialTicks);
|
||||
public abstract void onRender(
|
||||
World world,
|
||||
Vector3 selectedPosition,
|
||||
OrbitalRenderProperties properties,
|
||||
int orbitalExisted,
|
||||
float partialTicks);
|
||||
}
|
||||
|
||||
public static class Axis {
|
||||
@@ -288,10 +320,10 @@ public final class Orbital {
|
||||
}
|
||||
|
||||
public static Axis persisentRandomAxis() {
|
||||
//Actually quite important to use only Y-positive here since if we
|
||||
//would use negative y, the axis may turn counter-
|
||||
//clockwise, what's intended to be set in another variable, which
|
||||
//may cause bugs if we want to use only clockwise axis'.
|
||||
// Actually quite important to use only Y-positive here since if we
|
||||
// would use negative y, the axis may turn counter-
|
||||
// clockwise, what's intended to be set in another variable, which
|
||||
// may cause bugs if we want to use only clockwise axis'.
|
||||
return new Axis(Vector3.positiveYRandom());
|
||||
}
|
||||
|
||||
@@ -299,5 +331,4 @@ public final class Orbital {
|
||||
return this.axis.clone();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package makeo.gadomancy.client.events;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.network.FMLNetworkEvent;
|
||||
import java.util.Queue;
|
||||
import makeo.gadomancy.client.ClientProxy;
|
||||
import makeo.gadomancy.client.effect.EffectHandler;
|
||||
import makeo.gadomancy.client.renderers.tile.RenderTileEssentiaCompressor;
|
||||
@@ -10,8 +11,6 @@ import makeo.gadomancy.client.util.FamiliarHandlerClient;
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
import java.util.Queue;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -26,15 +25,15 @@ public class ClientHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onClientTick(TickEvent.ClientTickEvent event) {
|
||||
if(event.phase.equals(TickEvent.Phase.END) && !Minecraft.getMinecraft().isGamePaused()) {
|
||||
if (event.phase.equals(TickEvent.Phase.END) && !Minecraft.getMinecraft().isGamePaused()) {
|
||||
FamiliarHandlerClient.playerTickEvent();
|
||||
ClientHandler.ticks++;
|
||||
|
||||
EffectHandler.getInstance().tick();
|
||||
}
|
||||
|
||||
Queue<Runnable> actions = ((ClientProxy)Gadomancy.proxy).clientActions;
|
||||
while(actions.peek() != null) {
|
||||
Queue<Runnable> actions = ((ClientProxy) Gadomancy.proxy).clientActions;
|
||||
while (actions.peek() != null) {
|
||||
actions.poll().run();
|
||||
}
|
||||
}
|
||||
@@ -44,5 +43,4 @@ public class ClientHandler {
|
||||
EffectHandler.getInstance().clear();
|
||||
RenderTileEssentiaCompressor.ownedVortex.clear();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package makeo.gadomancy.client.events;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -7,8 +8,6 @@ import net.minecraft.world.World;
|
||||
import thaumcraft.api.BlockCoordinates;
|
||||
import thaumcraft.api.IArchitect;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -25,12 +24,18 @@ public class FakeArchitectItem extends Item implements IArchitect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<BlockCoordinates> getArchitectBlocks(ItemStack stack, World world, int x, int y, int z, int side, EntityPlayer player) {
|
||||
public ArrayList<BlockCoordinates> getArchitectBlocks(
|
||||
ItemStack stack, World world, int x, int y, int z, int side, EntityPlayer player) {
|
||||
return this.coords;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showAxis(ItemStack paramItemStack, World paramWorld, EntityPlayer paramEntityPlayer, int paramInt, EnumAxis paramEnumAxis) {
|
||||
public boolean showAxis(
|
||||
ItemStack paramItemStack,
|
||||
World paramWorld,
|
||||
EntityPlayer paramEntityPlayer,
|
||||
int paramInt,
|
||||
EnumAxis paramEnumAxis) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,9 @@ package makeo.gadomancy.client.events;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import makeo.gadomancy.api.GadomancyApi;
|
||||
import makeo.gadomancy.api.golems.cores.AdditionalGolemCore;
|
||||
import makeo.gadomancy.client.gui.GuiResearchRecipeAuraEffects;
|
||||
@@ -46,11 +49,6 @@ import thaumcraft.common.entities.golems.EntityGolemBase;
|
||||
import thaumcraft.common.items.relics.ItemThaumometer;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -68,16 +66,17 @@ public class RenderEventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void on(GuiScreenEvent.DrawScreenEvent.Pre e) {
|
||||
if(e.gui instanceof GuiGolem) {
|
||||
if (e.gui instanceof GuiGolem) {
|
||||
GuiGolem gui = (GuiGolem) e.gui;
|
||||
EntityGolemBase golem = new Injector(gui, GuiGolem.class).getField("golem");
|
||||
if(golem != null) {
|
||||
if (golem != null) {
|
||||
AdditionalGolemCore core = GadomancyApi.getAdditionalGolemCore(golem);
|
||||
if(core != null) {
|
||||
if (core != null) {
|
||||
this.blurbId = core.getBaseCore();
|
||||
String key = "golemblurb." + this.blurbId + ".text";
|
||||
this.oldGolemblurb = ResourceReloadListener.languageList.get(key);
|
||||
ResourceReloadListener.languageList.put(key, StatCollector.translateToLocal(core.getUnlocalizedGuiText()));
|
||||
ResourceReloadListener.languageList.put(
|
||||
key, StatCollector.translateToLocal(core.getUnlocalizedGuiText()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -85,7 +84,7 @@ public class RenderEventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void on(GuiScreenEvent.DrawScreenEvent.Post e) {
|
||||
if(this.oldGolemblurb != null) {
|
||||
if (this.oldGolemblurb != null) {
|
||||
String key = "golemblurb." + this.blurbId + ".text";
|
||||
ResourceReloadListener.languageList.put(key, this.oldGolemblurb);
|
||||
this.oldGolemblurb = null;
|
||||
@@ -94,46 +93,56 @@ public class RenderEventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void on(DrawBlockHighlightEvent e) {
|
||||
if(e.currentItem == null) return;
|
||||
if(e.currentItem.getItem() instanceof ItemWandCasting) {
|
||||
if (e.currentItem == null) return;
|
||||
if (e.currentItem.getItem() instanceof ItemWandCasting) {
|
||||
ItemFocusBasic focus = ((ItemWandCasting) e.currentItem.getItem()).getFocus(e.currentItem);
|
||||
if(focus == null || !(focus instanceof IArchitect)) {
|
||||
if (focus == null || !(focus instanceof IArchitect)) {
|
||||
Block block = e.player.worldObj.getBlock(e.target.blockX, e.target.blockY, e.target.blockZ);
|
||||
if(block != null && block == RegisteredBlocks.blockArcaneDropper) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(e.player.worldObj.getBlockMetadata(e.target.blockX, e.target.blockY, e.target.blockZ) & 7);
|
||||
if (block != null && block == RegisteredBlocks.blockArcaneDropper) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(
|
||||
e.player.worldObj.getBlockMetadata(e.target.blockX, e.target.blockY, e.target.blockZ) & 7);
|
||||
|
||||
ArrayList<BlockCoordinates> coords = new ArrayList<BlockCoordinates>();
|
||||
for(int x = -1; x < 2; x++) {
|
||||
for(int y = -1; y < 2; y++) {
|
||||
for(int z = -1; z < 2; z++) {
|
||||
coords.add(new BlockCoordinates(e.target.blockX + 2*dir.offsetX + x, e.target.blockY + 2*dir.offsetY + y, e.target.blockZ + 2*dir.offsetZ + z));
|
||||
for (int x = -1; x < 2; x++) {
|
||||
for (int y = -1; y < 2; y++) {
|
||||
for (int z = -1; z < 2; z++) {
|
||||
coords.add(new BlockCoordinates(
|
||||
e.target.blockX + 2 * dir.offsetX + x,
|
||||
e.target.blockY + 2 * dir.offsetY + y,
|
||||
e.target.blockZ + 2 * dir.offsetZ + z));
|
||||
}
|
||||
}
|
||||
}
|
||||
coords.add(new BlockCoordinates(e.target.blockX + dir.offsetX, e.target.blockY + dir.offsetY, e.target.blockZ + dir.offsetZ));
|
||||
coords.add(new BlockCoordinates(
|
||||
e.target.blockX + dir.offsetX,
|
||||
e.target.blockY + dir.offsetY,
|
||||
e.target.blockZ + dir.offsetZ));
|
||||
|
||||
RenderEventHandler.ARCHITECT_ITEM.setCoords(coords);
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
RenderEventHandler.WAND_HANDLER.handleArchitectOverlay(new ItemStack(RenderEventHandler.ARCHITECT_ITEM), e, e.player.ticksExisted, e.target);
|
||||
RenderEventHandler.WAND_HANDLER.handleArchitectOverlay(
|
||||
new ItemStack(RenderEventHandler.ARCHITECT_ITEM), e, e.player.ticksExisted, e.target);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
}
|
||||
} else if(e.currentItem.getItem() instanceof ItemThaumometer) {
|
||||
if(e.target.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK) return;
|
||||
} else if (e.currentItem.getItem() instanceof ItemThaumometer) {
|
||||
if (e.target.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK) return;
|
||||
int blockX = e.target.blockX;
|
||||
int blockY = e.target.blockY;
|
||||
int blockZ = e.target.blockZ;
|
||||
if(Minecraft.getMinecraft().gameSettings.thirdPersonView == 0) {
|
||||
if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 0) {
|
||||
TileEntity tile = e.player.worldObj.getTileEntity(blockX, blockY, blockZ);
|
||||
if(tile instanceof TileExtendedNode) {
|
||||
if (tile instanceof TileExtendedNode) {
|
||||
TileExtendedNode node = (TileExtendedNode) tile;
|
||||
if(node.getExtendedNodeType() == null) return;
|
||||
ExtendedTypeDisplayManager.notifyDisplayTick(node.getId(), node.getNodeType(), node.getExtendedNodeType());
|
||||
} else if(tile instanceof TileExtendedNodeJar) {
|
||||
if (node.getExtendedNodeType() == null) return;
|
||||
ExtendedTypeDisplayManager.notifyDisplayTick(
|
||||
node.getId(), node.getNodeType(), node.getExtendedNodeType());
|
||||
} else if (tile instanceof TileExtendedNodeJar) {
|
||||
TileExtendedNodeJar nodeJar = (TileExtendedNodeJar) tile;
|
||||
if(nodeJar.getExtendedNodeType() == null) return;
|
||||
ExtendedTypeDisplayManager.notifyDisplayTick(nodeJar.getId(), nodeJar.getNodeType(), nodeJar.getExtendedNodeType());
|
||||
if (nodeJar.getExtendedNodeType() == null) return;
|
||||
ExtendedTypeDisplayManager.notifyDisplayTick(
|
||||
nodeJar.getId(), nodeJar.getNodeType(), nodeJar.getExtendedNodeType());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -141,10 +150,11 @@ public class RenderEventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void guiOpen(GuiOpenEvent event) {
|
||||
if(event.gui != null && event.gui instanceof GuiResearchRecipe) {
|
||||
if (event.gui != null && event.gui instanceof GuiResearchRecipe) {
|
||||
GuiResearchRecipe gui = (GuiResearchRecipe) event.gui;
|
||||
ResearchItem research = new Injector(gui, GuiResearchRecipe.class).getField("research");
|
||||
if(research.key.equals(Gadomancy.MODID.toUpperCase() + ".AURA_EFFECTS") && !(gui instanceof GuiResearchRecipeAuraEffects)) {
|
||||
if (research.key.equals(Gadomancy.MODID.toUpperCase() + ".AURA_EFFECTS")
|
||||
&& !(gui instanceof GuiResearchRecipeAuraEffects)) {
|
||||
event.gui = GuiResearchRecipeAuraEffects.create(gui);
|
||||
}
|
||||
}
|
||||
@@ -161,9 +171,10 @@ public class RenderEventHandler {
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
public void renderEntityPre(RenderLivingEvent.Pre event) {
|
||||
if(event.entity instanceof EntityPlayer) {
|
||||
if (event.entity instanceof EntityPlayer) {
|
||||
EntityPlayer p = (EntityPlayer) event.entity;
|
||||
if(((DataAchromatic)SyncDataHolder.getDataClient("AchromaticData")).isAchromatic((EntityPlayer) event.entity)) {
|
||||
if (((DataAchromatic) SyncDataHolder.getDataClient("AchromaticData"))
|
||||
.isAchromatic((EntityPlayer) event.entity)) {
|
||||
this.current = p;
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.15F);
|
||||
GL11.glDepthMask(false);
|
||||
@@ -177,12 +188,12 @@ public class RenderEventHandler {
|
||||
System.arraycopy(this.armor, 0, p.inventory.armorInventory, 0, this.armor.length);
|
||||
|
||||
boolean changed = false;
|
||||
for(int i = 0; i < this.armor.length; i++) {
|
||||
if(this.armor[i] != null && NBTHelper.hasPersistentData(this.armor[i])) {
|
||||
for (int i = 0; i < this.armor.length; i++) {
|
||||
if (this.armor[i] != null && NBTHelper.hasPersistentData(this.armor[i])) {
|
||||
NBTTagCompound compound = NBTHelper.getPersistentData(this.armor[i]);
|
||||
if(compound.hasKey("disguise")) {
|
||||
if (compound.hasKey("disguise")) {
|
||||
NBTBase base = compound.getTag("disguise");
|
||||
if(base instanceof NBTTagCompound) {
|
||||
if (base instanceof NBTTagCompound) {
|
||||
p.inventory.armorInventory[i] = ItemStack.loadItemStackFromNBT((NBTTagCompound) base);
|
||||
} else {
|
||||
p.inventory.armorInventory[i] = null;
|
||||
@@ -192,7 +203,7 @@ public class RenderEventHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if(!changed) {
|
||||
if (!changed) {
|
||||
p.inventory.armorInventory = this.armor;
|
||||
this.armor = null;
|
||||
}
|
||||
@@ -201,9 +212,9 @@ public class RenderEventHandler {
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST, receiveCanceled = true)
|
||||
public void renderPost(RenderLivingEvent.Post event) {
|
||||
if(event.entity instanceof EntityPlayer) {
|
||||
if (event.entity instanceof EntityPlayer) {
|
||||
EntityPlayer p = (EntityPlayer) event.entity;
|
||||
if(this.armor != null) {
|
||||
if (this.armor != null) {
|
||||
p.inventory.armorInventory = this.armor;
|
||||
}
|
||||
}
|
||||
@@ -211,7 +222,7 @@ public class RenderEventHandler {
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGHEST, receiveCanceled = true)
|
||||
public void onSetArmor(RenderPlayerEvent.SetArmorModel event) {
|
||||
if(event.entityPlayer == this.current) {
|
||||
if (event.entityPlayer == this.current) {
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||
GL11.glDepthMask(true);
|
||||
@@ -219,26 +230,43 @@ public class RenderEventHandler {
|
||||
}
|
||||
|
||||
static {
|
||||
ResourceLocation mod = new ResourceLocation(Gadomancy.MODID.toLowerCase() + new String(new byte[] {58, 116, 101, 120, 116, 117, 114, 101, 115, 47, 109, 111, 100, 101, 108, 115, 47, 109, 111, 100, 101, 108, 65, 115, 115, 101, 99, 46, 111, 98, 106}, StandardCharsets.UTF_8));
|
||||
ResourceLocation mod = new ResourceLocation(Gadomancy.MODID.toLowerCase()
|
||||
+ new String(
|
||||
new byte[] {
|
||||
58, 116, 101, 120, 116, 117, 114, 101, 115, 47, 109, 111, 100, 101, 108, 115, 47, 109, 111,
|
||||
100, 101, 108, 65, 115, 115, 101, 99, 46, 111, 98, 106
|
||||
},
|
||||
StandardCharsets.UTF_8));
|
||||
IModelCustom buf;
|
||||
try {
|
||||
buf = new WavefrontObject("gadomancy:wRender", new GZIPInputStream(Minecraft.getMinecraft().getResourceManager().getResource(mod).getInputStream()));
|
||||
buf = new WavefrontObject(
|
||||
"gadomancy:wRender",
|
||||
new GZIPInputStream(Minecraft.getMinecraft()
|
||||
.getResourceManager()
|
||||
.getResource(mod)
|
||||
.getInputStream()));
|
||||
} catch (Exception exc) {
|
||||
//shush.
|
||||
// shush.
|
||||
buf = null;
|
||||
}
|
||||
obj = buf;
|
||||
}
|
||||
|
||||
private static final IModelCustom obj;
|
||||
private static final ResourceLocation tex = new ResourceLocation(new String(new byte[] {103, 97, 100, 111, 109, 97, 110, 99, 121, 58, 116, 101, 120, 116, 117, 114, 101, 115, 47, 109, 105, 115, 99, 47, 116, 101, 120, 87, 46, 112, 110, 103}, StandardCharsets.UTF_8));
|
||||
private static final ResourceLocation tex = new ResourceLocation(new String(
|
||||
new byte[] {
|
||||
103, 97, 100, 111, 109, 97, 110, 99, 121, 58, 116, 101, 120, 116, 117, 114, 101, 115, 47, 109, 105, 115,
|
||||
99, 47, 116, 101, 120, 87, 46, 112, 110, 103
|
||||
},
|
||||
StandardCharsets.UTF_8));
|
||||
private static int dList = -1;
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRender(RenderPlayerEvent.Specials.Post event) {
|
||||
if(event.entityPlayer == null) return;
|
||||
if(RenderEventHandler.obj == null) return;
|
||||
if(!CommonProxy.serverOnlineState) return;
|
||||
if(!MiscUtils.isMisunderstood(event.entityPlayer)) return;
|
||||
if (event.entityPlayer == null) return;
|
||||
if (RenderEventHandler.obj == null) return;
|
||||
if (!CommonProxy.serverOnlineState) return;
|
||||
if (!MiscUtils.isMisunderstood(event.entityPlayer)) return;
|
||||
|
||||
GL11.glColor4f(1f, 1f, 1f, 1f);
|
||||
|
||||
@@ -246,12 +274,18 @@ public class RenderEventHandler {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(RenderEventHandler.tex);
|
||||
boolean f = event.entityPlayer.capabilities.isFlying;
|
||||
double ma = f ? 15 : 5;
|
||||
double r = (ma * (Math.abs((ClientHandler.ticks % 80) - 40) / 40D)) +
|
||||
((65 - ma) * Math.max(0, Math.min(1, new Vector3(event.entityPlayer.motionX, 0, event.entityPlayer.motionZ).length())));
|
||||
double r = (ma * (Math.abs((ClientHandler.ticks % 80) - 40) / 40D))
|
||||
+ ((65 - ma)
|
||||
* Math.max(
|
||||
0,
|
||||
Math.min(
|
||||
1,
|
||||
new Vector3(event.entityPlayer.motionX, 0, event.entityPlayer.motionZ)
|
||||
.length())));
|
||||
GL11.glScaled(0.07, 0.07, 0.07);
|
||||
GL11.glRotatef(180, 0, 0, 1);
|
||||
GL11.glTranslated(0, -12.7, 0.7 - (((float) (r / ma)) * (f ? 0.5D : 0.2D)));
|
||||
if(RenderEventHandler.dList == -1) {
|
||||
if (RenderEventHandler.dList == -1) {
|
||||
RenderEventHandler.dList = GLAllocation.generateDisplayLists(2);
|
||||
GL11.glNewList(RenderEventHandler.dList, GL11.GL_COMPILE);
|
||||
RenderEventHandler.obj.renderOnly("wR");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package makeo.gadomancy.client.events;
|
||||
|
||||
import java.util.Map;
|
||||
import makeo.gadomancy.api.GadomancyApi;
|
||||
import makeo.gadomancy.api.golems.AdditionalGolemType;
|
||||
import makeo.gadomancy.client.textures.GolemGuiTexture;
|
||||
@@ -12,8 +13,6 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.util.StringTranslate;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -25,6 +24,7 @@ import java.util.Map;
|
||||
public class ResourceReloadListener implements IResourceManagerReloadListener {
|
||||
|
||||
public static final ResourceReloadListener instance = new ResourceReloadListener();
|
||||
|
||||
public static ResourceReloadListener getInstance() {
|
||||
return ResourceReloadListener.instance;
|
||||
}
|
||||
@@ -32,8 +32,8 @@ public class ResourceReloadListener implements IResourceManagerReloadListener {
|
||||
public static Map languageList;
|
||||
|
||||
private ResourceReloadListener() {
|
||||
Injector inner = new Injector(StringTranslate.class);
|
||||
Object O = inner.getField(Injector.findField(StringTranslate.class, StringTranslate.class));
|
||||
Injector inner = new Injector(StringTranslate.class);
|
||||
Object O = inner.getField(Injector.findField(StringTranslate.class, StringTranslate.class));
|
||||
Injector instance = new Injector(O);
|
||||
ResourceReloadListener.languageList = instance.getField(instance.findField(Map.class));
|
||||
}
|
||||
@@ -55,17 +55,23 @@ public class ResourceReloadListener implements IResourceManagerReloadListener {
|
||||
}
|
||||
|
||||
private void manipulateLanguageFile() {
|
||||
if(ResourceReloadListener.languageList != null) {
|
||||
for(AdditionalGolemType type : GadomancyApi.getAdditionalGolemTypes()) {
|
||||
ResourceReloadListener.languageList.put("item.ItemGolemPlacer." + type.getEnumEntry().ordinal() + ".name",
|
||||
if (ResourceReloadListener.languageList != null) {
|
||||
for (AdditionalGolemType type : GadomancyApi.getAdditionalGolemTypes()) {
|
||||
ResourceReloadListener.languageList.put(
|
||||
"item.ItemGolemPlacer." + type.getEnumEntry().ordinal() + ".name",
|
||||
StatCollector.translateToLocal(type.getUnlocalizedName() + ".name"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final ResourceLocation TC_GOLEM_GUI_TEXTURE = new ResourceLocation("thaumcraft", "textures/gui/guigolem.png");
|
||||
private static final ResourceLocation TC_GOLEM_GUI_TEXTURE =
|
||||
new ResourceLocation("thaumcraft", "textures/gui/guigolem.png");
|
||||
|
||||
private void registerTextureOverride() {
|
||||
Minecraft.getMinecraft().renderEngine.loadTexture(ResourceReloadListener.TC_GOLEM_GUI_TEXTURE, new GolemGuiTexture(ResourceReloadListener.TC_GOLEM_GUI_TEXTURE));
|
||||
Minecraft.getMinecraft()
|
||||
.renderEngine
|
||||
.loadTexture(
|
||||
ResourceReloadListener.TC_GOLEM_GUI_TEXTURE,
|
||||
new GolemGuiTexture(ResourceReloadListener.TC_GOLEM_GUI_TEXTURE));
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package makeo.gadomancy.client.gui;
|
||||
|
||||
import java.awt.*;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileArcanePackager;
|
||||
import makeo.gadomancy.common.containers.ContainerArcanePackager;
|
||||
import makeo.gadomancy.common.utils.ColorHelper;
|
||||
@@ -12,8 +13,6 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -40,7 +39,7 @@ public class ArcanePackagerGui extends GuiContainer {
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
if(this.tile.isInvalid()) {
|
||||
if (this.tile.isInvalid()) {
|
||||
Minecraft.getMinecraft().displayGuiScreen(null);
|
||||
return;
|
||||
}
|
||||
@@ -50,19 +49,19 @@ public class ArcanePackagerGui extends GuiContainer {
|
||||
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
|
||||
if(this.tile.progress > 0) {
|
||||
if (this.tile.progress > 0) {
|
||||
this.drawTexturedModalRect(89, 67, 210, 0, this.tile.progress, 9);
|
||||
}
|
||||
|
||||
if(this.tile.useEssentia) {
|
||||
if (this.tile.useEssentia) {
|
||||
this.drawTexturedModalRect(91, 97, 249, 10, 8, 8);
|
||||
}
|
||||
|
||||
if(this.tile.autoStart) {
|
||||
if (this.tile.autoStart) {
|
||||
this.drawTexturedModalRect(91, 110, 249, 10, 8, 8);
|
||||
}
|
||||
|
||||
if(this.tile.disguise) {
|
||||
if (this.tile.disguise) {
|
||||
this.drawTexturedModalRect(91, 123, 249, 10, 8, 8);
|
||||
}
|
||||
|
||||
@@ -78,11 +77,17 @@ public class ArcanePackagerGui extends GuiContainer {
|
||||
int var6 = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
this.drawString(100, 98, "gadomancy.info.ArcanePackager.useEssentia", this.tile.useEssentia ? Color.WHITE : Color.GRAY);
|
||||
this.drawString(
|
||||
100, 98, "gadomancy.info.ArcanePackager.useEssentia", this.tile.useEssentia ? Color.WHITE : Color.GRAY);
|
||||
|
||||
this.drawString(100, 111, "gadomancy.info.ArcanePackager.autoStart", this.tile.autoStart ? Color.WHITE : Color.GRAY);
|
||||
this.drawString(
|
||||
100, 111, "gadomancy.info.ArcanePackager.autoStart", this.tile.autoStart ? Color.WHITE : Color.GRAY);
|
||||
|
||||
this.drawString(100, 124, "gadomancy.info.ArcanePackager.disguisePackage", this.tile.disguise ? Color.WHITE : Color.GRAY);
|
||||
this.drawString(
|
||||
100,
|
||||
124,
|
||||
"gadomancy.info.ArcanePackager.disguisePackage",
|
||||
this.tile.disguise ? Color.WHITE : Color.GRAY);
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
@@ -105,25 +110,23 @@ public class ArcanePackagerGui extends GuiContainer {
|
||||
int checkX = x - baseX - 90;
|
||||
int checkY = y - baseY - 97;
|
||||
|
||||
if(checkX >= 0 && checkX < 8 && checkY >= 0 && checkY < 8) {
|
||||
if (checkX >= 0 && checkX < 8 && checkY >= 0 && checkY < 8) {
|
||||
this.tile.useEssentia = !this.tile.useEssentia;
|
||||
this.mc.playerController.sendEnchantPacket(this.inventorySlots.windowId, this.tile.useEssentia ? 0 : 1);
|
||||
}
|
||||
|
||||
checkY = y - baseY - 110;
|
||||
|
||||
if(checkX >= 0 && checkX < 8 && checkY >= 0 && checkY < 8) {
|
||||
if (checkX >= 0 && checkX < 8 && checkY >= 0 && checkY < 8) {
|
||||
this.tile.autoStart = !this.tile.autoStart;
|
||||
this.mc.playerController.sendEnchantPacket(this.inventorySlots.windowId, this.tile.autoStart ? 2 : 3);
|
||||
}
|
||||
|
||||
checkY = y - baseY - 123;
|
||||
|
||||
if(checkX >= 0 && checkX < 8 && checkY >= 0 && checkY < 8) {
|
||||
if (checkX >= 0 && checkX < 8 && checkY >= 0 && checkY < 8) {
|
||||
this.tile.disguise = !this.tile.disguise;
|
||||
this.mc.playerController.sendEnchantPacket(this.inventorySlots.windowId, this.tile.disguise ? 4 : 5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
package makeo.gadomancy.client.gui;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.aura.AuraResearchManager;
|
||||
import makeo.gadomancy.common.aura.ResearchPageAuraAspects;
|
||||
@@ -21,11 +25,6 @@ import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.lib.crafting.ThaumcraftCraftingManager;
|
||||
import thaumcraft.common.lib.utils.InventoryUtils;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -43,7 +42,8 @@ public class GuiResearchRecipeAuraEffects extends GuiResearchRecipe {
|
||||
|
||||
Injector inj = new Injector(this, GuiResearchRecipe.class);
|
||||
|
||||
ResearchPage[] additionalPages = ResearchPageAuraAspects.createAllAuraPagesFor(Minecraft.getMinecraft().thePlayer);
|
||||
ResearchPage[] additionalPages =
|
||||
ResearchPageAuraAspects.createAllAuraPagesFor(Minecraft.getMinecraft().thePlayer);
|
||||
ResearchPage[] pages = inj.getField("pages");
|
||||
ResearchPage[] newPages = new ResearchPage[pages.length + additionalPages.length];
|
||||
System.arraycopy(pages, 0, newPages, 0, pages.length);
|
||||
@@ -51,7 +51,9 @@ public class GuiResearchRecipeAuraEffects extends GuiResearchRecipe {
|
||||
inj.setField("pages", newPages);
|
||||
inj.setField("maxPages", newPages.length);
|
||||
|
||||
List<String> list = Thaumcraft.proxy.getScannedObjects().get(Minecraft.getMinecraft().thePlayer.getCommandSenderName());
|
||||
List<String> list = Thaumcraft.proxy
|
||||
.getScannedObjects()
|
||||
.get(Minecraft.getMinecraft().thePlayer.getCommandSenderName());
|
||||
if ((list != null) && (list.size() > 0)) {
|
||||
for (String s : list) {
|
||||
try {
|
||||
@@ -73,7 +75,8 @@ public class GuiResearchRecipeAuraEffects extends GuiResearchRecipe {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException e) {}
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,9 +125,17 @@ public class GuiResearchRecipeAuraEffects extends GuiResearchRecipe {
|
||||
ResearchPage rPage = pages[a];
|
||||
if (rPage instanceof ResearchPageAuraAspects) {
|
||||
this.drawAuraAspectPagePre(rPage, current % 2, sw, sh, par1, par2, page);
|
||||
} else if(rPage != null) {
|
||||
} else if (rPage != null) {
|
||||
try {
|
||||
Method m = Injector.getMethod("drawPage", GuiResearchRecipe.class, ResearchPage.class, int.class, int.class, int.class, int.class, int.class);
|
||||
Method m = Injector.getMethod(
|
||||
"drawPage",
|
||||
GuiResearchRecipe.class,
|
||||
ResearchPage.class,
|
||||
int.class,
|
||||
int.class,
|
||||
int.class,
|
||||
int.class,
|
||||
int.class);
|
||||
m.setAccessible(true);
|
||||
m.invoke(this, pages[a], current % 2, sw, sh, par1, par2);
|
||||
} catch (Exception e) {
|
||||
@@ -157,7 +168,7 @@ public class GuiResearchRecipeAuraEffects extends GuiResearchRecipe {
|
||||
|
||||
private void drawAuraAspectPagePre(ResearchPage page, int side, int x, int y, int mx, int my, int thisPage) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
String researchName = Gadomancy.MODID.toUpperCase() + ".AURA_EFFECTS"; //We know the name of that research.
|
||||
String researchName = Gadomancy.MODID.toUpperCase() + ".AURA_EFFECTS"; // We know the name of that research.
|
||||
researchName = StatCollector.translateToLocal(researchName);
|
||||
if ((thisPage == 0) && (side == 0)) {
|
||||
this.drawTexturedModalRect(x + 4, y - 13, 24, 184, 96, 4);
|
||||
@@ -204,7 +215,8 @@ public class GuiResearchRecipeAuraEffects extends GuiResearchRecipe {
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glScalef(2.0F, 2.0F, 2.0F);
|
||||
UtilsFX.drawTag((x + start) / 2, (y + count * 50) / 2, aspect, aspects.getAmount(aspect), 0, this.zLevel);
|
||||
UtilsFX.drawTag(
|
||||
(x + start) / 2, (y + count * 50) / 2, aspect, aspects.getAmount(aspect), 0, this.zLevel);
|
||||
GL11.glPopMatrix();
|
||||
String text = aspect.getName();
|
||||
int offset = fr.getStringWidth(text) / 2;
|
||||
@@ -240,8 +252,18 @@ public class GuiResearchRecipeAuraEffects extends GuiResearchRecipe {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GuiResearchRecipe.itemRenderer.renderItemAndEffectIntoGUI(this.mc.fontRenderer, this.mc.renderEngine, InventoryUtils.cycleItemStack(item), mx + 8 + xcount * 17, 17 * ycount + (my - (4 + items.size() / 8 * 8)));
|
||||
GuiResearchRecipe.itemRenderer.renderItemOverlayIntoGUI(this.mc.fontRenderer, this.mc.renderEngine, InventoryUtils.cycleItemStack(item), mx + 8 + xcount * 17, 17 * ycount + (my - (4 + items.size() / 8 * 8)));
|
||||
GuiResearchRecipe.itemRenderer.renderItemAndEffectIntoGUI(
|
||||
this.mc.fontRenderer,
|
||||
this.mc.renderEngine,
|
||||
InventoryUtils.cycleItemStack(item),
|
||||
mx + 8 + xcount * 17,
|
||||
17 * ycount + (my - (4 + items.size() / 8 * 8)));
|
||||
GuiResearchRecipe.itemRenderer.renderItemOverlayIntoGUI(
|
||||
this.mc.fontRenderer,
|
||||
this.mc.renderEngine,
|
||||
InventoryUtils.cycleItemStack(item),
|
||||
mx + 8 + xcount * 17,
|
||||
17 * ycount + (my - (4 + items.size() / 8 * 8)));
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glPopMatrix();
|
||||
xcount++;
|
||||
|
||||
@@ -2,6 +2,7 @@ package makeo.gadomancy.client.gui;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.awt.*;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileInfusionClaw;
|
||||
import makeo.gadomancy.common.containers.ContainerInfusionClaw;
|
||||
import makeo.gadomancy.common.utils.ColorHelper;
|
||||
@@ -15,8 +16,6 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -38,13 +37,16 @@ public class InfusionClawGui extends GuiContainer {
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
if(((TileInfusionClaw) this.container.clawInv).isInvalid()) {
|
||||
if (((TileInfusionClaw) this.container.clawInv).isInvalid()) {
|
||||
Minecraft.getMinecraft().displayGuiScreen(null);
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack cursorStack = this.container.playerInv.getItemStack();
|
||||
if(((TileInfusionClaw) this.container.clawInv).isRunning() || (cursorStack != null && cursorStack.stackSize > 0 && !this.container.clawInv.isItemValidForSlot(0, cursorStack))) {
|
||||
if (((TileInfusionClaw) this.container.clawInv).isRunning()
|
||||
|| (cursorStack != null
|
||||
&& cursorStack.stackSize > 0
|
||||
&& !this.container.clawInv.isItemValidForSlot(0, cursorStack))) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
@@ -79,14 +81,18 @@ public class InfusionClawGui extends GuiContainer {
|
||||
this.drawTexturedModalRect(baseX + 114, baseY + 36, 244, 19, 8, 8);
|
||||
|
||||
boolean isLocked = ((TileInfusionClaw) this.container.clawInv).isLocked();
|
||||
if(isLocked) {
|
||||
if (isLocked) {
|
||||
this.drawTexturedModalRect(baseX + 114, baseY + 36, 244, 27, 8, 8);
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(baseX + 124, baseY + 38, 0);
|
||||
GL11.glScalef(0.5F, 0.5F, 0.0F);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gadomancy.info.InfusionClaw.lock"), 0, 0, ColorHelper.toHex(isLocked ? Color.WHITE : Color.GRAY));
|
||||
this.fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("gadomancy.info.InfusionClaw.lock"),
|
||||
0,
|
||||
0,
|
||||
ColorHelper.toHex(isLocked ? Color.WHITE : Color.GRAY));
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
@@ -102,7 +108,7 @@ public class InfusionClawGui extends GuiContainer {
|
||||
int checkX = x - baseX - 114;
|
||||
int checkY = y - baseY - 36;
|
||||
|
||||
if(checkX >= 0 && checkX < 8 && checkY >= 0 && checkY < 8) {
|
||||
if (checkX >= 0 && checkX < 8 && checkY >= 0 && checkY < 8) {
|
||||
TileInfusionClaw tile = ((TileInfusionClaw) this.container.clawInv);
|
||||
this.mc.playerController.sendEnchantPacket(this.inventorySlots.windowId, tile.isLocked() ? 0 : 1);
|
||||
tile.setIsLocked(!tile.isLocked());
|
||||
|
||||
@@ -14,7 +14,7 @@ import net.minecraft.entity.Entity;
|
||||
* using Techne: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-tools/1261123
|
||||
*/
|
||||
public class ModelArcaneDropper extends ModelBase {
|
||||
//fields
|
||||
// fields
|
||||
ModelRenderer shape1;
|
||||
ModelRenderer shape2;
|
||||
ModelRenderer shape3;
|
||||
|
||||
@@ -5,7 +5,7 @@ import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelAuraPylon extends ModelBase {
|
||||
//fields
|
||||
// fields
|
||||
ModelRenderer outerpylon;
|
||||
ModelRenderer lowerconduit;
|
||||
ModelRenderer inlower1;
|
||||
@@ -22,8 +22,7 @@ public class ModelAuraPylon extends ModelBase {
|
||||
ModelRenderer inlowersmooth1;
|
||||
ModelRenderer inlowersmooth2;
|
||||
|
||||
public ModelAuraPylon()
|
||||
{
|
||||
public ModelAuraPylon() {
|
||||
this.textureWidth = 32;
|
||||
this.textureHeight = 32;
|
||||
|
||||
@@ -119,8 +118,7 @@ public class ModelAuraPylon extends ModelBase {
|
||||
this.setRotation(this.inlowersmooth2, 0F, 1.22173F, 0F);
|
||||
}
|
||||
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
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);
|
||||
this.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
this.outerpylon.render(f5);
|
||||
@@ -140,15 +138,13 @@ public class ModelAuraPylon extends ModelBase {
|
||||
this.inlowersmooth2.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelAuraPylonBottom extends ModelBase {
|
||||
//fields
|
||||
// fields
|
||||
ModelRenderer outerpylon;
|
||||
ModelRenderer lowerconduit;
|
||||
ModelRenderer inlower1;
|
||||
|
||||
@@ -5,7 +5,7 @@ import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelAuraPylonTop extends ModelBase {
|
||||
//fields
|
||||
// fields
|
||||
ModelRenderer outerpylon;
|
||||
ModelRenderer lowerconduit;
|
||||
ModelRenderer inlower1;
|
||||
@@ -18,8 +18,7 @@ public class ModelAuraPylonTop extends ModelBase {
|
||||
ModelRenderer outerpylonmiddle2;
|
||||
ModelRenderer outerpylonupper;
|
||||
|
||||
public ModelAuraPylonTop()
|
||||
{
|
||||
public ModelAuraPylonTop() {
|
||||
this.textureWidth = 32;
|
||||
this.textureHeight = 32;
|
||||
|
||||
@@ -91,8 +90,7 @@ public class ModelAuraPylonTop extends ModelBase {
|
||||
this.setRotation(this.outerpylonupper, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
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);
|
||||
this.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
this.outerpylon.render(f5);
|
||||
@@ -108,15 +106,13 @@ public class ModelAuraPylonTop extends ModelBase {
|
||||
this.outerpylonupper.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import net.minecraft.entity.Entity;
|
||||
* Created by makeo @ 11.11.2015 17:15
|
||||
*/
|
||||
public class ModelBlockProtector extends ModelBase {
|
||||
//fields
|
||||
// fields
|
||||
ModelRenderer Shape1;
|
||||
ModelRenderer Shape2;
|
||||
ModelRenderer Shape3;
|
||||
|
||||
@@ -12,7 +12,7 @@ import net.minecraft.entity.Entity;
|
||||
*/
|
||||
public class ModelEssentiaCompressor extends ModelBase {
|
||||
|
||||
//Ugh techne...
|
||||
// Ugh techne...
|
||||
ModelRenderer Plate1;
|
||||
ModelRenderer Plate2;
|
||||
ModelRenderer Plate3;
|
||||
@@ -252,5 +252,4 @@ public class ModelEssentiaCompressor extends ModelBase {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import net.minecraft.entity.Entity;
|
||||
* Created by makeo @ 09.11.2015 23:08
|
||||
*/
|
||||
public class ModelFocusPortalPart extends ModelBase {
|
||||
//fields
|
||||
// fields
|
||||
ModelRenderer shape1;
|
||||
ModelRenderer shape2;
|
||||
ModelRenderer shape3;
|
||||
|
||||
@@ -13,14 +13,14 @@ import net.minecraft.entity.Entity;
|
||||
* Created by makeo @ 08.10.2015 16:14
|
||||
*/
|
||||
public class ModelInfusionClawPart extends ModelBase {
|
||||
//fields
|
||||
// fields
|
||||
ModelRenderer shape1;
|
||||
|
||||
public ModelInfusionClawPart(int num) {
|
||||
this.textureWidth = 32;
|
||||
this.textureHeight = 64;
|
||||
|
||||
this.shape1 = new ModelRenderer(this, 0, 8*num);
|
||||
this.shape1 = new ModelRenderer(this, 0, 8 * num);
|
||||
this.shape1.addBox(-3F, -1F, -3F, 6, 2, 6);
|
||||
this.shape1.setRotationPoint(0F, 0F, 0F);
|
||||
this.shape1.setTextureSize(32, 64);
|
||||
|
||||
@@ -13,7 +13,7 @@ import net.minecraft.entity.Entity;
|
||||
* Created by makeo @ 23.10.2015 23:13
|
||||
*/
|
||||
public class ModelJarPot extends ModelBase {
|
||||
//fields
|
||||
// fields
|
||||
ModelRenderer shape1;
|
||||
ModelRenderer shape2;
|
||||
ModelRenderer shape3;
|
||||
|
||||
@@ -13,7 +13,7 @@ import net.minecraft.entity.Entity;
|
||||
* Created by makeo @ 28.10.2015 12:31
|
||||
*/
|
||||
public class ModelManipulatorPart extends ModelBase {
|
||||
//fields
|
||||
// fields
|
||||
ModelRenderer shape2;
|
||||
ModelRenderer shape3;
|
||||
ModelRenderer shape4;
|
||||
|
||||
@@ -16,8 +16,7 @@ public class ModelPackagerPiston extends ModelBase {
|
||||
ModelRenderer shape1;
|
||||
ModelRenderer shape2;
|
||||
|
||||
public ModelPackagerPiston(boolean cut)
|
||||
{
|
||||
public ModelPackagerPiston(boolean cut) {
|
||||
this.textureWidth = 64;
|
||||
this.textureHeight = 32;
|
||||
|
||||
@@ -34,8 +33,7 @@ public class ModelPackagerPiston extends ModelBase {
|
||||
this.shape2.mirror = true;
|
||||
}
|
||||
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
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);
|
||||
this.shape1.render(f5);
|
||||
this.shape2.render(f5);
|
||||
|
||||
@@ -21,7 +21,7 @@ public class ModelPackedCompressorBlock extends ModelBase {
|
||||
this.block = new ModelRenderer(this, 0, 0);
|
||||
this.block.addBox(0F, 0F, 0F, 16, 16, 16);
|
||||
this.block.setRotationPoint(-8F, 22F, -8F);
|
||||
//block.setTextureSize(16, 16);
|
||||
// block.setTextureSize(16, 16);
|
||||
this.block.mirror = true;
|
||||
}
|
||||
|
||||
@@ -36,5 +36,4 @@ public class ModelPackedCompressorBlock extends ModelBase {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import net.minecraft.entity.Entity;
|
||||
* Created by makeo @ 27.10.2015 23:40
|
||||
*/
|
||||
public class ModelSmallCube extends ModelBase {
|
||||
//fields
|
||||
// fields
|
||||
ModelRenderer shape1;
|
||||
|
||||
public ModelSmallCube() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package makeo.gadomancy.client.models;
|
||||
|
||||
import java.awt.*;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
@@ -20,8 +21,6 @@ import thaumcraft.client.renderers.models.gear.ModelWand;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* This class is NOT part of the Gadomancy Mod
|
||||
* This file is copied from Azanors thaumcraft.client.renderers.models.gear.ModelWand.java and contains small modifications
|
||||
@@ -34,7 +33,7 @@ public class ModelWandPart extends ModelWand {
|
||||
ModelRenderer Rod;
|
||||
ModelRenderer Focus;
|
||||
ModelRenderer Cap;
|
||||
//ModelRenderer CapBottom;
|
||||
// ModelRenderer CapBottom;
|
||||
|
||||
private int runeCount;
|
||||
|
||||
@@ -51,16 +50,16 @@ public class ModelWandPart extends ModelWand {
|
||||
this.Cap.mirror = true;
|
||||
this.setRotation(this.Cap, 0.0F, 0.0F, 0.0F);
|
||||
|
||||
//this.CapBottom = new ModelRenderer(this, 0, 0);
|
||||
//this.CapBottom.addBox(-1.0F, -1.0F, -1.0F, 2, 2, 2);
|
||||
//this.CapBottom.setRotationPoint(0.0F, 20.0F, 0.0F);
|
||||
//this.CapBottom.setTextureSize(64, 32);
|
||||
//this.CapBottom.mirror = true;
|
||||
//setRotation(this.CapBottom, 0.0F, 0.0F, 0.0F);
|
||||
// this.CapBottom = new ModelRenderer(this, 0, 0);
|
||||
// this.CapBottom.addBox(-1.0F, -1.0F, -1.0F, 2, 2, 2);
|
||||
// this.CapBottom.setRotationPoint(0.0F, 20.0F, 0.0F);
|
||||
// this.CapBottom.setTextureSize(64, 32);
|
||||
// this.CapBottom.mirror = true;
|
||||
// setRotation(this.CapBottom, 0.0F, 0.0F, 0.0F);
|
||||
|
||||
this.Rod = new ModelRenderer(this, 0, 8);
|
||||
|
||||
//this.Rod.addBox(-1.0F, -1.0F, -1.0F, 2, 18, 2);
|
||||
// this.Rod.addBox(-1.0F, -1.0F, -1.0F, 2, 18, 2);
|
||||
|
||||
this.Rod.addBox(-1.0F, -1.0F, -1.0F, 2, height, 2);
|
||||
|
||||
@@ -140,7 +139,7 @@ public class ModelWandPart extends ModelWand {
|
||||
GL11.glPopMatrix();
|
||||
GL11.glTranslated(0.0D, 0.65D, 0.0D);
|
||||
}
|
||||
//this.CapBottom.render(0.0625F);
|
||||
// this.CapBottom.render(0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
if (wand.getFocus(wandStack) != null) {
|
||||
if (wand.getFocus(wandStack).getOrnament(focusStack) != null) {
|
||||
@@ -158,13 +157,15 @@ public class ModelWandPart extends ModelWand {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.25F, -0.1F, 0.0275F);
|
||||
GL11.glScaled(0.5D, 0.5D, 0.5D);
|
||||
ItemRenderer.renderItemIn2D(tessellator, f1, f2, f3, f4, icon.getIconWidth(), icon.getIconHeight(), 0.1F);
|
||||
ItemRenderer.renderItemIn2D(
|
||||
tessellator, f1, f2, f3, f4, icon.getIconWidth(), icon.getIconHeight(), 0.1F);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glTranslatef(-0.25F, -0.1F, 0.0275F);
|
||||
GL11.glScaled(0.5D, 0.5D, 0.5D);
|
||||
ItemRenderer.renderItemIn2D(tessellator, f1, f2, f3, f4, icon.getIconWidth(), icon.getIconHeight(), 0.1F);
|
||||
ItemRenderer.renderItemIn2D(
|
||||
tessellator, f1, f2, f3, f4, icon.getIconWidth(), icon.getIconHeight(), 0.1F);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
@@ -180,7 +181,8 @@ public class ModelWandPart extends ModelWand {
|
||||
}
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
|
||||
this.renderBlocks.setRenderBoundsFromBlock(Blocks.stone);
|
||||
BlockRenderer.drawFaces(this.renderBlocks, null, wand.getFocus(wandStack).getFocusDepthLayerIcon(focusStack), false);
|
||||
BlockRenderer.drawFaces(
|
||||
this.renderBlocks, null, wand.getFocus(wandStack).getFocusDepthLayerIcon(focusStack), false);
|
||||
GL11.glPopMatrix();
|
||||
alpha = 0.6F;
|
||||
}
|
||||
@@ -236,11 +238,11 @@ public class ModelWandPart extends ModelWand {
|
||||
for (int a = 0; a < 14; a++) {
|
||||
int rune = (a + rot * 3) % 16;
|
||||
|
||||
//edit start
|
||||
if(a < this.runeCount) {
|
||||
// edit start
|
||||
if (a < this.runeCount) {
|
||||
this.drawRune(0.36D + a * 0.14D, -0.009999999776482582D, -0.08D, rune, player);
|
||||
}
|
||||
//edit end
|
||||
// edit end
|
||||
}
|
||||
}
|
||||
GL11.glBlendFunc(770, 771);
|
||||
|
||||
+44
-9
@@ -50,23 +50,50 @@ public class BlockExtendedNodeJarRenderer implements ISimpleBlockRenderingHandle
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
IIcon i1 = ((BlockJar) ConfigBlocks.blockJar).iconJarTop;
|
||||
IIcon i2 = ((BlockJar) ConfigBlocks.blockJar).iconJarSide;
|
||||
block.setBlockBounds(BlockExtendedNodeJarRenderer.W3, 0.0F, BlockExtendedNodeJarRenderer.W3, BlockExtendedNodeJarRenderer.W13, BlockExtendedNodeJarRenderer.W12, BlockExtendedNodeJarRenderer.W13);
|
||||
block.setBlockBounds(
|
||||
BlockExtendedNodeJarRenderer.W3,
|
||||
0.0F,
|
||||
BlockExtendedNodeJarRenderer.W3,
|
||||
BlockExtendedNodeJarRenderer.W13,
|
||||
BlockExtendedNodeJarRenderer.W12,
|
||||
BlockExtendedNodeJarRenderer.W13);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
BlockExtendedNodeJarRenderer.drawFaces(renderer, block, ((BlockJar) ConfigBlocks.blockJar).iconJarBottom, i1, i2, i2, i2, i2, true);
|
||||
block.setBlockBounds(BlockExtendedNodeJarRenderer.W5, BlockExtendedNodeJarRenderer.W12, BlockExtendedNodeJarRenderer.W5, BlockExtendedNodeJarRenderer.W11, BlockExtendedNodeJarRenderer.W14, BlockExtendedNodeJarRenderer.W11);
|
||||
BlockExtendedNodeJarRenderer.drawFaces(
|
||||
renderer, block, ((BlockJar) ConfigBlocks.blockJar).iconJarBottom, i1, i2, i2, i2, i2, true);
|
||||
block.setBlockBounds(
|
||||
BlockExtendedNodeJarRenderer.W5,
|
||||
BlockExtendedNodeJarRenderer.W12,
|
||||
BlockExtendedNodeJarRenderer.W5,
|
||||
BlockExtendedNodeJarRenderer.W11,
|
||||
BlockExtendedNodeJarRenderer.W14,
|
||||
BlockExtendedNodeJarRenderer.W11);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
BlockExtendedNodeJarRenderer.drawFaces(renderer, block, ((BlockJar) ConfigBlocks.blockJar).iconJarBottom, i1, i2, i2, i2, i2, true);
|
||||
BlockExtendedNodeJarRenderer.drawFaces(
|
||||
renderer, block, ((BlockJar) ConfigBlocks.blockJar).iconJarBottom, i1, i2, i2, i2, i2, true);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
public boolean renderWorldBlock(
|
||||
IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
int bb = this.setBrightness(world, x, y, z, block);
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
block.setBlockBounds(BlockExtendedNodeJarRenderer.W3, 0.0F, BlockExtendedNodeJarRenderer.W3, BlockExtendedNodeJarRenderer.W13, BlockExtendedNodeJarRenderer.W12, BlockExtendedNodeJarRenderer.W13);
|
||||
block.setBlockBounds(
|
||||
BlockExtendedNodeJarRenderer.W3,
|
||||
0.0F,
|
||||
BlockExtendedNodeJarRenderer.W3,
|
||||
BlockExtendedNodeJarRenderer.W13,
|
||||
BlockExtendedNodeJarRenderer.W12,
|
||||
BlockExtendedNodeJarRenderer.W13);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
block.setBlockBounds(BlockExtendedNodeJarRenderer.W5, BlockExtendedNodeJarRenderer.W12, BlockExtendedNodeJarRenderer.W5, BlockExtendedNodeJarRenderer.W11, BlockExtendedNodeJarRenderer.W14, BlockExtendedNodeJarRenderer.W11);
|
||||
block.setBlockBounds(
|
||||
BlockExtendedNodeJarRenderer.W5,
|
||||
BlockExtendedNodeJarRenderer.W12,
|
||||
BlockExtendedNodeJarRenderer.W5,
|
||||
BlockExtendedNodeJarRenderer.W11,
|
||||
BlockExtendedNodeJarRenderer.W14,
|
||||
BlockExtendedNodeJarRenderer.W11);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
|
||||
@@ -76,7 +103,16 @@ public class BlockExtendedNodeJarRenderer implements ISimpleBlockRenderingHandle
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void drawFaces(RenderBlocks renderblocks, Block block, IIcon i1, IIcon i2, IIcon i3, IIcon i4, IIcon i5, IIcon i6, boolean solidtop) {
|
||||
public static void drawFaces(
|
||||
RenderBlocks renderblocks,
|
||||
Block block,
|
||||
IIcon i1,
|
||||
IIcon i2,
|
||||
IIcon i3,
|
||||
IIcon i4,
|
||||
IIcon i5,
|
||||
IIcon i6,
|
||||
boolean solidtop) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
tessellator.startDrawingQuads();
|
||||
@@ -144,5 +180,4 @@ public class BlockExtendedNodeJarRenderer implements ISimpleBlockRenderingHandle
|
||||
public int getRenderId() {
|
||||
return RegisteredBlocks.rendererExtendedNodeJarBlock;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,16 +26,29 @@ public abstract class BlockRenderingHandler implements ISimpleBlockRenderingHand
|
||||
|
||||
protected void renderFace(int side, RenderBlocks renderer, Block block, int x, int y, int z, IIcon icon) {
|
||||
switch (side) {
|
||||
case 0: renderer.renderFaceYNeg(block, x, y, z, icon); break;
|
||||
case 1: renderer.renderFaceYPos(block, x, y, z, icon); break;
|
||||
case 2: renderer.renderFaceZNeg(block, x, y, z, icon); break;
|
||||
case 3: renderer.renderFaceZPos(block, x, y, z, icon); break;
|
||||
case 4: renderer.renderFaceXNeg(block, x, y, z, icon); break;
|
||||
case 5: renderer.renderFaceXPos(block, x, y, z, icon); break;
|
||||
case 0:
|
||||
renderer.renderFaceYNeg(block, x, y, z, icon);
|
||||
break;
|
||||
case 1:
|
||||
renderer.renderFaceYPos(block, x, y, z, icon);
|
||||
break;
|
||||
case 2:
|
||||
renderer.renderFaceZNeg(block, x, y, z, icon);
|
||||
break;
|
||||
case 3:
|
||||
renderer.renderFaceZPos(block, x, y, z, icon);
|
||||
break;
|
||||
case 4:
|
||||
renderer.renderFaceXNeg(block, x, y, z, icon);
|
||||
break;
|
||||
case 5:
|
||||
renderer.renderFaceXPos(block, x, y, z, icon);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected void renderFace(ForgeDirection side, RenderBlocks renderer, Block block, int x, int y, int z, IIcon icon) {
|
||||
protected void renderFace(
|
||||
ForgeDirection side, RenderBlocks renderer, Block block, int x, int y, int z, IIcon icon) {
|
||||
this.renderFace(side.ordinal(), renderer, block, x, y, z, icon);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,18 +23,20 @@ public class RenderBlockStoneMachine implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
if(metadata == 1) {
|
||||
BlockStoneMachine blockStoneMachine = (BlockStoneMachine)block;
|
||||
if (metadata == 1) {
|
||||
BlockStoneMachine blockStoneMachine = (BlockStoneMachine) block;
|
||||
RenderBlockStoneMachine.DEVICE_BLOCK.iconPedestal[0] = blockStoneMachine.pedestalSideIcon;
|
||||
RenderBlockStoneMachine.DEVICE_BLOCK.iconPedestal[1] = blockStoneMachine.pedestalTopIcon;
|
||||
RenderBlockStoneMachine.DEVICE_RENDERER.renderInventoryBlock(RenderBlockStoneMachine.DEVICE_BLOCK, 1, modelId, renderer);
|
||||
RenderBlockStoneMachine.DEVICE_RENDERER.renderInventoryBlock(
|
||||
RenderBlockStoneMachine.DEVICE_BLOCK, 1, modelId, renderer);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
public boolean renderWorldBlock(
|
||||
IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
if(metadata == 1) {
|
||||
if (metadata == 1) {
|
||||
RenderBlockStoneMachine.DEVICE_RENDERER.renderWorldBlock(world, x, y, z, block, modelId, renderer);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -16,13 +16,12 @@ import net.minecraft.world.IBlockAccess;
|
||||
*/
|
||||
public class RenderBlockTransparent extends BlockRenderingHandler {
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
|
||||
}
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
if(block instanceof IBlockTransparent) {
|
||||
public boolean renderWorldBlock(
|
||||
IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
if (block instanceof IBlockTransparent) {
|
||||
this.renderAllFaces(renderer, block, x, y, z, ((IBlockTransparent) block).getTransparentIcon());
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -49,11 +49,14 @@ public class PlayerCameraRenderer extends EntityRenderer {
|
||||
}
|
||||
|
||||
private boolean canChangeView() {
|
||||
return !this.isMarkedForRemoval && this.minecraft.thePlayer != null && !this.minecraft.thePlayer.isRiding() && !this.minecraft.thePlayer.isPlayerSleeping();
|
||||
return !this.isMarkedForRemoval
|
||||
&& this.minecraft.thePlayer != null
|
||||
&& !this.minecraft.thePlayer.isRiding()
|
||||
&& !this.minecraft.thePlayer.isPlayerSleeping();
|
||||
}
|
||||
|
||||
private void removeIfMarked() {
|
||||
if(this.isMarkedForRemoval && this.equals(Minecraft.getMinecraft().entityRenderer)) {
|
||||
if (this.isMarkedForRemoval && this.equals(Minecraft.getMinecraft().entityRenderer)) {
|
||||
Minecraft.getMinecraft().entityRenderer = this.prevRenderer;
|
||||
this.isRemoved = true;
|
||||
}
|
||||
@@ -63,12 +66,12 @@ public class PlayerCameraRenderer extends EntityRenderer {
|
||||
public void updateCameraAndRender(float partialTicks) {
|
||||
this.removeIfMarked();
|
||||
|
||||
if(this.canChangeView()) {
|
||||
if (this.canChangeView()) {
|
||||
this.moveCam(-1);
|
||||
//float tempEyeHeight = minecraft.thePlayer.eyeHeight;
|
||||
//minecraft.thePlayer.eyeHeight = minecraft.thePlayer.getDefaultEyeHeight();
|
||||
// float tempEyeHeight = minecraft.thePlayer.eyeHeight;
|
||||
// minecraft.thePlayer.eyeHeight = minecraft.thePlayer.getDefaultEyeHeight();
|
||||
super.updateCameraAndRender(partialTicks);
|
||||
//minecraft.thePlayer.eyeHeight = tempEyeHeight;
|
||||
// minecraft.thePlayer.eyeHeight = tempEyeHeight;
|
||||
this.moveCam(1);
|
||||
|
||||
return;
|
||||
@@ -97,7 +100,7 @@ public class PlayerCameraRenderer extends EntityRenderer {
|
||||
public void getMouseOver(float partialTicks) {
|
||||
this.removeIfMarked();
|
||||
|
||||
if(this.canChangeView()) {
|
||||
if (this.canChangeView()) {
|
||||
this.moveCam(-1);
|
||||
super.getMouseOver(partialTicks);
|
||||
this.moveCam(1);
|
||||
|
||||
+5
-5
@@ -40,11 +40,11 @@ public class RenderAdditionalGolemBase extends RenderGolemBase {
|
||||
|
||||
int ret = super.shouldRenderPass(entity, pass, par3);
|
||||
|
||||
//fix for render bug in tc
|
||||
// fix for render bug in tc
|
||||
if (RenderGolemHelper.requiresRenderFix((EntityGolemBase) entity)) {
|
||||
RenderGolemHelper.renderCarriedItemsFix(golem);
|
||||
|
||||
if(this.toolItem != null) {
|
||||
if (this.toolItem != null) {
|
||||
RenderGolemHelper.renderToolItem(golem, this.toolItem, this.mainModel, this.renderManager);
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,7 @@ public class RenderAdditionalGolemBase extends RenderGolemBase {
|
||||
@Override
|
||||
protected void renderCarriedItems(EntityGolemBase golem, float par2) {
|
||||
if (!RenderGolemHelper.requiresRenderFix(golem)) {
|
||||
if(this.toolItem != null) {
|
||||
if (this.toolItem != null) {
|
||||
RenderGolemHelper.renderToolItem(golem, this.toolItem, this.mainModel, this.renderManager);
|
||||
}
|
||||
super.renderCarriedItems(golem, par2);
|
||||
@@ -71,7 +71,7 @@ public class RenderAdditionalGolemBase extends RenderGolemBase {
|
||||
public void render(EntityGolemBase golem, double par2, double par4, double par6, float par8, float par9) {
|
||||
AdditionalGolemCore core = GadomancyApi.getAdditionalGolemCore(golem);
|
||||
ItemStack carriedItem = null;
|
||||
if(core != null) {
|
||||
if (core != null) {
|
||||
this.toolItem = core.getToolItem(golem);
|
||||
|
||||
carriedItem = golem.getCarriedForDisplay();
|
||||
@@ -80,7 +80,7 @@ public class RenderAdditionalGolemBase extends RenderGolemBase {
|
||||
|
||||
super.render(golem, par2, par4, par6, par8, par9);
|
||||
|
||||
if(carriedItem != null) {
|
||||
if (carriedItem != null) {
|
||||
golem.getDataWatcher().getWatchedObject(16).setObject(carriedItem);
|
||||
this.toolItem = null;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
package makeo.gadomancy.client.renderers.entity;
|
||||
|
||||
public class RenderEffectHelper {
|
||||
|
||||
|
||||
|
||||
}
|
||||
public class RenderEffectHelper {}
|
||||
@@ -18,11 +18,11 @@ public class RenderEntityAuraCore extends RenderEntityItem {
|
||||
public void doRender(Entity entity, double x, double y, double z, float parf1, float parf2) {
|
||||
super.doRender(entity, x, y, z, parf1, parf2);
|
||||
|
||||
if(!(entity instanceof EntityAuraCore)) return;
|
||||
if (!(entity instanceof EntityAuraCore)) return;
|
||||
|
||||
EntityAuraCore ea = (EntityAuraCore) entity;
|
||||
|
||||
if(ea.auraOrbital != null) {
|
||||
if (ea.auraOrbital != null) {
|
||||
ea.auraOrbital.lastRenderCall = System.currentTimeMillis();
|
||||
ea.auraOrbital.updateCenter(MiscUtils.getPositionVector(ea));
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class RenderEntityItem extends Render {
|
||||
|
||||
@Override
|
||||
public void doRender(Entity entity, double x, double y, double z, float parf1, float parf2) {
|
||||
if(!(entity instanceof EntityItem)) return;
|
||||
if (!(entity instanceof EntityItem)) return;
|
||||
RenderEntityItem.ri.doRender(entity, x, y, z, parf1, parf2);
|
||||
}
|
||||
|
||||
@@ -35,5 +35,4 @@ public class RenderEntityItem extends Render {
|
||||
RenderEntityItem.ri = new RenderItem();
|
||||
RenderEntityItem.ri.setRenderManager(RenderManager.instance);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package makeo.gadomancy.client.renderers.entity;
|
||||
|
||||
import java.awt.*;
|
||||
import makeo.gadomancy.api.golems.cores.AdditionalGolemCore;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -18,8 +19,6 @@ import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.client.renderers.models.entities.ModelGolem;
|
||||
import thaumcraft.common.entities.golems.EntityGolemBase;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -46,7 +45,8 @@ public class RenderGolemHelper {
|
||||
float f3 = icon.getMinU();
|
||||
float f4 = icon.getMaxV();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f3, f4, icon.getIconWidth(), icon.getIconHeight(), 0.2F);
|
||||
ItemRenderer.renderItemIn2D(
|
||||
Tessellator.instance, f1, f2, f3, f4, icon.getIconWidth(), icon.getIconHeight(), 0.2F);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
@@ -74,8 +74,15 @@ public class RenderGolemHelper {
|
||||
Color color = new Color(item.getItem().getColorFromItemStack(item, renderPass));
|
||||
GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
|
||||
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(),
|
||||
icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
|
||||
ItemRenderer.renderItemIn2D(
|
||||
Tessellator.instance,
|
||||
icon.getMaxU(),
|
||||
icon.getMinV(),
|
||||
icon.getMinU(),
|
||||
icon.getMaxV(),
|
||||
icon.getIconWidth(),
|
||||
icon.getIconHeight(),
|
||||
0.0625F);
|
||||
|
||||
GL11.glColor3f(1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
@@ -85,7 +92,8 @@ public class RenderGolemHelper {
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public static void renderToolItem(EntityGolemBase golem, ItemStack itemstack, ModelBase mainModel, RenderManager renderManager) {
|
||||
public static void renderToolItem(
|
||||
EntityGolemBase golem, ItemStack itemstack, ModelBase mainModel, RenderManager renderManager) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
@@ -101,36 +109,39 @@ public class RenderGolemHelper {
|
||||
float fs = 0.66F;
|
||||
GL11.glScalef(fs, fs, fs);
|
||||
|
||||
net.minecraftforge.client.IItemRenderer customRenderer = net.minecraftforge.client.MinecraftForgeClient.getItemRenderer(itemstack, net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED);
|
||||
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED, itemstack, net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D));
|
||||
net.minecraftforge.client.IItemRenderer customRenderer =
|
||||
net.minecraftforge.client.MinecraftForgeClient.getItemRenderer(
|
||||
itemstack, net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED);
|
||||
boolean is3D = (customRenderer != null
|
||||
&& customRenderer.shouldUseRenderHelper(
|
||||
net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED,
|
||||
itemstack,
|
||||
net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D));
|
||||
|
||||
Item item = itemstack.getItem();
|
||||
float f1;
|
||||
|
||||
if (item instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item).getRenderType())))
|
||||
{
|
||||
if (item instanceof ItemBlock
|
||||
&& (is3D
|
||||
|| RenderBlocks.renderItemIn3d(
|
||||
Block.getBlockFromItem(item).getRenderType()))) {
|
||||
f1 = 0.5F;
|
||||
GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
|
||||
f1 *= 0.75F;
|
||||
GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glScalef(-f1, -f1, f1);
|
||||
}
|
||||
else if (item == Items.bow)
|
||||
{
|
||||
} else if (item == Items.bow) {
|
||||
f1 = 0.625F;
|
||||
GL11.glTranslatef(0.0F, 0.125F, 0.3125F);
|
||||
GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glScalef(f1, -f1, f1);
|
||||
GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
else if (item.isFull3D())
|
||||
{
|
||||
} else if (item.isFull3D()) {
|
||||
f1 = 0.625F;
|
||||
|
||||
if (item.shouldRotateAroundWhenRendering())
|
||||
{
|
||||
if (item.shouldRotateAroundWhenRendering()) {
|
||||
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glTranslatef(0.0F, -0.125F, 0.0F);
|
||||
}
|
||||
@@ -140,9 +151,7 @@ public class RenderGolemHelper {
|
||||
GL11.glScalef(f1, -f1, f1);
|
||||
GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
f1 = 0.375F;
|
||||
GL11.glTranslatef(0.25F, 0.1875F, -0.1875F);
|
||||
GL11.glScalef(f1, f1, f1);
|
||||
@@ -155,31 +164,26 @@ public class RenderGolemHelper {
|
||||
int i;
|
||||
float f5;
|
||||
|
||||
if (itemstack.getItem().requiresMultipleRenderPasses())
|
||||
{
|
||||
for (i = 0; i < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++i)
|
||||
{
|
||||
if (itemstack.getItem().requiresMultipleRenderPasses()) {
|
||||
for (i = 0; i < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++i) {
|
||||
int j = itemstack.getItem().getColorFromItemStack(itemstack, i);
|
||||
f5 = (float)(j >> 16 & 255) / 255.0F;
|
||||
f2 = (float)(j >> 8 & 255) / 255.0F;
|
||||
float f3 = (float)(j & 255) / 255.0F;
|
||||
f5 = (float) (j >> 16 & 255) / 255.0F;
|
||||
f2 = (float) (j >> 8 & 255) / 255.0F;
|
||||
float f3 = (float) (j & 255) / 255.0F;
|
||||
GL11.glColor4f(f5, f2, f3, 1.0F);
|
||||
|
||||
renderManager.itemRenderer.renderItem(golem, itemstack, i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
i = itemstack.getItem().getColorFromItemStack(itemstack, 0);
|
||||
float f4 = (float)(i >> 16 & 255) / 255.0F;
|
||||
f5 = (float)(i >> 8 & 255) / 255.0F;
|
||||
f2 = (float)(i & 255) / 255.0F;
|
||||
float f4 = (float) (i >> 16 & 255) / 255.0F;
|
||||
f5 = (float) (i >> 8 & 255) / 255.0F;
|
||||
f2 = (float) (i & 255) / 255.0F;
|
||||
GL11.glColor4f(f4, f5, f2, 1.0F);
|
||||
|
||||
renderManager.itemRenderer.renderItem(golem, itemstack, 0);
|
||||
}
|
||||
|
||||
|
||||
GL11.glScaled(1.0D, 1.0D, 1.0D);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
@@ -15,7 +15,11 @@ import thaumcraft.api.nodes.NodeType;
|
||||
* Created by makeo @ 04.11.2015 20:41
|
||||
*/
|
||||
public class ItemCreativeNodeRenderer extends ItemExNodeRenderer {
|
||||
private static final AspectList ASPECTS = new AspectList().add(Aspect.AIR, 50).add(Aspect.FIRE, 50).add(Aspect.EARTH, 50).add(Aspect.WATER, 50);
|
||||
private static final AspectList ASPECTS = new AspectList()
|
||||
.add(Aspect.AIR, 50)
|
||||
.add(Aspect.FIRE, 50)
|
||||
.add(Aspect.EARTH, 50)
|
||||
.add(Aspect.WATER, 50);
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
@@ -24,6 +28,7 @@ public class ItemCreativeNodeRenderer extends ItemExNodeRenderer {
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
makeo.gadomancy.client.renderers.item.ItemNodeRenderer.renderNodeItem(type, item, ItemCreativeNodeRenderer.ASPECTS, NodeType.values()[item.getItemDamage()], null, data);
|
||||
makeo.gadomancy.client.renderers.item.ItemNodeRenderer.renderNodeItem(
|
||||
type, item, ItemCreativeNodeRenderer.ASPECTS, NodeType.values()[item.getItemDamage()], null, data);
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,9 @@ public class ItemExNodeRenderer extends ItemNodeRenderer {
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return (item != null) && (item.getItem() == Item.getItemFromBlock(RegisteredBlocks.blockNode)) && ((item.getItemDamage() == 0) || item.getItemDamage() == 5);
|
||||
return (item != null)
|
||||
&& (item.getItem() == Item.getItemFromBlock(RegisteredBlocks.blockNode))
|
||||
&& ((item.getItemDamage() == 0) || item.getItemDamage() == 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+3
-4
@@ -26,13 +26,14 @@ import thaumcraft.common.tiles.TileJarNode;
|
||||
*/
|
||||
public class ItemJarExtendedNodeRenderer implements IItemRenderer {
|
||||
|
||||
//Copied and modified to allow compatibility to the ExtendedNodes
|
||||
// Copied and modified to allow compatibility to the ExtendedNodes
|
||||
|
||||
public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) {
|
||||
return (item != null) && (item.getItem() == RegisteredItems.itemExtendedNodeJar);
|
||||
}
|
||||
|
||||
public boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) {
|
||||
public boolean shouldUseRenderHelper(
|
||||
IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) {
|
||||
return helper != ItemRendererHelper.EQUIPPED_BLOCK;
|
||||
}
|
||||
|
||||
@@ -68,7 +69,6 @@ public class ItemJarExtendedNodeRenderer implements IItemRenderer {
|
||||
ItemNodeRenderer.renderItemNode(tjf);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
GL11.glEnable(3042);
|
||||
@@ -79,7 +79,6 @@ public class ItemJarExtendedNodeRenderer implements IItemRenderer {
|
||||
this.rb.renderBlockAsItem(RegisteredBlocks.blockExtendedNodeJar, item.getItemDamage(), 1.0F);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
||||
GL11.glEnable(32826);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,21 +29,30 @@ import thaumcraft.common.tiles.TileNode;
|
||||
public class ItemNodeRenderer implements IItemRenderer {
|
||||
|
||||
public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) {
|
||||
return (item != null) && (item.getItem() == Item.getItemFromBlock(ConfigBlocks.blockAiry)) && ((item.getItemDamage() == 0) || (item.getItemDamage() == 5));
|
||||
return (item != null)
|
||||
&& (item.getItem() == Item.getItemFromBlock(ConfigBlocks.blockAiry))
|
||||
&& ((item.getItemDamage() == 0) || (item.getItemDamage() == 5));
|
||||
}
|
||||
|
||||
public boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) {
|
||||
public boolean shouldUseRenderHelper(
|
||||
IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) {
|
||||
return helper != ItemRendererHelper.EQUIPPED_BLOCK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
//Gadomancy: Redirect.
|
||||
// Gadomancy: Redirect.
|
||||
ItemNodeRenderer.renderNodeItem(type, item, data);
|
||||
}
|
||||
|
||||
//Gadomancy: Renamed to access it static from another class and added aspects, nodeType and nodeModifier as params
|
||||
public static void renderNodeItem(IItemRenderer.ItemRenderType type, ItemStack item, AspectList aspects, NodeType nodeType, NodeModifier nodeModifier, Object... data) {
|
||||
// Gadomancy: Renamed to access it static from another class and added aspects, nodeType and nodeModifier as params
|
||||
public static void renderNodeItem(
|
||||
IItemRenderer.ItemRenderType type,
|
||||
ItemStack item,
|
||||
AspectList aspects,
|
||||
NodeType nodeType,
|
||||
NodeModifier nodeModifier,
|
||||
Object... data) {
|
||||
if (type == IItemRenderer.ItemRenderType.ENTITY) {
|
||||
GL11.glTranslatef(-0.5F, -0.25F, -0.5F);
|
||||
} else if ((type == IItemRenderer.ItemRenderType.EQUIPPED) && ((data[1] instanceof EntityPlayer))) {
|
||||
@@ -66,12 +75,15 @@ public class ItemNodeRenderer implements IItemRenderer {
|
||||
GL11.glEnable(32826);
|
||||
}
|
||||
|
||||
|
||||
public static void renderNodeItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) {
|
||||
ItemNodeRenderer.renderNodeItem(type, item, ItemNodeRenderer.aspects, NodeType.NORMAL, null, data);
|
||||
}
|
||||
|
||||
private static AspectList aspects = new AspectList().add(Aspect.AIR, 40).add(Aspect.FIRE, 40).add(Aspect.EARTH, 40).add(Aspect.WATER, 40);
|
||||
private static AspectList aspects = new AspectList()
|
||||
.add(Aspect.AIR, 40)
|
||||
.add(Aspect.FIRE, 40)
|
||||
.add(Aspect.EARTH, 40)
|
||||
.add(Aspect.WATER, 40);
|
||||
|
||||
public static void renderItemNode(INode node) {
|
||||
if (node.getAspects().size() > 0) {
|
||||
@@ -118,7 +130,8 @@ public class ItemNodeRenderer implements IItemRenderer {
|
||||
GL11.glBlendFunc(770, aspect.getBlend());
|
||||
scale = MathHelper.sin(viewer.ticksExisted / (14.0F - count)) * bscale + bscale * 2.0F;
|
||||
scale = 0.2F + scale * (node.getAspects().getAmount(aspect) / 50.0F);
|
||||
UtilsFX.renderAnimatedQuadStrip(scale, alpha / node.getAspects().size(), frames, 0, i, 0.0F, aspect.getColor());
|
||||
UtilsFX.renderAnimatedQuadStrip(
|
||||
scale, alpha / node.getAspects().size(), frames, 0, i, 0.0F, aspect.getColor());
|
||||
GL11.glDisable(3042);
|
||||
GL11.glPopMatrix();
|
||||
count++;
|
||||
@@ -171,5 +184,4 @@ public class ItemNodeRenderer implements IItemRenderer {
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package makeo.gadomancy.client.renderers.item;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Random;
|
||||
import makeo.gadomancy.client.util.FamiliarHandlerClient;
|
||||
import makeo.gadomancy.common.items.baubles.ItemEtherealFamiliar;
|
||||
import makeo.gadomancy.common.utils.MiscUtils;
|
||||
@@ -19,9 +21,6 @@ import thaumcraft.client.lib.UtilsFX;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.entities.monster.EntityWisp;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -47,23 +46,26 @@ public class ItemRenderFamiliar implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
if(item == null || !(item.getItem() instanceof ItemEtherealFamiliar)) return;
|
||||
if (item == null || !(item.getItem() instanceof ItemEtherealFamiliar)) return;
|
||||
GL11.glPushMatrix();
|
||||
if(type == ItemRenderType.EQUIPPED) {
|
||||
if (type == ItemRenderType.EQUIPPED) {
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.7F);
|
||||
} else if(type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
|
||||
} else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
|
||||
GL11.glTranslatef(0, 1F, 0.8F);
|
||||
} else if(type == ItemRenderType.INVENTORY) {
|
||||
} else if (type == ItemRenderType.INVENTORY) {
|
||||
GL11.glTranslatef(0, -0.45F, 0);
|
||||
}
|
||||
|
||||
try {
|
||||
this.cleanActiveRenderInfo(type);
|
||||
GL11.glScalef(1.3F, 1.3F, 1.3F);
|
||||
if(ItemEtherealFamiliar.hasFamiliarAspect(item)) {
|
||||
if(ItemRenderFamiliar.ENTITY_WISP == null) ItemRenderFamiliar.ENTITY_WISP = new EntityWisp(new FakeWorld());
|
||||
ItemRenderFamiliar.ENTITY_WISP.ticksExisted = FamiliarHandlerClient.PartialEntityFamiliar.DUMMY_FAMILIAR.ticksExisted;
|
||||
ItemRenderFamiliar.ENTITY_WISP.setType(ItemEtherealFamiliar.getFamiliarAspect(item).getTag());
|
||||
if (ItemEtherealFamiliar.hasFamiliarAspect(item)) {
|
||||
if (ItemRenderFamiliar.ENTITY_WISP == null)
|
||||
ItemRenderFamiliar.ENTITY_WISP = new EntityWisp(new FakeWorld());
|
||||
ItemRenderFamiliar.ENTITY_WISP.ticksExisted =
|
||||
FamiliarHandlerClient.PartialEntityFamiliar.DUMMY_FAMILIAR.ticksExisted;
|
||||
ItemRenderFamiliar.ENTITY_WISP.setType(
|
||||
ItemEtherealFamiliar.getFamiliarAspect(item).getTag());
|
||||
ItemRenderFamiliar.renderEntityWispFor(null, ItemRenderFamiliar.ENTITY_WISP, 0, 0, 0, 0, 0);
|
||||
}
|
||||
} finally {
|
||||
@@ -108,18 +110,20 @@ public class ItemRenderFamiliar implements IItemRenderer {
|
||||
}
|
||||
|
||||
private void restoreActiveRenderInfo() {
|
||||
if(this.renderInfo[0] != -1) ActiveRenderInfo.rotationX = this.renderInfo[0];
|
||||
if(this.renderInfo[1] != -1) ActiveRenderInfo.rotationXZ = this.renderInfo[1];
|
||||
if(this.renderInfo[2] != -1) ActiveRenderInfo.rotationZ = this.renderInfo[2];
|
||||
if(this.renderInfo[3] != -1) ActiveRenderInfo.rotationYZ = this.renderInfo[3];
|
||||
if(this.renderInfo[4] != -1) ActiveRenderInfo.rotationXY = this.renderInfo[4];
|
||||
if (this.renderInfo[0] != -1) ActiveRenderInfo.rotationX = this.renderInfo[0];
|
||||
if (this.renderInfo[1] != -1) ActiveRenderInfo.rotationXZ = this.renderInfo[1];
|
||||
if (this.renderInfo[2] != -1) ActiveRenderInfo.rotationZ = this.renderInfo[2];
|
||||
if (this.renderInfo[3] != -1) ActiveRenderInfo.rotationYZ = this.renderInfo[3];
|
||||
if (this.renderInfo[4] != -1) ActiveRenderInfo.rotationXY = this.renderInfo[4];
|
||||
for (int i = 0; i < this.renderInfo.length; i++) {
|
||||
this.renderInfo[i] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
private static int size1;
|
||||
public static void renderEntityWispFor(EntityPlayer owner, EntityWisp wisp, double x, double y, double z, float fq, float pticks) {
|
||||
|
||||
public static void renderEntityWispFor(
|
||||
EntityPlayer owner, EntityWisp wisp, double x, double y, double z, float fq, float pticks) {
|
||||
if (ItemRenderFamiliar.size1 == 0) {
|
||||
ItemRenderFamiliar.size1 = UtilsFX.getTextureSize("textures/misc/wisp.png", 64);
|
||||
}
|
||||
@@ -130,24 +134,24 @@ public class ItemRenderFamiliar implements IItemRenderer {
|
||||
float f4 = ActiveRenderInfo.rotationYZ;
|
||||
float f5 = ActiveRenderInfo.rotationXY;
|
||||
float f10 = 1.0F;
|
||||
float f11 = (float)x;
|
||||
float f12 = (float)y + 0.45F;
|
||||
float f13 = (float)z;
|
||||
float f11 = (float) x;
|
||||
float f12 = (float) y + 0.45F;
|
||||
float f13 = (float) z;
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
boolean priv = owner != null && MiscUtils.isPrivilegedUser(owner);
|
||||
|
||||
Color color = new Color(0);
|
||||
if(priv) {
|
||||
if (priv) {
|
||||
color = new Color(Color.HSBtoRGB((System.currentTimeMillis() % 3240) / 3240F, 1F, 1F));
|
||||
if(owner.worldObj.rand.nextInt(3) == 0) {
|
||||
if (owner.worldObj.rand.nextInt(3) == 0) {
|
||||
EntityPlayer thisPlayer = Minecraft.getMinecraft().thePlayer;
|
||||
boolean isThisOwner = thisPlayer.equals(owner);
|
||||
World world = owner.worldObj;
|
||||
Random rand = world.rand;
|
||||
double oX, oY, oZ;
|
||||
if(isThisOwner) {
|
||||
if (isThisOwner) {
|
||||
oX = owner.posX + f11;
|
||||
oY = owner.posY + f12;
|
||||
oZ = owner.posZ + f13;
|
||||
@@ -156,10 +160,15 @@ public class ItemRenderFamiliar implements IItemRenderer {
|
||||
oY = thisPlayer.posY + (f12);
|
||||
oZ = thisPlayer.posZ + (f13);
|
||||
}
|
||||
Thaumcraft.proxy.wispFX(world, oX + (rand.nextFloat() - rand.nextFloat()) * 0.3F,
|
||||
oY + (rand.nextFloat() - rand.nextFloat()) * 0.3F,
|
||||
oZ + (rand.nextFloat() - rand.nextFloat()) * 0.3F,
|
||||
0.1F, color.getRed() / 255.0F, color.getGreen() / 255.0F, color.getBlue() / 255.0F);
|
||||
Thaumcraft.proxy.wispFX(
|
||||
world,
|
||||
oX + (rand.nextFloat() - rand.nextFloat()) * 0.3F,
|
||||
oY + (rand.nextFloat() - rand.nextFloat()) * 0.3F,
|
||||
oZ + (rand.nextFloat() - rand.nextFloat()) * 0.3F,
|
||||
0.1F,
|
||||
color.getRed() / 255.0F,
|
||||
color.getGreen() / 255.0F,
|
||||
color.getBlue() / 255.0F);
|
||||
}
|
||||
} else {
|
||||
if (Aspect.getAspect(wisp.getType()) != null) {
|
||||
@@ -207,7 +216,6 @@ public class ItemRenderFamiliar implements IItemRenderer {
|
||||
|
||||
int qq = wisp.ticksExisted % 16;
|
||||
|
||||
|
||||
float size8 = 16.0F;
|
||||
x0 = qq / size8;
|
||||
x1 = (qq + 1) / size8;
|
||||
@@ -233,5 +241,4 @@ public class ItemRenderFamiliar implements IItemRenderer {
|
||||
GL11.glAlphaFunc(516, 0.1F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,8 +30,8 @@ public class ItemRenderRemoteJar extends ItemRenderTileEntity<TileRemoteJar> {
|
||||
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack stack, Object... data) {
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
|
||||
AspectList aspects = ((ItemJarFilled)ConfigItems.itemJarFilled).getAspects(stack);
|
||||
if(aspects != null) {
|
||||
AspectList aspects = ((ItemJarFilled) ConfigItems.itemJarFilled).getAspects(stack);
|
||||
if (aspects != null) {
|
||||
this.tile.aspect = aspects.getAspects()[0];
|
||||
this.tile.amount = aspects.getAmount(this.tile.aspect);
|
||||
} else {
|
||||
@@ -39,7 +39,7 @@ public class ItemRenderRemoteJar extends ItemRenderTileEntity<TileRemoteJar> {
|
||||
this.tile.amount = 0;
|
||||
}
|
||||
|
||||
if(stack.hasTagCompound()) {
|
||||
if (stack.hasTagCompound()) {
|
||||
this.tile.networkId = NBTHelper.getUUID(stack.getTagCompound(), "networkId");
|
||||
}
|
||||
|
||||
@@ -48,7 +48,12 @@ public class ItemRenderRemoteJar extends ItemRenderTileEntity<TileRemoteJar> {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.5f, 0.5f, 0.5f);
|
||||
|
||||
RenderingRegistry.instance().renderInventoryBlock(RenderBlocks.getInstance(), RegisteredBlocks.blockRemoteJar, 0, RegisteredBlocks.blockRemoteJar.getRenderType());
|
||||
RenderingRegistry.instance()
|
||||
.renderInventoryBlock(
|
||||
RenderBlocks.getInstance(),
|
||||
RegisteredBlocks.blockRemoteJar,
|
||||
0,
|
||||
RegisteredBlocks.blockRemoteJar.getRenderType());
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,12 @@
|
||||
package makeo.gadomancy.client.renderers.item;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -19,7 +18,7 @@ import java.util.Map;
|
||||
public class ItemRenderStoneMachine extends ItemRenderTileEntity<TileEntity> {
|
||||
private final Map<Integer, RenderInfo> renderers = new HashMap<Integer, RenderInfo>();
|
||||
|
||||
public ItemRenderStoneMachine() { }
|
||||
public ItemRenderStoneMachine() {}
|
||||
|
||||
private static class RenderInfo {
|
||||
private TileEntity tile;
|
||||
@@ -32,7 +31,7 @@ public class ItemRenderStoneMachine extends ItemRenderTileEntity<TileEntity> {
|
||||
info.tile = tile;
|
||||
this.renderers.put(metadata, info);
|
||||
|
||||
if(tile.getWorldObj() == null) {
|
||||
if (tile.getWorldObj() == null) {
|
||||
tile.setWorldObj(ItemRenderTileEntity.FAKE_WORLD);
|
||||
}
|
||||
}
|
||||
@@ -44,8 +43,8 @@ public class ItemRenderStoneMachine extends ItemRenderTileEntity<TileEntity> {
|
||||
this.tile = info.tile;
|
||||
this.renderer = info.renderer;
|
||||
|
||||
if(stack.getItemDamage() == 0) {
|
||||
GL11.glTranslatef(0, 2/16f, 0);
|
||||
if (stack.getItemDamage() == 0) {
|
||||
GL11.glTranslatef(0, 2 / 16f, 0);
|
||||
}
|
||||
|
||||
super.renderItem(type, stack, data);
|
||||
|
||||
@@ -20,16 +20,16 @@ public class ItemRenderTEKnowledgeBook extends ItemRenderTileEntity<TileKnowledg
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
GL11.glPushMatrix();
|
||||
if(type.equals(ItemRenderType.INVENTORY)) {
|
||||
if (type.equals(ItemRenderType.INVENTORY)) {
|
||||
GL11.glScalef(1.4F, 1.4F, 1.4F);
|
||||
} else if(type.equals(ItemRenderType.ENTITY)) {
|
||||
} else if (type.equals(ItemRenderType.ENTITY)) {
|
||||
GL11.glScalef(2F, 2F, 2F);
|
||||
} else if(type.equals(ItemRenderType.EQUIPPED)) {
|
||||
} else if (type.equals(ItemRenderType.EQUIPPED)) {
|
||||
GL11.glRotatef(15F, 1, 0, 0);
|
||||
GL11.glRotatef(-50F, 0, 1, 0);
|
||||
GL11.glTranslatef(-0.4F, 0F, -1.25F);
|
||||
GL11.glScalef(1.8F, 1.8F, 1.8F);
|
||||
} else if(type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
|
||||
} else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
|
||||
GL11.glTranslatef(-0.2F, 0.4F, 0);
|
||||
GL11.glRotatef(30F, 0, 1, 0);
|
||||
GL11.glRotatef(55F, 0, 0, 1);
|
||||
|
||||
@@ -27,12 +27,12 @@ public class ItemRenderTileEntity<T extends TileEntity> implements IItemRenderer
|
||||
this.renderer = renderer;
|
||||
this.tile = tile;
|
||||
|
||||
if(tile.getWorldObj() == null) {
|
||||
if (tile.getWorldObj() == null) {
|
||||
tile.setWorldObj(ItemRenderTileEntity.FAKE_WORLD);
|
||||
}
|
||||
}
|
||||
|
||||
protected ItemRenderTileEntity() { }
|
||||
protected ItemRenderTileEntity() {}
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
@@ -46,13 +46,11 @@ public class ItemRenderTileEntity<T extends TileEntity> implements IItemRenderer
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
if(type == IItemRenderer.ItemRenderType.ENTITY)
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
if (type == IItemRenderer.ItemRenderType.ENTITY) GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
|
||||
if(type == ItemRenderType.INVENTORY)
|
||||
GL11.glTranslatef(0, -0.1F, 0);
|
||||
if (type == ItemRenderType.INVENTORY) GL11.glTranslatef(0, -0.1F, 0);
|
||||
|
||||
if(type == ItemRenderType.EQUIPPED_FIRST_PERSON && this.tile instanceof TileManipulationFocus)
|
||||
if (type == ItemRenderType.EQUIPPED_FIRST_PERSON && this.tile instanceof TileManipulationFocus)
|
||||
GL11.glTranslatef(0, 0.6F, 0);
|
||||
|
||||
this.renderer.renderTileEntityAt(this.tile, 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
package makeo.gadomancy.client.renderers.item;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -22,8 +21,8 @@ public class ItemRenderTileEntityMulti implements IItemRenderer {
|
||||
private Map<Integer, RenderSet> renderMap = new HashMap<Integer, RenderSet>();
|
||||
|
||||
public ItemRenderTileEntityMulti(RenderSet... renderSets) {
|
||||
for(RenderSet set : renderSets) {
|
||||
if(set != null) {
|
||||
for (RenderSet set : renderSets) {
|
||||
if (set != null) {
|
||||
this.renderMap.put(set.meta, set);
|
||||
}
|
||||
}
|
||||
@@ -42,13 +41,11 @@ public class ItemRenderTileEntityMulti implements IItemRenderer {
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
GL11.glPushMatrix();
|
||||
if(type == IItemRenderer.ItemRenderType.ENTITY)
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
if (type == IItemRenderer.ItemRenderType.ENTITY) GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
|
||||
if(type == ItemRenderType.INVENTORY)
|
||||
GL11.glTranslatef(0, -0.1F, 0);
|
||||
if (type == ItemRenderType.INVENTORY) GL11.glTranslatef(0, -0.1F, 0);
|
||||
|
||||
if(this.renderMap.containsKey(item.getItemDamage())) {
|
||||
if (this.renderMap.containsKey(item.getItemDamage())) {
|
||||
RenderSet set = this.renderMap.get(item.getItemDamage());
|
||||
set.renderer.renderTileEntityAt(set.te, 0, 0, 0, 0);
|
||||
}
|
||||
@@ -68,5 +65,4 @@ public class ItemRenderTileEntityMulti implements IItemRenderer {
|
||||
this.meta = meta;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package makeo.gadomancy.client.renderers.tile;
|
||||
|
||||
import java.util.Random;
|
||||
import makeo.gadomancy.client.effect.EffectHandler;
|
||||
import makeo.gadomancy.client.effect.fx.Orbital;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileAIShutdown;
|
||||
@@ -10,8 +11,6 @@ import net.minecraft.world.World;
|
||||
import thaumcraft.client.fx.ParticleEngine;
|
||||
import thaumcraft.client.fx.particles.FXWisp;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -26,31 +25,31 @@ public class RenderTileAIShutdown extends TileEntitySpecialRenderer {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float parTicks) {
|
||||
if(tileEntity == null || !(tileEntity instanceof TileAIShutdown)) return;
|
||||
if (tileEntity == null || !(tileEntity instanceof TileAIShutdown)) return;
|
||||
TileAIShutdown ta = (TileAIShutdown) tileEntity;
|
||||
|
||||
if(ta.getStoredEssentia() > 0) {
|
||||
if (ta.getStoredEssentia() > 0) {
|
||||
this.handleOrbital(ta);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleOrbital(TileAIShutdown ta) {
|
||||
if(ta.orbital == null && ta.getWorldObj() != null) {
|
||||
if (ta.orbital == null && ta.getWorldObj() != null) {
|
||||
ta.orbital = new Orbital(new Vector3(ta.xCoord + 0.5, ta.yCoord + 0.2, ta.zCoord + 0.5), ta.getWorldObj());
|
||||
}
|
||||
|
||||
if(ta.orbital != null && !ta.orbital.registered) {
|
||||
if (ta.orbital != null && !ta.orbital.registered) {
|
||||
EffectHandler.getInstance().registerOrbital(ta.orbital);
|
||||
}
|
||||
|
||||
if(ta.orbital != null) ta.orbital.lastRenderCall = System.currentTimeMillis();
|
||||
if (ta.orbital != null) ta.orbital.lastRenderCall = System.currentTimeMillis();
|
||||
|
||||
if(ta.getStoredEssentia() > 0) {
|
||||
if(ta.orbital != null && ta.orbital.orbitalsSize() == 0) {
|
||||
if (ta.getStoredEssentia() > 0) {
|
||||
if (ta.orbital != null && ta.orbital.orbitalsSize() == 0) {
|
||||
this.fillOrbital(ta.orbital);
|
||||
}
|
||||
} else {
|
||||
if(ta.orbital != null && ta.orbital.orbitalsSize() > 0) {
|
||||
if (ta.orbital != null && ta.orbital.orbitalsSize() > 0) {
|
||||
ta.orbital.clearOrbitals();
|
||||
}
|
||||
}
|
||||
@@ -62,11 +61,20 @@ public class RenderTileAIShutdown extends TileEntitySpecialRenderer {
|
||||
prop.setParticleSize(0F);
|
||||
prop.setRenderRunnable(new Orbital.OrbitalRenderRunnable() {
|
||||
@Override
|
||||
public void onRender(World world, Vector3 pos, Orbital.OrbitalRenderProperties properties, int orbitalExisted, float partialTicks) {
|
||||
if(RenderTileAIShutdown.rand.nextInt(3) == 0) {
|
||||
FXWisp ef = new FXWisp(world,
|
||||
pos.getX() + RenderTileAIShutdown.randomOffset(), pos.getY() + RenderTileAIShutdown.randomOffset(), pos.getZ() + RenderTileAIShutdown.randomOffset(),
|
||||
0.2F, 3);
|
||||
public void onRender(
|
||||
World world,
|
||||
Vector3 pos,
|
||||
Orbital.OrbitalRenderProperties properties,
|
||||
int orbitalExisted,
|
||||
float partialTicks) {
|
||||
if (RenderTileAIShutdown.rand.nextInt(3) == 0) {
|
||||
FXWisp ef = new FXWisp(
|
||||
world,
|
||||
pos.getX() + RenderTileAIShutdown.randomOffset(),
|
||||
pos.getY() + RenderTileAIShutdown.randomOffset(),
|
||||
pos.getZ() + RenderTileAIShutdown.randomOffset(),
|
||||
0.2F,
|
||||
3);
|
||||
ef.setGravity(-0.08F);
|
||||
ParticleEngine.instance.addEffect(world, ef);
|
||||
}
|
||||
@@ -79,11 +87,20 @@ public class RenderTileAIShutdown extends TileEntitySpecialRenderer {
|
||||
prop.setParticleSize(0F);
|
||||
prop.setRenderRunnable(new Orbital.OrbitalRenderRunnable() {
|
||||
@Override
|
||||
public void onRender(World world, Vector3 pos, Orbital.OrbitalRenderProperties properties, int orbitalExisted, float partialTicks) {
|
||||
if(RenderTileAIShutdown.rand.nextInt(3) == 0) {
|
||||
FXWisp ef = new FXWisp(world,
|
||||
pos.getX() + RenderTileAIShutdown.randomOffset(), pos.getY() + RenderTileAIShutdown.randomOffset(), pos.getZ() + RenderTileAIShutdown.randomOffset(),
|
||||
0.2F, 3);
|
||||
public void onRender(
|
||||
World world,
|
||||
Vector3 pos,
|
||||
Orbital.OrbitalRenderProperties properties,
|
||||
int orbitalExisted,
|
||||
float partialTicks) {
|
||||
if (RenderTileAIShutdown.rand.nextInt(3) == 0) {
|
||||
FXWisp ef = new FXWisp(
|
||||
world,
|
||||
pos.getX() + RenderTileAIShutdown.randomOffset(),
|
||||
pos.getY() + RenderTileAIShutdown.randomOffset(),
|
||||
pos.getZ() + RenderTileAIShutdown.randomOffset(),
|
||||
0.2F,
|
||||
3);
|
||||
ef.setGravity(-0.08F);
|
||||
ParticleEngine.instance.addEffect(world, ef);
|
||||
}
|
||||
@@ -96,11 +113,20 @@ public class RenderTileAIShutdown extends TileEntitySpecialRenderer {
|
||||
prop.setParticleSize(0F);
|
||||
prop.setRenderRunnable(new Orbital.OrbitalRenderRunnable() {
|
||||
@Override
|
||||
public void onRender(World world, Vector3 pos, Orbital.OrbitalRenderProperties properties, int orbitalExisted, float partialTicks) {
|
||||
if(RenderTileAIShutdown.rand.nextBoolean()) {
|
||||
FXWisp ef = new FXWisp(world,
|
||||
pos.getX() + RenderTileAIShutdown.randomOffset(), pos.getY() + RenderTileAIShutdown.randomOffset(), pos.getZ() + RenderTileAIShutdown.randomOffset(),
|
||||
0.15F, 5);
|
||||
public void onRender(
|
||||
World world,
|
||||
Vector3 pos,
|
||||
Orbital.OrbitalRenderProperties properties,
|
||||
int orbitalExisted,
|
||||
float partialTicks) {
|
||||
if (RenderTileAIShutdown.rand.nextBoolean()) {
|
||||
FXWisp ef = new FXWisp(
|
||||
world,
|
||||
pos.getX() + RenderTileAIShutdown.randomOffset(),
|
||||
pos.getY() + RenderTileAIShutdown.randomOffset(),
|
||||
pos.getZ() + RenderTileAIShutdown.randomOffset(),
|
||||
0.15F,
|
||||
5);
|
||||
ef.setGravity(-0.08F);
|
||||
ParticleEngine.instance.addEffect(world, ef);
|
||||
}
|
||||
@@ -113,11 +139,20 @@ public class RenderTileAIShutdown extends TileEntitySpecialRenderer {
|
||||
prop.setParticleSize(0F);
|
||||
prop.setRenderRunnable(new Orbital.OrbitalRenderRunnable() {
|
||||
@Override
|
||||
public void onRender(World world, Vector3 pos, Orbital.OrbitalRenderProperties properties, int orbitalExisted, float partialTicks) {
|
||||
if(RenderTileAIShutdown.rand.nextBoolean()) {
|
||||
FXWisp ef = new FXWisp(world,
|
||||
pos.getX() + RenderTileAIShutdown.randomOffset(), pos.getY() + RenderTileAIShutdown.randomOffset(), pos.getZ() + RenderTileAIShutdown.randomOffset(),
|
||||
0.15F, 5);
|
||||
public void onRender(
|
||||
World world,
|
||||
Vector3 pos,
|
||||
Orbital.OrbitalRenderProperties properties,
|
||||
int orbitalExisted,
|
||||
float partialTicks) {
|
||||
if (RenderTileAIShutdown.rand.nextBoolean()) {
|
||||
FXWisp ef = new FXWisp(
|
||||
world,
|
||||
pos.getX() + RenderTileAIShutdown.randomOffset(),
|
||||
pos.getY() + RenderTileAIShutdown.randomOffset(),
|
||||
pos.getZ() + RenderTileAIShutdown.randomOffset(),
|
||||
0.15F,
|
||||
5);
|
||||
ef.setGravity(-0.08F);
|
||||
ParticleEngine.instance.addEffect(world, ef);
|
||||
}
|
||||
@@ -130,22 +165,29 @@ public class RenderTileAIShutdown extends TileEntitySpecialRenderer {
|
||||
prop.setParticleSize(0F);
|
||||
prop.setRenderRunnable(new Orbital.OrbitalRenderRunnable() {
|
||||
@Override
|
||||
public void onRender(World world, Vector3 pos, Orbital.OrbitalRenderProperties properties, int orbitalExisted, float partialTicks) {
|
||||
if(RenderTileAIShutdown.rand.nextBoolean()) {
|
||||
FXWisp ef = new FXWisp(world,
|
||||
pos.getX() + RenderTileAIShutdown.randomOffset(), pos.getY() + RenderTileAIShutdown.randomOffset(), pos.getZ() + RenderTileAIShutdown.randomOffset(),
|
||||
0.15F, 5);
|
||||
public void onRender(
|
||||
World world,
|
||||
Vector3 pos,
|
||||
Orbital.OrbitalRenderProperties properties,
|
||||
int orbitalExisted,
|
||||
float partialTicks) {
|
||||
if (RenderTileAIShutdown.rand.nextBoolean()) {
|
||||
FXWisp ef = new FXWisp(
|
||||
world,
|
||||
pos.getX() + RenderTileAIShutdown.randomOffset(),
|
||||
pos.getY() + RenderTileAIShutdown.randomOffset(),
|
||||
pos.getZ() + RenderTileAIShutdown.randomOffset(),
|
||||
0.15F,
|
||||
5);
|
||||
ef.setGravity(-0.08F);
|
||||
ParticleEngine.instance.addEffect(world, ef);
|
||||
}
|
||||
}
|
||||
});
|
||||
orbital.addOrbitalPoint(prop);
|
||||
|
||||
}
|
||||
|
||||
private static float randomOffset() {
|
||||
return RenderTileAIShutdown.rand.nextFloat() * 0.2F;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,20 +36,20 @@ public class RenderTileArcaneDropper extends TileEntitySpecialRenderer {
|
||||
|
||||
ForgeDirection side = ForgeDirection.getOrientation(metadata & 7);
|
||||
|
||||
if(side == ForgeDirection.UP) {
|
||||
if (side == ForgeDirection.UP) {
|
||||
GL11.glRotatef(180, 1, 0, 0);
|
||||
GL11.glTranslatef(0, -2, 0);
|
||||
} else if(side != ForgeDirection.DOWN) {
|
||||
GL11.glRotatef(-90, side.offsetZ, 0, -1*side.offsetX);
|
||||
} else if (side != ForgeDirection.DOWN) {
|
||||
GL11.glRotatef(-90, side.offsetZ, 0, -1 * side.offsetX);
|
||||
GL11.glTranslatef(side.offsetX, -1, side.offsetZ);
|
||||
}
|
||||
|
||||
boolean flipped = (metadata & 8) == 8;
|
||||
if(side == ForgeDirection.WEST || side == ForgeDirection.EAST) {
|
||||
if (side == ForgeDirection.WEST || side == ForgeDirection.EAST) {
|
||||
flipped = !flipped;
|
||||
}
|
||||
|
||||
if(flipped) {
|
||||
if (flipped) {
|
||||
GL11.glRotatef(90, 0, 1, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,21 +32,21 @@ public class RenderTileArcanePackager extends TileEntitySpecialRenderer {
|
||||
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
GL11.glRotatef(180 , 1, 0, 0);
|
||||
GL11.glRotatef(180, 1, 0, 0);
|
||||
GL11.glTranslatef(0.5f, -1.5f, -0.5f);
|
||||
|
||||
GL11.glRotatef(-90*((TileJarFillable)tile).facing + 270, 0, 1, 0);
|
||||
GL11.glRotatef(-90 * ((TileJarFillable) tile).facing + 270, 0, 1, 0);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
float pistonOffset;
|
||||
int pixelProgress = ((TileArcanePackager)tile).progress;
|
||||
if(pixelProgress <= 40) {
|
||||
pistonOffset = (pixelProgress / 40f) * (3/16f);
|
||||
int pixelProgress = ((TileArcanePackager) tile).progress;
|
||||
if (pixelProgress <= 40) {
|
||||
pistonOffset = (pixelProgress / 40f) * (3 / 16f);
|
||||
} else {
|
||||
pixelProgress -= 41;
|
||||
float progress = pixelProgress / 5f;
|
||||
pistonOffset = (3/16f) - (progress * (3/16f));
|
||||
pistonOffset = (3 / 16f) - (progress * (3 / 16f));
|
||||
}
|
||||
|
||||
GL11.glTranslatef(0, pistonOffset, 0);
|
||||
@@ -56,7 +56,7 @@ public class RenderTileArcanePackager extends TileEntitySpecialRenderer {
|
||||
|
||||
this.bindTexture(RenderTileArcanePackager.TEXTURE_PISTON);
|
||||
|
||||
if(pistonOffset < 1/16f) {
|
||||
if (pistonOffset < 1 / 16f) {
|
||||
RenderTileArcanePackager.MODEL_PISTON_CUT.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
|
||||
} else {
|
||||
RenderTileArcanePackager.MODEL_PISTON.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package makeo.gadomancy.client.renderers.tile;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Random;
|
||||
import makeo.gadomancy.client.effect.EffectHandler;
|
||||
import makeo.gadomancy.client.effect.fx.Orbital;
|
||||
import makeo.gadomancy.client.models.ModelAuraPylon;
|
||||
@@ -19,9 +21,6 @@ import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.client.fx.ParticleEngine;
|
||||
import thaumcraft.client.fx.particles.FXWisp;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -35,9 +34,11 @@ public class RenderTileAuraPylon extends TileEntitySpecialRenderer {
|
||||
public static final ModelBase MODEL_AURA_PYLON = new ModelAuraPylon();
|
||||
public static final ModelBase MODEL_AURA_PYLON_TOP = new ModelAuraPylonTop();
|
||||
public static final ModelBase MODEL_AURA_PYLON_BOTTOM = new ModelAuraPylonBottom();
|
||||
public static final SimpleResourceLocation PYLON_TEXTURE_TOP = new SimpleResourceLocation("models/aura_pylon_peak.png");
|
||||
public static final SimpleResourceLocation PYLON_TEXTURE_TOP =
|
||||
new SimpleResourceLocation("models/aura_pylon_peak.png");
|
||||
public static final SimpleResourceLocation PYLON_TEXTURE = new SimpleResourceLocation("models/aura_pylon.png");
|
||||
public static final SimpleResourceLocation PYLON_TEXTURE_BOTTOM = new SimpleResourceLocation("models/aura_pylon_base.png");
|
||||
public static final SimpleResourceLocation PYLON_TEXTURE_BOTTOM =
|
||||
new SimpleResourceLocation("models/aura_pylon_base.png");
|
||||
|
||||
public void renderTileEntity(TileEntity tile, double x, double y, double z, float partTicks) {
|
||||
GL11.glPushMatrix();
|
||||
@@ -45,32 +46,32 @@ public class RenderTileAuraPylon extends TileEntitySpecialRenderer {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
ResourceLocation textureToBind;
|
||||
if(tile instanceof TileAuraPylonTop) {
|
||||
if (tile instanceof TileAuraPylonTop) {
|
||||
textureToBind = RenderTileAuraPylon.PYLON_TEXTURE_TOP;
|
||||
} else if(((TileAuraPylon) tile).isInputTile() || ((TileAuraPylon) tile).isLowestTile()) {
|
||||
} else if (((TileAuraPylon) tile).isInputTile() || ((TileAuraPylon) tile).isLowestTile()) {
|
||||
textureToBind = RenderTileAuraPylon.PYLON_TEXTURE_BOTTOM;
|
||||
} else {
|
||||
textureToBind = RenderTileAuraPylon.PYLON_TEXTURE;
|
||||
}
|
||||
this.bindTexture(textureToBind);
|
||||
for(int i = 0; i < 4; i++) {
|
||||
if(tile instanceof TileAuraPylonTop) {
|
||||
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);
|
||||
RenderTileAuraPylon.MODEL_AURA_PYLON_TOP.render(null, 0, 0, 0, 0, 0, 0.0625f);
|
||||
GL11.glPopMatrix();
|
||||
} else {
|
||||
if(((TileAuraPylon) tile).isInputTile() || ((TileAuraPylon) tile).isLowestTile()) {
|
||||
if (((TileAuraPylon) tile).isInputTile() || ((TileAuraPylon) tile).isLowestTile()) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(180, 1, 0, 0);
|
||||
GL11.glTranslatef(0, -2F, 0);
|
||||
//bindTexture(PYLON_TEXTURE_BOTTOM);
|
||||
// bindTexture(PYLON_TEXTURE_BOTTOM);
|
||||
RenderTileAuraPylon.MODEL_AURA_PYLON_BOTTOM.render(null, 0, 0, 0, 0, 0, 0.0625f);
|
||||
GL11.glPopMatrix();
|
||||
} else {
|
||||
//bindTexture(PYLON_TEXTURE);
|
||||
// bindTexture(PYLON_TEXTURE);
|
||||
RenderTileAuraPylon.MODEL_AURA_PYLON.render(null, 0, 0, 0, 0, 0, 0.0625f);
|
||||
}
|
||||
}
|
||||
@@ -80,30 +81,31 @@ public class RenderTileAuraPylon extends TileEntitySpecialRenderer {
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
|
||||
if(tile instanceof TileAuraPylonTop) {
|
||||
if (tile instanceof TileAuraPylonTop) {
|
||||
TileAuraPylonTop ta = (TileAuraPylonTop) tile;
|
||||
if(ta.orbital == null && tile.getWorldObj() != null) {
|
||||
ta.orbital = new Orbital(new Vector3(tile.xCoord + 0.5, tile.yCoord + 0.7, tile.zCoord + 0.5), tile.getWorldObj());
|
||||
if (ta.orbital == null && tile.getWorldObj() != null) {
|
||||
ta.orbital = new Orbital(
|
||||
new Vector3(tile.xCoord + 0.5, tile.yCoord + 0.7, tile.zCoord + 0.5), tile.getWorldObj());
|
||||
}
|
||||
|
||||
if(ta.orbital != null && !ta.orbital.registered) {
|
||||
if (ta.orbital != null && !ta.orbital.registered) {
|
||||
EffectHandler.getInstance().registerOrbital(ta.orbital);
|
||||
}
|
||||
|
||||
if(ta.shouldRenderEffect()) {
|
||||
if (ta.shouldRenderEffect()) {
|
||||
Aspect a = ta.getAspect();
|
||||
if(a == null) a = Aspect.WEATHER;
|
||||
if (a == null) a = Aspect.WEATHER;
|
||||
Color c = new Color(a.getColor());
|
||||
if(tile.getWorldObj().rand.nextInt(12) == 0) {
|
||||
if(a == Aspect.ENTROPY || a == Aspect.DARKNESS || a == Aspect.UNDEAD) {
|
||||
if (tile.getWorldObj().rand.nextInt(12) == 0) {
|
||||
if (a == Aspect.ENTROPY || a == Aspect.DARKNESS || a == Aspect.UNDEAD) {
|
||||
this.spawnWispParticles((TileAuraPylonTop) tile, 5, 0.5F, false);
|
||||
} else {
|
||||
this.spawnWispParticles((TileAuraPylonTop) tile, c, 0.5F, false);
|
||||
}
|
||||
}
|
||||
c = c.darker().darker();
|
||||
if(tile.getWorldObj().rand.nextInt(20) == 0) {
|
||||
if(a == Aspect.ENTROPY || a == Aspect.DARKNESS || a == Aspect.UNDEAD) {
|
||||
if (tile.getWorldObj().rand.nextInt(20) == 0) {
|
||||
if (a == Aspect.ENTROPY || a == Aspect.DARKNESS || a == Aspect.UNDEAD) {
|
||||
this.spawnWispParticles((TileAuraPylonTop) tile, 5, 0.25F, false);
|
||||
} else {
|
||||
this.spawnWispParticles((TileAuraPylonTop) tile, c, 0.25F, false);
|
||||
@@ -111,12 +113,12 @@ public class RenderTileAuraPylon extends TileEntitySpecialRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
if(ta.orbital != null) ta.orbital.lastRenderCall = System.currentTimeMillis();
|
||||
if (ta.orbital != null) ta.orbital.lastRenderCall = System.currentTimeMillis();
|
||||
|
||||
if(ta.shouldRenderAuraEffect() && ta.getAspect() != null) {
|
||||
if(ta.orbital != null && ta.orbital.orbitalsSize() == 0) {
|
||||
if (ta.shouldRenderAuraEffect() && ta.getAspect() != null) {
|
||||
if (ta.orbital != null && ta.orbital.orbitalsSize() == 0) {
|
||||
Aspect a = ta.getAspect();
|
||||
if(a != null) {
|
||||
if (a != null) {
|
||||
int col = a.getColor();
|
||||
col |= (0x55 << 24);
|
||||
Color c = new Color(col, true);
|
||||
@@ -127,7 +129,7 @@ public class RenderTileAuraPylon extends TileEntitySpecialRenderer {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(ta.orbital != null && ta.orbital.orbitalsSize() > 0) {
|
||||
if (ta.orbital != null && ta.orbital.orbitalsSize() > 0) {
|
||||
ta.orbital.clearOrbitals();
|
||||
}
|
||||
}
|
||||
@@ -135,7 +137,8 @@ public class RenderTileAuraPylon extends TileEntitySpecialRenderer {
|
||||
}
|
||||
|
||||
private void addNewOrbitalPoint(Orbital orbital, Random rand, Color color) {
|
||||
Orbital.OrbitalRenderProperties properties = new Orbital.OrbitalRenderProperties(Orbital.Axis.persisentRandomAxis(), rand.nextDouble() + 2D);
|
||||
Orbital.OrbitalRenderProperties properties =
|
||||
new Orbital.OrbitalRenderProperties(Orbital.Axis.persisentRandomAxis(), rand.nextDouble() + 2D);
|
||||
properties.setColor(color).setTicksForFullCircle(60 + rand.nextInt(40)).setOffsetTicks(rand.nextInt(80));
|
||||
properties.setSubParticleColor(color.brighter().brighter());
|
||||
orbital.addOrbitalPoint(properties);
|
||||
@@ -148,7 +151,16 @@ public class RenderTileAuraPylon extends TileEntitySpecialRenderer {
|
||||
int zCoord = tile.zCoord;
|
||||
float offset1 = inner ? 0.4F : 0.3F;
|
||||
float offset2 = inner ? 0.2F : 0.4F;
|
||||
FXWisp ef = new FXWisp(worldObj, xCoord + 0.55F, yCoord + 0.7F, zCoord + 0.55F, xCoord + offset1 + worldObj.rand.nextFloat() * offset2, yCoord + 0.7F, zCoord + offset1 + worldObj.rand.nextFloat() * offset2, size, type);
|
||||
FXWisp ef = new FXWisp(
|
||||
worldObj,
|
||||
xCoord + 0.55F,
|
||||
yCoord + 0.7F,
|
||||
zCoord + 0.55F,
|
||||
xCoord + offset1 + worldObj.rand.nextFloat() * offset2,
|
||||
yCoord + 0.7F,
|
||||
zCoord + offset1 + worldObj.rand.nextFloat() * offset2,
|
||||
size,
|
||||
type);
|
||||
ef.setGravity(-0.04F);
|
||||
ef.shrink = true;
|
||||
ParticleEngine.instance.addEffect(worldObj, ef);
|
||||
@@ -164,7 +176,18 @@ public class RenderTileAuraPylon extends TileEntitySpecialRenderer {
|
||||
float red = c.getRed() / 255F;
|
||||
float green = c.getGreen() / 255F;
|
||||
float blue = c.getBlue() / 255F;
|
||||
FXWisp ef = new FXWisp(worldObj, xCoord + 0.55F, yCoord + 0.7F, zCoord + 0.55F, xCoord + offset1 + worldObj.rand.nextFloat() * offset2, yCoord + 0.7F, zCoord + offset1 + worldObj.rand.nextFloat() * offset2, size, red, green, blue);
|
||||
FXWisp ef = new FXWisp(
|
||||
worldObj,
|
||||
xCoord + 0.55F,
|
||||
yCoord + 0.7F,
|
||||
zCoord + 0.55F,
|
||||
xCoord + offset1 + worldObj.rand.nextFloat() * offset2,
|
||||
yCoord + 0.7F,
|
||||
zCoord + offset1 + worldObj.rand.nextFloat() * offset2,
|
||||
size,
|
||||
red,
|
||||
green,
|
||||
blue);
|
||||
ef.setGravity(-0.04F);
|
||||
ef.shrink = true;
|
||||
ParticleEngine.instance.addEffect(worldObj, ef);
|
||||
@@ -174,5 +197,4 @@ public class RenderTileAuraPylon extends TileEntitySpecialRenderer {
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partTicks) {
|
||||
this.renderTileEntity(tileEntity, x, y, z, partTicks);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,7 +23,7 @@ public class RenderTileBlockProtector extends TileJarRenderer {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) {
|
||||
this.renderTileEntityAt((TileBlockProtector)tile, x, y, z, partialTicks);
|
||||
this.renderTileEntityAt((TileBlockProtector) tile, x, y, z, partialTicks);
|
||||
}
|
||||
|
||||
public void renderTileEntityAt(TileBlockProtector tile, double x, double y, double z, float partialTicks) {
|
||||
@@ -31,11 +31,11 @@ public class RenderTileBlockProtector extends TileJarRenderer {
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
GL11.glTranslatef(0.5f, 0, 0.5f);
|
||||
GL11.glRotatef(90*tile.facing, 0, 1, 0);
|
||||
GL11.glRotatef(90 * tile.facing, 0, 1, 0);
|
||||
GL11.glTranslatef(-0.5f, 0, -0.5f);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0, -2/16f - 0.03f, 0);
|
||||
GL11.glTranslatef(0, -2 / 16f - 0.03f, 0);
|
||||
GL11.glScalef(0.4f, 0.4f, 0.4f);
|
||||
GL11.glTranslatef(0.75f, 0.75f, 0.75f);
|
||||
|
||||
@@ -46,17 +46,16 @@ public class RenderTileBlockProtector extends TileJarRenderer {
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.5f, 1.5f, 0.5f);
|
||||
GL11.glRotatef(180, 1, 0, 0);
|
||||
|
||||
this.bindTexture(tile.getPowerLevel() > 0 ? RenderTileBlockProtector.TEXTURE_ON : RenderTileBlockProtector.TEXTURE_OFF);
|
||||
this.bindTexture(
|
||||
tile.getPowerLevel() > 0 ? RenderTileBlockProtector.TEXTURE_ON : RenderTileBlockProtector.TEXTURE_OFF);
|
||||
new ModelBlockProtector().render(null, 0, 0, 0, 0, 0, 0.0625f);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
||||
GL11.glTranslatef(0, -2/16f - 0.03f, 0);
|
||||
GL11.glTranslatef(0, -2 / 16f - 0.03f, 0);
|
||||
GL11.glScalef(0.4f, 0.4f, 0.4f);
|
||||
GL11.glTranslatef(0.75f, 0.75f, 0.75f);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public class RenderTileCapEldritch extends TileEldritchCapRenderer {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
|
||||
if(te.getWorldObj().provider.dimensionId == ModConfig.dimOuterId) {
|
||||
if (te.getWorldObj().provider.dimensionId == ModConfig.dimOuterId) {
|
||||
int old = Config.dimensionOuterId;
|
||||
Config.dimensionOuterId = ModConfig.dimOuterId;
|
||||
super.renderTileEntityAt(te, x, y, z, f);
|
||||
|
||||
+19
-15
@@ -1,5 +1,7 @@
|
||||
package makeo.gadomancy.client.renderers.tile;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import makeo.gadomancy.client.effect.EffectHandler;
|
||||
import makeo.gadomancy.client.effect.fx.FXVortex;
|
||||
import makeo.gadomancy.client.models.ModelEssentiaCompressor;
|
||||
@@ -13,9 +15,6 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* HellFirePvP@Admin
|
||||
* Date: 22.04.2016 / 21:39
|
||||
@@ -26,19 +25,21 @@ 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");
|
||||
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;
|
||||
if (tileEntity == null || !(tileEntity instanceof TileEssentiaCompressor)) return;
|
||||
|
||||
boolean isRenderedAsItem = false;
|
||||
if(tileEntity.getWorldObj() instanceof FakeWorld) { //LUL
|
||||
if (tileEntity.getWorldObj() instanceof FakeWorld) { // LUL
|
||||
isRenderedAsItem = true;
|
||||
}
|
||||
|
||||
if(!isRenderedAsItem && ((TileEssentiaCompressor) tileEntity).isMultiblockFormed()) {
|
||||
if (!isRenderedAsItem && ((TileEssentiaCompressor) tileEntity).isMultiblockFormed()) {
|
||||
int yOffset = ((TileEssentiaCompressor) tileEntity).getMultiblockYIndex();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y - yOffset - 0.5, z + 0.5);
|
||||
@@ -51,16 +52,21 @@ public class RenderTileEssentiaCompressor extends TileEntitySpecialRenderer {
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
if(yOffset == 1) { //The middle one. - well. the one where the blackhole is.
|
||||
this.renderBlackHoleEffect(tileEntity.xCoord + 0.5, tileEntity.yCoord + 0.5, tileEntity.zCoord + 0.5,
|
||||
(TileEssentiaCompressor) tileEntity.getWorldObj().getTileEntity(tileEntity.xCoord, tileEntity.yCoord - 1, tileEntity.zCoord));
|
||||
if (yOffset == 1) { // The middle one. - well. the one where the blackhole is.
|
||||
this.renderBlackHoleEffect(
|
||||
tileEntity.xCoord + 0.5,
|
||||
tileEntity.yCoord + 0.5,
|
||||
tileEntity.zCoord + 0.5,
|
||||
(TileEssentiaCompressor) tileEntity
|
||||
.getWorldObj()
|
||||
.getTileEntity(tileEntity.xCoord, tileEntity.yCoord - 1, tileEntity.zCoord));
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
} else {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y - 0.5, z + 0.5);
|
||||
GL11.glRotatef(180, 1, 0, 0);
|
||||
if(isRenderedAsItem) {
|
||||
if (isRenderedAsItem) {
|
||||
GL11.glTranslatef(0, -2.9F, 0);
|
||||
} else {
|
||||
GL11.glTranslatef(0, -2.877F, 0);
|
||||
@@ -69,7 +75,6 @@ public class RenderTileEssentiaCompressor extends TileEntitySpecialRenderer {
|
||||
RenderTileEssentiaCompressor.MODEL_PACKED_COMPRESSOR.render(null, 0, 0, 0, 0, 0, 0.0625f);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Map<ChunkCoordinates, FXVortex> ownedVortex = new HashMap<ChunkCoordinates, FXVortex>();
|
||||
@@ -85,10 +90,9 @@ public class RenderTileEssentiaCompressor extends TileEntitySpecialRenderer {
|
||||
v.registered = true;
|
||||
EffectHandler.getInstance().registerVortex(v);
|
||||
}
|
||||
if(!v.registered) {
|
||||
if (!v.registered) {
|
||||
EffectHandler.getInstance().registerVortex(v);
|
||||
}
|
||||
v.notify(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,7 +23,7 @@ public class RenderTileExtendedNode extends TileEntitySpecialRenderer {
|
||||
double rY = node.yCoord + 0.5;
|
||||
double rZ = node.zCoord + 0.5;
|
||||
float size = 1.0F;
|
||||
if(node.getExtendedNodeType() != null && node.getExtendedNodeType() == ExtendedNodeType.GROWING) {
|
||||
if (node.getExtendedNodeType() != null && node.getExtendedNodeType() == ExtendedNodeType.GROWING) {
|
||||
size *= 1.5F;
|
||||
}
|
||||
RenderTileNodeBasic.renderTileEntityAt(tile, rX, rY, rZ, partialTicks, size);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package makeo.gadomancy.client.renderers.tile;
|
||||
|
||||
import java.util.Random;
|
||||
import makeo.gadomancy.client.models.ModelInfusionClawPart;
|
||||
import makeo.gadomancy.client.models.ModelWandPart;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileInfusionClaw;
|
||||
@@ -23,8 +24,6 @@ import thaumcraft.common.config.ConfigItems;
|
||||
import thaumcraft.common.entities.projectile.EntityPrimalOrb;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -104,8 +103,8 @@ public class RenderTileInfusionClaw extends TileEntitySpecialRenderer {
|
||||
tile.animationStates[9] = -tile.animationStates[9];
|
||||
|
||||
ItemStack wandStack = tile.getStackInSlot(0);
|
||||
if(wandStack != null) {
|
||||
tile.animationStates[11] = ((ItemWandCasting)wandStack.getItem()).isStaff(wandStack) ? 0.5f : 0.1f;
|
||||
if (wandStack != null) {
|
||||
tile.animationStates[11] = ((ItemWandCasting) wandStack.getItem()).isStaff(wandStack) ? 0.5f : 0.1f;
|
||||
}
|
||||
}
|
||||
} else if (tile.animationStates[9] < 0) {
|
||||
@@ -116,7 +115,6 @@ public class RenderTileInfusionClaw extends TileEntitySpecialRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
@@ -140,7 +138,7 @@ public class RenderTileInfusionClaw extends TileEntitySpecialRenderer {
|
||||
}
|
||||
|
||||
private void renderWand(ItemStack wandStack, float ticks) {
|
||||
GL11.glRotatef(((ticks/3) / 20.0F) * (180F / (float)Math.PI), 0, 1f, 0);
|
||||
GL11.glRotatef(((ticks / 3) / 20.0F) * (180F / (float) Math.PI), 0, 1f, 0);
|
||||
|
||||
this.renderTopPart();
|
||||
|
||||
@@ -156,7 +154,7 @@ public class RenderTileInfusionClaw extends TileEntitySpecialRenderer {
|
||||
GL11.glTranslatef(0, MathHelper.sin((ticks / 3) / 10.0F) * 0.08F + 0.08F, 0);
|
||||
|
||||
GL11.glTranslatef(0, -1.4924f, 0);
|
||||
if(item.isStaff(wandFocusStack)) {
|
||||
if (item.isStaff(wandFocusStack)) {
|
||||
GL11.glTranslatef(0, -0.5f, 0);
|
||||
|
||||
RenderTileInfusionClaw.STAFF_RENDERER.renderItem(IItemRenderer.ItemRenderType.ENTITY, wandFocusStack);
|
||||
@@ -178,7 +176,7 @@ public class RenderTileInfusionClaw extends TileEntitySpecialRenderer {
|
||||
}
|
||||
|
||||
private void renderPrimalOrb(TileInfusionClaw tile, float elapsed) {
|
||||
if(tile.animationStates[11] > 0) {
|
||||
if (tile.animationStates[11] > 0) {
|
||||
tile.animationStates[11] += elapsed / 70f;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
@@ -193,27 +191,50 @@ public class RenderTileInfusionClaw extends TileEntitySpecialRenderer {
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
if(0.75f - tile.animationStates[11] < -0.5f) {
|
||||
if (0.75f - tile.animationStates[11] < -0.5f) {
|
||||
tile.animationStates[11] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void createSideZap(TileInfusionClaw tile) {
|
||||
for(int i = 2; i < 6; i++) {
|
||||
for (int i = 2; i < 6; i++) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
||||
this.createZap(tile, 0.5f + 0.5f*(float)dir.offsetX, 0.6f, 0.5f + 0.5f*(float)dir.offsetZ, 0.5f + dir.offsetX*0.2f, 0.2f, 0.5f + dir.offsetZ*0.2f);
|
||||
this.createZap(
|
||||
tile,
|
||||
0.5f + 0.5f * (float) dir.offsetX,
|
||||
0.6f,
|
||||
0.5f + 0.5f * (float) dir.offsetZ,
|
||||
0.5f + dir.offsetX * 0.2f,
|
||||
0.2f,
|
||||
0.5f + dir.offsetZ * 0.2f);
|
||||
this.playZapSound(tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
private void createZap(TileEntity tile, float startX, float startY, float startZ, float endX, float endY, float endZ) {
|
||||
Thaumcraft.proxy.nodeBolt(Thaumcraft.proxy.getClientWorld(), tile.xCoord + startX, tile.yCoord + startY, tile.zCoord + startZ,
|
||||
tile.xCoord + endX, tile.yCoord + endY, tile.zCoord + endZ);
|
||||
private void createZap(
|
||||
TileEntity tile, float startX, float startY, float startZ, float endX, float endY, float endZ) {
|
||||
Thaumcraft.proxy.nodeBolt(
|
||||
Thaumcraft.proxy.getClientWorld(),
|
||||
tile.xCoord + startX,
|
||||
tile.yCoord + startY,
|
||||
tile.zCoord + startZ,
|
||||
tile.xCoord + endX,
|
||||
tile.yCoord + endY,
|
||||
tile.zCoord + endZ);
|
||||
}
|
||||
|
||||
private void playZapSound(float x, float y, float z) {
|
||||
Thaumcraft.proxy.getClientWorld().playSound(x, y, z, "thaumcraft:zap", 0.1F, 1.0F + Thaumcraft.proxy.getClientWorld().rand.nextFloat() * 0.2F, false);
|
||||
Thaumcraft.proxy
|
||||
.getClientWorld()
|
||||
.playSound(
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
"thaumcraft:zap",
|
||||
0.1F,
|
||||
1.0F + Thaumcraft.proxy.getClientWorld().rand.nextFloat() * 0.2F,
|
||||
false);
|
||||
}
|
||||
|
||||
private void renderSides(TileInfusionClaw tile, World world, int x, int y, int z, float elapsed) {
|
||||
@@ -242,7 +263,8 @@ public class RenderTileInfusionClaw extends TileEntitySpecialRenderer {
|
||||
float widthMove = this.getNextMoveOffset(tile, i + 4, speed, elapsed);
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(i + 2);
|
||||
boolean powered = world != null && world.getIndirectPowerLevelTo(x + dir.offsetX, y, z + dir.offsetZ, dir.ordinal()) > 0;
|
||||
boolean powered = world != null
|
||||
&& world.getIndirectPowerLevelTo(x + dir.offsetX, y, z + dir.offsetZ, dir.ordinal()) > 0;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
|
||||
@@ -16,12 +16,13 @@ import org.lwjgl.opengl.GL11;
|
||||
*/
|
||||
public class RenderTileKnowledgeBook extends TileEntitySpecialRenderer {
|
||||
|
||||
private static final ResourceLocation bookTexture = new ResourceLocation("minecraft", "textures/entity/enchanting_table_book.png");
|
||||
private static final ResourceLocation bookTexture =
|
||||
new ResourceLocation("minecraft", "textures/entity/enchanting_table_book.png");
|
||||
private static final ModelBook modelBook = new ModelBook();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialTicks) {
|
||||
if(te == null || !(te instanceof TileKnowledgeBook)) return;
|
||||
if (te == null || !(te instanceof TileKnowledgeBook)) return;
|
||||
|
||||
this.renderFloatingBook((TileKnowledgeBook) te, x, y, z, partialTicks);
|
||||
}
|
||||
@@ -30,51 +31,52 @@ public class RenderTileKnowledgeBook extends TileEntitySpecialRenderer {
|
||||
TileKnowledgeBook.FloatingBookAttributes attributes = te.getBookAttributes();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)x + 0.5F, (float)y + 0.1F, (float)z + 0.5F);
|
||||
float f1 = (float)attributes.field_145926_a + partialTicks;
|
||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.1F, (float) z + 0.5F);
|
||||
float f1 = (float) attributes.field_145926_a + partialTicks;
|
||||
GL11.glTranslatef(0.0F, 0.1F + MathHelper.sin(f1 * 0.1F) * 0.03F, 0.0F);
|
||||
float f2;
|
||||
|
||||
for (f2 = attributes.field_145928_o - attributes.field_145925_p; f2 >= (float)Math.PI; f2 -= ((float)Math.PI * 2F)) {}
|
||||
for (f2 = attributes.field_145928_o - attributes.field_145925_p;
|
||||
f2 >= (float) Math.PI;
|
||||
f2 -= ((float) Math.PI * 2F)) {}
|
||||
|
||||
while (f2 < -(float)Math.PI)
|
||||
{
|
||||
f2 += ((float)Math.PI * 2F);
|
||||
while (f2 < -(float) Math.PI) {
|
||||
f2 += ((float) Math.PI * 2F);
|
||||
}
|
||||
|
||||
float f3 = attributes.field_145925_p + f2 * partialTicks;
|
||||
GL11.glRotatef(-f3 * 180.0F / (float)Math.PI, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-f3 * 180.0F / (float) Math.PI, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(80.0F, 0.0F, 0.0F, 1.0F);
|
||||
this.bindTexture(RenderTileKnowledgeBook.bookTexture);
|
||||
float f4 = attributes.field_145931_j + (attributes.field_145933_i - attributes.field_145931_j) * partialTicks + 0.25F;
|
||||
float f5 = attributes.field_145931_j + (attributes.field_145933_i - attributes.field_145931_j) * partialTicks + 0.75F;
|
||||
f4 = (f4 - (float)MathHelper.truncateDoubleToInt(f4)) * 1.6F - 0.3F;
|
||||
f5 = (f5 - (float)MathHelper.truncateDoubleToInt(f5)) * 1.6F - 0.3F;
|
||||
float f4 = attributes.field_145931_j
|
||||
+ (attributes.field_145933_i - attributes.field_145931_j) * partialTicks
|
||||
+ 0.25F;
|
||||
float f5 = attributes.field_145931_j
|
||||
+ (attributes.field_145933_i - attributes.field_145931_j) * partialTicks
|
||||
+ 0.75F;
|
||||
f4 = (f4 - (float) MathHelper.truncateDoubleToInt(f4)) * 1.6F - 0.3F;
|
||||
f5 = (f5 - (float) MathHelper.truncateDoubleToInt(f5)) * 1.6F - 0.3F;
|
||||
|
||||
if (f4 < 0.0F)
|
||||
{
|
||||
if (f4 < 0.0F) {
|
||||
f4 = 0.0F;
|
||||
}
|
||||
|
||||
if (f5 < 0.0F)
|
||||
{
|
||||
if (f5 < 0.0F) {
|
||||
f5 = 0.0F;
|
||||
}
|
||||
|
||||
if (f4 > 1.0F)
|
||||
{
|
||||
if (f4 > 1.0F) {
|
||||
f4 = 1.0F;
|
||||
}
|
||||
|
||||
if (f5 > 1.0F)
|
||||
{
|
||||
if (f5 > 1.0F) {
|
||||
f5 = 1.0F;
|
||||
}
|
||||
|
||||
//float f6 = attributes.field_145927_n + (attributes.field_145930_m - attributes.field_145927_n) * partialTicks; We don't want it to close..
|
||||
// float f6 = attributes.field_145927_n + (attributes.field_145930_m - attributes.field_145927_n) *
|
||||
// partialTicks; We don't want it to close..
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
RenderTileKnowledgeBook.modelBook.render(null, 45F, f4, f5, 0.9F, 0.0F, 0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
+5
-5
@@ -27,12 +27,12 @@ public class RenderTileManipulationFocus extends TileEntitySpecialRenderer {
|
||||
this.bindTexture(new SimpleResourceLocation("models/manipulation_focus_" + tile.getBlockMetadata() + ".png"));
|
||||
|
||||
GL11.glRotatef(180, 1, 0, 0);
|
||||
GL11.glTranslatef(0.5f, -1.5f + (2/16f), -0.5f);
|
||||
GL11.glTranslatef(0.5f, -1.5f + (2 / 16f), -0.5f);
|
||||
|
||||
if(tile.getBlockMetadata() == 0 || tile.getBlockMetadata() == 3) {
|
||||
if (tile.getBlockMetadata() == 0 || tile.getBlockMetadata() == 3) {
|
||||
GL11.glPushMatrix();
|
||||
for(int i = 0; i < 4; i++) {
|
||||
if(tile.getBlockMetadata() == 0) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (tile.getBlockMetadata() == 0) {
|
||||
RenderTileManipulationFocus.RANDOM_FOCUS.render(null, 0, 0, 0, 0, 0, 0.0625f);
|
||||
} else {
|
||||
RenderTileManipulationFocus.PORTAL_FOCUS.render(null, 0, 0, 0, 0, 0, 0.0625f);
|
||||
@@ -48,6 +48,6 @@ public class RenderTileManipulationFocus extends TileEntitySpecialRenderer {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) {
|
||||
this.renderTileEntityAt((TileManipulationFocus)tile, x, y, z, partialTicks);
|
||||
this.renderTileEntityAt((TileManipulationFocus) tile, x, y, z, partialTicks);
|
||||
}
|
||||
}
|
||||
+8
-6
@@ -1,5 +1,6 @@
|
||||
package makeo.gadomancy.client.renderers.tile;
|
||||
|
||||
import java.util.Map;
|
||||
import makeo.gadomancy.common.utils.Injector;
|
||||
import makeo.gadomancy.common.utils.SimpleResourceLocation;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -7,8 +8,6 @@ import net.minecraft.util.ResourceLocation;
|
||||
import thaumcraft.client.lib.UtilsFX;
|
||||
import thaumcraft.client.renderers.tile.TileInfusionPillarRenderer;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -20,15 +19,18 @@ import java.util.Map;
|
||||
public class RenderTileManipulatorPillar extends TileInfusionPillarRenderer {
|
||||
private static final String TC_TEXTURE = "textures/models/pillar.png";
|
||||
private static final ResourceLocation TEXTURE = new SimpleResourceLocation("models/manipulator_pillar.png");
|
||||
private static final Map<String, ResourceLocation> BOUND_TEXTURES = new Injector(UtilsFX.class).getField("boundTextures");
|
||||
private static final Map<String, ResourceLocation> BOUND_TEXTURES =
|
||||
new Injector(UtilsFX.class).getField("boundTextures");
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8) {
|
||||
ResourceLocation originalTexture = RenderTileManipulatorPillar.BOUND_TEXTURES.get(RenderTileManipulatorPillar.TC_TEXTURE);
|
||||
RenderTileManipulatorPillar.BOUND_TEXTURES.put(RenderTileManipulatorPillar.TC_TEXTURE, RenderTileManipulatorPillar.TEXTURE);
|
||||
ResourceLocation originalTexture =
|
||||
RenderTileManipulatorPillar.BOUND_TEXTURES.get(RenderTileManipulatorPillar.TC_TEXTURE);
|
||||
RenderTileManipulatorPillar.BOUND_TEXTURES.put(
|
||||
RenderTileManipulatorPillar.TC_TEXTURE, RenderTileManipulatorPillar.TEXTURE);
|
||||
super.renderTileEntityAt(par1TileEntity, par2, par4, par6, par8);
|
||||
|
||||
if(originalTexture != null) {
|
||||
if (originalTexture != null) {
|
||||
RenderTileManipulatorPillar.BOUND_TEXTURES.put(RenderTileManipulatorPillar.TC_TEXTURE, originalTexture);
|
||||
} else {
|
||||
RenderTileManipulatorPillar.BOUND_TEXTURES.remove(RenderTileManipulatorPillar.TC_TEXTURE);
|
||||
|
||||
@@ -45,14 +45,26 @@ public class RenderTileNodeBasic {
|
||||
|
||||
public static final ResourceLocation nodetex = new ResourceLocation("thaumcraft", "textures/misc/nodes.png");
|
||||
|
||||
//Gadomancy: changed params x, y, z from int to double
|
||||
public static void renderNode(EntityLivingBase viewer, double viewDistance, boolean visible, boolean depthIgnore, float size, double x, double y, double z, float partialTicks, AspectList aspects, NodeType type, NodeModifier mod) {
|
||||
// Gadomancy: changed params x, y, z from int to double
|
||||
public static void renderNode(
|
||||
EntityLivingBase viewer,
|
||||
double viewDistance,
|
||||
boolean visible,
|
||||
boolean depthIgnore,
|
||||
float size,
|
||||
double x,
|
||||
double y,
|
||||
double z,
|
||||
float partialTicks,
|
||||
AspectList aspects,
|
||||
NodeType type,
|
||||
NodeModifier mod) {
|
||||
long nt = System.nanoTime();
|
||||
|
||||
UtilsFX.bindTexture(RenderTileNodeBasic.nodetex);
|
||||
int frames = 32;
|
||||
if ((aspects.size() > 0) && (visible)) {
|
||||
double distance = viewer.getDistance(x, y, z); //Gadomancy: Removed '+ 0.5D' to coords.
|
||||
double distance = viewer.getDistance(x, y, z); // Gadomancy: Removed '+ 0.5D' to coords.
|
||||
if (distance > viewDistance) {
|
||||
return;
|
||||
}
|
||||
@@ -84,7 +96,6 @@ public class RenderTileNodeBasic {
|
||||
float rad = 6.283186F;
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, alpha);
|
||||
|
||||
|
||||
int i = (int) ((nt / 40000000L + x) % frames);
|
||||
|
||||
int count = 0;
|
||||
@@ -103,8 +114,19 @@ public class RenderTileNodeBasic {
|
||||
scale = 0.2F + scale * (aspects.getAmount(aspect) / 50.0F);
|
||||
scale *= size;
|
||||
angle = (float) (time % (5000 + 500 * count)) / (5000.0F + 500 * count) * rad;
|
||||
//Gadomancy (following line): Removed '+ 0.5D' to coords.
|
||||
UtilsFX.renderFacingStrip(x, y, z, angle, scale, alpha / Math.max(1.0F, aspects.size() / 2.0F), frames, 0, i, partialTicks, aspect.getColor());
|
||||
// Gadomancy (following line): Removed '+ 0.5D' to coords.
|
||||
UtilsFX.renderFacingStrip(
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
angle,
|
||||
scale,
|
||||
alpha / Math.max(1.0F, aspects.size() / 2.0F),
|
||||
frames,
|
||||
0,
|
||||
i,
|
||||
partialTicks,
|
||||
aspect.getColor());
|
||||
GL11.glDisable(3042);
|
||||
GL11.glPopMatrix();
|
||||
count++;
|
||||
@@ -146,7 +168,7 @@ public class RenderTileNodeBasic {
|
||||
strip = 3;
|
||||
}
|
||||
GL11.glColor4f(1.0F, 0.0F, 1.0F, alpha);
|
||||
//Gadomancy (following line): Removed '+ 0.5D' to coords.
|
||||
// Gadomancy (following line): Removed '+ 0.5D' to coords.
|
||||
UtilsFX.renderFacingStrip(x, y, z, angle, scale, alpha, frames, strip, i, partialTicks, 16777215);
|
||||
GL11.glDisable(3042);
|
||||
GL11.glPopMatrix();
|
||||
@@ -169,7 +191,7 @@ public class RenderTileNodeBasic {
|
||||
|
||||
int i = (int) ((nt / 40000000L + x) % frames);
|
||||
GL11.glColor4f(1.0F, 0.0F, 1.0F, 0.1F);
|
||||
//Gadomancy (following line): Removed '+ 0.5D' to coords.
|
||||
// Gadomancy (following line): Removed '+ 0.5D' to coords.
|
||||
UtilsFX.renderFacingStrip(x, y, z, 0.0F, 0.5F, 0.1F, frames, 1, i, partialTicks, 16777215);
|
||||
|
||||
GL11.glDepthMask(true);
|
||||
@@ -179,19 +201,20 @@ public class RenderTileNodeBasic {
|
||||
}
|
||||
}
|
||||
|
||||
//Gadomancy START
|
||||
// Gadomancy START
|
||||
public static void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) {
|
||||
RenderTileNodeBasic.renderTileEntityAt(tile, x, y, z, partialTicks, 1.0F);
|
||||
}
|
||||
//Gadomancy END
|
||||
// Gadomancy END
|
||||
|
||||
//Gadomancy: Added dynamic size
|
||||
public static void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks, float size) {
|
||||
//Gadomancy Added event hook
|
||||
// Gadomancy: Added dynamic size
|
||||
public static void renderTileEntityAt(
|
||||
TileEntity tile, double x, double y, double z, float partialTicks, float size) {
|
||||
// Gadomancy Added event hook
|
||||
EventHandlerRedirect.preNodeRender(tile);
|
||||
|
||||
if (!(tile instanceof INode)) {
|
||||
//Gadomancy Added event hook
|
||||
// Gadomancy Added event hook
|
||||
EventHandlerRedirect.postNodeRender(tile);
|
||||
return;
|
||||
}
|
||||
@@ -203,12 +226,21 @@ public class RenderTileNodeBasic {
|
||||
if ((viewer instanceof EntityPlayer)) {
|
||||
if ((tile != null) && ((tile instanceof TileJarNode))) {
|
||||
condition = true;
|
||||
size = (float) ((size * 7D) / 10D); //Gadomancy: Node size is 70% of the default size in standart TC. calculating the same here.
|
||||
} else if ((((EntityPlayer) viewer).inventory.armorItemInSlot(3) != null) && ((((EntityPlayer) viewer).inventory.armorItemInSlot(3).getItem() instanceof IRevealer)) && (((IRevealer) ((EntityPlayer) viewer).inventory.armorItemInSlot(3).getItem()).showNodes(((EntityPlayer) viewer).inventory.armorItemInSlot(3), viewer))) {
|
||||
size = (float) ((size * 7D)
|
||||
/ 10D); // Gadomancy: Node size is 70% of the default size in standart TC. calculating the same
|
||||
// here.
|
||||
} else if ((((EntityPlayer) viewer).inventory.armorItemInSlot(3) != null)
|
||||
&& ((((EntityPlayer) viewer).inventory.armorItemInSlot(3).getItem() instanceof IRevealer))
|
||||
&& (((IRevealer) ((EntityPlayer) viewer)
|
||||
.inventory
|
||||
.armorItemInSlot(3)
|
||||
.getItem())
|
||||
.showNodes(((EntityPlayer) viewer).inventory.armorItemInSlot(3), viewer))) {
|
||||
condition = true;
|
||||
depthIgnore = true;
|
||||
} else if ((((EntityPlayer) viewer).inventory.getCurrentItem() != null) && ((((EntityPlayer) viewer).inventory.getCurrentItem().getItem() instanceof ItemThaumometer))) {
|
||||
//Gadomancy: Changed from tile.xCoord, ... to x, y, z to make it dependent from params
|
||||
} else if ((((EntityPlayer) viewer).inventory.getCurrentItem() != null)
|
||||
&& ((((EntityPlayer) viewer).inventory.getCurrentItem().getItem() instanceof ItemThaumometer))) {
|
||||
// Gadomancy: Changed from tile.xCoord, ... to x, y, z to make it dependent from params
|
||||
if (UtilsFX.isVisibleTo(0.44F, viewer, x, y, z)) {
|
||||
condition = true;
|
||||
depthIgnore = true;
|
||||
@@ -216,15 +248,29 @@ public class RenderTileNodeBasic {
|
||||
}
|
||||
}
|
||||
}
|
||||
//Gadomancy: Changed from tile.xCoord, ... to x, y, z to make it dependent from params
|
||||
RenderTileNodeBasic.renderNode(viewer, viewDistance, condition, depthIgnore, size, x, y, z, partialTicks, ((INode) tile).getAspects(), ((INode) tile).getNodeType(), ((INode) tile).getNodeModifier());
|
||||
if (((tile instanceof TileNode)) && (((TileNode) tile).drainEntity != null) && (((TileNode) tile).drainCollision != null)) {
|
||||
// Gadomancy: Changed from tile.xCoord, ... to x, y, z to make it dependent from params
|
||||
RenderTileNodeBasic.renderNode(
|
||||
viewer,
|
||||
viewDistance,
|
||||
condition,
|
||||
depthIgnore,
|
||||
size,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
partialTicks,
|
||||
((INode) tile).getAspects(),
|
||||
((INode) tile).getNodeType(),
|
||||
((INode) tile).getNodeModifier());
|
||||
if (((tile instanceof TileNode))
|
||||
&& (((TileNode) tile).drainEntity != null)
|
||||
&& (((TileNode) tile).drainCollision != null)) {
|
||||
Entity drainEntity = ((TileNode) tile).drainEntity;
|
||||
if (((drainEntity instanceof EntityPlayer)) && (!((EntityPlayer) drainEntity).isUsingItem())) {
|
||||
((TileNode) tile).drainEntity = null;
|
||||
((TileNode) tile).drainCollision = null;
|
||||
|
||||
//Gadomancy Added event hook
|
||||
// Gadomancy Added event hook
|
||||
EventHandlerRedirect.postNodeRender(tile);
|
||||
return;
|
||||
}
|
||||
@@ -237,8 +283,14 @@ public class RenderTileNodeBasic {
|
||||
f10 = MathHelper.sin(iiud / 10.0F) * 10.0F;
|
||||
}
|
||||
Vec3 vec3 = Vec3.createVectorHelper(-0.1D, -0.1D, 0.5D);
|
||||
vec3.rotateAroundX(-(drainEntity.prevRotationPitch + (drainEntity.rotationPitch - drainEntity.prevRotationPitch) * partialTicks) * 3.141593F / 180.0F);
|
||||
vec3.rotateAroundY(-(drainEntity.prevRotationYaw + (drainEntity.rotationYaw - drainEntity.prevRotationYaw) * partialTicks) * 3.141593F / 180.0F);
|
||||
vec3.rotateAroundX(-(drainEntity.prevRotationPitch
|
||||
+ (drainEntity.rotationPitch - drainEntity.prevRotationPitch) * partialTicks)
|
||||
* 3.141593F
|
||||
/ 180.0F);
|
||||
vec3.rotateAroundY(-(drainEntity.prevRotationYaw
|
||||
+ (drainEntity.rotationYaw - drainEntity.prevRotationYaw) * partialTicks)
|
||||
* 3.141593F
|
||||
/ 180.0F);
|
||||
vec3.rotateAroundY(-f10 * 0.01F);
|
||||
vec3.rotateAroundX(-f10 * 0.015F);
|
||||
double d3 = drainEntity.prevPosX + (drainEntity.posX - drainEntity.prevPosX) * partialTicks + vec3.xCoord;
|
||||
@@ -246,13 +298,23 @@ public class RenderTileNodeBasic {
|
||||
double d5 = drainEntity.prevPosZ + (drainEntity.posZ - drainEntity.prevPosZ) * partialTicks + vec3.zCoord;
|
||||
double d6 = drainEntity == Minecraft.getMinecraft().thePlayer ? 0.0D : drainEntity.getEyeHeight();
|
||||
|
||||
UtilsFX.drawFloatyLine(d3, d4 + d6, d5, drainCollision.blockX + 0.5D, drainCollision.blockY + 0.5D, drainCollision.blockZ + 0.5D, partialTicks, ((TileNode) tile).color.getRGB(), "textures/misc/wispy.png", -0.02F, Math.min(iiud, 10) / 10.0F);
|
||||
UtilsFX.drawFloatyLine(
|
||||
d3,
|
||||
d4 + d6,
|
||||
d5,
|
||||
drainCollision.blockX + 0.5D,
|
||||
drainCollision.blockY + 0.5D,
|
||||
drainCollision.blockZ + 0.5D,
|
||||
partialTicks,
|
||||
((TileNode) tile).color.getRGB(),
|
||||
"textures/misc/wispy.png",
|
||||
-0.02F,
|
||||
Math.min(iiud, 10) / 10.0F);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
//Gadomancy Added event hook
|
||||
// Gadomancy Added event hook
|
||||
EventHandlerRedirect.postNodeRender(tile);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,11 +31,11 @@ public class RenderTileNodeManipulator extends TileWandPedestalRenderer {
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(RenderTileNodeManipulator.TEXTURE);
|
||||
|
||||
for(int i = 0; i < 4; i++) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(i + 2);
|
||||
GL11.glTranslatef(dir.offsetX * (-6/16f), 0, dir.offsetZ * (-6/16f));
|
||||
GL11.glTranslatef(dir.offsetX * (-6 / 16f), 0, dir.offsetZ * (-6 / 16f));
|
||||
|
||||
RenderTileNodeManipulator.MODEL.render(null, 0, 0, 0, 0, 0, 0.0625f);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
@@ -16,7 +16,7 @@ import thaumcraft.common.config.Config;
|
||||
public class RenderTileObelisk extends TileEldritchObeliskRenderer {
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
|
||||
if(te.getWorldObj().provider.dimensionId == ModConfig.dimOuterId) {
|
||||
if (te.getWorldObj().provider.dimensionId == ModConfig.dimOuterId) {
|
||||
int old = Config.dimensionOuterId;
|
||||
Config.dimensionOuterId = ModConfig.dimOuterId;
|
||||
super.renderTileEntityAt(te, x, y, z, f);
|
||||
|
||||
@@ -33,15 +33,20 @@ public class RenderTileRemoteJar extends TileJarRenderer {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glTranslatef(0.45f/2, 0.003f, 0.45f/2);
|
||||
GL11.glTranslatef(0.45f / 2, 0.003f, 0.45f / 2);
|
||||
GL11.glScalef(0.55f, 1, 0.55f);
|
||||
|
||||
TileMirrorRenderer renderer = new TileMirrorRenderer();
|
||||
|
||||
renderer.func_147497_a(this.field_147501_a);
|
||||
|
||||
if(this.field_147501_a.field_147553_e != null) {
|
||||
renderer.renderTileEntityAt(this.createFakeTile(tile, BlockRemoteJar.getJarTile(tile).networkId != null), 0, 0, 0, partialTicks);
|
||||
if (this.field_147501_a.field_147553_e != null) {
|
||||
renderer.renderTileEntityAt(
|
||||
this.createFakeTile(tile, BlockRemoteJar.getJarTile(tile).networkId != null),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
partialTicks);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
@@ -55,9 +60,8 @@ public class RenderTileRemoteJar extends TileJarRenderer {
|
||||
|
||||
GL11.glScalef(1.002f, 1f, 1.002f);
|
||||
|
||||
|
||||
GL11.glTranslatef(0, -1.5f, 0);
|
||||
//GL11.glRotatef(180, 1f, 0, 0);
|
||||
// GL11.glRotatef(180, 1f, 0, 0);
|
||||
|
||||
RenderTileRemoteJar.MODEL_JAR_POT.render(null, 0f, 0f, 0f, 0f, 0f, 0.0625f);
|
||||
|
||||
@@ -72,13 +76,13 @@ public class RenderTileRemoteJar extends TileJarRenderer {
|
||||
fake.linked = linked;
|
||||
fake.blockMetadata = 7;
|
||||
|
||||
if(tile.getWorldObj() == null) {
|
||||
if (tile.getWorldObj() == null) {
|
||||
fake.setWorldObj(new FakeWorld());
|
||||
} else {
|
||||
fake.setWorldObj(tile.getWorldObj());
|
||||
}
|
||||
|
||||
if(tile.getWorldObj() instanceof FakeWorld) {
|
||||
if (tile.getWorldObj() instanceof FakeWorld) {
|
||||
EntityPlayer p = Minecraft.getMinecraft().thePlayer;
|
||||
fake.xCoord = (int) p.posX;
|
||||
fake.yCoord = (int) p.posY;
|
||||
|
||||
@@ -26,7 +26,7 @@ public class RenderTileStickyJar extends TileEntitySpecialRenderer {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) {
|
||||
if(tile != null && tile instanceof TileStickyJar && ((TileStickyJar) tile).isValid()) {
|
||||
if (tile != null && tile instanceof TileStickyJar && ((TileStickyJar) tile).isValid()) {
|
||||
TileStickyJar stickyJar = (TileStickyJar) tile;
|
||||
|
||||
TileJarFillable parent = stickyJar.getParent();
|
||||
@@ -38,9 +38,9 @@ public class RenderTileStickyJar extends TileEntitySpecialRenderer {
|
||||
GL11.glTranslated(x, y, z);
|
||||
this.rotateJar(stickyJar.placedOn, ForgeDirection.getOrientation(stickyJar.facing));
|
||||
|
||||
//TESR
|
||||
// TESR
|
||||
TileEntitySpecialRenderer renderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(parent);
|
||||
if(renderer != null) {
|
||||
if (renderer != null) {
|
||||
stickyJar.syncToParent();
|
||||
|
||||
renderer.renderTileEntityAt(parent, 0, 0, 0, partialTicks);
|
||||
@@ -48,7 +48,7 @@ public class RenderTileStickyJar extends TileEntitySpecialRenderer {
|
||||
stickyJar.syncFromParent();
|
||||
}
|
||||
|
||||
//ISimpleBlockHandler
|
||||
// ISimpleBlockHandler
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
|
||||
@@ -62,7 +62,8 @@ public class RenderTileStickyJar extends TileEntitySpecialRenderer {
|
||||
Tessellator tess = Tessellator.instance;
|
||||
tess.startDrawingQuads();
|
||||
|
||||
tess.setNormal(0, -stickyJar.placedOn.offsetY, -Math.abs(stickyJar.placedOn.offsetZ + stickyJar.placedOn.offsetX));
|
||||
tess.setNormal(
|
||||
0, -stickyJar.placedOn.offsetY, -Math.abs(stickyJar.placedOn.offsetZ + stickyJar.placedOn.offsetX));
|
||||
|
||||
tess.setTranslation(-tile.xCoord, -tile.yCoord, -tile.zCoord);
|
||||
|
||||
@@ -79,20 +80,28 @@ public class RenderTileStickyJar extends TileEntitySpecialRenderer {
|
||||
}
|
||||
|
||||
private void rotateJar(ForgeDirection placedOn, ForgeDirection facing) {
|
||||
if(placedOn == ForgeDirection.UP) {
|
||||
if (placedOn == ForgeDirection.UP) {
|
||||
GL11.glTranslatef(Math.abs(facing.offsetZ), 1, Math.abs(facing.offsetX));
|
||||
GL11.glRotatef(180, facing.offsetX, 0, facing.offsetZ);
|
||||
} else if(placedOn != ForgeDirection.DOWN) {
|
||||
} else if (placedOn != ForgeDirection.DOWN) {
|
||||
GL11.glTranslatef(0.5f, 0.5f, 0.5f);
|
||||
GL11.glRotatef(90, placedOn.offsetZ * -1, 0, placedOn.offsetX);
|
||||
|
||||
switch (placedOn) {
|
||||
case NORTH: GL11.glRotatef(0, 0, 1, 0); break;
|
||||
case EAST: GL11.glRotatef(-90, 0, 1, 0); break;
|
||||
case SOUTH: GL11.glRotatef(180, 0, 1, 0); break;
|
||||
case WEST: GL11.glRotatef(90, 0, 1, 0); break;
|
||||
default:
|
||||
break;
|
||||
case NORTH:
|
||||
GL11.glRotatef(0, 0, 1, 0);
|
||||
break;
|
||||
case EAST:
|
||||
GL11.glRotatef(-90, 0, 1, 0);
|
||||
break;
|
||||
case SOUTH:
|
||||
GL11.glRotatef(180, 0, 1, 0);
|
||||
break;
|
||||
case WEST:
|
||||
GL11.glRotatef(90, 0, 1, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package makeo.gadomancy.client.textures;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import javax.imageio.ImageIO;
|
||||
import net.minecraft.client.renderer.texture.SimpleTexture;
|
||||
import net.minecraft.client.resources.IResource;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -30,8 +29,7 @@ public abstract class BaseTexture extends SimpleTexture {
|
||||
IResource iresource = resourceManager.getResource(location);
|
||||
inputstream = iresource.getInputStream();
|
||||
return ImageIO.read(inputstream);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
if (inputstream != null) {
|
||||
inputstream.close();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
package makeo.gadomancy.client.textures;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import javax.imageio.ImageIO;
|
||||
import makeo.gadomancy.api.GadomancyApi;
|
||||
import makeo.gadomancy.api.golems.AdditionalGolemType;
|
||||
import net.minecraft.client.renderer.texture.TextureUtil;
|
||||
@@ -11,13 +17,6 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import thaumcraft.common.entities.golems.EnumGolemType;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -43,8 +42,7 @@ public class GolemGuiTexture extends BaseTexture {
|
||||
this.deleteGlTexture();
|
||||
InputStream inputstream = null;
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
IResource iresource = resourceManager.getResource(this.textureLocation);
|
||||
inputstream = iresource.getInputStream();
|
||||
BufferedImage bufferedimage = this.manipulateImage(resourceManager, ImageIO.read(inputstream));
|
||||
@@ -52,30 +50,24 @@ public class GolemGuiTexture extends BaseTexture {
|
||||
boolean flag = false;
|
||||
boolean flag1 = false;
|
||||
|
||||
if (iresource.hasMetadata())
|
||||
{
|
||||
try
|
||||
{
|
||||
TextureMetadataSection texturemetadatasection = (TextureMetadataSection)iresource.getMetadata("texture");
|
||||
if (iresource.hasMetadata()) {
|
||||
try {
|
||||
TextureMetadataSection texturemetadatasection =
|
||||
(TextureMetadataSection) iresource.getMetadata("texture");
|
||||
|
||||
if (texturemetadatasection != null)
|
||||
{
|
||||
if (texturemetadatasection != null) {
|
||||
flag = texturemetadatasection.getTextureBlur();
|
||||
flag1 = texturemetadatasection.getTextureClamp();
|
||||
}
|
||||
}
|
||||
catch (RuntimeException runtimeexception)
|
||||
{
|
||||
GolemGuiTexture.LOGGER.warn("Failed reading metadata of: " + this.textureLocation, runtimeexception);
|
||||
} catch (RuntimeException runtimeexception) {
|
||||
GolemGuiTexture.LOGGER.warn(
|
||||
"Failed reading metadata of: " + this.textureLocation, runtimeexception);
|
||||
}
|
||||
}
|
||||
|
||||
TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, flag, flag1);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (inputstream != null)
|
||||
{
|
||||
} finally {
|
||||
if (inputstream != null) {
|
||||
inputstream.close();
|
||||
}
|
||||
}
|
||||
@@ -86,41 +78,43 @@ public class GolemGuiTexture extends BaseTexture {
|
||||
|
||||
List<AdditionalGolemType> types = GadomancyApi.getAdditionalGolemTypes();
|
||||
|
||||
int newHeight = (24*scale) * (this.getMaxOrdinal() + 1);
|
||||
BufferedImage newImg = new BufferedImage(image.getWidth(), newHeight < image.getHeight() ? image.getHeight() : newHeight, image.getType());
|
||||
int newHeight = (24 * scale) * (this.getMaxOrdinal() + 1);
|
||||
BufferedImage newImg = new BufferedImage(
|
||||
image.getWidth(), newHeight < image.getHeight() ? image.getHeight() : newHeight, image.getType());
|
||||
|
||||
for(int x = 0; x < image.getWidth(); x++) {
|
||||
for(int y = 0; y < image.getHeight(); y++) {
|
||||
for (int x = 0; x < image.getWidth(); x++) {
|
||||
for (int y = 0; y < image.getHeight(); y++) {
|
||||
newImg.setRGB(x, y, image.getRGB(x, y));
|
||||
}
|
||||
}
|
||||
|
||||
for(AdditionalGolemType type : types) {
|
||||
for (AdditionalGolemType type : types) {
|
||||
try {
|
||||
int ordinal = type.getEnumEntry().ordinal();
|
||||
BufferedImage slotImg = this.loadImage(resourceManager, type.getInvSlotTexture());
|
||||
|
||||
float slotScale = (24*scale) / (float)slotImg.getWidth();
|
||||
float slotScale = (24 * scale) / (float) slotImg.getWidth();
|
||||
|
||||
if(slotScale > 1) {
|
||||
if (slotScale > 1) {
|
||||
slotImg = this.scaleImage(slotImg, slotScale, slotScale);
|
||||
}
|
||||
|
||||
for(int x = 0; x < slotImg.getWidth(); x++) {
|
||||
for(int y = 0; y < slotImg.getHeight(); y++) {
|
||||
newImg.setRGB((184*scale) + x, ordinal * (24*scale) + y, slotImg.getRGB(x, y));
|
||||
for (int x = 0; x < slotImg.getWidth(); x++) {
|
||||
for (int y = 0; y < slotImg.getHeight(); y++) {
|
||||
newImg.setRGB((184 * scale) + x, ordinal * (24 * scale) + y, slotImg.getRGB(x, y));
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
GolemGuiTexture.LOGGER.warn("Failed loading golem inventory slot texture of: " + type.getModId() + ":" + type.getName());
|
||||
GolemGuiTexture.LOGGER.warn(
|
||||
"Failed loading golem inventory slot texture of: " + type.getModId() + ":" + type.getName());
|
||||
}
|
||||
}
|
||||
return newImg;
|
||||
}
|
||||
|
||||
private BufferedImage scaleImage(BufferedImage input, float xScale, float yScale) {
|
||||
int newX = (int) (input.getWidth()*xScale);
|
||||
int newY = (int) (input.getHeight()*yScale);
|
||||
int newX = (int) (input.getWidth() * xScale);
|
||||
int newY = (int) (input.getHeight() * yScale);
|
||||
|
||||
Image temp = input.getScaledInstance(newX, newY, Image.SCALE_REPLICATE);
|
||||
|
||||
@@ -135,33 +129,11 @@ public class GolemGuiTexture extends BaseTexture {
|
||||
|
||||
private int getMaxOrdinal() {
|
||||
int max = 0;
|
||||
for(EnumGolemType type : EnumGolemType.values()) {
|
||||
if(type.ordinal() > max) {
|
||||
for (EnumGolemType type : EnumGolemType.values()) {
|
||||
if (type.ordinal() > max) {
|
||||
max = type.ordinal();
|
||||
}
|
||||
}
|
||||
return max;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public class FakeEntityGolemBase extends EntityGolemBase {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
//Golem stuff
|
||||
// Golem stuff
|
||||
@Override
|
||||
public String getGolemDecoration() {
|
||||
return this.golem.getGolemDecoration();
|
||||
@@ -62,7 +62,7 @@ public class FakeEntityGolemBase extends EntityGolemBase {
|
||||
return this.golem.getUpgradeAmount(type);
|
||||
}
|
||||
|
||||
//Player stuff
|
||||
// Player stuff
|
||||
@Override
|
||||
public float getEyeHeight() {
|
||||
return this.player.getEyeHeight();
|
||||
@@ -161,11 +161,11 @@ public class FakeEntityGolemBase extends EntityGolemBase {
|
||||
|
||||
this.itemCarried = this.player.getHeldItem();
|
||||
|
||||
if(this.player.isSwingInProgress) {
|
||||
if(this.player.getHeldItem() == null) {
|
||||
if (this.player.isSwingInProgress) {
|
||||
if (this.player.getHeldItem() == null) {
|
||||
this.action = 6 - this.player.swingProgressInt;
|
||||
} else {
|
||||
this.rightArm = 5 - (int)(this.player.swingProgress * 5);
|
||||
this.rightArm = 5 - (int) (this.player.swingProgress * 5);
|
||||
}
|
||||
} else {
|
||||
this.action = 0;
|
||||
|
||||
@@ -2,6 +2,9 @@ package makeo.gadomancy.client.transformation;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import makeo.gadomancy.client.renderers.entity.PlayerCameraRenderer;
|
||||
import makeo.gadomancy.common.network.PacketHandler;
|
||||
import makeo.gadomancy.common.network.packets.PacketAbortTransform;
|
||||
@@ -12,10 +15,6 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import thaumcraft.common.entities.golems.EntityGolemBase;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -48,7 +47,8 @@ public class TransformationHelper {
|
||||
|
||||
public static boolean isTransformable() {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
return mc.thePlayer.equals(mc.renderViewEntity) && !RegisteredIntegrations.morph.isMorphed()
|
||||
return mc.thePlayer.equals(mc.renderViewEntity)
|
||||
&& !RegisteredIntegrations.morph.isMorphed()
|
||||
&& mc.entityRenderer.getClass().equals(EntityRenderer.class)
|
||||
&& (TransformationHelper.renderer == null || TransformationHelper.renderer.isRemoved());
|
||||
}
|
||||
@@ -58,7 +58,7 @@ public class TransformationHelper {
|
||||
return !mc.renderViewEntity.equals(mc.thePlayer)
|
||||
|| RegisteredIntegrations.morph.isMorphed()
|
||||
|| (!mc.entityRenderer.getClass().equals(EntityRenderer.class)
|
||||
&& !(mc.entityRenderer instanceof PlayerCameraRenderer));
|
||||
&& !(mc.entityRenderer instanceof PlayerCameraRenderer));
|
||||
}
|
||||
|
||||
public static boolean isTransformed() {
|
||||
@@ -66,24 +66,23 @@ public class TransformationHelper {
|
||||
}
|
||||
|
||||
public static boolean isTransformed(EntityPlayer player) {
|
||||
if(player.equals(Minecraft.getMinecraft().thePlayer))
|
||||
return TransformationHelper.isTransformed();
|
||||
if (player.equals(Minecraft.getMinecraft().thePlayer)) return TransformationHelper.isTransformed();
|
||||
return TransformationHelper.getTransformedEntityId(player) != -1;
|
||||
}
|
||||
|
||||
public static FakeEntityGolemBase getTransformedEntity(EntityPlayer player) {
|
||||
Integer entityId = TransformationHelper.transformedPlayers.get(player.getEntityId());
|
||||
if(entityId != null) {
|
||||
if (entityId != null) {
|
||||
FakeEntityGolemBase golem = TransformationHelper.entityCache.get(entityId);
|
||||
if(golem == null) {
|
||||
if (golem == null) {
|
||||
EntityGolemBase rawGolem = TransformationHelper.findGolem(entityId);
|
||||
if(rawGolem != null) {
|
||||
if (rawGolem != null) {
|
||||
golem = new FakeEntityGolemBase(rawGolem, player);
|
||||
TransformationHelper.entityCache.put(entityId, golem);
|
||||
}
|
||||
}
|
||||
|
||||
if(golem != null) {
|
||||
if (golem != null) {
|
||||
return golem;
|
||||
}
|
||||
}
|
||||
@@ -92,9 +91,9 @@ public class TransformationHelper {
|
||||
|
||||
private static EntityGolemBase findGolem(int entityId) {
|
||||
List<Entity> loaded = Minecraft.getMinecraft().thePlayer.worldObj.getLoadedEntityList();
|
||||
for(int i = 0; i < loaded.size(); i++) {
|
||||
for (int i = 0; i < loaded.size(); i++) {
|
||||
Entity entity = loaded.get(i);
|
||||
if(entity instanceof EntityGolemBase && entity.getEntityId() == entityId) {
|
||||
if (entity instanceof EntityGolemBase && entity.getEntityId() == entityId) {
|
||||
return (EntityGolemBase) entity;
|
||||
}
|
||||
}
|
||||
@@ -115,15 +114,16 @@ public class TransformationHelper {
|
||||
}
|
||||
|
||||
public static void cancelTransformation(PacketAbortTransform.AbortReason reason) {
|
||||
if(TransformationHelper.isTransformed()) {
|
||||
if (TransformationHelper.isTransformed()) {
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketAbortTransform(reason));
|
||||
TransformationHelper.onAbortTransformation(Minecraft.getMinecraft().thePlayer.getEntityId());
|
||||
TransformationHelper.onAbortTransformation(
|
||||
Minecraft.getMinecraft().thePlayer.getEntityId());
|
||||
}
|
||||
}
|
||||
|
||||
public static void onStartTransformation(int targetId, int appearanceId) {
|
||||
if(Minecraft.getMinecraft().thePlayer.getEntityId() == targetId) {
|
||||
if(TransformationHelper.isTransformable()) {
|
||||
if (Minecraft.getMinecraft().thePlayer.getEntityId() == targetId) {
|
||||
if (TransformationHelper.isTransformable()) {
|
||||
TransformationHelper.transformedPlayers.put(targetId, appearanceId);
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
@@ -141,8 +141,8 @@ public class TransformationHelper {
|
||||
TransformationHelper.transformedPlayers.remove(targetId);
|
||||
TransformationHelper.entityCache.remove(targetId);
|
||||
|
||||
if(Minecraft.getMinecraft().thePlayer.getEntityId() == targetId && TransformationHelper.isTransformed()) {
|
||||
if (Minecraft.getMinecraft().thePlayer.getEntityId() == targetId && TransformationHelper.isTransformed()) {
|
||||
TransformationHelper.renderer.markForRemoval();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,8 +24,8 @@ public class ExtendedTypeDisplayManager {
|
||||
private static String oldName;
|
||||
|
||||
public static void notifyRenderTick() {
|
||||
if(ExtendedTypeDisplayManager.currTime > ExtendedTypeDisplayManager.timeout) {
|
||||
if(ExtendedTypeDisplayManager.changedLanguageFile) {
|
||||
if (ExtendedTypeDisplayManager.currTime > ExtendedTypeDisplayManager.timeout) {
|
||||
if (ExtendedTypeDisplayManager.changedLanguageFile) {
|
||||
ExtendedTypeDisplayManager.resetLanguageFile();
|
||||
}
|
||||
} else {
|
||||
@@ -35,19 +35,20 @@ public class ExtendedTypeDisplayManager {
|
||||
|
||||
private static void resetLanguageFile() {
|
||||
ExtendedTypeDisplayManager.currentNodeId = null;
|
||||
ResourceReloadListener.languageList.put(ExtendedTypeDisplayManager.changedEntry, ExtendedTypeDisplayManager.oldName);
|
||||
ResourceReloadListener.languageList.put(
|
||||
ExtendedTypeDisplayManager.changedEntry, ExtendedTypeDisplayManager.oldName);
|
||||
ExtendedTypeDisplayManager.changedLanguageFile = false;
|
||||
}
|
||||
|
||||
public static void notifyDisplayTick(String id, NodeType nodeType, ExtendedNodeType extendedNodeType) {
|
||||
ExtendedTypeDisplayManager.currTime = 0;
|
||||
|
||||
if(ExtendedTypeDisplayManager.currentNodeId != null && !ExtendedTypeDisplayManager.currentNodeId.equals(id)) {
|
||||
//New node.
|
||||
if (ExtendedTypeDisplayManager.currentNodeId != null && !ExtendedTypeDisplayManager.currentNodeId.equals(id)) {
|
||||
// New node.
|
||||
ExtendedTypeDisplayManager.resetLanguageFile();
|
||||
}
|
||||
|
||||
if(!ExtendedTypeDisplayManager.changedLanguageFile) {
|
||||
if (!ExtendedTypeDisplayManager.changedLanguageFile) {
|
||||
String toChance = "nodetype." + nodeType + ".name";
|
||||
String name = StatCollector.translateToLocal(toChance);
|
||||
String growingStr = StatCollector.translateToLocal("gadomancy.nodes." + extendedNodeType.name());
|
||||
|
||||
@@ -2,6 +2,10 @@ package makeo.gadomancy.client.util;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import makeo.gadomancy.client.renderers.item.ItemRenderFamiliar;
|
||||
import makeo.gadomancy.common.data.DataFamiliar;
|
||||
import makeo.gadomancy.common.network.packets.PacketFamiliarBolt;
|
||||
@@ -19,11 +23,6 @@ import thaumcraft.client.fx.bolt.FXLightningBolt;
|
||||
import thaumcraft.client.renderers.entity.RenderWisp;
|
||||
import thaumcraft.common.entities.monster.EntityWisp;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -43,15 +42,26 @@ public class FamiliarHandlerClient {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void processBoltPacket(PacketFamiliarBolt pkt) {
|
||||
EntityPlayer p = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(pkt.owner);
|
||||
if(p == null || p.getDistanceSqToEntity(Minecraft.getMinecraft().thePlayer) > 1024) return; //32^2
|
||||
if (p == null || p.getDistanceSqToEntity(Minecraft.getMinecraft().thePlayer) > 1024) return; // 32^2
|
||||
ExFamiliarData data = FamiliarHandlerClient.clientFamiliars.get(p.getCommandSenderName());
|
||||
if(data == null) return;
|
||||
if (data == null) return;
|
||||
PartialEntityFamiliar fam = data.familiar;
|
||||
float y = (float) (fam.posY + 1.22F);
|
||||
if (!Minecraft.getMinecraft().thePlayer.getCommandSenderName().equalsIgnoreCase(pkt.owner)) {
|
||||
y += 0.2F;
|
||||
}
|
||||
FXLightningBolt bolt = new FXLightningBolt(Minecraft.getMinecraft().theWorld, (float) fam.posX, y, (float) fam.posZ, pkt.targetX, pkt.targetY, pkt.targetZ, Minecraft.getMinecraft().theWorld.rand.nextLong(), 10, 4.0F, 5);
|
||||
FXLightningBolt bolt = new FXLightningBolt(
|
||||
Minecraft.getMinecraft().theWorld,
|
||||
(float) fam.posX,
|
||||
y,
|
||||
(float) fam.posZ,
|
||||
pkt.targetX,
|
||||
pkt.targetY,
|
||||
pkt.targetZ,
|
||||
Minecraft.getMinecraft().theWorld.rand.nextLong(),
|
||||
10,
|
||||
4.0F,
|
||||
5);
|
||||
bolt.defaultFractal();
|
||||
bolt.setType(pkt.type);
|
||||
bolt.finalizeBolt();
|
||||
@@ -60,18 +70,19 @@ public class FamiliarHandlerClient {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void playerRenderEvent(EntityPlayer player, float partialTicks) {
|
||||
String ownerName = player.getCommandSenderName();
|
||||
if(!FamiliarHandlerClient.clientFamiliars.containsKey(ownerName)) return;
|
||||
if (!FamiliarHandlerClient.clientFamiliars.containsKey(ownerName)) return;
|
||||
|
||||
ExFamiliarData data = FamiliarHandlerClient.clientFamiliars.get(ownerName);
|
||||
PartialEntityFamiliar fam = data.familiar;
|
||||
|
||||
Aspect aspect = Aspect.getAspect(data.data.aspectTag);
|
||||
|
||||
if(FamiliarHandlerClient.ENTITY_WISP == null) FamiliarHandlerClient.ENTITY_WISP = new EntityWisp(new FakeWorld());
|
||||
if (FamiliarHandlerClient.ENTITY_WISP == null)
|
||||
FamiliarHandlerClient.ENTITY_WISP = new EntityWisp(new FakeWorld());
|
||||
FamiliarHandlerClient.ENTITY_WISP.setType(aspect.getTag());
|
||||
FamiliarHandlerClient.ENTITY_WISP.ticksExisted = fam.dummyEntity.ticksExisted;
|
||||
GL11.glPushMatrix();
|
||||
if(fam.owner == null || fam.owner.get() == null) {
|
||||
if (fam.owner == null || fam.owner.get() == null) {
|
||||
fam.owner = new WeakReference<EntityPlayer>(player);
|
||||
}
|
||||
EntityPlayer current = Minecraft.getMinecraft().thePlayer;
|
||||
@@ -82,7 +93,7 @@ public class FamiliarHandlerClient {
|
||||
String currentPl = current.getCommandSenderName();
|
||||
String otherPl = player.getCommandSenderName();
|
||||
|
||||
if(!currentPl.equals(otherPl)) {
|
||||
if (!currentPl.equals(otherPl)) {
|
||||
diffY += 1.32;
|
||||
|
||||
EntityLivingBase entity = Minecraft.getMinecraft().renderViewEntity;
|
||||
@@ -91,14 +102,15 @@ public class FamiliarHandlerClient {
|
||||
diffZ -= ((entity.posZ - entity.lastTickPosZ) * partialTicks);
|
||||
}
|
||||
|
||||
ItemRenderFamiliar.renderEntityWispFor(fam.owner.get(), FamiliarHandlerClient.ENTITY_WISP, diffX, diffY, diffZ, 0, partialTicks);
|
||||
ItemRenderFamiliar.renderEntityWispFor(
|
||||
fam.owner.get(), FamiliarHandlerClient.ENTITY_WISP, diffX, diffY, diffZ, 0, partialTicks);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void playerTickEvent() {
|
||||
if(Minecraft.getMinecraft().theWorld == null) return;
|
||||
for(ExFamiliarData data : FamiliarHandlerClient.clientFamiliars.values()) {
|
||||
if (Minecraft.getMinecraft().theWorld == null) return;
|
||||
for (ExFamiliarData data : FamiliarHandlerClient.clientFamiliars.values()) {
|
||||
data.familiar.tick();
|
||||
}
|
||||
PartialEntityFamiliar.DUMMY_FAMILIAR.tick();
|
||||
@@ -110,15 +122,16 @@ public class FamiliarHandlerClient {
|
||||
}
|
||||
|
||||
public static void handleAdditions(List<DataFamiliar.FamiliarData> toAdd) {
|
||||
for(DataFamiliar.FamiliarData data : toAdd) {
|
||||
PartialEntityFamiliar familiar = new PartialEntityFamiliar(Minecraft.getMinecraft().theWorld.getPlayerEntityByName(data.owner), data.owner);
|
||||
for (DataFamiliar.FamiliarData data : toAdd) {
|
||||
PartialEntityFamiliar familiar = new PartialEntityFamiliar(
|
||||
Minecraft.getMinecraft().theWorld.getPlayerEntityByName(data.owner), data.owner);
|
||||
ExFamiliarData exData = new ExFamiliarData(data, familiar);
|
||||
FamiliarHandlerClient.clientFamiliars.put(data.owner, exData);
|
||||
}
|
||||
}
|
||||
|
||||
public static void handleRemovals(List<DataFamiliar.FamiliarData> toRemove) {
|
||||
for(DataFamiliar.FamiliarData data : toRemove) {
|
||||
for (DataFamiliar.FamiliarData data : toRemove) {
|
||||
FamiliarHandlerClient.clientFamiliars.remove(data.owner);
|
||||
}
|
||||
}
|
||||
@@ -140,8 +153,8 @@ public class FamiliarHandlerClient {
|
||||
|
||||
ExFamiliarData that = (ExFamiliarData) o;
|
||||
|
||||
return (this.data != null ? this.data.equals(that.data) : that.data == null) && (this.familiar != null ? this.familiar.equals(that.familiar) : that.familiar == null);
|
||||
|
||||
return (this.data != null ? this.data.equals(that.data) : that.data == null)
|
||||
&& (this.familiar != null ? this.familiar.equals(that.familiar) : that.familiar == null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -193,10 +206,11 @@ public class FamiliarHandlerClient {
|
||||
this.ticksExisted++;
|
||||
this.dummyEntity.ticksExisted = this.ticksExisted;
|
||||
|
||||
if(this.owner.get() == null) {
|
||||
if(this.potentialOwnerName != null) {
|
||||
EntityPlayer player = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(this.potentialOwnerName);
|
||||
if(player != null) {
|
||||
if (this.owner.get() == null) {
|
||||
if (this.potentialOwnerName != null) {
|
||||
EntityPlayer player =
|
||||
Minecraft.getMinecraft().theWorld.getPlayerEntityByName(this.potentialOwnerName);
|
||||
if (player != null) {
|
||||
this.owner = new WeakReference<EntityPlayer>(player);
|
||||
} else {
|
||||
return;
|
||||
@@ -205,7 +219,8 @@ public class FamiliarHandlerClient {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if(this.owner.get().worldObj.provider.dimensionId != Minecraft.getMinecraft().renderViewEntity.worldObj.provider.dimensionId) {
|
||||
if (this.owner.get().worldObj.provider.dimensionId
|
||||
!= Minecraft.getMinecraft().renderViewEntity.worldObj.provider.dimensionId) {
|
||||
this.owner = new WeakReference<EntityPlayer>(null);
|
||||
return;
|
||||
}
|
||||
@@ -226,5 +241,4 @@ public class FamiliarHandlerClient {
|
||||
this.posY = this.owner.get().posY + this.renderY;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
package makeo.gadomancy.client.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
@@ -9,11 +13,6 @@ import thaumcraft.client.fx.particles.FXBubble;
|
||||
import thaumcraft.client.lib.UtilsFX;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -42,22 +41,25 @@ public class MultiTickEffectDispatcher {
|
||||
|
||||
private static void handleBubbleSpawnings(World world) {
|
||||
Iterator<BubbleFXInfo> it = MultiTickEffectDispatcher.bubbleInfos.iterator();
|
||||
while(it.hasNext()) {
|
||||
while (it.hasNext()) {
|
||||
BubbleFXInfo info = it.next();
|
||||
if(info.dimId != world.provider.dimensionId) {
|
||||
if (info.dimId != world.provider.dimensionId) {
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
info.renderTicks++;
|
||||
if(info.renderTicks > info.overallTicks) {
|
||||
if (info.renderTicks > info.overallTicks) {
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
if(world.rand.nextInt(3) == 0) {
|
||||
float x = info.posX + (world.rand.nextBoolean() ? 1 : -1) * (world.rand.nextFloat() * info.rangeAroundItem);
|
||||
float y = info.posY + (world.rand.nextBoolean() ? 1 : -1) * (world.rand.nextFloat() * info.rangeAroundItem);
|
||||
float z = info.posZ + (world.rand.nextBoolean() ? 1 : -1) * (world.rand.nextFloat() * info.rangeAroundItem);
|
||||
if (world.rand.nextInt(3) == 0) {
|
||||
float x = info.posX
|
||||
+ (world.rand.nextBoolean() ? 1 : -1) * (world.rand.nextFloat() * info.rangeAroundItem);
|
||||
float y = info.posY
|
||||
+ (world.rand.nextBoolean() ? 1 : -1) * (world.rand.nextFloat() * info.rangeAroundItem);
|
||||
float z = info.posZ
|
||||
+ (world.rand.nextBoolean() ? 1 : -1) * (world.rand.nextFloat() * info.rangeAroundItem);
|
||||
FXBubble fb = new FXBubble(world, x, y, z, 0.0D, 0.0D, 0.0D, 0);
|
||||
fb.setAlphaF(0.25F);
|
||||
fb.setRGB(1.0F, 1.0F, 1.0F);
|
||||
@@ -69,42 +71,62 @@ public class MultiTickEffectDispatcher {
|
||||
private static void handleWispyLineEffects(World currentRenderWorld, float partialTicks) {
|
||||
Tessellator tessellator;
|
||||
Iterator<FloatyLineInfo> it = MultiTickEffectDispatcher.floatyLineInfos.iterator();
|
||||
while(it.hasNext()) {
|
||||
while (it.hasNext()) {
|
||||
FloatyLineInfo info = it.next();
|
||||
if(info.dimId != currentRenderWorld.provider.dimensionId) {
|
||||
if (info.dimId != currentRenderWorld.provider.dimensionId) {
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
info.renderTicks++;
|
||||
if(info.renderTicks > info.tickCap) {
|
||||
if (info.renderTicks > info.tickCap) {
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
if(info.randomOffset == -1) {
|
||||
if (info.randomOffset == -1) {
|
||||
info.randomOffset = currentRenderWorld.rand.nextInt(20);
|
||||
}
|
||||
|
||||
float ticks = Minecraft.getMinecraft().renderViewEntity.ticksExisted + info.randomOffset + partialTicks;
|
||||
UtilsFX.drawFloatyLine(info.pedestalX, info.pedestalY, info.pedestalZ, info.originX, info.originY, info.originZ, partialTicks, info.colorAsInt, "textures/misc/wispy.png", -0.02F, Math.min(ticks, 10.0F) / 10.0F);
|
||||
UtilsFX.drawFloatyLine(
|
||||
info.pedestalX,
|
||||
info.pedestalY,
|
||||
info.pedestalZ,
|
||||
info.originX,
|
||||
info.originY,
|
||||
info.originZ,
|
||||
partialTicks,
|
||||
info.colorAsInt,
|
||||
"textures/misc/wispy.png",
|
||||
-0.02F,
|
||||
Math.min(ticks, 10.0F) / 10.0F);
|
||||
}
|
||||
}
|
||||
|
||||
private static void handleVortexDiggingEffects(World currentRenderWorld) {
|
||||
Iterator<VortexDigInfo> it = MultiTickEffectDispatcher.vortexDigInfos.iterator();
|
||||
while(it.hasNext()) {
|
||||
while (it.hasNext()) {
|
||||
VortexDigInfo info = it.next();
|
||||
if(info.dimId != currentRenderWorld.provider.dimensionId) {
|
||||
if (info.dimId != currentRenderWorld.provider.dimensionId) {
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
info.renderTicks++;
|
||||
if(info.renderTicks > info.tickCap) {
|
||||
if (info.renderTicks > info.tickCap) {
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
Thaumcraft.proxy.boreDigFx(currentRenderWorld, info.tX, info.tY, info.tZ, info.oX, info.oY, info.oZ, info.blockInstance, info.meta);
|
||||
Thaumcraft.proxy.boreDigFx(
|
||||
currentRenderWorld,
|
||||
info.tX,
|
||||
info.tY,
|
||||
info.tZ,
|
||||
info.oX,
|
||||
info.oY,
|
||||
info.oZ,
|
||||
info.blockInstance,
|
||||
info.meta);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +167,16 @@ public class MultiTickEffectDispatcher {
|
||||
private int colorAsInt;
|
||||
private int randomOffset = -1;
|
||||
|
||||
public FloatyLineInfo(int dimId, double pedestalX, double pedestalY, double pedestalZ, double originX, double originY, double originZ, int tickCap, int colorAsInt) {
|
||||
public FloatyLineInfo(
|
||||
int dimId,
|
||||
double pedestalX,
|
||||
double pedestalY,
|
||||
double pedestalZ,
|
||||
double originX,
|
||||
double originY,
|
||||
double originZ,
|
||||
int tickCap,
|
||||
int colorAsInt) {
|
||||
this.dimId = dimId;
|
||||
this.pedestalX = pedestalX;
|
||||
this.pedestalY = pedestalY;
|
||||
@@ -185,7 +216,17 @@ public class MultiTickEffectDispatcher {
|
||||
private int renderTicks;
|
||||
private int tickCap;
|
||||
|
||||
public VortexDigInfo(int dimId, int oX, int oY, int oZ, int tX, int tY, int tZ, Block blockInstance, int meta, int tickDuration) {
|
||||
public VortexDigInfo(
|
||||
int dimId,
|
||||
int oX,
|
||||
int oY,
|
||||
int oZ,
|
||||
int tX,
|
||||
int tY,
|
||||
int tZ,
|
||||
Block blockInstance,
|
||||
int meta,
|
||||
int tickDuration) {
|
||||
this.dimId = dimId;
|
||||
this.oX = oX;
|
||||
this.oY = oY;
|
||||
@@ -198,5 +239,4 @@ public class MultiTickEffectDispatcher {
|
||||
this.tickCap = tickDuration;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package makeo.gadomancy.client.util;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Random;
|
||||
import makeo.gadomancy.common.utils.MiscUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntitySmokeFX;
|
||||
@@ -7,9 +9,6 @@ import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -20,25 +19,44 @@ import java.util.Random;
|
||||
*/
|
||||
public class UtilsFX {
|
||||
|
||||
private static final Color[] RUNE_COLORS_RED = { new Color(0xB60707), new Color(0xEE3782), new Color(0xF37B20), new Color(0xFF6722), new Color(0xFF6D30), new Color(0xFF0000) };
|
||||
private static final Color[] RUNE_COLORS_GREEN = { new Color(0x015629), new Color(0x0E9C00), new Color(0x010000), new Color(0x01FF00), new Color(0x014C3E)};
|
||||
private static final Color[] RUNE_COLORS_BLUE = { new Color(0x060956), new Color(0x012578), new Color(0x0C1556), new Color(0x0100FF), new Color(0x01018C)};
|
||||
private static final Color[] RUNE_COLORS_RED = {
|
||||
new Color(0xB60707),
|
||||
new Color(0xEE3782),
|
||||
new Color(0xF37B20),
|
||||
new Color(0xFF6722),
|
||||
new Color(0xFF6D30),
|
||||
new Color(0xFF0000)
|
||||
};
|
||||
private static final Color[] RUNE_COLORS_GREEN = {
|
||||
new Color(0x015629), new Color(0x0E9C00), new Color(0x010000), new Color(0x01FF00), new Color(0x014C3E)
|
||||
};
|
||||
private static final Color[] RUNE_COLORS_BLUE = {
|
||||
new Color(0x060956), new Color(0x012578), new Color(0x0C1556), new Color(0x0100FF), new Color(0x01018C)
|
||||
};
|
||||
|
||||
public static void doRuneEffects(World world, int x, int y, int z, int colorFlag) {
|
||||
if(world.isRemote) {
|
||||
if (world.isRemote) {
|
||||
int cnt = 20;
|
||||
while(cnt > 0) {
|
||||
while (cnt > 0) {
|
||||
cnt--;
|
||||
Color rand = UtilsFX.evaluateRandomColor(world.rand, colorFlag);
|
||||
Thaumcraft.proxy.blockRunes(world, x + UtilsFX.randomOffset(world), y + UtilsFX.randomOffset(world), z + UtilsFX.randomOffset(world),
|
||||
rand.getRed() / 255F, rand.getGreen() / 255F, rand.getBlue() / 255F, world.rand.nextInt(10) + 30, -0.01F - (world.rand.nextBoolean() ? world.rand.nextBoolean() ? 0.02F : 0.01F : 0F));
|
||||
Thaumcraft.proxy.blockRunes(
|
||||
world,
|
||||
x + UtilsFX.randomOffset(world),
|
||||
y + UtilsFX.randomOffset(world),
|
||||
z + UtilsFX.randomOffset(world),
|
||||
rand.getRed() / 255F,
|
||||
rand.getGreen() / 255F,
|
||||
rand.getBlue() / 255F,
|
||||
world.rand.nextInt(10) + 30,
|
||||
-0.01F - (world.rand.nextBoolean() ? world.rand.nextBoolean() ? 0.02F : 0.01F : 0F));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Color evaluateRandomColor(Random rand, int colorFlag) {
|
||||
Color[] possibleColors;
|
||||
if(colorFlag == 1) {
|
||||
if (colorFlag == 1) {
|
||||
possibleColors = UtilsFX.RUNE_COLORS_BLUE;
|
||||
} else {
|
||||
possibleColors = UtilsFX.RUNE_COLORS_RED;
|
||||
@@ -51,7 +69,7 @@ public class UtilsFX {
|
||||
}
|
||||
|
||||
public static void doSparkleEffectsAround(World world, int x, int y, int z) {
|
||||
for(ChunkCoordinates cc : MiscUtils.getCoordinatesAround(new ChunkCoordinates(x, y, z))) {
|
||||
for (ChunkCoordinates cc : MiscUtils.getCoordinatesAround(new ChunkCoordinates(x, y, z))) {
|
||||
UtilsFX.doSparkleEffects(world, cc.posX, cc.posY, cc.posZ);
|
||||
}
|
||||
}
|
||||
@@ -63,14 +81,22 @@ public class UtilsFX {
|
||||
public static void doSmokeEffects(World world, int x, int y, int z, float size) {
|
||||
int count = world.rand.nextInt(6) + 2;
|
||||
for (int i = 0; i < count; i++) {
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(
|
||||
new EntitySmokeFX(world, x + 0.5 + UtilsFX.randEffectOffset(world.rand), y + 0.5 + UtilsFX.randEffectOffset(world.rand), z + 0.5 + UtilsFX.randEffectOffset(world.rand),
|
||||
UtilsFX.randEffectOffset(world.rand) * 0.01F, UtilsFX.randEffectOffset(world.rand) * 0.1F, UtilsFX.randEffectOffset(world.rand) * 0.01F, size));
|
||||
Minecraft.getMinecraft()
|
||||
.effectRenderer
|
||||
.addEffect(new EntitySmokeFX(
|
||||
world,
|
||||
x + 0.5 + UtilsFX.randEffectOffset(world.rand),
|
||||
y + 0.5 + UtilsFX.randEffectOffset(world.rand),
|
||||
z + 0.5 + UtilsFX.randEffectOffset(world.rand),
|
||||
UtilsFX.randEffectOffset(world.rand) * 0.01F,
|
||||
UtilsFX.randEffectOffset(world.rand) * 0.1F,
|
||||
UtilsFX.randEffectOffset(world.rand) * 0.01F,
|
||||
size));
|
||||
}
|
||||
}
|
||||
|
||||
public static void doSmokeEffectsAround(World world, int x, int y, int z, float size) {
|
||||
for(ChunkCoordinates cc : MiscUtils.getCoordinatesAround(new ChunkCoordinates(x, y, z))) {
|
||||
for (ChunkCoordinates cc : MiscUtils.getCoordinatesAround(new ChunkCoordinates(x, y, z))) {
|
||||
UtilsFX.doSmokeEffects(world, cc.posX, cc.posY, cc.posZ, size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@ import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import makeo.gadomancy.client.ClientProxy;
|
||||
import makeo.gadomancy.common.aura.AuraEffects;
|
||||
import makeo.gadomancy.common.containers.ContainerArcanePackager;
|
||||
@@ -29,10 +32,6 @@ import thaumcraft.api.wands.WandTriggerRegistry;
|
||||
import thaumcraft.common.entities.golems.ContainerGolem;
|
||||
import thaumcraft.common.entities.golems.EntityGolemBase;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -47,7 +46,7 @@ public class CommonProxy implements IGuiHandler {
|
||||
|
||||
public static final EventHandlerGolem EVENT_HANDLER_GOLEM = new EventHandlerGolem();
|
||||
|
||||
public void onConstruct() { }
|
||||
public void onConstruct() {}
|
||||
|
||||
public void preInitalize() {
|
||||
PacketHandler.init();
|
||||
@@ -85,7 +84,7 @@ public class CommonProxy implements IGuiHandler {
|
||||
|
||||
public void postInitalize() {
|
||||
RegisteredPotions.init();
|
||||
AuraEffects.AER.getTickInterval(); //initalize AuraEffects
|
||||
AuraEffects.AER.getTickInterval(); // initalize AuraEffects
|
||||
|
||||
RegisteredResearches.init();
|
||||
RegisteredIntegrations.init();
|
||||
@@ -100,25 +99,28 @@ public class CommonProxy implements IGuiHandler {
|
||||
public static void unregisterWandHandler(String modid, Block block, int metadata) {
|
||||
HashMap<String, HashMap<List, List>> triggers = new Injector(WandTriggerRegistry.class).getField("triggers");
|
||||
HashMap<List, List> modTriggers = triggers.get(modid);
|
||||
if(modTriggers == null) return;
|
||||
if (modTriggers == null) return;
|
||||
List arrKey = Arrays.asList(block, metadata);
|
||||
modTriggers.remove(arrKey);
|
||||
triggers.put(modid, modTriggers);
|
||||
}
|
||||
|
||||
public void spawnBubbles(World world, float posX, float posY, float posZ, float rangeAroundItem) {
|
||||
PacketStartAnimation pkt = new PacketStartAnimation(PacketStartAnimation.ID_BUBBLES,
|
||||
Float.floatToIntBits(posX), Float.floatToIntBits(posY), Float.floatToIntBits(posZ),
|
||||
PacketStartAnimation pkt = new PacketStartAnimation(
|
||||
PacketStartAnimation.ID_BUBBLES,
|
||||
Float.floatToIntBits(posX),
|
||||
Float.floatToIntBits(posY),
|
||||
Float.floatToIntBits(posZ),
|
||||
Float.floatToIntBits(rangeAroundItem));
|
||||
PacketHandler.INSTANCE.sendToAllAround(pkt, new NetworkRegistry.TargetPoint(world.provider.dimensionId,
|
||||
posX, posY, posZ, 32));
|
||||
PacketHandler.INSTANCE.sendToAllAround(
|
||||
pkt, new NetworkRegistry.TargetPoint(world.provider.dimensionId, posX, posY, posZ, 32));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
switch (ID) {
|
||||
case 0:
|
||||
return new ContainerGolem(player.inventory, ((EntityGolemBase)world.getEntityByID(x)).inventory);
|
||||
return new ContainerGolem(player.inventory, ((EntityGolemBase) world.getEntityByID(x)).inventory);
|
||||
case 1:
|
||||
return new ContainerInfusionClaw(player.inventory, (IInventory) world.getTileEntity(x, y, z));
|
||||
case 2:
|
||||
@@ -132,7 +134,7 @@ public class CommonProxy implements IGuiHandler {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void runDelayedClientSide(Runnable run) { }
|
||||
public void runDelayedClientSide(Runnable run) {}
|
||||
|
||||
public Side getSide() {
|
||||
return this instanceof ClientProxy ? Side.CLIENT : Side.SERVER;
|
||||
|
||||
@@ -19,7 +19,11 @@ import thaumcraft.common.Thaumcraft;
|
||||
*
|
||||
* Created by makeo @ 29.11.2014 14:07
|
||||
*/
|
||||
@Mod(modid = Gadomancy.MODID, name = Gadomancy.NAME, version = Gadomancy.VERSION, dependencies="required-after:Thaumcraft@[4.1.1.11,);after:Waila;after:Automagy")
|
||||
@Mod(
|
||||
modid = Gadomancy.MODID,
|
||||
name = Gadomancy.NAME,
|
||||
version = Gadomancy.VERSION,
|
||||
dependencies = "required-after:Thaumcraft@[4.1.1.11,);after:Waila;after:Automagy")
|
||||
public class Gadomancy {
|
||||
public static final String MODID = "gadomancy";
|
||||
public static final String NAME = "Gadomancy";
|
||||
@@ -48,7 +52,7 @@ public class Gadomancy {
|
||||
}
|
||||
|
||||
public static void unloadModData() {
|
||||
if(Gadomancy.modData != null) {
|
||||
if (Gadomancy.modData != null) {
|
||||
Gadomancy.modData.save();
|
||||
Gadomancy.modData = null;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package makeo.gadomancy.common.api;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import makeo.gadomancy.api.AuraEffect;
|
||||
import makeo.gadomancy.api.ClickBehavior;
|
||||
import makeo.gadomancy.api.golems.AdditionalGolemType;
|
||||
@@ -22,11 +26,6 @@ import org.apache.logging.log4j.Logger;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.common.entities.golems.EntityGolemBase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -44,11 +43,12 @@ public class DefaultApiHandler implements IApiHandler {
|
||||
@Override
|
||||
public boolean registerAdditionalGolemType(String name, String modId, AdditionalGolemType newType) {
|
||||
String uniqueName = name.toUpperCase();
|
||||
if(!DefaultApiHandler.additionalGolemTypes.containsKey(uniqueName)) {
|
||||
if (!DefaultApiHandler.additionalGolemTypes.containsKey(uniqueName)) {
|
||||
GolemEnumHelper.addGolemType(uniqueName, newType);
|
||||
|
||||
ItemAdditionalGolemPlacer placerItem = new ItemAdditionalGolemPlacer(newType);
|
||||
GameRegistry.registerItem(placerItem, "item" + StringHelper.firstToUpper(name.toLowerCase()) + "GolemPlacer");
|
||||
GameRegistry.registerItem(
|
||||
placerItem, "item" + StringHelper.firstToUpper(name.toLowerCase()) + "GolemPlacer");
|
||||
newType.setModId(modId);
|
||||
newType.setPlacerItem(placerItem);
|
||||
|
||||
@@ -73,7 +73,7 @@ public class DefaultApiHandler implements IApiHandler {
|
||||
@Override
|
||||
public AdditionalGolemCore getAdditionalGolemCore(EntityGolemBase golem) {
|
||||
String coreName = golem.getDataWatcher().getWatchableObjectString(ModConfig.golemDatawatcherId);
|
||||
if(!coreName.isEmpty()) {
|
||||
if (!coreName.isEmpty()) {
|
||||
return DefaultApiHandler.additionalGolemCores.get(coreName);
|
||||
}
|
||||
return null;
|
||||
@@ -81,9 +81,9 @@ public class DefaultApiHandler implements IApiHandler {
|
||||
|
||||
@Override
|
||||
public AdditionalGolemCore getAdditionalGolemCore(ItemStack placer) {
|
||||
if(NBTHelper.hasPersistentData(placer)) {
|
||||
if (NBTHelper.hasPersistentData(placer)) {
|
||||
NBTTagCompound persistent = NBTHelper.getPersistentData(placer);
|
||||
if(persistent.hasKey("Core")) {
|
||||
if (persistent.hasKey("Core")) {
|
||||
return DefaultApiHandler.additionalGolemCores.get(persistent.getString("Core"));
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,7 @@ public class DefaultApiHandler implements IApiHandler {
|
||||
|
||||
@Override
|
||||
public boolean registerAdditionalGolemCore(String name, AdditionalGolemCore core) {
|
||||
if(!DefaultApiHandler.additionalGolemCores.containsKey(name)) {
|
||||
if (!DefaultApiHandler.additionalGolemCores.containsKey(name)) {
|
||||
core.setName(name);
|
||||
DefaultApiHandler.additionalGolemCores.put(name, core);
|
||||
return true;
|
||||
@@ -107,15 +107,15 @@ public class DefaultApiHandler implements IApiHandler {
|
||||
golem.setCore(core == null ? -1 : core.getBaseCore());
|
||||
golem.getDataWatcher().updateObject(ModConfig.golemDatawatcherId, coreName);
|
||||
|
||||
if(!golem.worldObj.isRemote) {
|
||||
if (!golem.worldObj.isRemote) {
|
||||
NBTHelper.getPersistentData(golem).setString("Core", coreName);
|
||||
((ExtendedGolemProperties)golem.getExtendedProperties(Gadomancy.MODID)).updateGolem();
|
||||
((ExtendedGolemProperties) golem.getExtendedProperties(Gadomancy.MODID)).updateGolem();
|
||||
} else {
|
||||
golem.setupGolem();
|
||||
golem.setupGolemInventory();
|
||||
}
|
||||
|
||||
golem.worldObj.setEntityState(golem, (byte)7);
|
||||
golem.worldObj.setEntityState(golem, (byte) 7);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -130,8 +130,8 @@ public class DefaultApiHandler implements IApiHandler {
|
||||
|
||||
@Override
|
||||
public void registerAdditionalAuraEffect(Aspect aspect, AuraEffect effect) {
|
||||
if(aspect == null || effect == null) return;
|
||||
if(AuraEffectHandler.registeredEffects.containsKey(aspect)) {
|
||||
if (aspect == null || effect == null) return;
|
||||
if (AuraEffectHandler.registeredEffects.containsKey(aspect)) {
|
||||
DefaultApiHandler.log.warn("AuraEffect for '" + aspect.getTag() + "' is already registered!");
|
||||
} else {
|
||||
AuraEffectHandler.registeredEffects.put(aspect, effect);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package makeo.gadomancy.common.aura;
|
||||
|
||||
import java.util.*;
|
||||
import makeo.gadomancy.api.AuraEffect;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -8,8 +9,6 @@ import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -23,12 +22,14 @@ public class AuraEffectHandler {
|
||||
public static Map<Aspect, AuraEffect> registeredEffects = new HashMap<Aspect, AuraEffect>();
|
||||
|
||||
public static void distributeEffects(Aspect aspect, World worldObj, double x, double y, double z, int tick) {
|
||||
if(!AuraEffectHandler.registeredEffects.containsKey(aspect) || worldObj.isRemote || AuraResearchManager.isBlacklisted(aspect)) return;
|
||||
if (!AuraEffectHandler.registeredEffects.containsKey(aspect)
|
||||
|| worldObj.isRemote
|
||||
|| AuraResearchManager.isBlacklisted(aspect)) return;
|
||||
AuraEffect effect = AuraEffectHandler.registeredEffects.get(aspect);
|
||||
if((tick % effect.getTickInterval()) != 0) return;
|
||||
if ((tick % effect.getTickInterval()) != 0) return;
|
||||
|
||||
AuraEffect.EffectType type = effect.getEffectType();
|
||||
if(type != null) {
|
||||
if (type != null) {
|
||||
switch (type) {
|
||||
case ENTITY_EFFECT:
|
||||
AuraEffectHandler.doEntityEffects(effect, worldObj, x, y, z);
|
||||
@@ -42,11 +43,14 @@ public class AuraEffectHandler {
|
||||
AuraEffectHandler.doBlockEffects(effect, worldObj, x, y, z);
|
||||
}
|
||||
|
||||
//Distribute research
|
||||
// Distribute research
|
||||
double range = effect.getRange();
|
||||
List players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x - 0.5, y - 0.5, z - 0.5, x + 0.5, y + 0.5, z + 0.5).expand(range, range, range));
|
||||
for(Object p : players) {
|
||||
if(p == null || !(p instanceof EntityPlayer)) continue;
|
||||
List players = worldObj.getEntitiesWithinAABB(
|
||||
EntityPlayer.class,
|
||||
AxisAlignedBB.getBoundingBox(x - 0.5, y - 0.5, z - 0.5, x + 0.5, y + 0.5, z + 0.5)
|
||||
.expand(range, range, range));
|
||||
for (Object p : players) {
|
||||
if (p == null || !(p instanceof EntityPlayer)) continue;
|
||||
EntityPlayer player = (EntityPlayer) p;
|
||||
AuraResearchManager.tryUnlockAuraEffect(player, aspect);
|
||||
}
|
||||
@@ -64,7 +68,7 @@ public class AuraEffectHandler {
|
||||
int zz = worldObj.rand.nextInt(intRange) - worldObj.rand.nextInt(intRange);
|
||||
|
||||
ChunkCoordinates blockCC = new ChunkCoordinates((int) x + xx, (int) y + yy, (int) z + zz);
|
||||
if(foundBlocks.contains(blockCC)) {
|
||||
if (foundBlocks.contains(blockCC)) {
|
||||
count++;
|
||||
} else {
|
||||
foundBlocks.add(blockCC);
|
||||
@@ -75,20 +79,22 @@ public class AuraEffectHandler {
|
||||
|
||||
private static void doEntityEffects(AuraEffect effect, World worldObj, double x, double y, double z) {
|
||||
double range = effect.getRange();
|
||||
List entitiesInRange = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(x - 0.5, y - 0.5, z - 0.5, x + 0.5, y + 0.5, z + 0.5).expand(range, range, range));
|
||||
List entitiesInRange = worldObj.getEntitiesWithinAABB(
|
||||
Entity.class,
|
||||
AxisAlignedBB.getBoundingBox(x - 0.5, y - 0.5, z - 0.5, x + 0.5, y + 0.5, z + 0.5)
|
||||
.expand(range, range, range));
|
||||
Iterator it = entitiesInRange.iterator();
|
||||
while(it.hasNext()) {
|
||||
while (it.hasNext()) {
|
||||
Entity e = (Entity) it.next();
|
||||
if(e == null || e.isDead) {
|
||||
if (e == null || e.isDead) {
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
if(!effect.isEntityApplicable(e)) it.remove();
|
||||
if (!effect.isEntityApplicable(e)) it.remove();
|
||||
}
|
||||
ChunkCoordinates origin = new ChunkCoordinates((int) x, (int) y, (int) z);
|
||||
for(Object e : entitiesInRange) {
|
||||
for (Object e : entitiesInRange) {
|
||||
effect.doEntityEffect(origin, (Entity) e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
package makeo.gadomancy.common.aura;
|
||||
|
||||
import static makeo.gadomancy.common.utils.MiscUtils.ticksForMinutes;
|
||||
import static makeo.gadomancy.common.utils.MiscUtils.ticksForSeconds;
|
||||
|
||||
import java.util.Random;
|
||||
import makeo.gadomancy.api.AuraEffect;
|
||||
import makeo.gadomancy.common.events.EventHandlerEntity;
|
||||
import makeo.gadomancy.common.integration.IntegrationThaumicTinkerer;
|
||||
@@ -42,11 +46,6 @@ import thaumcraft.common.lib.utils.EntityUtils;
|
||||
import thaumcraft.common.lib.utils.Utils;
|
||||
import thaumcraft.common.lib.world.ThaumcraftWorldGenerator;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import static makeo.gadomancy.common.utils.MiscUtils.ticksForMinutes;
|
||||
import static makeo.gadomancy.common.utils.MiscUtils.ticksForSeconds;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -56,35 +55,79 @@ import static makeo.gadomancy.common.utils.MiscUtils.ticksForSeconds;
|
||||
* Created by HellFirePvP @ 29.11.2015 19:09
|
||||
*/
|
||||
public class AuraEffects {
|
||||
private static final ItemStack[][] ITEMS_SOUL = {{new ItemStack(Items.bow), new ItemStack(Items.wooden_sword), new ItemStack(Items.stone_sword), new ItemStack(Items.iron_sword), new ItemStack(Items.stone_axe), new ItemStack(Items.iron_axe)},{new ItemStack(Items.leather_boots), new ItemStack(Items.chainmail_boots), new ItemStack(Items.iron_boots)},{new ItemStack(Items.leather_leggings), new ItemStack(Items.chainmail_leggings), new ItemStack(Items.iron_leggings)},{new ItemStack(Items.leather_chestplate), new ItemStack(Items.chainmail_chestplate), new ItemStack(Items.iron_chestplate)},{new ItemStack(Blocks.lit_pumpkin), new ItemStack(Blocks.pumpkin)}};
|
||||
private static final ItemStack[][] ITEMS_SOUL = {
|
||||
{
|
||||
new ItemStack(Items.bow),
|
||||
new ItemStack(Items.wooden_sword),
|
||||
new ItemStack(Items.stone_sword),
|
||||
new ItemStack(Items.iron_sword),
|
||||
new ItemStack(Items.stone_axe),
|
||||
new ItemStack(Items.iron_axe)
|
||||
},
|
||||
{new ItemStack(Items.leather_boots), new ItemStack(Items.chainmail_boots), new ItemStack(Items.iron_boots)},
|
||||
{
|
||||
new ItemStack(Items.leather_leggings),
|
||||
new ItemStack(Items.chainmail_leggings),
|
||||
new ItemStack(Items.iron_leggings)
|
||||
},
|
||||
{
|
||||
new ItemStack(Items.leather_chestplate),
|
||||
new ItemStack(Items.chainmail_chestplate),
|
||||
new ItemStack(Items.iron_chestplate)
|
||||
},
|
||||
{new ItemStack(Blocks.lit_pumpkin), new ItemStack(Blocks.pumpkin)}
|
||||
};
|
||||
|
||||
//Potion amplifiers start with 0 == lvl 1!
|
||||
// Potion amplifiers start with 0 == lvl 1!
|
||||
|
||||
//Std. potion effects
|
||||
public static final AuraEffect AER = new PotionDistributionEffect(Potion.moveSpeed, 4, 6, ticksForMinutes(6), 1).register(Aspect.AIR);
|
||||
public static final AuraEffect AQUA = new PotionDistributionEffect(Potion.waterBreathing, 4, 10, ticksForMinutes(10), 0).register(Aspect.WATER);
|
||||
public static final AuraEffect TERRA = new PotionDistributionEffect(Potion.resistance, 4, 8, ticksForMinutes(5), 0).register(Aspect.EARTH);
|
||||
public static final AuraEffect ORDO = new PotionDistributionEffect(Potion.regeneration, 4, 6, ticksForMinutes(3), 0).register(Aspect.ORDER);
|
||||
public static final AuraEffect PERDITIO = new PotionDistributionEffect(Potion.weakness, 4, 8, ticksForMinutes(3), 0).register(Aspect.ENTROPY);
|
||||
public static final AuraEffect TELUM = new PotionDistributionEffect(Potion.damageBoost, 4, 6, ticksForMinutes(6), 2).register(Aspect.WEAPON);
|
||||
public static final AuraEffect TUTAMEN = new PotionDistributionEffect(Potion.resistance, 4, 6, ticksForMinutes(6), 1).register(Aspect.ARMOR);
|
||||
public static final AuraEffect MOTUS = new PotionDistributionEffect(Potion.moveSpeed, 4, 6, ticksForMinutes(2), 2).register(Aspect.MOTION); //Fast speed for short duration, long charge time
|
||||
public static final AuraEffect ITER = new PotionDistributionEffect(Potion.moveSpeed, 2, 10, ticksForMinutes(15), 0).register(Aspect.TRAVEL); //Slower speed for long duration, fast charge time
|
||||
public static final AuraEffect FAMES = new PotionDistributionEffect(Potion.hunger, 4, 6, ticksForMinutes(2), 0).register(Aspect.HUNGER);
|
||||
public static final AuraEffect SENSUS = new PotionDistributionEffect(Potion.nightVision, 2, 8, ticksForMinutes(8), 0).register(Aspect.SENSES);
|
||||
public static final AuraEffect VOLATUS = new PotionDistributionEffect(Potion.jump, 2, 5, ticksForMinutes(4), 0).register(Aspect.FLIGHT);
|
||||
public static final AuraEffect POTENTIA = new PotionDistributionEffect(Potion.damageBoost, 4, 6, ticksForMinutes(4), 0).register(Aspect.ENERGY);
|
||||
public static final AuraEffect TENEBRAE = new PotionDistributionEffect(Potion.blindness, 4, 6, ticksForMinutes(1), 0).register(Aspect.DARKNESS);
|
||||
public static final AuraEffect SANO = new PotionDistributionEffect(Potion.regeneration, 8, 10, ticksForMinutes(5), 1).register(Aspect.HEAL);
|
||||
public static final AuraEffect MORTUUS = new PotionDistributionEffect(Potion.wither, 4, 6, ticksForMinutes(3), 1).register(Aspect.DEATH);
|
||||
public static final AuraEffect HUMANUS = new PotionDistributionEffect(Potion.field_76434_w, 2, 5, ticksForMinutes(4), 1).register(Aspect.MAN);
|
||||
public static final AuraEffect INSTRUMENTUM = new PotionDistributionEffect(Potion.digSpeed, 2, 7, ticksForMinutes(6), 0).register(Aspect.TOOL);
|
||||
public static final AuraEffect PERFODIO = new PotionDistributionEffect(Potion.digSpeed, 2, 7, ticksForMinutes(5), 2).register(Aspect.MINE);
|
||||
public static final AuraEffect VENENUM = new PotionDistributionEffect(Potion.poison, 2, 6, ticksForMinutes(1), 0).register(Aspect.POISON);
|
||||
public static final AuraEffect VINCULUM = new PotionDistributionEffect(Potion.moveSlowdown, 4, 6, ticksForMinutes(3), 0).register(Aspect.TRAP);
|
||||
// Std. potion effects
|
||||
public static final AuraEffect AER =
|
||||
new PotionDistributionEffect(Potion.moveSpeed, 4, 6, ticksForMinutes(6), 1).register(Aspect.AIR);
|
||||
public static final AuraEffect AQUA =
|
||||
new PotionDistributionEffect(Potion.waterBreathing, 4, 10, ticksForMinutes(10), 0).register(Aspect.WATER);
|
||||
public static final AuraEffect TERRA =
|
||||
new PotionDistributionEffect(Potion.resistance, 4, 8, ticksForMinutes(5), 0).register(Aspect.EARTH);
|
||||
public static final AuraEffect ORDO =
|
||||
new PotionDistributionEffect(Potion.regeneration, 4, 6, ticksForMinutes(3), 0).register(Aspect.ORDER);
|
||||
public static final AuraEffect PERDITIO =
|
||||
new PotionDistributionEffect(Potion.weakness, 4, 8, ticksForMinutes(3), 0).register(Aspect.ENTROPY);
|
||||
public static final AuraEffect TELUM =
|
||||
new PotionDistributionEffect(Potion.damageBoost, 4, 6, ticksForMinutes(6), 2).register(Aspect.WEAPON);
|
||||
public static final AuraEffect TUTAMEN =
|
||||
new PotionDistributionEffect(Potion.resistance, 4, 6, ticksForMinutes(6), 1).register(Aspect.ARMOR);
|
||||
public static final AuraEffect MOTUS = new PotionDistributionEffect(Potion.moveSpeed, 4, 6, ticksForMinutes(2), 2)
|
||||
.register(Aspect.MOTION); // Fast speed for short duration, long charge time
|
||||
public static final AuraEffect ITER = new PotionDistributionEffect(Potion.moveSpeed, 2, 10, ticksForMinutes(15), 0)
|
||||
.register(Aspect.TRAVEL); // Slower speed for long duration, fast charge time
|
||||
public static final AuraEffect FAMES =
|
||||
new PotionDistributionEffect(Potion.hunger, 4, 6, ticksForMinutes(2), 0).register(Aspect.HUNGER);
|
||||
public static final AuraEffect SENSUS =
|
||||
new PotionDistributionEffect(Potion.nightVision, 2, 8, ticksForMinutes(8), 0).register(Aspect.SENSES);
|
||||
public static final AuraEffect VOLATUS =
|
||||
new PotionDistributionEffect(Potion.jump, 2, 5, ticksForMinutes(4), 0).register(Aspect.FLIGHT);
|
||||
public static final AuraEffect POTENTIA =
|
||||
new PotionDistributionEffect(Potion.damageBoost, 4, 6, ticksForMinutes(4), 0).register(Aspect.ENERGY);
|
||||
public static final AuraEffect TENEBRAE =
|
||||
new PotionDistributionEffect(Potion.blindness, 4, 6, ticksForMinutes(1), 0).register(Aspect.DARKNESS);
|
||||
public static final AuraEffect SANO =
|
||||
new PotionDistributionEffect(Potion.regeneration, 8, 10, ticksForMinutes(5), 1).register(Aspect.HEAL);
|
||||
public static final AuraEffect MORTUUS =
|
||||
new PotionDistributionEffect(Potion.wither, 4, 6, ticksForMinutes(3), 1).register(Aspect.DEATH);
|
||||
public static final AuraEffect HUMANUS =
|
||||
new PotionDistributionEffect(Potion.field_76434_w, 2, 5, ticksForMinutes(4), 1).register(Aspect.MAN);
|
||||
public static final AuraEffect INSTRUMENTUM =
|
||||
new PotionDistributionEffect(Potion.digSpeed, 2, 7, ticksForMinutes(6), 0).register(Aspect.TOOL);
|
||||
public static final AuraEffect PERFODIO =
|
||||
new PotionDistributionEffect(Potion.digSpeed, 2, 7, ticksForMinutes(5), 2).register(Aspect.MINE);
|
||||
public static final AuraEffect VENENUM =
|
||||
new PotionDistributionEffect(Potion.poison, 2, 6, ticksForMinutes(1), 0).register(Aspect.POISON);
|
||||
public static final AuraEffect VINCULUM =
|
||||
new PotionDistributionEffect(Potion.moveSlowdown, 4, 6, ticksForMinutes(3), 0).register(Aspect.TRAP);
|
||||
|
||||
//Special effects..
|
||||
public static final AuraEffect LUCRUM = new PotionDistributionEffect(RegisteredPotions.POTION_LUCK, 4, 6, ticksForMinutes(5), 1).register(Aspect.GREED); //Mining luck (Adding fortune)
|
||||
// Special effects..
|
||||
public static final AuraEffect LUCRUM = new PotionDistributionEffect(
|
||||
RegisteredPotions.POTION_LUCK, 4, 6, ticksForMinutes(5), 1)
|
||||
.register(Aspect.GREED); // Mining luck (Adding fortune)
|
||||
public static final AuraEffect VICTUS = new AuraEffect.EntityAuraEffect() {
|
||||
@Override
|
||||
public boolean isEntityApplicable(Entity e) {
|
||||
@@ -93,9 +136,9 @@ public class AuraEffects {
|
||||
|
||||
@Override
|
||||
public void doEntityEffect(ChunkCoordinates originTile, Entity e) {
|
||||
if(e instanceof EntityPlayer) return;
|
||||
if (e instanceof EntityPlayer) return;
|
||||
EntityAgeable ageable = (EntityAgeable) e;
|
||||
if(ageable.worldObj.rand.nextInt(20) == 0) ageable.setGrowingAge(0); //setAdult
|
||||
if (ageable.worldObj.rand.nextInt(20) == 0) ageable.setGrowingAge(0); // setAdult
|
||||
}
|
||||
}.register(Aspect.LIFE);
|
||||
public static final AuraEffect PANNUS = new AuraEffect.EntityAuraEffect() {
|
||||
@@ -107,7 +150,7 @@ public class AuraEffects {
|
||||
@Override
|
||||
public void doEntityEffect(ChunkCoordinates originTile, Entity e) {
|
||||
EntitySheep sheep = (EntitySheep) e;
|
||||
if(sheep.worldObj.rand.nextInt(10) == 0) sheep.setSheared(false);
|
||||
if (sheep.worldObj.rand.nextInt(10) == 0) sheep.setSheared(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -123,7 +166,7 @@ public class AuraEffects {
|
||||
|
||||
@Override
|
||||
public void doEntityEffect(ChunkCoordinates originTile, Entity e) {
|
||||
if(!EventHandlerEntity.registeredLuxPylons.contains(originTile))
|
||||
if (!EventHandlerEntity.registeredLuxPylons.contains(originTile))
|
||||
EventHandlerEntity.registeredLuxPylons.add(originTile);
|
||||
}
|
||||
|
||||
@@ -146,7 +189,8 @@ public class AuraEffects {
|
||||
@Override
|
||||
public void doBlockEffect(ChunkCoordinates originTile, ChunkCoordinates selectedBlock, World world) {
|
||||
int highestY = world.getTopSolidOrLiquidBlock(selectedBlock.posX, selectedBlock.posZ);
|
||||
EntityLightningBolt entityLightning = new EntityLightningBolt(world, selectedBlock.posX + 0.5, highestY, selectedBlock.posZ + 0.5);
|
||||
EntityLightningBolt entityLightning =
|
||||
new EntityLightningBolt(world, selectedBlock.posX + 0.5, highestY, selectedBlock.posZ + 0.5);
|
||||
world.addWeatherEffect(entityLightning);
|
||||
}
|
||||
}.register(Aspect.WEATHER);
|
||||
@@ -163,8 +207,10 @@ public class AuraEffects {
|
||||
|
||||
@Override
|
||||
public void doEntityEffect(ChunkCoordinates originTile, Entity e) {
|
||||
if(e.worldObj.rand.nextInt(20) == 0 && !((EntityLivingBase) e).isPotionActive(Config.potionTaintPoisonID)) {
|
||||
((EntityLivingBase) e).addPotionEffect(new PotionEffect(Config.potionTaintPoisonID, ticksForSeconds(20), 0, true));
|
||||
if (e.worldObj.rand.nextInt(20) == 0
|
||||
&& !((EntityLivingBase) e).isPotionActive(Config.potionTaintPoisonID)) {
|
||||
((EntityLivingBase) e)
|
||||
.addPotionEffect(new PotionEffect(Config.potionTaintPoisonID, ticksForSeconds(20), 0, true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,12 +221,12 @@ public class AuraEffects {
|
||||
|
||||
@Override
|
||||
public void doBlockEffect(ChunkCoordinates originTile, ChunkCoordinates selectedBlock, World world) {
|
||||
if(!Config.genTaint) return;
|
||||
if (!Config.genTaint) return;
|
||||
int x = selectedBlock.posX;
|
||||
int y = selectedBlock.posY;
|
||||
int z = selectedBlock.posZ;
|
||||
BlockTaintFibres.spreadFibres(world, x, y, z);
|
||||
if(world.rand.nextInt(12) == 0) {
|
||||
if (world.rand.nextInt(12) == 0) {
|
||||
Utils.setBiomeAt(world, x, z, ThaumcraftWorldGenerator.biomeTaint);
|
||||
world.addBlockEvent(x, y, z, world.getBlock(x, y, z), 1, 0);
|
||||
}
|
||||
@@ -206,13 +252,13 @@ public class AuraEffects {
|
||||
public void doEntityEffect(ChunkCoordinates originTile, Entity e) {
|
||||
EntityLivingBase living = (EntityLivingBase) e;
|
||||
int activeDuration = 0;
|
||||
if(living.isPotionActive(Potion.moveSlowdown)) {
|
||||
if (living.isPotionActive(Potion.moveSlowdown)) {
|
||||
PotionEffect effect = living.getActivePotionEffect(Potion.moveSlowdown);
|
||||
activeDuration = effect.getDuration();
|
||||
}
|
||||
|
||||
boolean canAdd = (ticksForMinutes(3) - activeDuration) >= 5;
|
||||
if(canAdd) {
|
||||
if (canAdd) {
|
||||
living.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), activeDuration + 5, 1, true));
|
||||
}
|
||||
}
|
||||
@@ -230,7 +276,8 @@ public class AuraEffects {
|
||||
@Override
|
||||
public void doBlockEffect(ChunkCoordinates originTile, ChunkCoordinates selectedBlock, World world) {
|
||||
Block selected = world.getBlock(selectedBlock.posX, selectedBlock.posY, selectedBlock.posZ);
|
||||
if(selected.equals(Blocks.water) && world.getBlockMetadata(selectedBlock.posX, selectedBlock.posY, selectedBlock.posZ) == 0) {
|
||||
if (selected.equals(Blocks.water)
|
||||
&& world.getBlockMetadata(selectedBlock.posX, selectedBlock.posY, selectedBlock.posZ) == 0) {
|
||||
world.setBlock(selectedBlock.posX, selectedBlock.posY, selectedBlock.posZ, Blocks.ice);
|
||||
}
|
||||
}
|
||||
@@ -248,9 +295,12 @@ public class AuraEffects {
|
||||
|
||||
@Override
|
||||
public void doEntityEffect(ChunkCoordinates originTile, Entity e) {
|
||||
AuraEffects.addOrExtendPotionEffect(Potion.damageBoost, (EntityLivingBase) e, ticksForMinutes(3), 30, 1, false);
|
||||
AuraEffects.addOrExtendPotionEffect(Potion.moveSpeed, (EntityLivingBase) e, ticksForMinutes(3), 30, 0, false);
|
||||
AuraEffects.addOrExtendPotionEffect(Potion.regeneration, (EntityLivingBase) e, ticksForMinutes(3), 30, 0, false);
|
||||
AuraEffects.addOrExtendPotionEffect(
|
||||
Potion.damageBoost, (EntityLivingBase) e, ticksForMinutes(3), 30, 1, false);
|
||||
AuraEffects.addOrExtendPotionEffect(
|
||||
Potion.moveSpeed, (EntityLivingBase) e, ticksForMinutes(3), 30, 0, false);
|
||||
AuraEffects.addOrExtendPotionEffect(
|
||||
Potion.regeneration, (EntityLivingBase) e, ticksForMinutes(3), 30, 0, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -266,8 +316,9 @@ public class AuraEffects {
|
||||
@Override
|
||||
public void doBlockEffect(ChunkCoordinates originTile, ChunkCoordinates selectedBlock, World world) {
|
||||
EntityBrainyZombie zombie = new EntityBrainyZombie(world);
|
||||
boolean canSpawn = AuraEffects.setAndCheckPosition(zombie, selectedBlock, world, true) && zombie.getCanSpawnHere(); //Position for getCanSpawn here is updated.
|
||||
if(canSpawn) {
|
||||
boolean canSpawn = AuraEffects.setAndCheckPosition(zombie, selectedBlock, world, true)
|
||||
&& zombie.getCanSpawnHere(); // Position for getCanSpawn here is updated.
|
||||
if (canSpawn) {
|
||||
ChunkCoordinates pos = new ChunkCoordinates((int) zombie.posX, (int) zombie.posY, (int) zombie.posZ);
|
||||
pos = AuraEffects.iterateDown(pos, world);
|
||||
zombie.setPosition(pos.posX + 0.5, pos.posY, pos.posZ + 0.5);
|
||||
@@ -290,12 +341,14 @@ public class AuraEffects {
|
||||
public void doEntityEffect(ChunkCoordinates originTile, Entity e) {
|
||||
EntityPlayer player = (EntityPlayer) e;
|
||||
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() != null && player.getHeldItem().getItem() instanceof ItemWandCasting) {
|
||||
if (player.getHeldItem() != null
|
||||
&& player.getHeldItem().getItem() != null
|
||||
&& player.getHeldItem().getItem() instanceof ItemWandCasting) {
|
||||
ItemStack wand = player.getHeldItem();
|
||||
ItemWandCasting wandCasting = (ItemWandCasting) wand.getItem();
|
||||
AspectList al = wandCasting.getAspectsWithRoom(wand);
|
||||
for(Aspect a : al.getAspects()) {
|
||||
if(a != null) wandCasting.addRealVis(wand, a, 4, true);
|
||||
for (Aspect a : al.getAspects()) {
|
||||
if (a != null) wandCasting.addRealVis(wand, a, 4, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -315,10 +368,10 @@ public class AuraEffects {
|
||||
public void doEntityEffect(ChunkCoordinates originTile, Entity e) {
|
||||
EntityPlayer player = (EntityPlayer) e;
|
||||
|
||||
for(Aspect a : Aspect.getPrimalAspects()) {
|
||||
if(a != null && e.worldObj.rand.nextInt(40) == 0) {
|
||||
if(e.worldObj.rand.nextInt(20) == 0) {
|
||||
//1 temp warp.
|
||||
for (Aspect a : Aspect.getPrimalAspects()) {
|
||||
if (a != null && e.worldObj.rand.nextInt(40) == 0) {
|
||||
if (e.worldObj.rand.nextInt(20) == 0) {
|
||||
// 1 temp warp.
|
||||
Thaumcraft.addWarpToPlayer(player, 1, true);
|
||||
}
|
||||
ScanManager.checkAndSyncAspectKnowledge(player, a, 1);
|
||||
@@ -399,7 +452,7 @@ public class AuraEffects {
|
||||
|
||||
@Override
|
||||
public void doEntityEffect(ChunkCoordinates originTile, Entity e) {
|
||||
if(!e.isImmuneToFire()) {
|
||||
if (!e.isImmuneToFire()) {
|
||||
e.setFire(10);
|
||||
}
|
||||
}
|
||||
@@ -407,10 +460,12 @@ public class AuraEffects {
|
||||
public static final AuraEffect ELDRITCH = new AuraEffect.EntityAuraEffect() {
|
||||
@Override
|
||||
public boolean isEntityApplicable(Entity e) {
|
||||
if(e instanceof EntityMob) {
|
||||
if (e instanceof EntityMob) {
|
||||
EntityMob mob = (EntityMob) e;
|
||||
if(mob.getEntityAttribute(EntityUtils.CHAMPION_MOD).getAttributeValue() < 0
|
||||
&& mob.getEntityAttribute(SharedMonsterAttributes.maxHealth).getBaseValue() >= 10.0D) {
|
||||
if (mob.getEntityAttribute(EntityUtils.CHAMPION_MOD).getAttributeValue() < 0
|
||||
&& mob.getEntityAttribute(SharedMonsterAttributes.maxHealth)
|
||||
.getBaseValue()
|
||||
>= 10.0D) {
|
||||
boolean whitelisted = false;
|
||||
for (Class clazz : ConfigEntities.championModWhitelist.keySet()) {
|
||||
if (clazz.isAssignableFrom(e.getClass())) {
|
||||
@@ -430,15 +485,18 @@ public class AuraEffects {
|
||||
|
||||
@Override
|
||||
public void doEntityEffect(ChunkCoordinates originTile, Entity e) {
|
||||
if(e.worldObj.rand.nextInt(4) == 0) {
|
||||
if (e.worldObj.rand.nextInt(4) == 0) {
|
||||
EntityMob mob = (EntityMob) e;
|
||||
PotionEffect effect = mob.getActivePotionEffect(RegisteredPotions.ELDRITCH);
|
||||
|
||||
if(effect != null && effect.getAmplifier() > 4) {
|
||||
if (effect != null && effect.getAmplifier() > 4) {
|
||||
EntityUtils.makeChampion(mob, false);
|
||||
mob.removePotionEffect(RegisteredPotions.ELDRITCH.getId());
|
||||
} else {
|
||||
mob.addPotionEffect(new PotionEffect(RegisteredPotions.ELDRITCH.getId(), MiscUtils.ticksForMinutes(1), effect == null ? 1 : effect.getAmplifier() + 1));
|
||||
mob.addPotionEffect(new PotionEffect(
|
||||
RegisteredPotions.ELDRITCH.getId(),
|
||||
MiscUtils.ticksForMinutes(1),
|
||||
effect == null ? 1 : effect.getAmplifier() + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -457,19 +515,22 @@ public class AuraEffects {
|
||||
@Override
|
||||
public void doBlockEffect(ChunkCoordinates originTile, ChunkCoordinates selectedBlock, World world) {
|
||||
EntityLiving mob = world.rand.nextBoolean() ? new EntitySkeleton(world) : new EntityZombie(world);
|
||||
if(AuraEffects.setAndCheckPosition(mob, selectedBlock, world, true) && world.difficultySetting != EnumDifficulty.PEACEFUL) {
|
||||
for(int i = 0; i < 5; i++) {
|
||||
if (AuraEffects.setAndCheckPosition(mob, selectedBlock, world, true)
|
||||
&& world.difficultySetting != EnumDifficulty.PEACEFUL) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
mob.setCurrentItemOrArmor(i, null);
|
||||
}
|
||||
|
||||
int timeout = 40;
|
||||
int totalCount = (world.rand.nextInt(3) == 0 ? 1 : 0) + 2;
|
||||
do {
|
||||
int slot = mob.getEquipmentInSlot(0) == null ? 0 : (mob.getEquipmentInSlot(4) == null ? 4 : (world.rand.nextInt(3)+1));
|
||||
if(mob.getEquipmentInSlot(slot) == null) {
|
||||
int slot = mob.getEquipmentInSlot(0) == null
|
||||
? 0
|
||||
: (mob.getEquipmentInSlot(4) == null ? 4 : (world.rand.nextInt(3) + 1));
|
||||
if (mob.getEquipmentInSlot(slot) == null) {
|
||||
ItemStack[] items = AuraEffects.ITEMS_SOUL[slot];
|
||||
ItemStack stack = items[world.rand.nextInt(items.length)];
|
||||
if(stack.getItem() != Items.bow || mob instanceof EntitySkeleton) {
|
||||
if (stack.getItem() != Items.bow || mob instanceof EntitySkeleton) {
|
||||
totalCount--;
|
||||
mob.setCurrentItemOrArmor(slot, stack);
|
||||
mob.setEquipmentDropChance(slot, 0);
|
||||
@@ -478,8 +539,9 @@ public class AuraEffects {
|
||||
timeout--;
|
||||
} while (totalCount > 0 && timeout > 0);
|
||||
|
||||
if(timeout > 0) {
|
||||
mob.addPotionEffect(new PotionEffect(Potion.invisibility.getId(), MiscUtils.ticksForMinutes(60*24*365), 1, true));
|
||||
if (timeout > 0) {
|
||||
mob.addPotionEffect(new PotionEffect(
|
||||
Potion.invisibility.getId(), MiscUtils.ticksForMinutes(60 * 24 * 365), 1, true));
|
||||
|
||||
ChunkCoordinates pos = new ChunkCoordinates((int) mob.posX, (int) mob.posY, (int) mob.posZ);
|
||||
pos = AuraEffects.iterateDown(pos, world);
|
||||
@@ -489,7 +551,9 @@ public class AuraEffects {
|
||||
}
|
||||
}
|
||||
}.register(Aspect.SOUL);
|
||||
public static final AuraEffect PRAECANTATIO = new PotionDistributionEffect(RegisteredPotions.VIS_DISCOUNT, 4, 6, ticksForMinutes(5), 1).register(Aspect.MAGIC);
|
||||
public static final AuraEffect PRAECANTATIO = new PotionDistributionEffect(
|
||||
RegisteredPotions.VIS_DISCOUNT, 4, 6, ticksForMinutes(5), 1)
|
||||
.register(Aspect.MAGIC);
|
||||
public static final AuraEffect LIMUS = new AuraEffect.BlockAuraEffect() {
|
||||
@Override
|
||||
public int getBlockCount(Random random) {
|
||||
@@ -503,8 +567,9 @@ public class AuraEffects {
|
||||
slime.writeEntityToNBT(data);
|
||||
data.setInteger("Size", 0);
|
||||
slime.readEntityFromNBT(data);
|
||||
boolean canSpawn = AuraEffects.setAndCheckPosition(slime, selectedBlock, world, true) && world.difficultySetting != EnumDifficulty.PEACEFUL;
|
||||
if(canSpawn) {
|
||||
boolean canSpawn = AuraEffects.setAndCheckPosition(slime, selectedBlock, world, true)
|
||||
&& world.difficultySetting != EnumDifficulty.PEACEFUL;
|
||||
if (canSpawn) {
|
||||
ChunkCoordinates pos = new ChunkCoordinates((int) slime.posX, (int) slime.posY, (int) slime.posZ);
|
||||
pos = AuraEffects.iterateDown(pos, world);
|
||||
slime.setPosition(pos.posX + 0.5, pos.posY, pos.posZ + 0.5);
|
||||
@@ -519,7 +584,8 @@ public class AuraEffects {
|
||||
}.register(Aspect.SLIME);
|
||||
public static final AuraEffect BESTIA = new AuraEffect.BlockAuraEffect() {
|
||||
|
||||
private final Class[] animalClasses = { EntitySheep.class, EntityCow.class, EntityChicken.class, EntityPig.class };
|
||||
private final Class[] animalClasses = {EntitySheep.class, EntityCow.class, EntityChicken.class, EntityPig.class
|
||||
};
|
||||
|
||||
@Override
|
||||
public int getBlockCount(Random random) {
|
||||
@@ -531,12 +597,13 @@ public class AuraEffects {
|
||||
Class animalClass = this.animalClasses[world.rand.nextInt(this.animalClasses.length)];
|
||||
EntityLivingBase animal;
|
||||
try {
|
||||
animal = (EntityLivingBase) animalClass.getConstructor(World.class).newInstance(world);
|
||||
animal = (EntityLivingBase)
|
||||
animalClass.getConstructor(World.class).newInstance(world);
|
||||
} catch (Exception e) {
|
||||
return;
|
||||
}
|
||||
boolean canSpawn = AuraEffects.setAndCheckPosition(animal, selectedBlock, world, true);
|
||||
if(canSpawn) {
|
||||
if (canSpawn) {
|
||||
ChunkCoordinates pos = new ChunkCoordinates((int) animal.posX, (int) animal.posY, (int) animal.posZ);
|
||||
pos = AuraEffects.iterateDown(pos, world);
|
||||
animal.setPosition(pos.posX + 0.5, pos.posY, pos.posZ + 0.5);
|
||||
@@ -550,19 +617,21 @@ public class AuraEffects {
|
||||
}
|
||||
}.register(Aspect.BEAST);
|
||||
|
||||
public static final AuraEffect VITREUS = new PotionDistributionEffect(RegisteredPotions.ACHROMATIC, 4, 6, ticksForMinutes(5), 0) {
|
||||
@Override
|
||||
public boolean isEntityApplicable(Entity e) {
|
||||
return e instanceof EntityPlayer;
|
||||
}
|
||||
}.register(Aspect.CRYSTAL);
|
||||
public static final AuraEffect VITREUS =
|
||||
new PotionDistributionEffect(RegisteredPotions.ACHROMATIC, 4, 6, ticksForMinutes(5), 0) {
|
||||
@Override
|
||||
public boolean isEntityApplicable(Entity e) {
|
||||
return e instanceof EntityPlayer;
|
||||
}
|
||||
}.register(Aspect.CRYSTAL);
|
||||
|
||||
public static class PotionDistributionEffect extends AuraEffect.EntityAuraEffect {
|
||||
|
||||
private Potion potion;
|
||||
private int tickInterval, addedDuration, durationCap, amplifier;
|
||||
|
||||
public PotionDistributionEffect(Potion potion, int tickInterval, int addedDuration, int durationCap, int amplifier) {
|
||||
public PotionDistributionEffect(
|
||||
Potion potion, int tickInterval, int addedDuration, int durationCap, int amplifier) {
|
||||
this.potion = potion;
|
||||
this.tickInterval = tickInterval;
|
||||
this.addedDuration = addedDuration;
|
||||
@@ -580,7 +649,8 @@ public class AuraEffects {
|
||||
if (e == null || !(e instanceof EntityLivingBase)) return;
|
||||
|
||||
EntityLivingBase living = (EntityLivingBase) e;
|
||||
AuraEffects.addOrExtendPotionEffect(this.potion, living, this.durationCap, this.addedDuration, this.amplifier);
|
||||
AuraEffects.addOrExtendPotionEffect(
|
||||
this.potion, living, this.durationCap, this.addedDuration, this.amplifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -592,74 +662,80 @@ public class AuraEffects {
|
||||
private static void waterLocation(ChunkCoordinates coordinates, World world) {
|
||||
Block block = world.getBlock(coordinates.posX, coordinates.posY, coordinates.posZ);
|
||||
if (block.getTickRandomly()) {
|
||||
world.scheduleBlockUpdate(coordinates.posX, coordinates.posY, coordinates.posZ, block, world.rand.nextInt(8) + 2);
|
||||
world.scheduleBlockUpdate(
|
||||
coordinates.posX, coordinates.posY, coordinates.posZ, block, world.rand.nextInt(8) + 2);
|
||||
}
|
||||
if(IntegrationThaumicTinkerer.isCropBlock(block)) {
|
||||
if (IntegrationThaumicTinkerer.isCropBlock(block)) {
|
||||
TileEntity te = world.getTileEntity(coordinates.posX, coordinates.posY, coordinates.posZ);
|
||||
if(te != null && IntegrationThaumicTinkerer.isCropTile(te)) {
|
||||
if (te != null && IntegrationThaumicTinkerer.isCropTile(te)) {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
te.updateEntity(); //Badumm tss..
|
||||
te.updateEntity(); // Badumm tss..
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void addOrExtendPotionEffect(Potion potion, EntityLivingBase entityLiving, int cap, int durToAdd, int amplifier, boolean ambient) {
|
||||
private static void addOrExtendPotionEffect(
|
||||
Potion potion, EntityLivingBase entityLiving, int cap, int durToAdd, int amplifier, boolean ambient) {
|
||||
int activeDuration = 0;
|
||||
if(entityLiving.isPotionActive(potion)) {
|
||||
if (entityLiving.isPotionActive(potion)) {
|
||||
PotionEffect effect = entityLiving.getActivePotionEffect(potion);
|
||||
activeDuration = effect.getDuration();
|
||||
}
|
||||
|
||||
boolean canAdd = (cap - activeDuration) >= durToAdd;
|
||||
if(canAdd) {
|
||||
entityLiving.addPotionEffect(new PotionEffect(potion.getId(), activeDuration + durToAdd, amplifier, ambient));
|
||||
if (canAdd) {
|
||||
entityLiving.addPotionEffect(
|
||||
new PotionEffect(potion.getId(), activeDuration + durToAdd, amplifier, ambient));
|
||||
}
|
||||
}
|
||||
|
||||
private static void addOrExtendPotionEffect(Potion potion, EntityLivingBase entityLiving, int cap, int durToAdd, int amplifier) {
|
||||
private static void addOrExtendPotionEffect(
|
||||
Potion potion, EntityLivingBase entityLiving, int cap, int durToAdd, int amplifier) {
|
||||
AuraEffects.addOrExtendPotionEffect(potion, entityLiving, cap, durToAdd, amplifier, true);
|
||||
}
|
||||
|
||||
private static ChunkCoordinates iterateDown(ChunkCoordinates pos, World world) {
|
||||
while(world.isAirBlock(pos.posX, pos.posY, pos.posZ)) {
|
||||
while (world.isAirBlock(pos.posX, pos.posY, pos.posZ)) {
|
||||
pos.posY -= 1;
|
||||
}
|
||||
pos.posY += 1;
|
||||
return pos;
|
||||
}
|
||||
|
||||
//Designed for spawning. Looks in 1 block radius for possible location, and if one location is found, teleporting the entity there.
|
||||
//Call with mayVary == true to search in 1 block radius, call with mayVary == false for only checking the current block.
|
||||
private static boolean setAndCheckPosition(EntityLivingBase entity, ChunkCoordinates cc, World world, boolean mayVary) {
|
||||
if(!world.isAirBlock(cc.posX, cc.posY, cc.posZ)) {
|
||||
if(!mayVary) return false;
|
||||
// Designed for spawning. Looks in 1 block radius for possible location, and if one location is found, teleporting
|
||||
// the entity there.
|
||||
// Call with mayVary == true to search in 1 block radius, call with mayVary == false for only checking the current
|
||||
// block.
|
||||
private static boolean setAndCheckPosition(
|
||||
EntityLivingBase entity, ChunkCoordinates cc, World world, boolean mayVary) {
|
||||
if (!world.isAirBlock(cc.posX, cc.posY, cc.posZ)) {
|
||||
if (!mayVary) return false;
|
||||
ChunkCoordinates up = new ChunkCoordinates(cc.posX, cc.posY + 1, cc.posZ);
|
||||
if(AuraEffects.setAndCheckPosition(entity, up, world, false)) {
|
||||
if (AuraEffects.setAndCheckPosition(entity, up, world, false)) {
|
||||
return true;
|
||||
}
|
||||
ChunkCoordinates down = new ChunkCoordinates(cc.posX, cc.posY - 1, cc.posZ);
|
||||
return AuraEffects.setAndCheckPosition(entity, down, world, false);
|
||||
}
|
||||
ChunkCoordinates up = new ChunkCoordinates(cc.posX, cc.posY + 1, cc.posZ);
|
||||
if(world.isAirBlock(up.posX, up.posY, up.posZ)) {
|
||||
if (world.isAirBlock(up.posX, up.posY, up.posZ)) {
|
||||
entity.setPosition(up.posX, up.posY, up.posZ);
|
||||
return true;
|
||||
}
|
||||
ChunkCoordinates down = new ChunkCoordinates(cc.posX, cc.posY - 1, cc.posZ);
|
||||
if(world.isAirBlock(down.posX, down.posY, down.posZ)) {
|
||||
if (world.isAirBlock(down.posX, down.posY, down.posZ)) {
|
||||
entity.setPosition(down.posX, down.posY, down.posZ);
|
||||
return true;
|
||||
}
|
||||
if(!mayVary) return false;
|
||||
ChunkCoordinates hMove = new ChunkCoordinates(cc.posX + 1, cc.posY, cc.posZ );
|
||||
if(AuraEffects.setAndCheckPosition(entity, hMove, world, false)) return true;
|
||||
hMove = new ChunkCoordinates(cc.posX , cc.posY, cc.posZ + 1);
|
||||
if(AuraEffects.setAndCheckPosition(entity, hMove, world, false)) return true;
|
||||
hMove = new ChunkCoordinates(cc.posX - 1, cc.posY, cc.posZ );
|
||||
if(AuraEffects.setAndCheckPosition(entity, hMove, world, false)) return true;
|
||||
hMove = new ChunkCoordinates(cc.posX , cc.posY, cc.posZ - 1);
|
||||
if (!mayVary) return false;
|
||||
ChunkCoordinates hMove = new ChunkCoordinates(cc.posX + 1, cc.posY, cc.posZ);
|
||||
if (AuraEffects.setAndCheckPosition(entity, hMove, world, false)) return true;
|
||||
hMove = new ChunkCoordinates(cc.posX, cc.posY, cc.posZ + 1);
|
||||
if (AuraEffects.setAndCheckPosition(entity, hMove, world, false)) return true;
|
||||
hMove = new ChunkCoordinates(cc.posX - 1, cc.posY, cc.posZ);
|
||||
if (AuraEffects.setAndCheckPosition(entity, hMove, world, false)) return true;
|
||||
hMove = new ChunkCoordinates(cc.posX, cc.posY, cc.posZ - 1);
|
||||
return AuraEffects.setAndCheckPosition(entity, hMove, world, false);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package makeo.gadomancy.common.aura;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.data.config.ModConfig;
|
||||
import makeo.gadomancy.common.network.PacketHandler;
|
||||
@@ -12,9 +14,6 @@ import thaumcraft.api.research.ResearchItem;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.lib.research.ResearchManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -28,14 +27,15 @@ public class AuraResearchManager {
|
||||
public static final String TC_AURA_RESEARCH_STR = "GADOMANCY.AURA.%s";
|
||||
|
||||
public static void tryUnlockAuraEffect(EntityPlayer player, Aspect aspect) {
|
||||
if(!AuraEffectHandler.registeredEffects.containsKey(aspect)) return;
|
||||
if(AuraResearchManager.isBlacklisted(aspect)) return;
|
||||
if (!AuraEffectHandler.registeredEffects.containsKey(aspect)) return;
|
||||
if (AuraResearchManager.isBlacklisted(aspect)) return;
|
||||
|
||||
if(!ResearchManager.isResearchComplete(player.getCommandSenderName(), Gadomancy.MODID.toUpperCase() + ".AURA_EFFECTS")) return;
|
||||
if(!Thaumcraft.proxy.getPlayerKnowledge().hasDiscoveredAspect(player.getCommandSenderName(), aspect)) return;
|
||||
if (!ResearchManager.isResearchComplete(
|
||||
player.getCommandSenderName(), Gadomancy.MODID.toUpperCase() + ".AURA_EFFECTS")) return;
|
||||
if (!Thaumcraft.proxy.getPlayerKnowledge().hasDiscoveredAspect(player.getCommandSenderName(), aspect)) return;
|
||||
|
||||
String res = String.format(AuraResearchManager.TC_AURA_RESEARCH_STR, aspect.getTag());
|
||||
if(ResearchManager.isResearchComplete(player.getCommandSenderName(), res)) return;
|
||||
if (ResearchManager.isResearchComplete(player.getCommandSenderName(), res)) return;
|
||||
Thaumcraft.proxy.getResearchManager().completeResearch(player, res);
|
||||
|
||||
PacketTCNotificationText text = new PacketTCNotificationText("gadomancy.aura.research.unlock", aspect.getTag());
|
||||
@@ -45,12 +45,12 @@ public class AuraResearchManager {
|
||||
public static List<String> getLines(String aspectTag) {
|
||||
List<String> lines = new ArrayList<String>();
|
||||
String base = "gadomancy.aura.effect." + aspectTag;
|
||||
if(StatCollector.canTranslate(base)) {
|
||||
if (StatCollector.canTranslate(base)) {
|
||||
lines.add(StatCollector.translateToLocal(base));
|
||||
return lines;
|
||||
}
|
||||
int count = 0;
|
||||
while(StatCollector.canTranslate(base + "_" + count)) {
|
||||
while (StatCollector.canTranslate(base + "_" + count)) {
|
||||
lines.add(StatCollector.translateToLocal(base + "_" + count));
|
||||
count++;
|
||||
}
|
||||
@@ -59,25 +59,28 @@ public class AuraResearchManager {
|
||||
|
||||
public static List<String> getKnowledge(EntityPlayer player) {
|
||||
List<String> lines = new ArrayList<String>();
|
||||
for(Aspect a : AuraEffectHandler.registeredEffects.keySet()) {
|
||||
if(ResearchManager.isResearchComplete(player.getCommandSenderName(), String.format(AuraResearchManager.TC_AURA_RESEARCH_STR, a.getTag()))) {
|
||||
if(!AuraResearchManager.isBlacklisted(a)) lines.add(a.getTag());
|
||||
for (Aspect a : AuraEffectHandler.registeredEffects.keySet()) {
|
||||
if (ResearchManager.isResearchComplete(
|
||||
player.getCommandSenderName(),
|
||||
String.format(AuraResearchManager.TC_AURA_RESEARCH_STR, a.getTag()))) {
|
||||
if (!AuraResearchManager.isBlacklisted(a)) lines.add(a.getTag());
|
||||
}
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
||||
public static boolean isBlacklisted(Aspect a) {
|
||||
for(String aspectTag : ModConfig.blacklistAuraEffects) {
|
||||
if(aspectTag == null) continue;
|
||||
if(aspectTag.equals(a.getTag())) return true;
|
||||
for (String aspectTag : ModConfig.blacklistAuraEffects) {
|
||||
if (aspectTag == null) continue;
|
||||
if (aspectTag.equals(a.getTag())) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void registerAuraResearches() {
|
||||
for(Aspect a : AuraEffectHandler.registeredEffects.keySet()) {
|
||||
new ResearchItem(String.format(AuraResearchManager.TC_AURA_RESEARCH_STR, a.getTag()), Gadomancy.MODID).registerResearchItem();
|
||||
for (Aspect a : AuraEffectHandler.registeredEffects.keySet()) {
|
||||
new ResearchItem(String.format(AuraResearchManager.TC_AURA_RESEARCH_STR, a.getTag()), Gadomancy.MODID)
|
||||
.registerResearchItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
package makeo.gadomancy.common.aura;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import makeo.gadomancy.common.utils.SimpleResourceLocation;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -8,10 +11,6 @@ import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -42,34 +41,37 @@ public class ResearchPageAuraAspects extends ResearchPage {
|
||||
|
||||
public static int getAdditionalPagesFor(EntityPlayer player) {
|
||||
List<String> knowledge = AuraResearchManager.getKnowledge(player);
|
||||
if(knowledge.size() == 0) return 0;
|
||||
if (knowledge.size() == 0) return 0;
|
||||
return ((knowledge.size() & 3) == 0) ? (knowledge.size() >> 2) : ((knowledge.size() >> 2) + 1);
|
||||
}
|
||||
|
||||
public static List<String> getAspectTagsForPageIndex(EntityPlayer player, int pageIndex) {
|
||||
List<String> knowledge = AuraResearchManager.getKnowledge(player);
|
||||
if(knowledge.size() <= 0) return new ArrayList<String>();
|
||||
if (knowledge.size() <= 0) return new ArrayList<String>();
|
||||
Collections.sort(knowledge);
|
||||
int startIndex = pageIndex << 2;
|
||||
if(knowledge.size() <= startIndex) return new ArrayList<String>(); //Should not happen, because getAdditionalPages should only return indexes within range
|
||||
if (knowledge.size() <= startIndex)
|
||||
return new ArrayList<
|
||||
String>(); // Should not happen, because getAdditionalPages should only return indexes within range
|
||||
return knowledge.subList(startIndex, (startIndex + 4 > knowledge.size()) ? knowledge.size() : startIndex + 4);
|
||||
}
|
||||
|
||||
public static AspectList createPageAspectList(List<String> tagList) {
|
||||
AspectList list = new AspectList();
|
||||
for(String tag : tagList) {
|
||||
for (String tag : tagList) {
|
||||
Aspect a = ResearchPageAuraAspects.createAuraFakeAspect(tag);
|
||||
if(a != null) list.add(a, 0);
|
||||
if (a != null) list.add(a, 0);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static Aspect createAuraFakeAspect(String tag) {
|
||||
Aspect original = Aspect.getAspect(tag);
|
||||
if(original == null) return null;
|
||||
if (original == null) return null;
|
||||
String fakeTemp = "GADOMANCY_TEMP_" + tag;
|
||||
|
||||
Aspect fake = new FakeAspect(fakeTemp, original.getColor(), null, original.getImage(), original.getBlend(), true);
|
||||
Aspect fake =
|
||||
new FakeAspect(fakeTemp, original.getColor(), null, original.getImage(), original.getBlend(), true);
|
||||
fake.setTag(original.getTag());
|
||||
return fake;
|
||||
}
|
||||
@@ -78,7 +80,8 @@ public class ResearchPageAuraAspects extends ResearchPage {
|
||||
|
||||
private boolean headAspect;
|
||||
|
||||
public FakeAspect(String tag, int color, Aspect[] components, ResourceLocation image, int blend, boolean isHead) {
|
||||
public FakeAspect(
|
||||
String tag, int color, Aspect[] components, ResourceLocation image, int blend, boolean isHead) {
|
||||
super(tag, color, components, image, blend);
|
||||
Aspect.aspects.remove(tag);
|
||||
this.headAspect = isHead;
|
||||
@@ -86,11 +89,10 @@ public class ResearchPageAuraAspects extends ResearchPage {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
if(this.headAspect) return super.getName();
|
||||
if (this.headAspect) return super.getName();
|
||||
String tag = super.getTag();
|
||||
if(tag == null || tag.isEmpty() || tag.equals("")) return "";
|
||||
if (tag == null || tag.isEmpty() || tag.equals("")) return "";
|
||||
return StatCollector.translateToLocal(tag);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package makeo.gadomancy.common.blocks;
|
||||
|
||||
import java.util.List;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileArcaneDropper;
|
||||
import makeo.gadomancy.common.registration.RegisteredItems;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -14,8 +15,6 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -48,7 +47,7 @@ public class BlockArcaneDropper extends BlockTransparent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(){
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -59,18 +58,21 @@ public class BlockArcaneDropper extends BlockTransparent {
|
||||
ForgeDirection direction = ForgeDirection.getOrientation(metadata & 7);
|
||||
boolean flipped = (metadata & 8) == 8;
|
||||
|
||||
if(direction == ForgeDirection.SOUTH
|
||||
|| direction == ForgeDirection.NORTH) {
|
||||
if (direction == ForgeDirection.SOUTH || direction == ForgeDirection.NORTH) {
|
||||
flipped = !flipped;
|
||||
}
|
||||
|
||||
ForgeDirection rotated = direction.getRotation(flipped ? ForgeDirection.getOrientation((direction.ordinal() + 4) % 6) : ForgeDirection.getOrientation((direction.ordinal() + 2) % 6));
|
||||
ForgeDirection rotated = direction.getRotation(
|
||||
flipped
|
||||
? ForgeDirection.getOrientation((direction.ordinal() + 4) % 6)
|
||||
: ForgeDirection.getOrientation((direction.ordinal() + 2) % 6));
|
||||
|
||||
return direction != side && rotated != side && rotated.getOpposite() != side;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
|
||||
public int onBlockPlaced(
|
||||
World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
|
||||
return side;
|
||||
}
|
||||
|
||||
@@ -84,30 +86,30 @@ public class BlockArcaneDropper extends BlockTransparent {
|
||||
}
|
||||
|
||||
private static final AxisAlignedBB[] COLLISION_BOXES = {
|
||||
AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 0.3125f, 1),//down
|
||||
AxisAlignedBB.getBoundingBox(0, 0.6875f, 0, 1, 1, 1),//up
|
||||
|
||||
AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 1, 0.3125f),//north
|
||||
AxisAlignedBB.getBoundingBox(0, 0, 0.6875f, 1, 1, 1),//south
|
||||
|
||||
AxisAlignedBB.getBoundingBox(0, 0, 0, 0.3125f, 1, 1),//west
|
||||
AxisAlignedBB.getBoundingBox(0.6875f, 0, 0, 1, 1, 1), //east
|
||||
AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 0.3125f, 1), // down
|
||||
AxisAlignedBB.getBoundingBox(0, 0.6875f, 0, 1, 1, 1), // up
|
||||
AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 1, 0.3125f), // north
|
||||
AxisAlignedBB.getBoundingBox(0, 0, 0.6875f, 1, 1, 1), // south
|
||||
AxisAlignedBB.getBoundingBox(0, 0, 0, 0.3125f, 1, 1), // west
|
||||
AxisAlignedBB.getBoundingBox(0.6875f, 0, 0, 1, 1, 1), // east
|
||||
};
|
||||
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB boundingBox, List list, Entity entity) {
|
||||
public void addCollisionBoxesToList(
|
||||
World world, int x, int y, int z, AxisAlignedBB boundingBox, List list, Entity entity) {
|
||||
ForgeDirection side = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z) & 7);
|
||||
|
||||
for(int i = 0; i < BlockArcaneDropper.COLLISION_BOXES.length; i++) {
|
||||
if(i != side.ordinal()) {
|
||||
for (int i = 0; i < BlockArcaneDropper.COLLISION_BOXES.length; i++) {
|
||||
if (i != side.ordinal()) {
|
||||
this.setBlockBounds(BlockArcaneDropper.COLLISION_BOXES[i]);
|
||||
super.addCollisionBoxesToList(world, x, y, z, boundingBox, list, entity);
|
||||
}
|
||||
}
|
||||
|
||||
if(side.offsetX + side.offsetY + side.offsetZ < 0) {
|
||||
if (side.offsetX + side.offsetY + side.offsetZ < 0) {
|
||||
this.setBlockBounds(side.offsetX * -0.125f, side.offsetY * -0.125f, side.offsetZ * -0.125f, 1f, 1f, 1f);
|
||||
} else {
|
||||
this.setBlockBounds(0f, 0f, 0f, 1 - side.offsetX * 0.125f, 1 - side.offsetY * 0.125f, 1 - side.offsetZ * 0.125f);
|
||||
this.setBlockBounds(
|
||||
0f, 0f, 0f, 1 - side.offsetX * 0.125f, 1 - side.offsetY * 0.125f, 1 - side.offsetZ * 0.125f);
|
||||
}
|
||||
super.addCollisionBoxesToList(world, x, y, z, boundingBox, list, entity);
|
||||
|
||||
@@ -124,7 +126,7 @@ public class BlockArcaneDropper extends BlockTransparent {
|
||||
float pitch = entity.rotationPitch;
|
||||
|
||||
boolean flipped;
|
||||
if(side == ForgeDirection.UP || side == ForgeDirection.DOWN) {
|
||||
if (side == ForgeDirection.UP || side == ForgeDirection.DOWN) {
|
||||
yaw += 180;
|
||||
flipped = yaw > 315 || yaw < 45 || (yaw < 225 && yaw > 135);
|
||||
} else {
|
||||
@@ -138,8 +140,8 @@ public class BlockArcaneDropper extends BlockTransparent {
|
||||
case EAST:
|
||||
yaw += 90;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
flipped = Math.abs(yaw) < Math.abs(pitch);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package makeo.gadomancy.common.blocks;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import java.util.List;
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileAuraPylon;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileAuraPylonTop;
|
||||
@@ -27,8 +28,6 @@ import thaumcraft.api.ThaumcraftApiHelper;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
import thaumcraft.common.lib.research.ResearchManager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -70,7 +69,7 @@ public class BlockAuraPylon extends BlockContainer implements IBlockTransparent
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if(meta == 1) {
|
||||
if (meta == 1) {
|
||||
return 10;
|
||||
}
|
||||
return super.getLightValue(world, x, y, z);
|
||||
@@ -84,7 +83,10 @@ public class BlockAuraPylon extends BlockContainer implements IBlockTransparent
|
||||
@Override
|
||||
public boolean canReplace(World world, int x, int y, int z, int side, ItemStack stack) {
|
||||
int damage = stack.getItemDamage();
|
||||
if (damage == 1 && (y < 1 || world.getBlock(x, y - 1, z) != RegisteredBlocks.blockAuraPylon || world.getBlockMetadata(x, y - 1, z) != 0)) {
|
||||
if (damage == 1
|
||||
&& (y < 1
|
||||
|| world.getBlock(x, y - 1, z) != RegisteredBlocks.blockAuraPylon
|
||||
|| world.getBlockMetadata(x, y - 1, z) != 0)) {
|
||||
return false;
|
||||
}
|
||||
return super.canReplace(world, x, y, z, side, stack);
|
||||
@@ -92,7 +94,7 @@ public class BlockAuraPylon extends BlockContainer implements IBlockTransparent
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
if(meta == 0) {
|
||||
if (meta == 0) {
|
||||
return new TileAuraPylon();
|
||||
} else {
|
||||
return new TileAuraPylonTop();
|
||||
@@ -100,20 +102,30 @@ public class BlockAuraPylon extends BlockContainer implements IBlockTransparent
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float par7, float par8, float par9) {
|
||||
if(world.getBlockMetadata(x, y, z) != 1) {
|
||||
public boolean onBlockActivated(
|
||||
World world, int x, int y, int z, EntityPlayer player, int side, float par7, float par8, float par9) {
|
||||
if (world.getBlockMetadata(x, y, z) != 1) {
|
||||
Block up = world.getBlock(x, y + 1, z);
|
||||
return up instanceof BlockAuraPylon && up.onBlockActivated(world, x, y + 1, z, player, side, par7, par8, par9);
|
||||
return up instanceof BlockAuraPylon
|
||||
&& up.onBlockActivated(world, x, y + 1, z, player, side, par7, par8, par9);
|
||||
}
|
||||
ItemStack heldItem = player.getHeldItem();
|
||||
if(!world.isRemote && heldItem != null && heldItem.getItem() instanceof ItemWandCasting &&
|
||||
ResearchManager.isResearchComplete(player.getCommandSenderName(), Gadomancy.MODID.toUpperCase() + ".AURA_PYLON")) {
|
||||
if (!world.isRemote
|
||||
&& heldItem != null
|
||||
&& heldItem.getItem() instanceof ItemWandCasting
|
||||
&& ResearchManager.isResearchComplete(
|
||||
player.getCommandSenderName(), Gadomancy.MODID.toUpperCase() + ".AURA_PYLON")) {
|
||||
TileAuraPylon tileAuraPylon = (TileAuraPylon) world.getTileEntity(x, y - 1, z);
|
||||
if(MultiblockHelper.isMultiblockPresent(world, x, y, z, RegisteredMultiblocks.auraPylonPattern) &&
|
||||
!tileAuraPylon.isPartOfMultiblock() &&
|
||||
ThaumcraftApiHelper.consumeVisFromWandCrafting(player.getCurrentEquippedItem(), player, RegisteredRecipes.costsAuraPylonMultiblock, true)) {
|
||||
if (MultiblockHelper.isMultiblockPresent(world, x, y, z, RegisteredMultiblocks.auraPylonPattern)
|
||||
&& !tileAuraPylon.isPartOfMultiblock()
|
||||
&& ThaumcraftApiHelper.consumeVisFromWandCrafting(
|
||||
player.getCurrentEquippedItem(),
|
||||
player,
|
||||
RegisteredRecipes.costsAuraPylonMultiblock,
|
||||
true)) {
|
||||
PacketStartAnimation pkt = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, x, y, z);
|
||||
NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint(world.provider.dimensionId, x, y, z, 32);
|
||||
NetworkRegistry.TargetPoint point =
|
||||
new NetworkRegistry.TargetPoint(world.provider.dimensionId, x, y, z, 32);
|
||||
PacketHandler.INSTANCE.sendToAllAround(pkt, point);
|
||||
TileAuraPylon ta = (TileAuraPylon) world.getTileEntity(x, y - 1, z);
|
||||
ta.setTileInformation(true, false);
|
||||
|
||||
@@ -69,11 +69,10 @@ public class BlockEssentiaCompressor extends BlockContainer implements IBlockTra
|
||||
@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)) {
|
||||
if (te == null || !(te instanceof TileEssentiaCompressor)) {
|
||||
return 0;
|
||||
} else {
|
||||
if(((TileEssentiaCompressor) te).isMultiblockFormed() &&
|
||||
((TileEssentiaCompressor) te).isMasterTile()) {
|
||||
if (((TileEssentiaCompressor) te).isMultiblockFormed() && ((TileEssentiaCompressor) te).isMasterTile()) {
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
@@ -85,11 +84,11 @@ public class BlockEssentiaCompressor extends BlockContainer implements IBlockTra
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te == null || !(te instanceof TileEssentiaCompressor)) return;
|
||||
if (te == null || !(te instanceof TileEssentiaCompressor)) return;
|
||||
TileEssentiaCompressor compressor = (TileEssentiaCompressor) te;
|
||||
if(compressor.isMultiblockFormed()) {
|
||||
if (compressor.isMultiblockFormed()) {
|
||||
AspectList al = compressor.getAspects();
|
||||
if(al.visSize() > 0) {
|
||||
if (al.visSize() > 0) {
|
||||
ExplosionHelper.taintplosion(world, x, y, z, true, 2, 2.0F, 4, 20);
|
||||
world.setBlockToAir(x, y, z);
|
||||
} else {
|
||||
@@ -102,13 +101,13 @@ public class BlockEssentiaCompressor extends BlockContainer implements IBlockTra
|
||||
@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)) {
|
||||
if (te == null || !(te instanceof TileEssentiaCompressor)) {
|
||||
super.setBlockBoundsBasedOnState(world, x, y, z);
|
||||
return;
|
||||
}
|
||||
if(((TileEssentiaCompressor) te).isMultiblockFormed()) {
|
||||
if(((TileEssentiaCompressor) te).isMasterTile()) {
|
||||
this.setBlockBounds(0, 0, 0, 1, 3, 1); //master is lowest tile here.
|
||||
if (((TileEssentiaCompressor) te).isMultiblockFormed()) {
|
||||
if (((TileEssentiaCompressor) te).isMasterTile()) {
|
||||
this.setBlockBounds(0, 0, 0, 1, 3, 1); // master is lowest tile here.
|
||||
} else {
|
||||
int yM = ((TileEssentiaCompressor) te).getMultiblockYIndex();
|
||||
this.setBlockBounds(0, -yM, 0, 1, 3 - yM, 1);
|
||||
@@ -119,37 +118,63 @@ public class BlockEssentiaCompressor extends BlockContainer implements IBlockTra
|
||||
}
|
||||
|
||||
@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;
|
||||
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()) {
|
||||
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);
|
||||
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"))) {
|
||||
if (heldItem != null
|
||||
&& heldItem.getItem() instanceof ItemWandCasting
|
||||
&& ResearchManager.isResearchComplete(
|
||||
player.getCommandSenderName(), SimpleResearchItem.getFullName("ESSENTIA_COMPRESSOR"))) {
|
||||
ChunkCoordinates lowest = this.findLowestCompressorBlock(world, x, y, z);
|
||||
boolean canForm = lowest != null && this.isMuliblockPossible(world, lowest);
|
||||
if(canForm && ThaumcraftApiHelper.consumeVisFromWandCrafting(player.getCurrentEquippedItem(), player, RegisteredRecipes.costsCompressorMultiblock, true)) {
|
||||
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);
|
||||
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);
|
||||
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 =
|
||||
(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);
|
||||
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 =
|
||||
(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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -158,16 +183,16 @@ public class BlockEssentiaCompressor extends BlockContainer implements IBlockTra
|
||||
}
|
||||
|
||||
private boolean isMuliblockPossible(World world, ChunkCoordinates lowest) {
|
||||
return lowest != null &&
|
||||
this.isMultiblockable(world, lowest.posX, lowest.posY , lowest.posZ) &&
|
||||
this.isMultiblockable(world, lowest.posX, lowest.posY + 1, lowest.posZ) &&
|
||||
this.isMultiblockable(world, lowest.posX, lowest.posY + 2, lowest.posZ);
|
||||
return lowest != null
|
||||
&& this.isMultiblockable(world, lowest.posX, lowest.posY, lowest.posZ)
|
||||
&& this.isMultiblockable(world, lowest.posX, lowest.posY + 1, lowest.posZ)
|
||||
&& this.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(!this.isMultiblockable(world, x, y - i, z)) break;
|
||||
if (!this.isMultiblockable(world, x, y - i, z)) break;
|
||||
result = new ChunkCoordinates(x, y - i, z);
|
||||
}
|
||||
return result;
|
||||
@@ -176,8 +201,8 @@ public class BlockEssentiaCompressor extends BlockContainer implements IBlockTra
|
||||
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;
|
||||
if (!block.equals(RegisteredBlocks.blockEssentiaCompressor)) return false;
|
||||
if (te == null || !(te instanceof TileEssentiaCompressor)) return false;
|
||||
TileEssentiaCompressor compressor = (TileEssentiaCompressor) te;
|
||||
return !compressor.isMultiblockFormed();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package makeo.gadomancy.common.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileExtendedNodeJar;
|
||||
import makeo.gadomancy.common.items.ItemExtendedNodeJar;
|
||||
import makeo.gadomancy.common.registration.RegisteredBlocks;
|
||||
@@ -22,9 +24,6 @@ import thaumcraft.common.blocks.BlockJar;
|
||||
import thaumcraft.common.blocks.CustomStepSound;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -76,8 +75,8 @@ public class BlockExtendedNodeJar extends BlockContainer {
|
||||
return RegisteredBlocks.rendererExtendedNodeJarBlock;
|
||||
}
|
||||
|
||||
|
||||
public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) {
|
||||
public void onBlockHarvested(
|
||||
World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) {
|
||||
this.dropBlockAsItem(par1World, par2, par3, par4, par5, 0);
|
||||
super.onBlockHarvested(par1World, par2, par3, par4, par5, par6EntityPlayer);
|
||||
}
|
||||
@@ -85,12 +84,22 @@ public class BlockExtendedNodeJar extends BlockContainer {
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if ((te != null) && ((te instanceof TileExtendedNodeJar)) && (((TileExtendedNodeJar) te).drop) &&
|
||||
(((TileExtendedNodeJar) te).getAspects() != null)) {
|
||||
if ((te != null)
|
||||
&& ((te instanceof TileExtendedNodeJar))
|
||||
&& (((TileExtendedNodeJar) te).drop)
|
||||
&& (((TileExtendedNodeJar) te).getAspects() != null)) {
|
||||
ItemStack drop = new ItemStack(RegisteredItems.itemExtendedNodeJar);
|
||||
((ItemExtendedNodeJar) drop.getItem()).setAspects(drop, ((TileExtendedNodeJar) te).getAspects().copy());
|
||||
((ItemExtendedNodeJar) drop.getItem()).setNodeAttributes(drop, ((TileExtendedNodeJar) te).getNodeType(), ((TileExtendedNodeJar) te).getNodeModifier(), ((TileExtendedNodeJar) te).getExtendedNodeType(), ((TileExtendedNodeJar) te).getId());
|
||||
((ItemExtendedNodeJar) drop.getItem()).setBehaviorSnapshot(drop, ((TileExtendedNodeJar) te).getBehaviorSnapshot());
|
||||
((ItemExtendedNodeJar) drop.getItem())
|
||||
.setAspects(drop, ((TileExtendedNodeJar) te).getAspects().copy());
|
||||
((ItemExtendedNodeJar) drop.getItem())
|
||||
.setNodeAttributes(
|
||||
drop,
|
||||
((TileExtendedNodeJar) te).getNodeType(),
|
||||
((TileExtendedNodeJar) te).getNodeModifier(),
|
||||
((TileExtendedNodeJar) te).getExtendedNodeType(),
|
||||
((TileExtendedNodeJar) te).getId());
|
||||
((ItemExtendedNodeJar) drop.getItem())
|
||||
.setBehaviorSnapshot(drop, ((TileExtendedNodeJar) te).getBehaviorSnapshot());
|
||||
drops.add(drop);
|
||||
}
|
||||
return drops;
|
||||
@@ -106,7 +115,8 @@ public class BlockExtendedNodeJar extends BlockContainer {
|
||||
super.setBlockBoundsBasedOnState(world, i, j, k);
|
||||
}
|
||||
|
||||
public void addCollisionBoxesToList(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List arraylist, Entity par7Entity) {
|
||||
public void addCollisionBoxesToList(
|
||||
World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List arraylist, Entity par7Entity) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
}
|
||||
@@ -114,5 +124,4 @@ public class BlockExtendedNodeJar extends BlockContainer {
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||
return 11;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -39,7 +39,7 @@ public class BlockInfusionClaw extends BlockTransparent {
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
if(!world.isRemote) {
|
||||
if (!world.isRemote) {
|
||||
TileInfusionClaw tile = (TileInfusionClaw) world.getTileEntity(x, y, z);
|
||||
tile.updateRedstone(world.isBlockIndirectlyGettingPowered(x, y, z));
|
||||
}
|
||||
@@ -47,7 +47,7 @@ public class BlockInfusionClaw extends BlockTransparent {
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
|
||||
if(entity instanceof EntityPlayer) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
TileInfusionClaw tile = (TileInfusionClaw) world.getTileEntity(x, y, z);
|
||||
tile.setOwner((EntityPlayer) entity);
|
||||
}
|
||||
@@ -69,12 +69,21 @@ public class BlockInfusionClaw extends BlockTransparent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) {
|
||||
if(!world.isRemote) {
|
||||
public boolean onBlockActivated(
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityPlayer player,
|
||||
int p_149727_6_,
|
||||
float p_149727_7_,
|
||||
float p_149727_8_,
|
||||
float p_149727_9_) {
|
||||
if (!world.isRemote) {
|
||||
TileInfusionClaw tile = (TileInfusionClaw) world.getTileEntity(x, y, z);
|
||||
if(tile.hasOwner()) {
|
||||
if (tile.hasOwner()) {
|
||||
player.openGui(Gadomancy.instance, 1, world, x, y, z);
|
||||
} else if(tile.setOwner(player)) {
|
||||
} else if (tile.setOwner(player)) {
|
||||
player.addChatComponentMessage(new ChatComponentTranslation("gadomancy.info.InfusionClaw.owner"));
|
||||
}
|
||||
}
|
||||
@@ -85,7 +94,7 @@ public class BlockInfusionClaw extends BlockTransparent {
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int metadata) {
|
||||
TileInfusionClaw tile = (TileInfusionClaw) world.getTileEntity(x, y, z);
|
||||
ItemStack wandStack = tile.getStackInSlot(0);
|
||||
if(wandStack != null && wandStack.stackSize > 0) {
|
||||
if (wandStack != null && wandStack.stackSize > 0) {
|
||||
float f = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
@@ -104,9 +113,9 @@ public class BlockInfusionClaw extends BlockTransparent {
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int side) {
|
||||
if(y > 0) {
|
||||
if (y > 0) {
|
||||
ClickBehavior behavior = RegisteredBlocks.getClawClickBehavior(world, x, y - 1, z);
|
||||
if(behavior != null) {
|
||||
if (behavior != null) {
|
||||
return behavior.getComparatorOutput();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package makeo.gadomancy.common.blocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileKnowledgeBook;
|
||||
import makeo.gadomancy.common.registration.RegisteredBlocks;
|
||||
@@ -18,15 +19,14 @@ import net.minecraft.world.World;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* HellFirePvP@Admin
|
||||
* Date: 19.04.2016 / 14:52
|
||||
* on Gadomancy
|
||||
* BlockKnowledgeBook
|
||||
*/
|
||||
public class BlockKnowledgeBook extends BlockContainer implements IBlockTransparent, TileKnowledgeBook.IKnowledgeProvider {
|
||||
public class BlockKnowledgeBook extends BlockContainer
|
||||
implements IBlockTransparent, TileKnowledgeBook.IKnowledgeProvider {
|
||||
|
||||
private IIcon icon;
|
||||
|
||||
@@ -54,7 +54,16 @@ public class BlockKnowledgeBook extends BlockContainer implements IBlockTranspar
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) {
|
||||
public boolean onBlockActivated(
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityPlayer player,
|
||||
int p_149727_6_,
|
||||
float p_149727_7_,
|
||||
float p_149727_8_,
|
||||
float p_149727_9_) {
|
||||
ItemStack thaumonomicon = new ItemStack(ConfigItems.itemThaumonomicon);
|
||||
ConfigItems.itemThaumonomicon.onItemRightClick(thaumonomicon, world, player);
|
||||
/*if(world.isRemote) {
|
||||
@@ -70,21 +79,21 @@ public class BlockKnowledgeBook extends BlockContainer implements IBlockTranspar
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor) {
|
||||
if(world.isRemote) return;
|
||||
if (world.isRemote) return;
|
||||
Block lower = world.getBlock(x, y - 1, z);
|
||||
int metaLower = world.getBlockMetadata(x, y - 1, z);
|
||||
if(!lower.equals(ConfigBlocks.blockStoneDevice) || metaLower != 1) {
|
||||
if (!lower.equals(ConfigBlocks.blockStoneDevice) || metaLower != 1) {
|
||||
this.breakThisBlock(world, x, y, z);
|
||||
}
|
||||
if(!world.isAirBlock(x, y + 1, z)) {
|
||||
if (!world.isAirBlock(x, y + 1, z)) {
|
||||
this.breakThisBlock(world, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
private void breakThisBlock(World world, int x, int y, int z) {
|
||||
if(world.isRemote) return;
|
||||
if (world.isRemote) return;
|
||||
ArrayList<ItemStack> stacks = this.getDrops(world, x, y, z, 0, 0);
|
||||
for(ItemStack i : stacks) {
|
||||
for (ItemStack i : stacks) {
|
||||
EntityItem item = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, i);
|
||||
world.spawnEntityInWorld(item);
|
||||
}
|
||||
@@ -103,8 +112,8 @@ public class BlockKnowledgeBook extends BlockContainer implements IBlockTranspar
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int p_149736_5_) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te instanceof TileKnowledgeBook) {
|
||||
if(((TileKnowledgeBook) te).isResearching()) {
|
||||
if(((TileKnowledgeBook) te).hasCognitio()) {
|
||||
if (((TileKnowledgeBook) te).isResearching()) {
|
||||
if (((TileKnowledgeBook) te).hasCognitio()) {
|
||||
return 15;
|
||||
}
|
||||
return 1;
|
||||
|
||||
@@ -16,7 +16,7 @@ public class BlockNode extends thaumcraft.common.blocks.BlockAiry {
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
if(metadata == 0) {
|
||||
if (metadata == 0) {
|
||||
return new TileExtendedNode();
|
||||
}
|
||||
return super.createTileEntity(world, metadata);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package makeo.gadomancy.common.blocks;
|
||||
|
||||
import java.util.List;
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileNodeManipulator;
|
||||
import makeo.gadomancy.common.registration.RegisteredItems;
|
||||
@@ -15,8 +16,6 @@ import thaumcraft.common.blocks.BlockStoneDevice;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
import thaumcraft.common.lib.research.ResearchManager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -50,11 +49,10 @@ public class BlockNodeManipulator extends BlockStoneDevice {
|
||||
return null;
|
||||
}
|
||||
|
||||
//TC stuff...
|
||||
// TC stuff...
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
if (metadata == 5)
|
||||
return new TileNodeManipulator();
|
||||
if (metadata == 5) return new TileNodeManipulator();
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -73,17 +71,22 @@ public class BlockNodeManipulator extends BlockStoneDevice {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float par7, float par8, float par9) {
|
||||
public boolean onBlockActivated(
|
||||
World world, int x, int y, int z, EntityPlayer player, int side, float par7, float par8, float par9) {
|
||||
TileNodeManipulator tile = (TileNodeManipulator) world.getTileEntity(x, y, z);
|
||||
ItemStack heldItem = player.getHeldItem();
|
||||
if(tile.isInMultiblock()) {
|
||||
if (tile.isInMultiblock()) {
|
||||
super.onBlockActivated(world, x, y, z, player, side, par7, par8, par9);
|
||||
} else if(!world.isRemote && heldItem != null && heldItem.getItem() instanceof ItemWandCasting) {
|
||||
} else if (!world.isRemote && heldItem != null && heldItem.getItem() instanceof ItemWandCasting) {
|
||||
tile.checkMultiblock();
|
||||
if (tile.isMultiblockStructurePresent()) {
|
||||
String research = tile.getMultiblockType().getResearchNeeded();
|
||||
if(!ResearchManager.isResearchComplete(player.getCommandSenderName(), research)) return false;
|
||||
if (ThaumcraftApiHelper.consumeVisFromWandCrafting(player.getCurrentEquippedItem(), player, tile.getMultiblockType().getMultiblockCosts(), true)) {
|
||||
if (!ResearchManager.isResearchComplete(player.getCommandSenderName(), research)) return false;
|
||||
if (ThaumcraftApiHelper.consumeVisFromWandCrafting(
|
||||
player.getCurrentEquippedItem(),
|
||||
player,
|
||||
tile.getMultiblockType().getMultiblockCosts(),
|
||||
true)) {
|
||||
tile.formMultiblock();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package makeo.gadomancy.common.blocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileRemoteJar;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileStickyJar;
|
||||
@@ -16,9 +18,6 @@ import thaumcraft.common.blocks.BlockJar;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumcraft.common.tiles.TileJarFillable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -55,12 +54,12 @@ public class BlockRemoteJar extends BlockJar {
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
ArrayList<ItemStack> drops = super.getDrops(world, x, y, z, metadata, fortune);
|
||||
|
||||
for(ItemStack drop : drops) {
|
||||
if(drop.getItem() == ConfigItems.itemJarFilled || drop.getItem() == Item.getItemFromBlock(this)) {
|
||||
for (ItemStack drop : drops) {
|
||||
if (drop.getItem() == ConfigItems.itemJarFilled || drop.getItem() == Item.getItemFromBlock(this)) {
|
||||
drop.func_150996_a(Item.getItemFromBlock(this));
|
||||
|
||||
TileRemoteJar tile = BlockRemoteJar.getJarTile(world, x, y, z);
|
||||
if(tile.networkId != null) {
|
||||
if (tile.networkId != null) {
|
||||
NBTHelper.setUUID(NBTHelper.getData(drop), "networkId", tile.networkId);
|
||||
}
|
||||
}
|
||||
@@ -69,11 +68,13 @@ public class BlockRemoteJar extends BlockJar {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float these, float are, float variables) {
|
||||
public boolean onBlockActivated(
|
||||
World world, int x, int y, int z, EntityPlayer player, int side, float these, float are, float variables) {
|
||||
ItemStack heldItem = player.getHeldItem();
|
||||
if (heldItem != null && heldItem.getItem() == ConfigItems.itemEssence) {
|
||||
if(!world.isRemote) {
|
||||
BlockStickyJar.handlePhial(world, x, y, z, player, heldItem, (TileJarFillable) world.getTileEntity(x, y, z));
|
||||
if (!world.isRemote) {
|
||||
BlockStickyJar.handlePhial(
|
||||
world, x, y, z, player, heldItem, (TileJarFillable) world.getTileEntity(x, y, z));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package makeo.gadomancy.common.blocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileStickyJar;
|
||||
import makeo.gadomancy.common.registration.RegisteredBlocks;
|
||||
@@ -27,9 +29,6 @@ import thaumcraft.common.config.ConfigItems;
|
||||
import thaumcraft.common.items.ItemEssence;
|
||||
import thaumcraft.common.tiles.TileJarFillable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -49,9 +48,9 @@ public class BlockStickyJar extends BlockJar implements IBlockTransparent {
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile instanceof TileStickyJar) {
|
||||
if (tile instanceof TileStickyJar) {
|
||||
TileStickyJar stickyJar = (TileStickyJar) tile;
|
||||
if(stickyJar.isValid()) {
|
||||
if (stickyJar.isValid()) {
|
||||
return stickyJar.getParentBlock().getIcon(world, x, y, z, side);
|
||||
}
|
||||
}
|
||||
@@ -176,8 +175,8 @@ public class BlockStickyJar extends BlockJar implements IBlockTransparent {
|
||||
case EAST:
|
||||
yaw += 90;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (Math.abs(yaw) < Math.abs(pitch)) {
|
||||
@@ -212,14 +211,15 @@ public class BlockStickyJar extends BlockJar implements IBlockTransparent {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile != null && tile instanceof TileStickyJar && ((TileStickyJar) tile).isValid()) {
|
||||
|
||||
((TileStickyJar) tile).getParent().validate(); //Ugh...
|
||||
world.setTileEntity(x, y, z, ((TileStickyJar) tile).getParent()); //Ugh. that fix...
|
||||
((TileStickyJar) tile).getParent().validate(); // Ugh...
|
||||
world.setTileEntity(x, y, z, ((TileStickyJar) tile).getParent()); // Ugh. that fix...
|
||||
|
||||
ArrayList<ItemStack> drops = ((TileStickyJar) tile).getParentBlock()
|
||||
ArrayList<ItemStack> drops = ((TileStickyJar) tile)
|
||||
.getParentBlock()
|
||||
.getDrops(world, x, y, z, ((TileStickyJar) tile).getParentMetadata(), fortune);
|
||||
|
||||
((TileStickyJar) tile).getParent().invalidate(); //Uhm...
|
||||
world.setTileEntity(x, y, z, tile); //Revert. xD
|
||||
((TileStickyJar) tile).getParent().invalidate(); // Uhm...
|
||||
world.setTileEntity(x, y, z, tile); // Revert. xD
|
||||
|
||||
boolean found = false;
|
||||
for (ItemStack drop : drops) {
|
||||
@@ -240,28 +240,36 @@ public class BlockStickyJar extends BlockJar implements IBlockTransparent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float these, float are, float variables) {
|
||||
public boolean onBlockActivated(
|
||||
World world, int x, int y, int z, EntityPlayer player, int side, float these, float are, float variables) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileStickyJar) {
|
||||
TileStickyJar tileStickyJar = (TileStickyJar) tile;
|
||||
|
||||
StickyJarInfo info = RegisteredBlocks.getStickyJarInfo(tileStickyJar.getParentBlock(), world.getBlockMetadata(x, y, z));
|
||||
StickyJarInfo info =
|
||||
RegisteredBlocks.getStickyJarInfo(tileStickyJar.getParentBlock(), world.getBlockMetadata(x, y, z));
|
||||
|
||||
ItemStack heldItem = player.getHeldItem();
|
||||
|
||||
if (info.needsPhialHandling() && heldItem != null && heldItem.getItem() == ConfigItems.itemEssence) {
|
||||
if(!world.isRemote) {
|
||||
if (!world.isRemote) {
|
||||
BlockStickyJar.handlePhial(world, x, y, z, player, heldItem, tileStickyJar);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean handleAspectFilter = info.needsLabelHandling() && heldItem != null && heldItem.getItem() == ConfigItems.itemResource
|
||||
&& heldItem.getItemDamage() == 13 && tileStickyJar.aspectFilter == null
|
||||
&& (((IEssentiaContainerItem) heldItem.getItem()).getAspects(heldItem) != null || tileStickyJar.amount != 0);
|
||||
boolean handleAspectFilter = info.needsLabelHandling()
|
||||
&& heldItem != null
|
||||
&& heldItem.getItem() == ConfigItems.itemResource
|
||||
&& heldItem.getItemDamage() == 13
|
||||
&& tileStickyJar.aspectFilter == null
|
||||
&& (((IEssentiaContainerItem) heldItem.getItem()).getAspects(heldItem) != null
|
||||
|| tileStickyJar.amount != 0);
|
||||
|
||||
ForgeDirection newDir = tileStickyJar.changeDirection(ForgeDirection.getOrientation(side));
|
||||
boolean result = ((TileStickyJar) tile).getParentBlock().onBlockActivated(world, x, y, z, player, newDir.ordinal(), these, are, variables);
|
||||
boolean result = ((TileStickyJar) tile)
|
||||
.getParentBlock()
|
||||
.onBlockActivated(world, x, y, z, player, newDir.ordinal(), these, are, variables);
|
||||
|
||||
if (handleAspectFilter) {
|
||||
tileStickyJar.facing = newDir.ordinal();
|
||||
@@ -273,16 +281,19 @@ public class BlockStickyJar extends BlockJar implements IBlockTransparent {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void handlePhial(World world, int x, int y, int z, EntityPlayer player, ItemStack stack, TileJarFillable tile) {
|
||||
public static void handlePhial(
|
||||
World world, int x, int y, int z, EntityPlayer player, ItemStack stack, TileJarFillable tile) {
|
||||
ItemEssence itemEssence = (ItemEssence) ConfigItems.itemEssence;
|
||||
|
||||
AspectList aspects = itemEssence.getAspects(stack);
|
||||
if(aspects != null) {
|
||||
Map.Entry<Aspect, Integer> entry = aspects.aspects.entrySet().iterator().next();
|
||||
if (aspects != null) {
|
||||
Map.Entry<Aspect, Integer> entry =
|
||||
aspects.aspects.entrySet().iterator().next();
|
||||
|
||||
Aspect jarAspect = tile.aspectFilter == null ? tile.aspect : tile.aspectFilter;
|
||||
|
||||
if((jarAspect == null || entry.getKey() == jarAspect) && tile.amount + entry.getValue() <= tile.maxAmount) {
|
||||
if ((jarAspect == null || entry.getKey() == jarAspect)
|
||||
&& tile.amount + entry.getValue() <= tile.maxAmount) {
|
||||
tile.addToContainer(entry.getKey(), entry.getValue());
|
||||
stack.stackSize--;
|
||||
|
||||
@@ -294,7 +305,7 @@ public class BlockStickyJar extends BlockJar implements IBlockTransparent {
|
||||
}
|
||||
} else {
|
||||
Aspect aspect = tile.aspect;
|
||||
if(aspect != null && tile.takeFromContainer(aspect, 8)) {
|
||||
if (aspect != null && tile.takeFromContainer(aspect, 8)) {
|
||||
stack.stackSize--;
|
||||
|
||||
ItemStack essenceStack = new ItemStack(itemEssence, 1, 1);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package makeo.gadomancy.common.blocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileArcanePackager;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileBlockProtector;
|
||||
@@ -30,9 +32,6 @@ import thaumcraft.common.lib.utils.InventoryUtils;
|
||||
import thaumcraft.common.tiles.TileJarFillable;
|
||||
import thaumcraft.common.tiles.TilePedestal;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -82,7 +81,7 @@ public class BlockStoneMachine extends Block {
|
||||
}
|
||||
} else if (metadata == 2) {
|
||||
return this.protectorIcon;
|
||||
} else if(metadata == 4) {
|
||||
} else if (metadata == 4) {
|
||||
return this.packagerIcon;
|
||||
}
|
||||
|
||||
@@ -91,7 +90,13 @@ public class BlockStoneMachine extends Block {
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int metadata) {
|
||||
return metadata == 15 || metadata == 0 || metadata == 1 || metadata == 2 || metadata == 3 || metadata == 4 || metadata == 5;
|
||||
return metadata == 15
|
||||
|| metadata == 0
|
||||
|| metadata == 1
|
||||
|| metadata == 2
|
||||
|| metadata == 3
|
||||
|| metadata == 4
|
||||
|| metadata == 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -123,11 +128,11 @@ public class BlockStoneMachine extends Block {
|
||||
return new TileBlockProtector();
|
||||
} else if (metadata == 3) {
|
||||
return new TileManipulationFocus();
|
||||
} else if(metadata == 4) {
|
||||
} else if (metadata == 4) {
|
||||
return new TileArcanePackager();
|
||||
}/* else if(metadata == 5) {
|
||||
return new TileAIShutdown();
|
||||
}*/
|
||||
} /* else if(metadata == 5) {
|
||||
return new TileAIShutdown();
|
||||
}*/
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -148,13 +153,13 @@ public class BlockStoneMachine extends Block {
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int metadata) {
|
||||
if (metadata == 1) {
|
||||
InventoryUtils.dropItems(world, x, y, z);
|
||||
} else if(metadata == 4) {
|
||||
if(!world.isRemote) {
|
||||
} else if (metadata == 4) {
|
||||
if (!world.isRemote) {
|
||||
TileArcanePackager tile = (TileArcanePackager) world.getTileEntity(x, y, z);
|
||||
|
||||
for(int i = 0; i < tile.getSizeInventory(); i++) {
|
||||
for (int i = 0; i < tile.getSizeInventory(); i++) {
|
||||
ItemStack stack = tile.getStackInSlot(i);
|
||||
if(stack != null && stack.stackSize > 0) {
|
||||
if (stack != null && stack.stackSize > 0) {
|
||||
float f = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
@@ -169,14 +174,14 @@ public class BlockStoneMachine extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
super.breakBlock(world, x, y, z, block, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReplace(World world, int x, int y, int z, int side, ItemStack stack) {
|
||||
int damage = stack.getItemDamage();
|
||||
if ((damage == 0 || damage == 3) && (y < 1 || world.getBlock(x, y - 1, z) != RegisteredBlocks.blockNodeManipulator)) {
|
||||
if ((damage == 0 || damage == 3)
|
||||
&& (y < 1 || world.getBlock(x, y - 1, z) != RegisteredBlocks.blockNodeManipulator)) {
|
||||
return false;
|
||||
}
|
||||
return super.canReplace(world, x, y, z, side, stack);
|
||||
@@ -186,7 +191,8 @@ public class BlockStoneMachine extends Block {
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase ent, ItemStack stack) {
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
if (metadata == 2 || metadata == 4) {
|
||||
((TileJarFillable) world.getTileEntity(x, y, z)).facing = MathHelper.floor_double(-ent.rotationYaw * 4.0F / 360.0F + 0.5D) & 0x3;
|
||||
((TileJarFillable) world.getTileEntity(x, y, z)).facing =
|
||||
MathHelper.floor_double(-ent.rotationYaw * 4.0F / 360.0F + 0.5D) & 0x3;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,16 +210,17 @@ public class BlockStoneMachine extends Block {
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
} else if (metadata == 0 || metadata == 3) {
|
||||
if (world.getBlock(x, y - 1, z) != RegisteredBlocks.blockNodeManipulator || world.getBlockMetadata(x, y - 1, z) != 5) {
|
||||
if (world.getBlock(x, y - 1, z) != RegisteredBlocks.blockNodeManipulator
|
||||
|| world.getBlockMetadata(x, y - 1, z) != 5) {
|
||||
this.dropBlockAsItem(world, x, y, z, metadata, 0);
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
} else if(metadata == 1) {
|
||||
} else if (metadata == 1) {
|
||||
if (!world.isAirBlock(x, y + 1, z)) {
|
||||
InventoryUtils.dropItems(world, x, y, z);
|
||||
}
|
||||
} else if(metadata == 4) {
|
||||
if(!world.isRemote) {
|
||||
} else if (metadata == 4) {
|
||||
if (!world.isRemote) {
|
||||
TileArcanePackager tile = (TileArcanePackager) world.getTileEntity(x, y, z);
|
||||
tile.updateRedstone(world.isBlockIndirectlyGettingPowered(x, y, z));
|
||||
}
|
||||
@@ -223,7 +230,7 @@ public class BlockStoneMachine extends Block {
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
if(metadata == 2) {
|
||||
if (metadata == 2) {
|
||||
TileBlockProtector protector = (TileBlockProtector) world.getTileEntity(x, y, z);
|
||||
return protector.getCurrentRange();
|
||||
}
|
||||
@@ -238,7 +245,7 @@ public class BlockStoneMachine extends Block {
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int side) {
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
if(metadata == 2) {
|
||||
if (metadata == 2) {
|
||||
TileBlockProtector protector = (TileBlockProtector) world.getTileEntity(x, y, z);
|
||||
return protector.getCurrentRange();
|
||||
}
|
||||
@@ -246,19 +253,21 @@ public class BlockStoneMachine extends Block {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onBlockActivated(
|
||||
World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if (metadata == 0 || metadata == 3) {
|
||||
if (world.getBlock(x, y - 1, z).equals(RegisteredBlocks.blockNodeManipulator) && world.getBlockMetadata(x, y - 1, z) == 5) {
|
||||
if (world.getBlock(x, y - 1, z).equals(RegisteredBlocks.blockNodeManipulator)
|
||||
&& world.getBlockMetadata(x, y - 1, z) == 5) {
|
||||
return world.getBlock(x, y - 1, z).onBlockActivated(world, x, y - 1, z, player, side, hitX, hitY, hitZ);
|
||||
}
|
||||
} else if (metadata == 1) {
|
||||
if(world.isAirBlock(x, y + 1, z)) {
|
||||
if (world.isAirBlock(x, y + 1, z)) {
|
||||
return ConfigBlocks.blockStoneDevice.onBlockActivated(world, x, y, z, player, side, hitX, hitY, hitZ);
|
||||
}
|
||||
return true;
|
||||
} else if(metadata == 4) {
|
||||
} else if (metadata == 4) {
|
||||
player.openGui(Gadomancy.instance, 2, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
@@ -277,23 +286,24 @@ public class BlockStoneMachine extends Block {
|
||||
this.setBlockBounds(3 / 16f, 0, 3 / 16f, 1 - (3 / 16f), 6 / 16f, 1 - (3 / 16f));
|
||||
} else if (metadata == 1) {
|
||||
this.setBlockBounds(0.25f, 0, 0.25f, 0.75f, 0.99f, 0.75f);
|
||||
} else if(metadata == 2) {
|
||||
this.setBlockBounds(0, 0, 0, 1, 3/16f, 1);
|
||||
} else if(metadata == 4) {
|
||||
this.setBlockBounds(0, 0, 0, 1, 12/16f, 1);
|
||||
}/* else if(metadata == 5) {
|
||||
setBlockBounds(0, 0, 0, 1, 1, 1);
|
||||
}*/
|
||||
} else if (metadata == 2) {
|
||||
this.setBlockBounds(0, 0, 0, 1, 3 / 16f, 1);
|
||||
} else if (metadata == 4) {
|
||||
this.setBlockBounds(0, 0, 0, 1, 12 / 16f, 1);
|
||||
} /* else if(metadata == 5) {
|
||||
setBlockBounds(0, 0, 0, 1, 1, 1);
|
||||
}*/
|
||||
super.setBlockBoundsBasedOnState(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB axisalignedbb, List list, Entity entity) {
|
||||
public void addCollisionBoxesToList(
|
||||
World world, int x, int y, int z, AxisAlignedBB axisalignedbb, List list, Entity entity) {
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
if (metadata == 11 || metadata == 15 || metadata == 1) {
|
||||
this.setBlockBounds(0, 0, 0, 1, 1, 1);
|
||||
} else if(metadata == 2) {
|
||||
this.setBlockBounds(3 / 16f, 0, 3 / 16f, 1 - (3 / 16f), 9.5f/16f, 1 - (3 / 16f));
|
||||
} else if (metadata == 2) {
|
||||
this.setBlockBounds(3 / 16f, 0, 3 / 16f, 1 - (3 / 16f), 9.5f / 16f, 1 - (3 / 16f));
|
||||
super.addCollisionBoxesToList(world, x, y, z, axisalignedbb, list, entity);
|
||||
this.setBlockBoundsBasedOnState(world, x, y, z);
|
||||
} else {
|
||||
|
||||
@@ -2,6 +2,7 @@ package makeo.gadomancy.common.blocks.tiles;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import java.util.*;
|
||||
import makeo.gadomancy.client.effect.fx.Orbital;
|
||||
import makeo.gadomancy.common.registration.AIShutdownWhitelist;
|
||||
import makeo.gadomancy.common.utils.Injector;
|
||||
@@ -21,8 +22,6 @@ import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.aspects.IAspectContainer;
|
||||
import thaumcraft.api.aspects.IEssentiaTransport;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -53,12 +52,13 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if(this.worldObj == null) return;
|
||||
if (this.worldObj == null) return;
|
||||
this.ticksExisted++;
|
||||
|
||||
if(!this.worldObj.isRemote) {
|
||||
if (!this.worldObj.isRemote) {
|
||||
ChunkCoordinates cc = this.getCoords();
|
||||
if (!TileAIShutdown.trackedEntities.containsKey(cc)) TileAIShutdown.trackedEntities.put(cc, Lists.newLinkedList());
|
||||
if (!TileAIShutdown.trackedEntities.containsKey(cc))
|
||||
TileAIShutdown.trackedEntities.put(cc, Lists.newLinkedList());
|
||||
|
||||
if ((this.ticksExisted & 15) == 0) {
|
||||
this.killAI();
|
||||
@@ -70,7 +70,6 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon
|
||||
this.drainDefaultEssentia();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void drainDefaultEssentia() {
|
||||
@@ -81,7 +80,8 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon
|
||||
|
||||
private void handleIO() {
|
||||
if (this.storedAmount < TileAIShutdown.MAX_AMT) {
|
||||
TileEntity te = ThaumcraftApiHelper.getConnectableTile(this.worldObj, this.xCoord, this.yCoord, this.zCoord, ForgeDirection.UP);
|
||||
TileEntity te = ThaumcraftApiHelper.getConnectableTile(
|
||||
this.worldObj, this.xCoord, this.yCoord, this.zCoord, ForgeDirection.UP);
|
||||
if (te != null) {
|
||||
IEssentiaTransport ic = (IEssentiaTransport) te;
|
||||
if (!ic.canOutputTo(ForgeDirection.DOWN)) {
|
||||
@@ -97,12 +97,15 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon
|
||||
|
||||
private void killAI() {
|
||||
ChunkCoordinates cc = this.getCoords();
|
||||
List objEntityList = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, TileAIShutdown.BOX.copy().offset(this.xCoord, this.yCoord, this.zCoord));
|
||||
List objEntityList = this.worldObj.getEntitiesWithinAABB(
|
||||
EntityLivingBase.class, TileAIShutdown.BOX.copy().offset(this.xCoord, this.yCoord, this.zCoord));
|
||||
for (Object o : objEntityList) {
|
||||
if(o != null && o instanceof EntityLiving &&
|
||||
!((EntityLiving) o).isDead && this.canAffect((EntityLiving) o)) {
|
||||
if (o != null
|
||||
&& o instanceof EntityLiving
|
||||
&& !((EntityLiving) o).isDead
|
||||
&& this.canAffect((EntityLiving) o)) {
|
||||
EntityLiving el = (EntityLiving) o;
|
||||
if(this.storedAmount <= 0) return;
|
||||
if (this.storedAmount <= 0) return;
|
||||
AffectedEntity affected = this.removeAI(el);
|
||||
TileAIShutdown.trackedEntities.get(cc).add(affected);
|
||||
}
|
||||
@@ -110,7 +113,7 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon
|
||||
}
|
||||
|
||||
private AffectedEntity removeAI(EntityLiving el) {
|
||||
if(TileAIShutdown.RAND.nextInt(4) == 0) {
|
||||
if (TileAIShutdown.RAND.nextInt(4) == 0) {
|
||||
this.storedAmount = Math.max(0, this.storedAmount - 1);
|
||||
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||
this.markDirty();
|
||||
@@ -130,9 +133,10 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon
|
||||
if (entry == null || !(entry instanceof EntityAITasks.EntityAITaskEntry)) continue;
|
||||
boolean needsRemoval = true;
|
||||
for (Class<? extends EntityAIBase> aiClass : entries) {
|
||||
if(aiClass.isAssignableFrom(((EntityAITasks.EntityAITaskEntry) entry).action.getClass())) needsRemoval = false;
|
||||
if (aiClass.isAssignableFrom(((EntityAITasks.EntityAITaskEntry) entry).action.getClass()))
|
||||
needsRemoval = false;
|
||||
}
|
||||
if(needsRemoval) {
|
||||
if (needsRemoval) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
@@ -143,9 +147,10 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon
|
||||
if (entry == null || !(entry instanceof EntityAITasks.EntityAITaskEntry)) continue;
|
||||
boolean needsRemoval = true;
|
||||
for (Class<? extends EntityAIBase> aiClass : entries) {
|
||||
if(aiClass.isAssignableFrom(((EntityAITasks.EntityAITaskEntry) entry).action.getClass())) needsRemoval = false;
|
||||
if (aiClass.isAssignableFrom(((EntityAITasks.EntityAITaskEntry) entry).action.getClass()))
|
||||
needsRemoval = false;
|
||||
}
|
||||
if(needsRemoval) {
|
||||
if (needsRemoval) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
@@ -161,10 +166,10 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon
|
||||
|
||||
public boolean canAffect(EntityLiving el) {
|
||||
ChunkCoordinates cc = this.getCoords();
|
||||
if(!TileAIShutdown.trackedEntities.containsKey(cc)) return false;
|
||||
if (!TileAIShutdown.trackedEntities.containsKey(cc)) return false;
|
||||
UUID uu = el.getUniqueID();
|
||||
for (AffectedEntity ae : TileAIShutdown.trackedEntities.get(cc)) {
|
||||
if(ae.eUUID.equals(uu)) return false;
|
||||
if (ae.eUUID.equals(uu)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -179,14 +184,13 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon
|
||||
compound.setInteger("amount", this.storedAmount);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// IAspectContainer & IEssentiaTransport
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public AspectList getAspects() {
|
||||
if(this.storedAmount <= 0) return new AspectList();
|
||||
if (this.storedAmount <= 0) return new AspectList();
|
||||
return new AspectList().add(Aspect.ENTROPY, this.storedAmount);
|
||||
}
|
||||
|
||||
@@ -224,7 +228,7 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean takeFromContainer(AspectList list) {
|
||||
return false; //NO-OP
|
||||
return false; // NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -235,7 +239,7 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean doesContainerContain(AspectList list) {
|
||||
return false; //NO-OP
|
||||
return false; // NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -263,13 +267,13 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon
|
||||
|
||||
@Override
|
||||
public Aspect getSuctionType(ForgeDirection direction) {
|
||||
if(!this.isConnectable(direction)) return null;
|
||||
if (!this.isConnectable(direction)) return null;
|
||||
return Aspect.ENTROPY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSuctionAmount(ForgeDirection direction) {
|
||||
if(!this.isConnectable(direction)) return 0;
|
||||
if (!this.isConnectable(direction)) return 0;
|
||||
return this.getMinimumSuction();
|
||||
}
|
||||
|
||||
@@ -290,7 +294,7 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon
|
||||
|
||||
@Override
|
||||
public int getEssentiaAmount(ForgeDirection direction) {
|
||||
if(!this.isConnectable(direction)) return 0;
|
||||
if (!this.isConnectable(direction)) return 0;
|
||||
return this.storedAmount;
|
||||
}
|
||||
|
||||
@@ -304,12 +308,12 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon
|
||||
return false;
|
||||
}
|
||||
|
||||
//Tracker methods
|
||||
// Tracker methods
|
||||
|
||||
public static void removeTrackedEntity(EntityLiving entityLiving) {
|
||||
for (ChunkCoordinates cc : TileAIShutdown.trackedEntities.keySet()) {
|
||||
for (AffectedEntity ae : TileAIShutdown.trackedEntities.get(cc)) {
|
||||
if(ae.eUUID.equals(entityLiving.getUniqueID())) {
|
||||
if (ae.eUUID.equals(entityLiving.getUniqueID())) {
|
||||
TileAIShutdown.trackedEntities.get(cc).remove(ae);
|
||||
entityLiving.tasks.taskEntries = ae.tasks;
|
||||
entityLiving.targetTasks.taskEntries = ae.targetTasks;
|
||||
@@ -324,12 +328,13 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon
|
||||
|
||||
public static void removeTrackedEntities(World world, int x, int y, int z) {
|
||||
ChunkCoordinates cc = new ChunkCoordinates(x, y, z);
|
||||
if(TileAIShutdown.trackedEntities.containsKey(cc)) {
|
||||
if (TileAIShutdown.trackedEntities.containsKey(cc)) {
|
||||
for (AffectedEntity ae : TileAIShutdown.trackedEntities.get(cc)) {
|
||||
for (Object objE : world.getLoadedEntityList()) {
|
||||
if(objE != null && objE instanceof EntityLiving &&
|
||||
!((EntityLiving) objE).isDead &&
|
||||
((EntityLiving) objE).getUniqueID().equals(ae.eUUID)) {
|
||||
if (objE != null
|
||||
&& objE instanceof EntityLiving
|
||||
&& !((EntityLiving) objE).isDead
|
||||
&& ((EntityLiving) objE).getUniqueID().equals(ae.eUUID)) {
|
||||
((EntityLiving) objE).tasks.taskEntries = ae.tasks;
|
||||
((EntityLiving) objE).targetTasks.taskEntries = ae.targetTasks;
|
||||
TileAIShutdown.injEntityLivingBase.setObject(objE);
|
||||
@@ -348,9 +353,10 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon
|
||||
public List<EntityAITasks.EntityAITaskEntry> tasks;
|
||||
public List<EntityAITasks.EntityAITaskEntry> targetTasks;
|
||||
|
||||
public AffectedEntity(UUID eUUID,
|
||||
List<EntityAITasks.EntityAITaskEntry> tasks,
|
||||
List<EntityAITasks.EntityAITaskEntry> targetTasks) {
|
||||
public AffectedEntity(
|
||||
UUID eUUID,
|
||||
List<EntityAITasks.EntityAITaskEntry> tasks,
|
||||
List<EntityAITasks.EntityAITaskEntry> targetTasks) {
|
||||
this.eUUID = eUUID;
|
||||
this.tasks = tasks;
|
||||
this.targetTasks = targetTasks;
|
||||
@@ -368,7 +374,5 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon
|
||||
public int hashCode() {
|
||||
return this.eUUID != null ? this.eUUID.hashCode() : 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+40
-19
@@ -1,5 +1,8 @@
|
||||
package makeo.gadomancy.common.blocks.tiles;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import makeo.gadomancy.common.data.config.ModConfig;
|
||||
import makeo.gadomancy.common.utils.world.TCMazeHandler;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -11,10 +14,6 @@ import net.minecraft.world.WorldServer;
|
||||
import thaumcraft.common.lib.research.ResearchManager;
|
||||
import thaumcraft.common.tiles.TileEldritchPortal;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -25,7 +24,8 @@ import java.util.Map;
|
||||
*/
|
||||
public class TileAdditionalEldritchPortal extends TileEldritchPortal {
|
||||
|
||||
private static Map<EntityPlayer, ExtendedChunkCoordinates> trackedPortalActivity = new HashMap<EntityPlayer, ExtendedChunkCoordinates>();
|
||||
private static Map<EntityPlayer, ExtendedChunkCoordinates> trackedPortalActivity =
|
||||
new HashMap<EntityPlayer, ExtendedChunkCoordinates>();
|
||||
private EntityPlayer toTeleport;
|
||||
private int count;
|
||||
|
||||
@@ -33,34 +33,56 @@ public class TileAdditionalEldritchPortal extends TileEldritchPortal {
|
||||
public void updateEntity() {
|
||||
this.count += 1;
|
||||
if ((this.worldObj.isRemote) && ((this.count % 250 == 0) || (this.count == 0))) {
|
||||
this.worldObj.playSound(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, "thaumcraft:evilportal", 1.0F, 1.0F, false);
|
||||
this.worldObj.playSound(
|
||||
this.xCoord + 0.5D,
|
||||
this.yCoord + 0.5D,
|
||||
this.zCoord + 0.5D,
|
||||
"thaumcraft:evilportal",
|
||||
1.0F,
|
||||
1.0F,
|
||||
false);
|
||||
}
|
||||
if ((this.worldObj.isRemote) && (this.opencount < 30)) {
|
||||
this.opencount += 1;
|
||||
}
|
||||
|
||||
if ((!this.worldObj.isRemote) && (this.count % 5 == 0) && this.toTeleport == null) {
|
||||
List<EntityPlayerMP> players = this.worldObj.getEntitiesWithinAABB(EntityPlayerMP.class, AxisAlignedBB.getBoundingBox(this.xCoord, this.yCoord, this.zCoord, this.xCoord + 1, this.yCoord + 1, this.zCoord + 1).expand(0.5D, 1.0D, 0.5D));
|
||||
if(players != null && !players.isEmpty()) {
|
||||
List<EntityPlayerMP> players = this.worldObj.getEntitiesWithinAABB(
|
||||
EntityPlayerMP.class,
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
this.xCoord,
|
||||
this.yCoord,
|
||||
this.zCoord,
|
||||
this.xCoord + 1,
|
||||
this.yCoord + 1,
|
||||
this.zCoord + 1)
|
||||
.expand(0.5D, 1.0D, 0.5D));
|
||||
if (players != null && !players.isEmpty()) {
|
||||
EntityPlayerMP toTeleport = players.get(0);
|
||||
|
||||
if(toTeleport.timeUntilPortal > 0) return;
|
||||
if (toTeleport.timeUntilPortal > 0) return;
|
||||
|
||||
if(!ResearchManager.isResearchComplete(toTeleport.getCommandSenderName(), TileNodeManipulator.MultiblockType.E_PORTAL_CREATOR.getResearchNeeded())) {
|
||||
if (!ResearchManager.isResearchComplete(
|
||||
toTeleport.getCommandSenderName(),
|
||||
TileNodeManipulator.MultiblockType.E_PORTAL_CREATOR.getResearchNeeded())) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.toTeleport = toTeleport;
|
||||
toTeleport.timeUntilPortal = 200;
|
||||
|
||||
if(toTeleport.dimension != ModConfig.dimOuterId) {
|
||||
//Teleporting there.
|
||||
if (toTeleport.dimension != ModConfig.dimOuterId) {
|
||||
// Teleporting there.
|
||||
|
||||
if(TCMazeHandler.createSessionWaitForTeleport(toTeleport)) {
|
||||
TileAdditionalEldritchPortal.startTracking(toTeleport, new ExtendedChunkCoordinates(new ChunkCoordinates(this.xCoord, this.yCoord, this.zCoord), toTeleport.dimension));
|
||||
if (TCMazeHandler.createSessionWaitForTeleport(toTeleport)) {
|
||||
TileAdditionalEldritchPortal.startTracking(
|
||||
toTeleport,
|
||||
new ExtendedChunkCoordinates(
|
||||
new ChunkCoordinates(this.xCoord, this.yCoord, this.zCoord),
|
||||
toTeleport.dimension));
|
||||
}
|
||||
} else {
|
||||
//Teleporting back.
|
||||
// Teleporting back.
|
||||
|
||||
TCMazeHandler.closeSession(toTeleport, true);
|
||||
}
|
||||
@@ -69,16 +91,16 @@ public class TileAdditionalEldritchPortal extends TileEldritchPortal {
|
||||
}
|
||||
|
||||
public static void startTracking(EntityPlayer player, ExtendedChunkCoordinates tileCoords) {
|
||||
if(!TileAdditionalEldritchPortal.trackedPortalActivity.containsKey(player)) {
|
||||
if (!TileAdditionalEldritchPortal.trackedPortalActivity.containsKey(player)) {
|
||||
TileAdditionalEldritchPortal.trackedPortalActivity.put(player, tileCoords);
|
||||
}
|
||||
}
|
||||
|
||||
public static void informSessionStart(EntityPlayer player) {
|
||||
if(TileAdditionalEldritchPortal.trackedPortalActivity.containsKey(player)) {
|
||||
if (TileAdditionalEldritchPortal.trackedPortalActivity.containsKey(player)) {
|
||||
ExtendedChunkCoordinates tileCoords = TileAdditionalEldritchPortal.trackedPortalActivity.get(player);
|
||||
TileAdditionalEldritchPortal.trackedPortalActivity.remove(player);
|
||||
if(tileCoords != null) {
|
||||
if (tileCoords != null) {
|
||||
ChunkCoordinates cc = tileCoords.coordinates;
|
||||
WorldServer ws = MinecraftServer.getServer().worldServerForDimension(tileCoords.dimId);
|
||||
ws.removeTileEntity(cc.posX, cc.posY, cc.posZ);
|
||||
@@ -98,5 +120,4 @@ public class TileAdditionalEldritchPortal extends TileEldritchPortal {
|
||||
this.dimId = dimId;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package makeo.gadomancy.common.blocks.tiles;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import makeo.gadomancy.common.registration.RegisteredBlocks;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -12,9 +14,6 @@ import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import thaumcraft.common.lib.utils.InventoryUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -40,10 +39,10 @@ public class TileArcaneDropper extends TileEntity implements ISidedInventory {
|
||||
this.removedCount = 0;
|
||||
this.removedEntity = null;
|
||||
|
||||
if(this.dropQueue.size() > 0) {
|
||||
for(int i = 0; i < this.dropQueue.size(); i++) {
|
||||
if (this.dropQueue.size() > 0) {
|
||||
for (int i = 0; i < this.dropQueue.size(); i++) {
|
||||
EntityItem item = this.dropQueue.get(i);
|
||||
if(!item.isDead && !this.worldObj.loadedEntityList.contains(item)) {
|
||||
if (!item.isDead && !this.worldObj.loadedEntityList.contains(item)) {
|
||||
this.getWorldObj().spawnEntityInWorld(item);
|
||||
this.dropQueue.remove(i);
|
||||
i--;
|
||||
@@ -51,15 +50,15 @@ public class TileArcaneDropper extends TileEntity implements ISidedInventory {
|
||||
}
|
||||
}
|
||||
|
||||
if(this.count > 20) {
|
||||
if (this.count > 20) {
|
||||
this.count = 0;
|
||||
|
||||
World world = this.getWorldObj();
|
||||
if(!world.isRemote) {
|
||||
if (!world.isRemote) {
|
||||
int oldSize = this.items.size();
|
||||
this.updateInventory();
|
||||
if(oldSize != 0 || this.items.size() != 0) {
|
||||
//Comparator...
|
||||
if (oldSize != 0 || this.items.size() != 0) {
|
||||
// Comparator...
|
||||
world.notifyBlockChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType());
|
||||
}
|
||||
}
|
||||
@@ -70,24 +69,25 @@ public class TileArcaneDropper extends TileEntity implements ISidedInventory {
|
||||
private void updateInventory() {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() & 7);
|
||||
|
||||
double x = this.xCoord + dir.offsetX*2 + 0.5;
|
||||
double y = this.yCoord + dir.offsetY*2 + 0.5;
|
||||
double z = this.zCoord + dir.offsetZ*2 + 0.5;
|
||||
double x = this.xCoord + dir.offsetX * 2 + 0.5;
|
||||
double y = this.yCoord + dir.offsetY * 2 + 0.5;
|
||||
double z = this.zCoord + dir.offsetZ * 2 + 0.5;
|
||||
|
||||
AxisAlignedBB box = AxisAlignedBB.getBoundingBox(x, y, z, x, y, z).expand(TileArcaneDropper.RADIUS, TileArcaneDropper.RADIUS, TileArcaneDropper.RADIUS);
|
||||
AxisAlignedBB box = AxisAlignedBB.getBoundingBox(x, y, z, x, y, z)
|
||||
.expand(TileArcaneDropper.RADIUS, TileArcaneDropper.RADIUS, TileArcaneDropper.RADIUS);
|
||||
this.items = this.getWorldObj().getEntitiesWithinAABB(EntityItem.class, box);
|
||||
|
||||
//Add 10 empty slots
|
||||
for(int i = 0; i < 10; i++) {
|
||||
// Add 10 empty slots
|
||||
for (int i = 0; i < 10; i++) {
|
||||
this.items.add(null);
|
||||
}
|
||||
}
|
||||
|
||||
private EntityItem dropItem(ItemStack stack) {
|
||||
if(this.removedEntity != null && this.removedEntity.isDead) {
|
||||
for(EntityItem entityItem : this.items) {
|
||||
if(entityItem == this.removedEntity) {
|
||||
if(InventoryUtils.areItemStacksEqualStrict(this.removedEntity.getEntityItem(), stack)
|
||||
if (this.removedEntity != null && this.removedEntity.isDead) {
|
||||
for (EntityItem entityItem : this.items) {
|
||||
if (entityItem == this.removedEntity) {
|
||||
if (InventoryUtils.areItemStacksEqualStrict(this.removedEntity.getEntityItem(), stack)
|
||||
&& this.removedEntity.getEntityItem().stackSize + this.removedCount == stack.stackSize) {
|
||||
this.removedEntity.getEntityItem().stackSize += this.removedCount;
|
||||
this.removedEntity.isDead = false;
|
||||
@@ -103,19 +103,19 @@ public class TileArcaneDropper extends TileEntity implements ISidedInventory {
|
||||
|
||||
ForgeDirection side = ForgeDirection.getOrientation(this.getBlockMetadata() & 7);
|
||||
|
||||
double x = this.xCoord + 0.5 + side.offsetX*0.5;
|
||||
double y = this.yCoord + 0.25 + side.offsetY*0.5;
|
||||
double z = this.zCoord + 0.5 + side.offsetZ*0.5;
|
||||
double x = this.xCoord + 0.5 + side.offsetX * 0.5;
|
||||
double y = this.yCoord + 0.25 + side.offsetY * 0.5;
|
||||
double z = this.zCoord + 0.5 + side.offsetZ * 0.5;
|
||||
|
||||
EntityItem entityItem = new EntityItem(this.getWorldObj(), x, y, z, stack.copy());//
|
||||
EntityItem entityItem = new EntityItem(this.getWorldObj(), x, y, z, stack.copy()); //
|
||||
|
||||
entityItem.motionX = side.offsetX*0.1;
|
||||
entityItem.motionY = side.offsetY*0.1;
|
||||
entityItem.motionZ = side.offsetZ*0.1;
|
||||
entityItem.motionX = side.offsetX * 0.1;
|
||||
entityItem.motionY = side.offsetY * 0.1;
|
||||
entityItem.motionZ = side.offsetZ * 0.1;
|
||||
|
||||
entityItem.delayBeforeCanPickup = 3;
|
||||
|
||||
//prevent stackOverflows
|
||||
// prevent stackOverflows
|
||||
this.dropQueue.add(entityItem);
|
||||
|
||||
return entityItem;
|
||||
@@ -131,7 +131,7 @@ public class TileArcaneDropper extends TileEntity implements ISidedInventory {
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
this.updateInventory();
|
||||
|
||||
if(slot >= this.items.size()) return null; //Get rekt. nothing here on this slot.
|
||||
if (slot >= this.items.size()) return null; // Get rekt. nothing here on this slot.
|
||||
|
||||
EntityItem entity = this.items.get(slot);
|
||||
return entity == null || entity.isDead ? null : entity.getEntityItem();
|
||||
@@ -141,7 +141,7 @@ public class TileArcaneDropper extends TileEntity implements ISidedInventory {
|
||||
public ItemStack decrStackSize(int slot, int amount) {
|
||||
ItemStack stack = this.getStackInSlot(slot);
|
||||
|
||||
if(stack.stackSize - amount <= 0) {
|
||||
if (stack.stackSize - amount <= 0) {
|
||||
this.setInventorySlotContents(slot, null);
|
||||
return stack.copy();
|
||||
}
|
||||
@@ -160,12 +160,12 @@ public class TileArcaneDropper extends TileEntity implements ISidedInventory {
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
EntityItem oldEntity = this.items.get(slot);
|
||||
|
||||
if(oldEntity != null) {
|
||||
if (oldEntity != null) {
|
||||
oldEntity.setDead();
|
||||
}
|
||||
|
||||
if(stack != null && stack.stackSize > 0) {
|
||||
if(oldEntity != null && InventoryUtils.areItemStacksEqualStrict(oldEntity.getEntityItem(), stack)) {
|
||||
if (stack != null && stack.stackSize > 0) {
|
||||
if (oldEntity != null && InventoryUtils.areItemStacksEqualStrict(oldEntity.getEntityItem(), stack)) {
|
||||
oldEntity.getEntityItem().stackSize = stack.stackSize;
|
||||
oldEntity.isDead = false;
|
||||
} else {
|
||||
@@ -205,19 +205,15 @@ public class TileArcaneDropper extends TileEntity implements ISidedInventory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
|
||||
}
|
||||
public void openInventory() {}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
|
||||
}
|
||||
public void closeInventory() {}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
int[] slots = new int[this.getSizeInventory()];
|
||||
for(int i = 0; i < slots.length; i++) {
|
||||
for (int i = 0; i < slots.length; i++) {
|
||||
slots[i] = i;
|
||||
}
|
||||
return slots;
|
||||
@@ -225,13 +221,13 @@ public class TileArcaneDropper extends TileEntity implements ISidedInventory {
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side) {
|
||||
return RegisteredBlocks.blockArcaneDropper
|
||||
.isSideSolid(this.getWorldObj(), this.xCoord, this.yCoord, this.zCoord, ForgeDirection.getOrientation(side));
|
||||
return RegisteredBlocks.blockArcaneDropper.isSideSolid(
|
||||
this.getWorldObj(), this.xCoord, this.yCoord, this.zCoord, ForgeDirection.getOrientation(side));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side) {
|
||||
if(this.canInsertItem(slot, stack, side)) {
|
||||
if (this.canInsertItem(slot, stack, side)) {
|
||||
EntityItem entityItem = this.items.get(slot);
|
||||
return entityItem == null || entityItem.delayBeforeCanPickup <= 0;
|
||||
}
|
||||
|
||||
@@ -3,10 +3,12 @@ package makeo.gadomancy.common.blocks.tiles;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import makeo.gadomancy.common.entities.fake.AdvancedFakePlayer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -17,10 +19,6 @@ import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -38,7 +36,7 @@ public class TileArcaneHand extends SynchronizedTileEntity implements ISidedInve
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if(this.im == null) {
|
||||
if (this.im == null) {
|
||||
this.updateConnection();
|
||||
}
|
||||
}
|
||||
@@ -55,7 +53,7 @@ public class TileArcaneHand extends SynchronizedTileEntity implements ISidedInve
|
||||
|
||||
TileEntity tile = this.getWorldObj().getTileEntity(this.xCoord, this.yCoord - 1, this.zCoord);
|
||||
if (tile != null && this.worldObj instanceof WorldServer) {
|
||||
if(this.fakePlayer == null) {
|
||||
if (this.fakePlayer == null) {
|
||||
this.fakePlayer = new GuiFakePlayer(this);
|
||||
}
|
||||
|
||||
@@ -63,18 +61,28 @@ public class TileArcaneHand extends SynchronizedTileEntity implements ISidedInve
|
||||
this.fakePlayer.posY = this.yCoord;
|
||||
this.fakePlayer.posZ = this.zCoord;
|
||||
|
||||
this.im.activateBlockOrUseItem(this.fakePlayer, this.worldObj, null, this.xCoord, this.yCoord - 1, this.zCoord, ForgeDirection.UP.ordinal(), 0.5F, 0.5F, 0.5F);
|
||||
this.im.activateBlockOrUseItem(
|
||||
this.fakePlayer,
|
||||
this.worldObj,
|
||||
null,
|
||||
this.xCoord,
|
||||
this.yCoord - 1,
|
||||
this.zCoord,
|
||||
ForgeDirection.UP.ordinal(),
|
||||
0.5F,
|
||||
0.5F,
|
||||
0.5F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
if(this.container == null) {
|
||||
if (this.container == null) {
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
int[] slots = new int[this.slots.size()];
|
||||
for(int i = 0; i < slots.length; i++) {
|
||||
for (int i = 0; i < slots.length; i++) {
|
||||
slots[i] = i;
|
||||
}
|
||||
return slots;
|
||||
@@ -104,7 +112,7 @@ public class TileArcaneHand extends SynchronizedTileEntity implements ISidedInve
|
||||
if (this.tile.container != null) {
|
||||
this.tile.slots = new ArrayList<Slot>();
|
||||
for (Slot slot : (List<Slot>) this.tile.container.inventorySlots) {
|
||||
if(!this.inventory.equals(slot.inventory)) {
|
||||
if (!this.inventory.equals(slot.inventory)) {
|
||||
this.tile.slots.add(slot);
|
||||
}
|
||||
}
|
||||
@@ -188,14 +196,10 @@ public class TileArcaneHand extends SynchronizedTileEntity implements ISidedInve
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
|
||||
}
|
||||
public void openInventory() {}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
|
||||
}
|
||||
public void closeInventory() {}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package makeo.gadomancy.common.blocks.tiles;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import makeo.gadomancy.common.registration.RegisteredItems;
|
||||
import makeo.gadomancy.common.utils.ItemUtils;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -14,9 +15,6 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.common.tiles.TileJarFillable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -30,7 +28,7 @@ public class TileArcanePackager extends TileJarFillable implements ISidedInvento
|
||||
|
||||
private ItemStack[] contents = new ItemStack[12];
|
||||
|
||||
//0 - 46
|
||||
// 0 - 46
|
||||
public byte progress = -1;
|
||||
public boolean autoStart;
|
||||
public boolean useEssentia;
|
||||
@@ -86,7 +84,8 @@ public class TileArcanePackager extends TileJarFillable implements ISidedInvento
|
||||
}
|
||||
} else {
|
||||
if (this.redstoneState == null) {
|
||||
this.redstoneState = this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord);
|
||||
this.redstoneState =
|
||||
this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
|
||||
if (this.progress >= 47) {
|
||||
@@ -108,7 +107,7 @@ public class TileArcanePackager extends TileJarFillable implements ISidedInvento
|
||||
}
|
||||
|
||||
public void updateRedstone(boolean state) {
|
||||
if(this.redstoneState != null && state && !this.redstoneState) {
|
||||
if (this.redstoneState != null && state && !this.redstoneState) {
|
||||
if (this.canPack()) {
|
||||
this.progress = 0;
|
||||
this.markForUpdate();
|
||||
@@ -145,7 +144,6 @@ public class TileArcanePackager extends TileJarFillable implements ISidedInvento
|
||||
ItemStack string = this.getStackInSlot(10);
|
||||
return string != null && string.stackSize >= 1 && string.getItem() == Items.string;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void doPack() {
|
||||
@@ -158,7 +156,10 @@ public class TileArcanePackager extends TileJarFillable implements ISidedInvento
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack pack = new ItemStack(this.disguise ? RegisteredItems.itemFakeLootbag : RegisteredItems.itemPackage, 1, this.useEssentia ? 1 : 0);
|
||||
ItemStack pack = new ItemStack(
|
||||
this.disguise ? RegisteredItems.itemFakeLootbag : RegisteredItems.itemPackage,
|
||||
1,
|
||||
this.useEssentia ? 1 : 0);
|
||||
boolean success = RegisteredItems.itemPackage.setContents(pack, contents);
|
||||
|
||||
if (success) {
|
||||
@@ -174,12 +175,14 @@ public class TileArcanePackager extends TileJarFillable implements ISidedInvento
|
||||
this.setInventorySlotContents(i, null);
|
||||
}
|
||||
} else {
|
||||
this.worldObj.newExplosion(null, this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5, 1, false, false);
|
||||
this.worldObj.newExplosion(
|
||||
null, this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5, 1, false, false);
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
for (int i = 0; i < 9; i++) {
|
||||
ItemStack stack = this.contents[i];
|
||||
if(stack != null) {
|
||||
EntityItem entityItem = new EntityItem(this.worldObj, this.xCoord + 0.5, this.yCoord + (13/16f), this.zCoord + 0.5, stack);
|
||||
if (stack != null) {
|
||||
EntityItem entityItem = new EntityItem(
|
||||
this.worldObj, this.xCoord + 0.5, this.yCoord + (13 / 16f), this.zCoord + 0.5, stack);
|
||||
ItemUtils.applyRandomDropOffset(entityItem, this.worldObj.rand);
|
||||
this.worldObj.spawnEntityInWorld(entityItem);
|
||||
this.contents[i] = null;
|
||||
@@ -301,14 +304,10 @@ public class TileArcanePackager extends TileJarFillable implements ISidedInvento
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
|
||||
}
|
||||
public void openInventory() {}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
|
||||
}
|
||||
public void closeInventory() {}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
@@ -324,11 +323,11 @@ public class TileArcanePackager extends TileJarFillable implements ISidedInvento
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
if (side == 0) {
|
||||
return new int[]{11};
|
||||
return new int[] {11};
|
||||
}
|
||||
|
||||
if (TileArcanePackager.ORIENTATION_MAPPING[side] == super.facing) {
|
||||
return new int[]{9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8};
|
||||
return new int[] {9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8};
|
||||
}
|
||||
|
||||
return new int[0];
|
||||
|
||||
Loaded 100 of 262 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user