mirror of
https://github.com/GTNewHorizons/Gadomancy.git
synced 2026-11-26 23:03:18 +00:00
- Growing Nodes are now Jar-able and thus moveable
- Growing Node Vortex Explosion added - Made "Growing" more dangerous and more rewarding
This commit is contained in:
1 parent
924d305c56
commit
dd1c9daca2
23 files changed
+1209
-102
No files matched your search
@@ -7,19 +7,23 @@ import cpw.mods.fml.common.FMLLog;
|
||||
import makeo.gadomancy.client.events.RenderEventHandler;
|
||||
import makeo.gadomancy.client.events.ResourceReloadListener;
|
||||
import makeo.gadomancy.client.gui.InfusionClawGui;
|
||||
import makeo.gadomancy.client.renderers.block.BlockExtendedNodeJarRenderer;
|
||||
import makeo.gadomancy.client.renderers.block.RenderBlockTransparent;
|
||||
import makeo.gadomancy.client.renderers.entity.RenderAdditionalGolemBase;
|
||||
import makeo.gadomancy.client.renderers.item.ItemExNodeRenderer;
|
||||
import makeo.gadomancy.client.renderers.item.ItemJarExtendedNodeRenderer;
|
||||
import makeo.gadomancy.client.renderers.item.ItemRenderRemoteJar;
|
||||
import makeo.gadomancy.client.renderers.item.ItemRenderTileEntity;
|
||||
import makeo.gadomancy.client.renderers.tile.RenderTileArcaneDropper;
|
||||
import makeo.gadomancy.client.renderers.tile.RenderTileExtendedNode;
|
||||
import makeo.gadomancy.client.renderers.tile.RenderTileExtendedNodeJar;
|
||||
import makeo.gadomancy.client.renderers.tile.RenderTileInfusionClaw;
|
||||
import makeo.gadomancy.client.renderers.tile.RenderTileRemoteJar;
|
||||
import makeo.gadomancy.client.renderers.tile.RenderTileStickyJar;
|
||||
import makeo.gadomancy.common.CommonProxy;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileArcaneDropper;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileExtendedNode;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileExtendedNodeJar;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileInfusionClaw;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileRemoteJar;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileStickyJar;
|
||||
@@ -43,6 +47,7 @@ import sun.reflect.generics.visitor.Reifier;
|
||||
import thaumcraft.api.nodes.INode;
|
||||
import thaumcraft.client.gui.GuiGolem;
|
||||
import thaumcraft.client.renderers.entity.RenderGolemBase;
|
||||
import thaumcraft.client.renderers.tile.ItemJarNodeRenderer;
|
||||
import thaumcraft.common.entities.golems.EntityGolemBase;
|
||||
|
||||
import java.util.List;
|
||||
@@ -82,6 +87,9 @@ public class ClientProxy extends CommonProxy {
|
||||
RenderTileExtendedNode nodeRenderer = new RenderTileExtendedNode();
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileExtendedNode.class, nodeRenderer);
|
||||
|
||||
RenderTileExtendedNodeJar nodeJarRenderer = new RenderTileExtendedNodeJar();
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileExtendedNodeJar.class, nodeJarRenderer);
|
||||
|
||||
//Items
|
||||
TileArcaneDropper fakeTile = new TileArcaneDropper();
|
||||
fakeTile.blockMetadata = 8 | ForgeDirection.SOUTH.ordinal();
|
||||
@@ -91,10 +99,12 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(RegisteredItems.itemBlockAiryCopy, new ItemExNodeRenderer());
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(RegisteredItems.itemExtendedNodeJar, new ItemJarExtendedNodeRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockRemoteJar), new ItemRenderRemoteJar(renderTileRemoteJar));
|
||||
|
||||
//Blocks
|
||||
RegisteredBlocks.rendererTransparentBlock = registerBlockRenderer(new RenderBlockTransparent());
|
||||
RegisteredBlocks.rendererExtendedNodeJarBlock = registerBlockRenderer(new BlockExtendedNodeJarRenderer());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,7 +2,9 @@ package makeo.gadomancy.client.events;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import makeo.gadomancy.client.util.ExtendedTypeDisplayManager;
|
||||
import makeo.gadomancy.client.util.MultiTickEffectDispatcher;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileExtendedNode;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileExtendedNodeJar;
|
||||
import makeo.gadomancy.common.registration.RegisteredBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -73,9 +75,10 @@ public class RenderEventHandler {
|
||||
TileExtendedNode node = (TileExtendedNode) tile;
|
||||
if(node.getExtendedNodeType() == null) return;
|
||||
ExtendedTypeDisplayManager.notifyDisplayTick(node.getId(), node.getNodeType(), node.getExtendedNodeType());
|
||||
} else if(tile instanceof TileJarNode) {
|
||||
TileJarNode nodeJar = (TileJarNode) tile;
|
||||
|
||||
} else if(tile instanceof TileExtendedNodeJar) {
|
||||
TileExtendedNodeJar nodeJar = (TileExtendedNodeJar) tile;
|
||||
if(nodeJar.getExtendedNodeType() == null) return;
|
||||
ExtendedTypeDisplayManager.notifyDisplayTick(nodeJar.getId(), nodeJar.getNodeType(), nodeJar.getExtendedNodeType());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,5 +87,6 @@ public class RenderEventHandler {
|
||||
@SubscribeEvent
|
||||
public void worldRenderEvent(RenderWorldLastEvent event) {
|
||||
ExtendedTypeDisplayManager.notifyRenderTick();
|
||||
MultiTickEffectDispatcher.notifyRenderTick(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
}
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
package makeo.gadomancy.client.renderers.block;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import makeo.gadomancy.common.registration.RegisteredBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.common.blocks.BlockJar;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
|
||||
/**
|
||||
* This class is NOT part of the Gadomancy Mod
|
||||
* This file is copied from Azanors thaumcraft.client.renderers.block.BlockRenderer.java and
|
||||
* thaumcraft.client.renderers.block.BlockJarRenderer.java
|
||||
* Thaumcraft: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1292130
|
||||
*
|
||||
* Created by Azanor
|
||||
* Modified to create compatibility with ExtendedNodes
|
||||
* Modified by HellFirePvP @ 26.10.2015 00:29
|
||||
*/
|
||||
public class BlockExtendedNodeJarRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public static float W1 = 0.0625F;
|
||||
public static float W2 = 0.125F;
|
||||
public static float W3 = 0.1875F;
|
||||
public static float W4 = 0.25F;
|
||||
public static float W5 = 0.3125F;
|
||||
public static float W6 = 0.375F;
|
||||
public static float W7 = 0.4375F;
|
||||
public static float W8 = 0.5F;
|
||||
public static float W9 = 0.5625F;
|
||||
public static float W10 = 0.625F;
|
||||
public static float W11 = 0.6875F;
|
||||
public static float W12 = 0.75F;
|
||||
public static float W13 = 0.8125F;
|
||||
public static float W14 = 0.875F;
|
||||
public static float W15 = 0.9375F;
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(3042);
|
||||
GL11.glBlendFunc(770, 771);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
IIcon i1 = ((BlockJar) ConfigBlocks.blockJar).iconJarTop;
|
||||
IIcon i2 = ((BlockJar) ConfigBlocks.blockJar).iconJarSide;
|
||||
block.setBlockBounds(W3, 0.0F, W3, W13, W12, W13);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
drawFaces(renderer, block, ((BlockJar) ConfigBlocks.blockJar).iconJarBottom, i1, i2, i2, i2, i2, true);
|
||||
block.setBlockBounds(W5, W12, W5, W11, W14, W11);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
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) {
|
||||
int bb = setBrightness(world, x, y, z, block);
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
block.setBlockBounds(W3, 0.0F, W3, W13, W12, W13);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
block.setBlockBounds(W5, W12, W5, W11, W14, W11);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
|
||||
renderer.clearOverrideBlockTexture();
|
||||
block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
return true;
|
||||
}
|
||||
|
||||
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();
|
||||
tessellator.setNormal(0.0F, -1.0F, 0.0F);
|
||||
renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, i1);
|
||||
tessellator.draw();
|
||||
if (solidtop) {
|
||||
GL11.glDisable(3008);
|
||||
}
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, i2);
|
||||
tessellator.draw();
|
||||
if (solidtop) {
|
||||
GL11.glEnable(3008);
|
||||
}
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, i3);
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, -1.0F);
|
||||
renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, i4);
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, i5);
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1.0F, 0.0F, 0.0F);
|
||||
renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, i6);
|
||||
tessellator.draw();
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
private int setBrightness(IBlockAccess blockAccess, int i, int j, int k, Block block) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
int mb = block.getMixedBrightnessForBlock(blockAccess, i, j, k);
|
||||
tessellator.setBrightness(mb);
|
||||
|
||||
float f = 1.0F;
|
||||
|
||||
int l = block.colorMultiplier(blockAccess, i, j, k);
|
||||
float f1 = (l >> 16 & 0xFF) / 255.0F;
|
||||
float f2 = (l >> 8 & 0xFF) / 255.0F;
|
||||
float f3 = (l & 0xFF) / 255.0F;
|
||||
if (EntityRenderer.anaglyphEnable) {
|
||||
float f6 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
|
||||
float f4 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
|
||||
float f7 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
|
||||
f1 = f6;
|
||||
f2 = f4;
|
||||
f3 = f7;
|
||||
}
|
||||
tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
|
||||
return mb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return RegisteredBlocks.rendererExtendedNodeJarBlock;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,6 +27,6 @@ public class ItemExNodeRenderer extends ItemNodeRenderer {
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
makeo.gadomancy.client.renderers.item.tc.ItemNodeRenderer.renderNodeItem(type, item, data);
|
||||
makeo.gadomancy.client.renderers.item.ItemNodeRenderer.renderNodeItem(type, item, data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package makeo.gadomancy.client.renderers.item;
|
||||
|
||||
import makeo.gadomancy.common.items.ItemExtendedNodeJar;
|
||||
import makeo.gadomancy.common.registration.RegisteredBlocks;
|
||||
import makeo.gadomancy.common.registration.RegisteredItems;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.tiles.TileJar;
|
||||
import thaumcraft.common.tiles.TileJarNode;
|
||||
|
||||
/**
|
||||
* This class is NOT part of the Gadomancy Mod
|
||||
* This file is copied from Azanors thaumcraft.client.renderers.tile.ItemJarNodeRenderer.java and contains small modifications
|
||||
* Thaumcraft: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1292130
|
||||
*
|
||||
* Created by Azanor
|
||||
* Modified by HellFirePvP @ 26.10.2015 00:06
|
||||
*/
|
||||
public class ItemJarExtendedNodeRenderer implements IItemRenderer {
|
||||
|
||||
//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) {
|
||||
if (helper == IItemRenderer.ItemRendererHelper.EQUIPPED_BLOCK) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
RenderBlocks rb = new RenderBlocks();
|
||||
|
||||
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) {
|
||||
if (item.getItem() == RegisteredItems.itemExtendedNodeJar) {
|
||||
if (type == IItemRenderer.ItemRenderType.ENTITY) {
|
||||
GL11.glTranslatef(-0.5F, -0.25F, -0.5F);
|
||||
} else if ((type == IItemRenderer.ItemRenderType.EQUIPPED) && ((data[1] instanceof EntityPlayer))) {
|
||||
GL11.glTranslatef(0.0F, 0.0F, -0.5F);
|
||||
}
|
||||
TileJarNode tjf = new TileJarNode();
|
||||
if (item.hasTagCompound()) {
|
||||
AspectList aspects = ((ItemExtendedNodeJar) item.getItem()).getAspects(item);
|
||||
if (aspects != null) {
|
||||
tjf.setAspects(aspects);
|
||||
tjf.setNodeType(((ItemExtendedNodeJar) item.getItem()).getNodeType(item));
|
||||
tjf.setNodeModifier(((ItemExtendedNodeJar) item.getItem()).getNodeModifier(item));
|
||||
}
|
||||
}
|
||||
tjf.blockType = ConfigBlocks.blockJar;
|
||||
tjf.blockMetadata = 2;
|
||||
GL11.glPushMatrix();
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileJar(), 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0.5D, 0.4D, 0.5D);
|
||||
ItemNodeRenderer.renderItemNode(tjf);
|
||||
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
|
||||
ItemNodeRenderer.renderItemNode(tjf);
|
||||
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
ItemNodeRenderer.renderItemNode(tjf);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
GL11.glEnable(3042);
|
||||
GL11.glBlendFunc(770, 771);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
this.rb.useInventoryTint = true;
|
||||
this.rb.renderBlockAsItem(RegisteredBlocks.blockExtendedNodeJar, item.getItemDamage(), 1.0F);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
||||
GL11.glEnable(32826);
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package makeo.gadomancy.client.renderers.item.tc;
|
||||
package makeo.gadomancy.client.renderers.item;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -21,7 +21,7 @@ import thaumcraft.common.tiles.TileNode;
|
||||
* This class is NOT part of the Gadomancy Mod
|
||||
* This file is copied from Azanors thaumcraft.client.renderers.tile.ItemNodeRenderer.java and contains small modifications
|
||||
* Thaumcraft: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1292130
|
||||
* <p/>
|
||||
*
|
||||
* Created by Azanor
|
||||
* Modified by HellFirePvP @ 24.10.2015 17:19
|
||||
*/
|
||||
@@ -1,6 +1,5 @@
|
||||
package makeo.gadomancy.client.renderers.tile;
|
||||
|
||||
import makeo.gadomancy.client.renderers.tile.tc.RenderTileNodeBasic;
|
||||
import makeo.gadomancy.common.blocks.tiles.ExtendedNodeType;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileExtendedNode;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package makeo.gadomancy.client.renderers.tile;
|
||||
|
||||
import thaumcraft.client.renderers.tile.TileJarRenderer;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
* <p/>
|
||||
* Created by HellFirePvP @ 26.10.2015 00:00
|
||||
*/
|
||||
public class RenderTileExtendedNodeJar extends TileJarRenderer {}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package makeo.gadomancy.client.renderers.tile.tc;
|
||||
package makeo.gadomancy.client.renderers.tile;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -0,0 +1,77 @@
|
||||
package makeo.gadomancy.client.util;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
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
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
*
|
||||
* Created by HellFirePvP @ 25.10.2015 18:54
|
||||
*/
|
||||
public class MultiTickEffectDispatcher {
|
||||
|
||||
private static ReentrantLock renderLock = new ReentrantLock();
|
||||
private static List<VortexDigInfo> vortexDigInfos = new ArrayList<VortexDigInfo>();
|
||||
|
||||
public static void notifyRenderTick(World currentRenderWorld) {
|
||||
renderLock.lock();
|
||||
try {
|
||||
handleVortexDiggingEffects(currentRenderWorld);
|
||||
} finally {
|
||||
renderLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
private static void handleVortexDiggingEffects(World currentRenderWorld) {
|
||||
Iterator<VortexDigInfo> it = vortexDigInfos.iterator();
|
||||
while(it.hasNext()) {
|
||||
VortexDigInfo info = it.next();
|
||||
if(info.dimId != currentRenderWorld.provider.dimensionId) it.remove();
|
||||
info.renderTicks++;
|
||||
if(info.renderTicks > 7) it.remove();
|
||||
|
||||
Thaumcraft.proxy.boreDigFx(currentRenderWorld, info.tX, info.tY, info.tZ, info.oX, info.oY, info.oZ, info.blockInstance, info.meta);
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerVortexDig(VortexDigInfo info) {
|
||||
renderLock.lock();
|
||||
try {
|
||||
vortexDigInfos.add(info);
|
||||
} finally {
|
||||
renderLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public static class VortexDigInfo {
|
||||
|
||||
private int dimId;
|
||||
private int oX, oY, oZ;
|
||||
private int tX, tY, tZ;
|
||||
private Block blockInstance;
|
||||
private int meta;
|
||||
private int renderTicks = 0;
|
||||
|
||||
public VortexDigInfo(int dimId, int oX, int oY, int oZ, int tX, int tY, int tZ, Block blockInstance, int meta) {
|
||||
this.dimId = dimId;
|
||||
this.oX = oX;
|
||||
this.oY = oY;
|
||||
this.oZ = oZ;
|
||||
this.tX = tX;
|
||||
this.tY = tY;
|
||||
this.tZ = tZ;
|
||||
this.blockInstance = blockInstance;
|
||||
this.meta = meta;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package makeo.gadomancy.common.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileExtendedNode;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileExtendedNodeJar;
|
||||
import makeo.gadomancy.common.items.ItemExtendedNodeJar;
|
||||
import makeo.gadomancy.common.registration.RegisteredBlocks;
|
||||
import makeo.gadomancy.common.registration.RegisteredItems;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
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
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
*
|
||||
* Original created by Azanor@Thaumcraft: thaumcraft.common.blocks.BlockJar
|
||||
* Modified to create compatibility with ExtendedNodes
|
||||
* Created by HellFirePvP @ 25.10.2015 22:02
|
||||
*/
|
||||
public class BlockExtendedNodeJar extends BlockContainer {
|
||||
|
||||
public BlockExtendedNodeJar() {
|
||||
super(Material.glass);
|
||||
setHardness(0.3F);
|
||||
setStepSound(new CustomStepSound("jar", 1.0F, 1.0F));
|
||||
setLightLevel(0.66F);
|
||||
setBlockName("blockExNodeJar");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister p_149651_1_) {}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
BlockJar jar = (BlockJar) ConfigBlocks.blockJar;
|
||||
return side == 1 ? jar.iconJarTop : side == 0 ? jar.iconJarBottom : jar.iconJarSide;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileExtendedNodeJar();
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return RegisteredBlocks.rendererExtendedNodeJarBlock;
|
||||
}
|
||||
|
||||
|
||||
public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) {
|
||||
dropBlockAsItem(par1World, par2, par3, par4, par5, 0);
|
||||
super.onBlockHarvested(par1World, par2, par3, par4, par5, par6EntityPlayer);
|
||||
}
|
||||
|
||||
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)) {
|
||||
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());
|
||||
drops.add(drop);
|
||||
}
|
||||
return drops;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean addDestroyEffects(World world, int x, int y, int z, int meta, EffectRenderer effectRenderer) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int i, int j, int k) {
|
||||
setBlockBounds(0.1875F, 0.0F, 0.1875F, 0.8125F, 0.75F, 0.8125F);
|
||||
super.setBlockBoundsBasedOnState(world, i, j, k);
|
||||
}
|
||||
|
||||
public void addCollisionBoxesToList(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List arraylist, Entity par7Entity) {
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
|
||||
}
|
||||
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||
return 11;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,8 +18,8 @@ import java.util.Map;
|
||||
public class GrowingNodeBehavior {
|
||||
|
||||
public static final double SATURATION_DIFFICULTY = 10D;
|
||||
public static final double SATURATION_CAP = 100D;
|
||||
public static final int HAPPINESS_CAP = 100;
|
||||
public static final double SATURATION_CAP = 200D;
|
||||
public static final int HAPPINESS_CAP = 1000;
|
||||
|
||||
//The node the behavior belongs to
|
||||
private final TileExtendedNode owningNode;
|
||||
@@ -80,12 +80,20 @@ public class GrowingNodeBehavior {
|
||||
}
|
||||
|
||||
//If the saturation is in the upper 85%
|
||||
System.out.println(percentSaturation + " - " + overallHappiness);
|
||||
if(percentSaturation > satCmp) {
|
||||
this.isSaturated = true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean mayZapNow() {
|
||||
return overallHappiness > owningNode.getWorldObj().rand.nextInt(HAPPINESS_CAP * HAPPINESS_CAP);
|
||||
}
|
||||
|
||||
public float getZapDamage() {
|
||||
float happinessPerc = ((float) overallHappiness) / ((float) HAPPINESS_CAP);
|
||||
return happinessPerc > 0.3 ? happinessPerc > 0.6 ? happinessPerc > 0.9 ? 12 : 8 : 5 : 2;
|
||||
}
|
||||
|
||||
private void addSaturation(Aspect aspect, double increasedSaturation) {
|
||||
double overallReduction = 1D / SATURATION_DIFFICULTY;
|
||||
if(aspectSaturation.containsKey(aspect)) {
|
||||
@@ -158,7 +166,7 @@ public class GrowingNodeBehavior {
|
||||
}
|
||||
|
||||
private double evaluateFeedingDenialFunc(double i) {
|
||||
return (Math.log(i) / 2) + 1;
|
||||
return (Math.log(i) / 6) + 1;
|
||||
}
|
||||
|
||||
private void handleOverfeed() {
|
||||
|
||||
@@ -1,18 +1,29 @@
|
||||
package makeo.gadomancy.common.blocks.tiles;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import makeo.gadomancy.common.network.PacketHandler;
|
||||
import makeo.gadomancy.common.network.packets.PacketTCNodeBolt;
|
||||
import makeo.gadomancy.common.utils.ExplosionHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.EnumDifficulty;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.aspects.IEssentiaContainerItem;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.entities.EntityAspectOrb;
|
||||
import thaumcraft.common.entities.monster.EntityWisp;
|
||||
import thaumcraft.common.items.ItemManaBean;
|
||||
import thaumcraft.common.items.ItemWispEssence;
|
||||
import thaumcraft.common.lib.network.fx.PacketFXZap;
|
||||
import thaumcraft.common.tiles.TileNode;
|
||||
|
||||
import java.util.List;
|
||||
@@ -28,6 +39,7 @@ import java.util.Random;
|
||||
*/
|
||||
public class TileExtendedNode extends TileNode {
|
||||
|
||||
private int ticksExisted = 0;
|
||||
private ExtendedNodeType extendedNodeType;
|
||||
private GrowingNodeBehavior behavior;
|
||||
|
||||
@@ -39,7 +51,7 @@ public class TileExtendedNode extends TileNode {
|
||||
this.behavior = new GrowingNodeBehavior(this);
|
||||
|
||||
if(new Random().nextBoolean()) {
|
||||
this.extendedNodeType = ExtendedNodeType.GROWING;
|
||||
extendedNodeType = ExtendedNodeType.GROWING;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +59,8 @@ public class TileExtendedNode extends TileNode {
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
ticksExisted++;
|
||||
|
||||
if(this.doingVortexExplosion) {
|
||||
if(this.vortexExplosion == null) {
|
||||
this.vortexExplosion = new ExplosionHelper.VortexExplosion(this);
|
||||
@@ -61,7 +75,8 @@ public class TileExtendedNode extends TileNode {
|
||||
|
||||
boolean needUpdate;
|
||||
|
||||
needUpdate = handleGrowingNode(false);
|
||||
needUpdate = handleGrowingNodeFirst(false);
|
||||
needUpdate = handleGrowingNodeSecond(needUpdate);
|
||||
|
||||
if(!worldObj.isRemote && needUpdate) {
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
@@ -69,7 +84,31 @@ public class TileExtendedNode extends TileNode {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean handleGrowingNode(boolean needUpdate) {
|
||||
private boolean handleGrowingNodeSecond(boolean needUpdate) {
|
||||
if(extendedNodeType == null || extendedNodeType != ExtendedNodeType.GROWING) return needUpdate;
|
||||
|
||||
if(worldObj.difficultySetting == EnumDifficulty.PEACEFUL) return needUpdate;
|
||||
if(worldObj.isRemote) return needUpdate;
|
||||
if(ticksExisted % 8 != 0) return needUpdate;
|
||||
|
||||
List livingEntities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1).expand(6.0D, 6.0D, 6.0D));
|
||||
if ((livingEntities != null) && (livingEntities.size() > 0)) {
|
||||
for (Object e : livingEntities) {
|
||||
EntityLivingBase livingEntity = (EntityLivingBase) e;
|
||||
if ((livingEntity.isEntityAlive()) && (!livingEntity.isEntityInvulnerable())) {
|
||||
if(livingEntity instanceof EntityPlayer && ((EntityPlayer) livingEntity).capabilities.isCreativeMode) continue;
|
||||
if(!behavior.mayZapNow()) continue;
|
||||
livingEntity.attackEntityFrom(DamageSource.magic, behavior.getZapDamage());
|
||||
PacketTCNodeBolt packet = new PacketTCNodeBolt(xCoord + 0.5F, yCoord + 0.5F, zCoord + 0.5F, (float) livingEntity.posX, (float) (livingEntity.posY + livingEntity.height), (float) livingEntity.posZ);
|
||||
PacketHandler.INSTANCE.sendToAllAround(packet, new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 32.0D));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return needUpdate;
|
||||
}
|
||||
|
||||
private boolean handleGrowingNodeFirst(boolean needUpdate) {
|
||||
if(extendedNodeType == null || extendedNodeType != ExtendedNodeType.GROWING) return needUpdate;
|
||||
|
||||
List aspectOrbs = this.worldObj.getEntitiesWithinAABB(EntityAspectOrb.class, AxisAlignedBB.getBoundingBox(this.xCoord, this.yCoord, this.zCoord, this.xCoord + 1, this.yCoord + 1, this.zCoord + 1).expand(15.0D, 15.0D, 15.0D));
|
||||
@@ -174,6 +213,10 @@ public class TileExtendedNode extends TileNode {
|
||||
return extendedNodeType;
|
||||
}
|
||||
|
||||
public void setExtendedNodeType(ExtendedNodeType extendedNodeType) {
|
||||
this.extendedNodeType = extendedNodeType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readCustomNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readCustomNBT(nbttagcompound);
|
||||
|
||||
@@ -0,0 +1,253 @@
|
||||
package makeo.gadomancy.common.blocks.tiles;
|
||||
|
||||
import makeo.gadomancy.common.utils.Injector;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.nodes.NodeModifier;
|
||||
import thaumcraft.api.nodes.NodeType;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.tiles.TileJar;
|
||||
import thaumcraft.common.tiles.TileJarNode;
|
||||
import thaumcraft.common.tiles.TileNode;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
* <p/>
|
||||
* Original created by Azanor@Thaumcraft: thaumcraft.common.tiles.TileJar
|
||||
* Modified to create compatibility with ExtendedNodes
|
||||
* Created by HellFirePvP @ 25.10.2015 22:50
|
||||
*/
|
||||
public class TileExtendedNodeJar extends TileJarNode {
|
||||
|
||||
private static final ResourceLocation tex = new ResourceLocation("thaumcraft", "textures/models/jar.png");
|
||||
private AspectList aspects = new AspectList();
|
||||
private AspectList aspectsBase = new AspectList();
|
||||
private NodeType nodeType = NodeType.NORMAL;
|
||||
private NodeModifier nodeModifier = null;
|
||||
private ExtendedNodeType extendedNodeType = null;
|
||||
private String id = "";
|
||||
public long animate = 0L;
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture() {
|
||||
return tex;
|
||||
}
|
||||
|
||||
public boolean canUpdate() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void readCustomNBT(NBTTagCompound nbttagcompound) {
|
||||
this.aspects.readFromNBT(nbttagcompound);
|
||||
this.id = nbttagcompound.getString("nodeId");
|
||||
|
||||
AspectList al = new AspectList();
|
||||
NBTTagList tlist = nbttagcompound.getTagList("AspectsBase", 10);
|
||||
for (int j = 0; j < tlist.tagCount(); j++) {
|
||||
NBTTagCompound rs = tlist.getCompoundTagAt(j);
|
||||
if (rs.hasKey("key")) {
|
||||
al.add(Aspect.getAspect(rs.getString("key")), rs.getInteger("amount"));
|
||||
}
|
||||
}
|
||||
Short oldBase = nbttagcompound.getShort("nodeVisBase");
|
||||
this.aspectsBase = new AspectList();
|
||||
if ((oldBase > 0) && (al.size() == 0)) {
|
||||
for (Aspect a : this.aspects.getAspects()) {
|
||||
this.aspectsBase.merge(a, oldBase);
|
||||
}
|
||||
} else {
|
||||
this.aspectsBase = al.copy();
|
||||
}
|
||||
setNodeType(NodeType.values()[nbttagcompound.getByte("type")]);
|
||||
byte mod = nbttagcompound.getByte("modifier");
|
||||
if(mod >= 0) setNodeModifier(NodeModifier.values()[mod]); else setNodeModifier(null);
|
||||
byte exType = nbttagcompound.getByte("extendedNodeType");
|
||||
if(exType >= 0) setExtendedNodeType(ExtendedNodeType.values()[exType]); else setExtendedNodeType(null);
|
||||
}
|
||||
|
||||
public void writeCustomNBT(NBTTagCompound nbttagcompound) {
|
||||
this.aspects.writeToNBT(nbttagcompound);
|
||||
nbttagcompound.setString("nodeId", this.id);
|
||||
NBTTagList tlist = new NBTTagList();
|
||||
nbttagcompound.setTag("AspectsBase", tlist);
|
||||
for (Aspect aspect : this.aspectsBase.getAspects()) {
|
||||
if (aspect != null) {
|
||||
NBTTagCompound f = new NBTTagCompound();
|
||||
f.setString("key", aspect.getTag());
|
||||
f.setInteger("amount", this.aspectsBase.getAmount(aspect));
|
||||
tlist.appendTag(f);
|
||||
}
|
||||
}
|
||||
nbttagcompound.setByte("type", (byte) getNodeType().ordinal());
|
||||
nbttagcompound.setByte("modifier", getNodeModifier() == null ? -1 : (byte) getNodeModifier().ordinal());
|
||||
nbttagcompound.setByte("extendedNodeType", getExtendedNodeType() == null ? -1 : (byte) getExtendedNodeType().ordinal());
|
||||
}
|
||||
|
||||
public AspectList getAspects() {
|
||||
return this.aspects;
|
||||
}
|
||||
|
||||
public AspectList getAspectsBase() {
|
||||
return this.aspectsBase;
|
||||
}
|
||||
|
||||
public void setAspects(AspectList aspects) {
|
||||
this.aspects = aspects.copy();
|
||||
this.aspectsBase = aspects.copy();
|
||||
}
|
||||
|
||||
public int addToContainer(Aspect tt, int am) {
|
||||
int out = 0;
|
||||
if (this.aspects.getAmount(tt) + am > this.aspectsBase.getAmount(tt)) {
|
||||
out = this.aspects.getAmount(tt) + am - this.aspectsBase.getAmount(tt);
|
||||
}
|
||||
this.aspects.add(tt, am - out);
|
||||
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||
markDirty();
|
||||
return out;
|
||||
}
|
||||
|
||||
public boolean takeFromContainer(Aspect tt, int am) {
|
||||
if (this.aspects.getAmount(tt) >= am) {
|
||||
this.aspects.remove(tt, am);
|
||||
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||
markDirty();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean takeFromContainer(AspectList ot) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean doesContainerContainAmount(Aspect tag, int amt) {
|
||||
if (this.aspects.getAmount(tag) >= amt) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean doesContainerContain(AspectList ot) {
|
||||
for (Aspect tt : ot.getAspects()) {
|
||||
if (this.aspects.getAmount(tt) < ot.getAmount(tt)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public int containerContains(Aspect tag) {
|
||||
return this.aspects.getAmount(tag);
|
||||
}
|
||||
|
||||
public NodeType getNodeType() {
|
||||
return this.nodeType;
|
||||
}
|
||||
|
||||
public void setNodeType(NodeType nodeType) {
|
||||
this.nodeType = nodeType;
|
||||
}
|
||||
|
||||
public void setNodeModifier(NodeModifier nodeModifier) {
|
||||
this.nodeModifier = nodeModifier;
|
||||
}
|
||||
|
||||
public NodeModifier getNodeModifier() {
|
||||
return this.nodeModifier;
|
||||
}
|
||||
|
||||
public ExtendedNodeType getExtendedNodeType() {
|
||||
return extendedNodeType;
|
||||
}
|
||||
|
||||
public void setExtendedNodeType(ExtendedNodeType extendedNodeType) {
|
||||
this.extendedNodeType = extendedNodeType;
|
||||
}
|
||||
|
||||
public int getNodeVisBase(Aspect aspect) {
|
||||
return this.aspectsBase.getAmount(aspect);
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setNodeVisBase(Aspect aspect, short nodeVisBase) {
|
||||
if (this.aspectsBase.getAmount(aspect) < nodeVisBase) {
|
||||
this.aspectsBase.merge(aspect, nodeVisBase);
|
||||
} else {
|
||||
this.aspectsBase.reduce(aspect, this.aspectsBase.getAmount(aspect) - nodeVisBase);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean receiveClientEvent(int i, int j) {
|
||||
if (i == 9) {
|
||||
if (this.worldObj.isRemote) {
|
||||
for (int yy = -1; yy < 3; yy++) {
|
||||
for (int xx = -1; xx < 2; xx++) {
|
||||
for (int zz = -1; zz < 2; zz++) {
|
||||
Thaumcraft.proxy.blockSparkle(this.worldObj, this.xCoord + xx, this.yCoord + yy, this.zCoord + zz, -9999, 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.animate = (System.currentTimeMillis() + 1000L);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return super.receiveClientEvent(i, j);
|
||||
}
|
||||
|
||||
public boolean drop = true;
|
||||
|
||||
public int onWandRightClick(World world, ItemStack wandstack, EntityPlayer player, int x, int y, int z, int side, int md) {
|
||||
if (!world.isRemote) {
|
||||
this.drop = false;
|
||||
world.setBlock(x, y, z, ConfigBlocks.blockAiry, 0, 3);
|
||||
TileExtendedNode tn = (TileExtendedNode) world.getTileEntity(x, y, z);
|
||||
if (tn != null) {
|
||||
tn.setAspects(getAspects());
|
||||
tn.setNodeModifier(getNodeModifier());
|
||||
tn.setNodeType(getNodeType());
|
||||
tn.setExtendedNodeType(getExtendedNodeType());
|
||||
new Injector(tn, TileNode.class).setField("id", getId());
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
tn.markDirty();
|
||||
}
|
||||
}
|
||||
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(ConfigBlocks.blockJar) + 61440);
|
||||
player.worldObj.playSound(x + 0.5D, y + 0.5D, z + 0.5D, "random.glass", 1.0F, 0.9F + player.worldObj.rand.nextFloat() * 0.2F, false);
|
||||
player.swingItem();
|
||||
return 0;
|
||||
}
|
||||
|
||||
public ItemStack onWandRightClick(World world, ItemStack wandstack, EntityPlayer player) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void onUsingWandTick(ItemStack wandstack, EntityPlayer player, int count) {
|
||||
}
|
||||
|
||||
public void onWandStoppedUsing(ItemStack wandstack, World world, EntityPlayer player, int count) {
|
||||
}
|
||||
|
||||
public boolean doesContainerAccept(Aspect tag) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
package makeo.gadomancy.common.items;
|
||||
|
||||
import makeo.gadomancy.common.blocks.tiles.ExtendedNodeType;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileExtendedNodeJar;
|
||||
import makeo.gadomancy.common.registration.RegisteredBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagInt;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.aspects.IEssentiaContainerItem;
|
||||
import thaumcraft.api.nodes.NodeModifier;
|
||||
import thaumcraft.api.nodes.NodeType;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.blocks.ItemJarNode;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumcraft.common.tiles.TileJarNode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
* <p/>
|
||||
* Original created by Azanor@Thaumcraft: thaumcraft.common.blocks.ItemJarNode
|
||||
* Modified to create compatibility with ExtendedNodes
|
||||
* Created by HellFirePvP @ 25.10.2015 22:33
|
||||
*/
|
||||
public class ItemExtendedNodeJar extends Item implements IEssentiaContainerItem {
|
||||
|
||||
public ItemExtendedNodeJar() {
|
||||
setMaxDamage(0);
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName("ItemExtendedNodeJar");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister p_94581_1_) {}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass) {
|
||||
return ((ItemJarNode) ConfigItems.itemJarNode).icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int dmg) {
|
||||
return ((ItemJarNode) ConfigItems.itemJarNode).icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int meta) {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
String desc = "§9" + StatCollector.translateToLocal("nodetype." + getNodeType(stack) + ".name");
|
||||
if(getExtendedNodeType(stack) != null) {
|
||||
desc = desc + ", " + StatCollector.translateToLocal("gadomancy.nodes." + getExtendedNodeType(stack));
|
||||
}
|
||||
if (getNodeModifier(stack) != null) {
|
||||
desc = desc + ", " + StatCollector.translateToLocal("nodemod." + getNodeModifier(stack) + ".name");
|
||||
}
|
||||
list.add(desc);
|
||||
AspectList aspects = getAspects(stack);
|
||||
if ((aspects != null) && (aspects.size() > 0)) {
|
||||
for (Aspect tag : aspects.getAspectsSorted()) {
|
||||
if (Thaumcraft.proxy.playerKnowledge.hasDiscoveredAspect(player.getCommandSenderName(), tag)) {
|
||||
list.add(tag.getName() + " x " + aspects.getAmount(tag));
|
||||
} else {
|
||||
list.add(StatCollector.translateToLocal("tc.aspect.unknown"));
|
||||
}
|
||||
}
|
||||
}
|
||||
super.addInformation(stack, player, list, par4);
|
||||
}
|
||||
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float par8, float par9, float par10) {
|
||||
Block var11 = world.getBlock(x, y, z);
|
||||
if (var11 == Blocks.snow_layer) {
|
||||
side = 1;
|
||||
} else if ((var11 != Blocks.vine) && (var11 != Blocks.tallgrass) && (var11 != Blocks.deadbush) && ((var11.isAir(world, x, y, z)) || (!var11.isReplaceable(world, x, y, z)))) {
|
||||
if (side == 0) {
|
||||
y--;
|
||||
}
|
||||
if (side == 1) {
|
||||
y++;
|
||||
}
|
||||
if (side == 2) {
|
||||
z--;
|
||||
}
|
||||
if (side == 3) {
|
||||
z++;
|
||||
}
|
||||
if (side == 4) {
|
||||
x--;
|
||||
}
|
||||
if (side == 5) {
|
||||
x++;
|
||||
}
|
||||
}
|
||||
if (stack.stackSize == 0) {
|
||||
return false;
|
||||
}
|
||||
if (!player.canPlayerEdit(x, y, z, side, stack)) {
|
||||
return false;
|
||||
}
|
||||
if ((y == 255) && (RegisteredBlocks.blockExtendedNodeJar.getMaterial().isSolid())) {
|
||||
return false;
|
||||
}
|
||||
if (world.canPlaceEntityOnSide(RegisteredBlocks.blockExtendedNodeJar, x, y, z, false, side, player, stack)) {
|
||||
Block var12 = RegisteredBlocks.blockExtendedNodeJar;
|
||||
int var13 = 2;
|
||||
int var14 = RegisteredBlocks.blockExtendedNodeJar.onBlockPlaced(world, x, y, z, side, par8, par9, par10, var13);
|
||||
if (placeBlockAt(stack, player, world, x, y, z, side, par8, par9, par10, var14)) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
|
||||
if ((te != null) && ((te instanceof TileExtendedNodeJar))) {
|
||||
if (stack.hasTagCompound()) {
|
||||
AspectList aspects = getAspects(stack);
|
||||
if (aspects != null) {
|
||||
((TileExtendedNodeJar) te).setAspects(aspects);
|
||||
((TileExtendedNodeJar) te).setNodeType(getNodeType(stack));
|
||||
((TileExtendedNodeJar) te).setNodeModifier(getNodeModifier(stack));
|
||||
((TileExtendedNodeJar) te).setExtendedNodeType(getExtendedNodeType(stack));
|
||||
((TileExtendedNodeJar) te).setId(getNodeId(stack));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, var12.stepSound.getStepResourcePath(), (var12.stepSound.getVolume() + 1.0F) / 2.0F, var12.stepSound.getPitch() * 0.8F);
|
||||
stack.stackSize -= 1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
|
||||
if (!world.setBlock(x, y, z, RegisteredBlocks.blockExtendedNodeJar, metadata, 3)) {
|
||||
return false;
|
||||
}
|
||||
if (world.getBlock(x, y, z) == RegisteredBlocks.blockExtendedNodeJar) {
|
||||
RegisteredBlocks.blockExtendedNodeJar.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
RegisteredBlocks.blockExtendedNodeJar.onPostBlockPlaced(world, x, y, z, metadata);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AspectList getAspects(ItemStack itemstack) {
|
||||
if (itemstack.hasTagCompound()) {
|
||||
AspectList aspects = new AspectList();
|
||||
aspects.readFromNBT(itemstack.getTagCompound());
|
||||
return aspects.size() > 0 ? aspects : null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAspects(ItemStack itemstack, AspectList aspects) {
|
||||
if (!itemstack.hasTagCompound()) {
|
||||
itemstack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
aspects.writeToNBT(itemstack.getTagCompound());
|
||||
}
|
||||
|
||||
public void setNodeAttributes(ItemStack itemstack, NodeType type, NodeModifier mod, ExtendedNodeType extendedNodeType, String id) {
|
||||
if (!itemstack.hasTagCompound()) {
|
||||
itemstack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
itemstack.setTagInfo("nodetype", new NBTTagInt(type.ordinal()));
|
||||
if (mod != null) {
|
||||
itemstack.setTagInfo("nodemod", new NBTTagInt(mod.ordinal()));
|
||||
}
|
||||
if(extendedNodeType != null) {
|
||||
itemstack.setTagInfo("nodeExMod", new NBTTagInt(extendedNodeType.ordinal()));
|
||||
}
|
||||
itemstack.setTagInfo("nodeid", new NBTTagString(id));
|
||||
}
|
||||
|
||||
public ExtendedNodeType getExtendedNodeType(ItemStack itemStack) {
|
||||
if (!itemStack.hasTagCompound() || (!itemStack.getTagCompound().hasKey("nodeExMod"))) {
|
||||
return null;
|
||||
}
|
||||
return ExtendedNodeType.values()[itemStack.getTagCompound().getInteger("nodeExMod")];
|
||||
}
|
||||
|
||||
public NodeType getNodeType(ItemStack itemstack) {
|
||||
if (!itemstack.hasTagCompound()) {
|
||||
return null;
|
||||
}
|
||||
return NodeType.values()[itemstack.getTagCompound().getInteger("nodetype")];
|
||||
}
|
||||
|
||||
public NodeModifier getNodeModifier(ItemStack itemstack) {
|
||||
if ((!itemstack.hasTagCompound()) || (!itemstack.getTagCompound().hasKey("nodemod"))) {
|
||||
return null;
|
||||
}
|
||||
return NodeModifier.values()[itemstack.getTagCompound().getInteger("nodemod")];
|
||||
}
|
||||
|
||||
public String getNodeId(ItemStack itemstack) {
|
||||
if (!itemstack.hasTagCompound()) {
|
||||
return "0";
|
||||
}
|
||||
return itemstack.getTagCompound().getString("nodeid");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.network.packets.PacketAnimationAbsorb;
|
||||
import makeo.gadomancy.common.network.packets.PacketStartAnimation;
|
||||
import makeo.gadomancy.common.network.packets.PacketTCNodeBolt;
|
||||
import makeo.gadomancy.common.network.packets.PacketUpdateGolemTypeOrder;
|
||||
|
||||
/**
|
||||
@@ -25,5 +26,6 @@ public class PacketHandler {
|
||||
INSTANCE.registerMessage(PacketUpdateGolemTypeOrder.class, PacketUpdateGolemTypeOrder.class, id++, Side.CLIENT);
|
||||
INSTANCE.registerMessage(PacketStartAnimation.class, PacketStartAnimation.class, id++, Side.CLIENT);
|
||||
INSTANCE.registerMessage(PacketAnimationAbsorb.class, PacketAnimationAbsorb.class, id++, Side.CLIENT);
|
||||
INSTANCE.registerMessage(PacketTCNodeBolt.class, PacketTCNodeBolt.class, id++, Side.CLIENT);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import makeo.gadomancy.client.util.MultiTickEffectDispatcher;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -58,7 +59,9 @@ public class PacketAnimationAbsorb implements IMessage, IMessageHandler<PacketAn
|
||||
public IMessage onMessage(PacketAnimationAbsorb p, MessageContext ctx) {
|
||||
Block b = Minecraft.getMinecraft().theWorld.getBlock(p.targetX, p.targetY, p.targetZ);
|
||||
int md = Minecraft.getMinecraft().theWorld.getBlockMetadata(p.targetX, p.targetY, p.targetZ);
|
||||
Thaumcraft.proxy.boreDigFx(Minecraft.getMinecraft().theWorld, (int) p.x, (int) p.y, (int) p.z, p.targetX, p.targetY, p.targetZ, b, md);
|
||||
MultiTickEffectDispatcher.VortexDigInfo info =
|
||||
new MultiTickEffectDispatcher.VortexDigInfo(Minecraft.getMinecraft().theWorld.provider.dimensionId, (int) p.x, (int) p.y, (int) p.z, p.targetX, p.targetY, p.targetZ, b, md);
|
||||
MultiTickEffectDispatcher.registerVortexDig(info);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package makeo.gadomancy.common.network.packets;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
* <p/>
|
||||
* Created by HellFirePvP @ 25.10.2015 19:42
|
||||
*/
|
||||
public class PacketTCNodeBolt implements IMessage, IMessageHandler<PacketTCNodeBolt, IMessage> {
|
||||
|
||||
private float x, y, z;
|
||||
private float targetX, targetY, targetZ;
|
||||
|
||||
public PacketTCNodeBolt() {}
|
||||
|
||||
public PacketTCNodeBolt(float x, float y, float z, float targetX, float targetY, float targetZ) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.targetX = targetX;
|
||||
this.targetY = targetY;
|
||||
this.targetZ = targetZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
this.x = buf.readFloat();
|
||||
this.y = buf.readFloat();
|
||||
this.z = buf.readFloat();
|
||||
this.targetX = buf.readFloat();
|
||||
this.targetY = buf.readFloat();
|
||||
this.targetZ = buf.readFloat();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
buf.writeFloat(x);
|
||||
buf.writeFloat(y);
|
||||
buf.writeFloat(z);
|
||||
buf.writeFloat(targetX);
|
||||
buf.writeFloat(targetY);
|
||||
buf.writeFloat(targetZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketTCNodeBolt p, MessageContext ctx) {
|
||||
Thaumcraft.proxy.nodeBolt(Minecraft.getMinecraft().theWorld, p.x, p.y, p.z, p.targetX, p.targetY, p.targetZ);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
package makeo.gadomancy.common.registration;
|
||||
|
||||
import cpw.mods.fml.common.registry.ExistingSubstitutionException;
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import makeo.gadomancy.api.ClickBehavior;
|
||||
import makeo.gadomancy.common.blocks.BlockArcaneDropper;
|
||||
import makeo.gadomancy.common.blocks.BlockExtendedNodeJar;
|
||||
import makeo.gadomancy.common.blocks.BlockInfusionClaw;
|
||||
import makeo.gadomancy.common.blocks.BlockNode;
|
||||
import makeo.gadomancy.common.blocks.BlockRemoteJar;
|
||||
import makeo.gadomancy.common.blocks.BlockStickyJar;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileArcaneDropper;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileExtendedNode;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileExtendedNodeJar;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileInfusionClaw;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileRemoteJar;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileStickyJar;
|
||||
@@ -39,12 +39,14 @@ public class RegisteredBlocks {
|
||||
private RegisteredBlocks() {}
|
||||
|
||||
public static int rendererTransparentBlock;
|
||||
public static int rendererExtendedNodeJarBlock;
|
||||
|
||||
public static BlockStickyJar blockStickyJar;
|
||||
public static BlockArcaneDropper blockArcaneDropper;
|
||||
public static BlockInfusionClaw blockInfusionClaw;
|
||||
public static BlockRemoteJar blockRemoteJar;
|
||||
public static BlockNode blockNode;
|
||||
public static BlockExtendedNodeJar blockExtendedNodeJar;
|
||||
|
||||
public static void init() {
|
||||
registerBlocks();
|
||||
@@ -61,7 +63,8 @@ public class RegisteredBlocks {
|
||||
blockArcaneDropper = registerBlock(new BlockArcaneDropper());
|
||||
blockInfusionClaw = registerBlock(new BlockInfusionClaw());
|
||||
blockRemoteJar = registerBlock(new BlockRemoteJar(), ItemBlockRemoteJar.class);
|
||||
blockNode = (BlockNode) new BlockNode().setBlockName("blockAiry").setCreativeTab(Thaumcraft.tabTC);
|
||||
blockNode = (BlockNode) new BlockNode().setBlockName("blockAiry");
|
||||
blockExtendedNodeJar = registerBlock(new BlockExtendedNodeJar());
|
||||
}
|
||||
|
||||
private static <T extends Block> T registerBlock(String name, T block) {
|
||||
@@ -93,6 +96,7 @@ public class RegisteredBlocks {
|
||||
registerTile(TileInfusionClaw.class);
|
||||
registerTile(TileRemoteJar.class);
|
||||
registerTile(TileExtendedNode.class);
|
||||
registerTile(TileExtendedNodeJar.class);
|
||||
}
|
||||
|
||||
private static void registerTile(Class<? extends TileEntity> tile, String name) {
|
||||
|
||||
@@ -4,7 +4,6 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.items.*;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
@@ -31,6 +30,7 @@ public class RegisteredItems {
|
||||
public static Item itemFakeGolemPlacer;
|
||||
public static Item itemTransformationFocus;
|
||||
public static Item itemGolemCoreBreak;
|
||||
public static Item itemExtendedNodeJar;
|
||||
|
||||
@Deprecated
|
||||
public static Item itemBlockAiryCopy; //!!!!!!!!!!DO NOT TOUCH THIS OR USE THIS ANYWHERE!!!!!!!!!!
|
||||
@@ -57,6 +57,7 @@ public class RegisteredItems {
|
||||
itemFakeGolemShield = registerItem(new ItemFakeGolemShield());
|
||||
itemTransformationFocus = registerItem(new ItemTransformationFocus());
|
||||
itemGolemCoreBreak = registerItem(new ItemGolemCoreBreak());
|
||||
itemExtendedNodeJar = registerItem(new ItemExtendedNodeJar());
|
||||
}
|
||||
|
||||
private static <T extends Item> T registerItem(T item, String name) {
|
||||
|
||||
@@ -5,16 +5,22 @@ import makeo.gadomancy.common.blocks.tiles.TileExtendedNode;
|
||||
import makeo.gadomancy.common.network.PacketHandler;
|
||||
import makeo.gadomancy.common.network.packets.PacketAnimationAbsorb;
|
||||
import makeo.gadomancy.common.network.packets.PacketStartAnimation;
|
||||
import makeo.gadomancy.common.network.packets.PacketTCNodeBolt;
|
||||
import makeo.gadomancy.common.registration.RegisteredBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.lib.utils.Utils;
|
||||
import thaumcraft.common.lib.world.ThaumcraftWorldGenerator;
|
||||
import thaumcraft.common.tiles.TileNode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -24,7 +30,7 @@ import java.util.List;
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
* <p/>
|
||||
*
|
||||
* Created by HellFirePvP @ 25.10.2015 10:17
|
||||
*/
|
||||
public class ExplosionHelper {
|
||||
@@ -32,10 +38,10 @@ public class ExplosionHelper {
|
||||
public static void taintplosion(World world, int x, int y, int z, boolean taintBiome, int chanceToTaint) {
|
||||
if(chanceToTaint < 1) chanceToTaint = 1;
|
||||
world.createExplosion(null, x + 0.5D, y + 0.5D, z + 0.5D, 3.0F, false);
|
||||
for (int a = 0; a < 50; a++) {
|
||||
int xx = x + world.rand.nextInt(8) - world.rand.nextInt(8);
|
||||
int yy = y + world.rand.nextInt(8) - world.rand.nextInt(8);
|
||||
int zz = z + world.rand.nextInt(8) - world.rand.nextInt(8);
|
||||
for (int a = 0; a < 80; a++) {
|
||||
int xx = x + world.rand.nextInt(10) - world.rand.nextInt(10);
|
||||
int yy = y + world.rand.nextInt(10) - world.rand.nextInt(10);
|
||||
int zz = z + world.rand.nextInt(10) - world.rand.nextInt(10);
|
||||
if (world.isAirBlock(xx, yy, zz)) {
|
||||
if (yy < y) {
|
||||
world.setBlock(xx, yy, zz, ConfigBlocks.blockFluxGoo, 8, 3);
|
||||
@@ -51,16 +57,15 @@ public class ExplosionHelper {
|
||||
|
||||
public static class VortexExplosion {
|
||||
|
||||
//Phase 0: Lightnings to blocks and entities around
|
||||
//Phase 1: Creating FallingBlocks and drawing them in
|
||||
//Phase END: Shooting all FallingBlocks into random directories around the node + taint explosion around the node
|
||||
private TileExtendedNode causingNode;
|
||||
private int tick;
|
||||
private int phase;
|
||||
private World world;
|
||||
private int x, y, z;
|
||||
private List<Vec3> pastTickBlocks = null;
|
||||
|
||||
public VortexExplosion(TileNode exNode) {
|
||||
public VortexExplosion(TileExtendedNode exNode) {
|
||||
this.causingNode = exNode;
|
||||
this.world = exNode.getWorldObj();
|
||||
this.x = exNode.xCoord;
|
||||
this.y = exNode.yCoord;
|
||||
@@ -70,25 +75,45 @@ public class ExplosionHelper {
|
||||
}
|
||||
|
||||
public void update() {
|
||||
List livingEntities = world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(6.0D, 6.0D, 6.0D));
|
||||
if ((livingEntities != null) && (livingEntities.size() > 0)) {
|
||||
for (Object e : livingEntities) {
|
||||
EntityLivingBase livingEntity = (EntityLivingBase) e;
|
||||
if ((livingEntity.isEntityAlive()) && (!livingEntity.isEntityInvulnerable())) {
|
||||
if(livingEntity instanceof EntityPlayer && ((EntityPlayer) livingEntity).capabilities.isCreativeMode) continue;
|
||||
if(world.rand.nextInt(16) != 0) continue;
|
||||
livingEntity.attackEntityFrom(DamageSource.magic, 4F);
|
||||
PacketTCNodeBolt packet = new PacketTCNodeBolt(x + 0.5F, y + 0.5F, z + 0.5F, (float) livingEntity.posX, (float) (livingEntity.posY + livingEntity.height), (float) livingEntity.posZ);
|
||||
PacketHandler.INSTANCE.sendToAllAround(packet, new NetworkRegistry.TargetPoint(world.provider.dimensionId, x, y, z, 32.0D));
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (phase) {
|
||||
case 0: {
|
||||
tick++;
|
||||
if(tick > 200) {
|
||||
tick = 0;
|
||||
phase = 1;
|
||||
taintplosion(world, x, y, z, false, 1);
|
||||
}
|
||||
|
||||
sendRadomVortexLightningPacket(world, x, y, z);
|
||||
sendRandomVortexLightningPacket(world, x, y, z);
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
tick++;
|
||||
int range = tick > 100 ? tick > 200 ? 8 : 6 : 4;
|
||||
int range = tick > 50 ? tick > 75 ? tick > 100 ? tick > 200 ? tick > 300 ? 9 : 7 : 6 : 5 : 4 : 3;
|
||||
if(pastTickBlocks != null) {
|
||||
for(Vec3 v : pastTickBlocks) {
|
||||
sendRandomVortexLightningPacket(world, x, y, z);
|
||||
world.setBlockToAir((int) v.xCoord, (int) v.yCoord, (int) v.zCoord);
|
||||
}
|
||||
}
|
||||
int ct = world.rand.nextInt(4);
|
||||
while(ct > 0) {
|
||||
ct--;
|
||||
sendRandomVortexLightningPacket(world, x, y, z);
|
||||
}
|
||||
pastTickBlocks = new ArrayList<Vec3>();
|
||||
int cnt = 10;
|
||||
do {
|
||||
@@ -105,16 +130,47 @@ public class ExplosionHelper {
|
||||
cnt--;
|
||||
} while (cnt > 0);
|
||||
|
||||
if(tick > 300) {
|
||||
if(tick == 200) {
|
||||
taintplosion(world, x, y, z, false, 1);
|
||||
}
|
||||
|
||||
if(tick == 300) {
|
||||
taintplosion(world, x, y, z, false, 1);
|
||||
}
|
||||
|
||||
if(tick > 400) {
|
||||
phase = 2;
|
||||
taintplosion(world, x, y, z, true, 5);
|
||||
reduceAspects(causingNode);
|
||||
taintplosion(world, x, y, z, true, 3);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void sendRadomVortexLightningPacket(World world, int x, int y, int z) {
|
||||
private void reduceAspects(TileExtendedNode node) {
|
||||
List<Aspect> lostAspects = new ArrayList<Aspect>();
|
||||
AspectList list = node.getAspectsBase();
|
||||
for(Aspect a : list.getAspects()) {
|
||||
if(world.rand.nextInt(4) == 0) {
|
||||
lostAspects.add(a);
|
||||
} else {
|
||||
list.reduce(a, list.getAmount(a) / 2);
|
||||
}
|
||||
}
|
||||
for(Aspect lost : lostAspects) {
|
||||
node.getAspectsBase().remove(lost);
|
||||
node.getAspects().remove(lost);
|
||||
}
|
||||
list = node.getAspects();
|
||||
for(Aspect a : list.getAspects()) {
|
||||
list.reduce(a, list.getAmount(a) / 2);
|
||||
}
|
||||
node.getWorldObj().markBlockForUpdate(node.xCoord, node.yCoord, node.zCoord);
|
||||
node.markDirty();
|
||||
}
|
||||
|
||||
private void sendRandomVortexLightningPacket(World world, int x, int y, int z) {
|
||||
PacketStartAnimation animationPacket = new PacketStartAnimation(PacketStartAnimation.ID_EX_VORTEX, x, y, z);
|
||||
NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint(world.provider.dimensionId, x, y, z, 32.0D);
|
||||
PacketHandler.INSTANCE.sendToAllAround(animationPacket, point);
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package makeo.gadomancy.common.utils;
|
||||
|
||||
import makeo.gadomancy.common.blocks.tiles.ExtendedNodeType;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileExtendedNode;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileExtendedNodeJar;
|
||||
import makeo.gadomancy.common.registration.RegisteredBlocks;
|
||||
import makeo.gadomancy.common.registration.RegisteredIntegrations;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -82,7 +86,7 @@ public class JarMultiblockHandler {
|
||||
return;
|
||||
|
||||
if(world.isRemote) return;
|
||||
JarMultiblockHandler.replaceTCJar(world, result[0], result[1], result[2]);
|
||||
replaceJar(world, result[0], result[1], result[2], true);
|
||||
}
|
||||
|
||||
private static void tryAutomagyJarNodeCreation(ItemStack wandStack, EntityPlayer player, World world, int x, int y, int z) {
|
||||
@@ -130,7 +134,7 @@ public class JarMultiblockHandler {
|
||||
if(!RegisteredIntegrations.automagy.handleNodeJarVisCost(wandStack, player)) return;
|
||||
|
||||
if(world.isRemote) return;
|
||||
JarMultiblockHandler.replaceAutomagyJar(world, result[0], result[1], result[2]);
|
||||
replaceJar(world, result[0], result[1], result[2], false);
|
||||
}
|
||||
|
||||
private static boolean containsMatch(boolean strict, List<ItemStack> inputs, ItemStack... targets) {
|
||||
@@ -178,87 +182,74 @@ public class JarMultiblockHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
//TODO spawn growingNodeJar and handle renders and such nasty stuff...
|
||||
|
||||
private static void replaceTCJar(World world, int x, int y, int z) {
|
||||
private static void replaceJar(World world, int x, int y, int z, boolean isThaumcraft) {
|
||||
int[][][] blueprint = {{{1, 1, 1}, {1, 1, 1}, {1, 1, 1}}, {{2, 2, 2}, {2, 2, 2}, {2, 2, 2}}, {{2, 2, 2}, {2, 3, 2}, {2, 2, 2}}, {{2, 2, 2}, {2, 2, 2}, {2, 2, 2}}};
|
||||
for (int yy = 0; yy < 4; yy++) {
|
||||
for (int xx = 0; xx < 3; xx++) {
|
||||
for (int zz = 0; zz < 3; zz++) {
|
||||
if (blueprint[yy][xx][zz] == 3) {
|
||||
TileEntity tile = world.getTileEntity(x + xx, y - yy + 2, z + zz);
|
||||
INode node = (INode) tile;
|
||||
AspectList na = node.getAspects().copy();
|
||||
int nt = node.getNodeType().ordinal();
|
||||
int nm = -1;
|
||||
if (node.getNodeModifier() != null) {
|
||||
nm = node.getNodeModifier().ordinal();
|
||||
}
|
||||
if (world.rand.nextFloat() < 0.75F) {
|
||||
if (node.getNodeModifier() == null) {
|
||||
nm = NodeModifier.PALE.ordinal();
|
||||
} else if (node.getNodeModifier() == NodeModifier.BRIGHT) {
|
||||
nm = -1;
|
||||
} else if (node.getNodeModifier() == NodeModifier.PALE) {
|
||||
nm = NodeModifier.FADING.ordinal();
|
||||
}
|
||||
}
|
||||
String nid = node.getId();
|
||||
node.setAspects(new AspectList());
|
||||
world.removeTileEntity(x + xx, y - yy + 2, z + zz);
|
||||
world.setBlock(x + xx, y - yy + 2, z + zz, ConfigBlocks.blockJar, 2, 3);
|
||||
tile = world.getTileEntity(x + xx, y - yy + 2, z + zz);
|
||||
TileJarNode jar = (TileJarNode) tile;
|
||||
jar.setAspects(na);
|
||||
if (nm >= 0) {
|
||||
jar.setNodeModifier(NodeModifier.values()[nm]);
|
||||
}
|
||||
jar.setNodeType(NodeType.values()[nt]);
|
||||
jar.setId(nid);
|
||||
world.addBlockEvent(x + xx, y - yy + 2, z + zz, ConfigBlocks.blockJar, 9, 0);
|
||||
handleJarForming(world, x, y, z, xx, yy, zz, isThaumcraft);
|
||||
} else {
|
||||
world.setBlockToAir(x + xx, y - yy + 2, z + zz);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "thaumcraft:wand", 1.0F, 1.0F);
|
||||
if(isThaumcraft) world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "thaumcraft:wand", 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
private static void replaceAutomagyJar(World world, int x, int y, int z) {
|
||||
int[][][] blueprint = {{{1, 1, 1}, {1, 1, 1}, {1, 1, 1}}, {{2, 2, 2}, {2, 2, 2}, {2, 2, 2}}, {{2, 2, 2}, {2, 3, 2}, {2, 2, 2}}, {{2, 2, 2}, {2, 2, 2}, {2, 2, 2}}};
|
||||
for (int yy = 0; yy < 4; yy++) {
|
||||
for (int xx = 0; xx < 3; xx++) {
|
||||
for (int zz = 0; zz < 3; zz++) {
|
||||
int index = blueprint[yy][xx][zz];
|
||||
if (index == 3) {
|
||||
TileEntity tile = world.getTileEntity(x + xx, y - yy + 2, z + zz);
|
||||
INode node = (INode) tile;
|
||||
AspectList na = node.getAspects().copy();
|
||||
int nt = node.getNodeType().ordinal();
|
||||
int nm = -1;
|
||||
if (node.getNodeModifier() != null) {
|
||||
nm = node.getNodeModifier().ordinal();
|
||||
}
|
||||
String nid = node.getId();
|
||||
node.setAspects(new AspectList());
|
||||
world.removeTileEntity(x + xx, y - yy + 2, z + zz);
|
||||
world.setBlock(x + xx, y - yy + 2, z + zz, ConfigBlocks.blockJar, 2, 3);
|
||||
tile = world.getTileEntity(x + xx, y - yy + 2, z + zz);
|
||||
TileJarNode jar = (TileJarNode) tile;
|
||||
jar.setAspects(na);
|
||||
if (nm >= 0) {
|
||||
jar.setNodeModifier(NodeModifier.values()[nm]);
|
||||
}
|
||||
jar.setNodeType(NodeType.values()[nt]);
|
||||
jar.setId(nid);
|
||||
world.addBlockEvent(x + xx, y - yy + 2, z + zz, ConfigBlocks.blockJar, 9, 0);
|
||||
} else {
|
||||
world.setBlockToAir(x + xx, y - yy + 2, z + zz);
|
||||
}
|
||||
private static void handleJarForming(World world, int x, int y, int z, int xx, int yy, int zz, boolean degrade) {
|
||||
TileEntity tile = world.getTileEntity(x + xx, y - yy + 2, z + zz);
|
||||
INode node = (INode) tile;
|
||||
AspectList na = node.getAspects().copy();
|
||||
int nt = node.getNodeType().ordinal();
|
||||
int nm = -1;
|
||||
int exNt = -1;
|
||||
if (node.getNodeModifier() != null) {
|
||||
nm = node.getNodeModifier().ordinal();
|
||||
}
|
||||
if(tile instanceof TileExtendedNode && ((TileExtendedNode) tile).getExtendedNodeType() != null) {
|
||||
exNt = ((TileExtendedNode) tile).getExtendedNodeType().ordinal();
|
||||
}
|
||||
if(degrade) {
|
||||
if (world.rand.nextFloat() < 0.75F) {
|
||||
if (node.getNodeModifier() == null) {
|
||||
nm = NodeModifier.PALE.ordinal();
|
||||
} else if (node.getNodeModifier() == NodeModifier.BRIGHT) {
|
||||
nm = -1;
|
||||
} else if (node.getNodeModifier() == NodeModifier.PALE) {
|
||||
nm = NodeModifier.FADING.ordinal();
|
||||
}
|
||||
}
|
||||
}
|
||||
String nid = node.getId();
|
||||
node.setAspects(new AspectList());
|
||||
world.removeTileEntity(x + xx, y - yy + 2, z + zz);
|
||||
if(exNt != -1) {
|
||||
world.setBlock(x + xx, y - yy + 2, z + zz, RegisteredBlocks.blockExtendedNodeJar, 0, 3);
|
||||
tile = world.getTileEntity(x + xx, y - yy + 2, z + zz);
|
||||
TileExtendedNodeJar exJar = (TileExtendedNodeJar) tile;
|
||||
exJar.setAspects(na);
|
||||
if (nm >= 0) {
|
||||
exJar.setNodeModifier(NodeModifier.values()[nm]);
|
||||
}
|
||||
exJar.setNodeType(NodeType.values()[nt]);
|
||||
exJar.setExtendedNodeType(ExtendedNodeType.values()[exNt]);
|
||||
exJar.setId(nid);
|
||||
} else {
|
||||
world.setBlock(x + xx, y - yy + 2, z + zz, ConfigBlocks.blockJar, 2, 3);
|
||||
tile = world.getTileEntity(x + xx, y - yy + 2, z + zz);
|
||||
TileJarNode jar = (TileJarNode) tile;
|
||||
jar.setAspects(na);
|
||||
if (nm >= 0) {
|
||||
jar.setNodeModifier(NodeModifier.values()[nm]);
|
||||
}
|
||||
jar.setNodeType(NodeType.values()[nt]);
|
||||
jar.setId(nid);
|
||||
}
|
||||
|
||||
//TC does nothing here tho...
|
||||
world.addBlockEvent(x + xx, y - yy + 2, z + zz, ConfigBlocks.blockJar, 9, 0);
|
||||
}
|
||||
|
||||
public abstract static class JarPieceEvaluationRunnable {
|
||||
|
||||
Reference in new issue
Block a user