thaumcraft.api.nodes.NodeType Java Examples
The following examples show how to use
thaumcraft.api.nodes.NodeType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ItemNodeRenderer.java From Gadomancy with GNU Lesser General Public License v3.0 | 6 votes |
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))) { GL11.glTranslatef(0.0F, 0.0F, -0.5F); } TileNode tjf = new TileNode(); tjf.setAspects(aspects); tjf.setNodeType(nodeType); tjf.blockType = ConfigBlocks.blockAiry; tjf.blockMetadata = 0; GL11.glPushMatrix(); GL11.glTranslated(0.5D, 0.5D, 0.5D); GL11.glScaled(2.0D, 2.0D, 2.0D); renderItemNode(tjf); GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); renderItemNode(tjf); GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); renderItemNode(tjf); GL11.glPopMatrix(); GL11.glEnable(32826); }
Example #2
Source File: ExtendedTypeDisplayManager.java From Gadomancy with GNU Lesser General Public License v3.0 | 6 votes |
public static void notifyDisplayTick(String id, NodeType nodeType, ExtendedNodeType extendedNodeType) { currTime = 0; if(currentNodeId != null && !currentNodeId.equals(id)) { //New node. resetLanguageFile(); } if(!changedLanguageFile) { String toChance = "nodetype." + nodeType + ".name"; String name = StatCollector.translateToLocal(toChance); String growingStr = StatCollector.translateToLocal("gadomancy.nodes." + extendedNodeType.name()); String newName = name + ", " + growingStr; ResourceReloadListener.languageList.put(toChance, newName); oldName = name; changedEntry = toChance; changedLanguageFile = true; currentNodeId = id; } }
Example #3
Source File: ItemCreativeNode.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advancedItemTooltips) { int metadata = stack.getItemDamage(); if(metadata == 0) { list.add("\u00a75Place a huge and bright aura node"); } else { list.add("\u00a75Place a node of type " + NodeType.values()[metadata].name().toLowerCase()); } list.add("\u00a7oCreative Mode Only"); }
Example #4
Source File: TileExtendedNodeJar.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
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); if(nbttagcompound.hasKey("Behavior")) { behaviorSnapshot = nbttagcompound.getCompoundTag("Behavior"); } }
Example #5
Source File: ItemCreativeNode.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
@Override public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { ForgeDirection dir = ForgeDirection.getOrientation(side); x += dir.offsetX; y += dir.offsetY; z += dir.offsetZ; if(placeRandomNode(world, x, y, z)) { int metadata = stack.getItemDamage(); TileNode node = (TileNode) world.getTileEntity(x, y, z); if(metadata == 0) { node.setNodeType(NodeType.NORMAL); node.setNodeModifier(NodeModifier.BRIGHT); AspectList aspects = new AspectList(); for(Aspect primal : Aspect.getPrimalAspects()) { aspects.add(primal, 500); } node.setAspects(aspects); node.markDirty(); world.markBlockForUpdate(x, y, z); } else { node.setNodeType(NodeType.values()[metadata]); } return true; } return false; }
Example #6
Source File: RegisteredManipulations.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
@Override public boolean affect(World world, INode node) { NodeType newType = node.getNodeType(); int random = world.rand.nextInt(40); if(random > 38) { if(node instanceof TileExtendedNode) { TileExtendedNode tNode = (TileExtendedNode) node; if(!(tNode.getExtendedNodeType() != null && tNode.getExtendedNodeType().equals(ExtendedNodeType.GROWING))) { newType = NodeType.HUNGRY; //1 of 40 } } else { newType = NodeType.HUNGRY; //1 of 40 } } else if(random > 37) { newType = NodeType.TAINTED; //1 of 40 } else if(random > 34) { newType = NodeType.UNSTABLE; //3 of 40 } else if(random > 29) { newType = NodeType.DARK; //5 of 40 } else if(random > 24) { newType = NodeType.PURE; //5 of 40 } else if(random > 14) { newType = NodeType.NORMAL; //10 of 40 } //15 of 40 chance nothing happens boolean changed = !newType.equals(node.getNodeType()); if(changed) node.setNodeType(newType); return changed; }
Example #7
Source File: RegisteredManipulations.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
@Override public boolean affect(World world, INode inode) { if(!(inode instanceof TileExtendedNode)) return false; TileExtendedNode node = (TileExtendedNode) inode; boolean isGrowingAlready = node.getExtendedNodeType() != null && node.getExtendedNodeType().equals(ExtendedNodeType.GROWING); if(isGrowingAlready) if(node.getNodeType().equals(NodeType.HUNGRY)) isGrowingAlready = false; if(!isGrowingAlready) { node.setExtendedNodeType(ExtendedNodeType.GROWING); ResearchHelper.distributeResearch(Gadomancy.MODID.toUpperCase() + ".GROWING", node.getWorldObj(), node.xCoord, node.yCoord, node.zCoord, 12); } return isGrowingAlready; }
Example #8
Source File: ItemExtendedNodeJar.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
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)); }
Example #9
Source File: TileEntityPortableNode.java From Electro-Magic-Tools with GNU General Public License v3.0 | 4 votes |
@Override public NodeType getNodeType() { return NodeType.UNSTABLE; }
Example #10
Source File: AdapterNode.java From OpenPeripheral-Integration with MIT License | 4 votes |
@ScriptCallable(returnTypes = ReturnType.STRING, description = "Get the type of the node") public String getNodeType(INode node) { NodeType nodeType = node.getNodeType(); return (nodeType != null? nodeType.name() : NONE); }
Example #11
Source File: ItemCreativeNode.java From Gadomancy with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void getSubItems(Item item, CreativeTabs tab, List list) { for(int i = 0; i < NodeType.values().length; i++) { list.add(new ItemStack(item, 1, i)); } }
Example #12
Source File: ItemExtendedNodeJar.java From Gadomancy with GNU Lesser General Public License v3.0 | 4 votes |
public NodeType getNodeType(ItemStack itemstack) { if (!itemstack.hasTagCompound()) { return null; } return NodeType.values()[itemstack.getTagCompound().getInteger("nodetype")]; }
Example #13
Source File: TileExtendedNodeJar.java From Gadomancy with GNU Lesser General Public License v3.0 | 4 votes |
public void setNodeType(NodeType nodeType) { this.nodeType = nodeType; }
Example #14
Source File: TileExtendedNodeJar.java From Gadomancy with GNU Lesser General Public License v3.0 | 4 votes |
public NodeType getNodeType() { return this.nodeType; }
Example #15
Source File: WandHandler.java From Gadomancy with GNU Lesser General Public License v3.0 | 4 votes |
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; NBTTagCompound behaviorSnapshot = null; if (node.getNodeModifier() != null) { nm = node.getNodeModifier().ordinal(); } if(tile instanceof TileExtendedNode && ((TileExtendedNode) tile).getExtendedNodeType() != null) { exNt = ((TileExtendedNode) tile).getExtendedNodeType().ordinal(); behaviorSnapshot = ((TileExtendedNode) tile).getBehaviorSnapshot(); } 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]); if(behaviorSnapshot != null) { exJar.setBehaviorSnapshot(behaviorSnapshot); } exJar.setId(nid); world.addBlockEvent(x + xx, y - yy + 2, z + zz, RegisteredBlocks.blockExtendedNodeJar, 9, 0); } 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); world.addBlockEvent(x + xx, y - yy + 2, z + zz, ConfigBlocks.blockJar, 9, 0); } }
Example #16
Source File: ItemCreativeNodeRenderer.java From Gadomancy with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { makeo.gadomancy.client.renderers.item.ItemNodeRenderer.renderNodeItem(type, item, ASPECTS, NodeType.values()[item.getItemDamage()], null, data); }
Example #17
Source File: ItemNodeRenderer.java From Gadomancy with GNU Lesser General Public License v3.0 | 4 votes |
public static void renderNodeItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) { renderNodeItem(type, item, aspects, NodeType.NORMAL, null, data); }