Jump to content

GotoLink

Members
  • Posts

    2012
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by GotoLink

  1. if(world.getBlockId(x-1, y, z) == this.blockID) if(world.getBlockId(x+1, y, z) == this.blockID) if(world.getBlockId(x, y, z-1) == this.blockID) if(world.getBlockId(x, y, z+1) == this.blockID) if(world.getBlockId(x+1, y, z+1) == this.blockID) if(world.getBlockId(x-1, y, z-1) == this.blockID) if(world.getBlockId(x-1, y, z+1) == this.blockID) { if(world.getBlockId(x+1, y, z-1) == this.blockID) { return textures[36]; } else { return textures[43]; } ///other code }}}}}}} Better, just check the surrounding first: List list = new ArrayList(); for(int i=x-1; i<x+2; i++) for(int j=y-1; j<y+2; j++) for(int k=z-1; k<z+2; k++) if((i!=x || j!=y || k!=z) && world.getBlockId(i,j,k) == this.blockID)//Find which neighbour block has same id list.add(new int[]{i,j,k}); Iterator itr = list.iterator(); while(itr.hasNext()) { int[] pos = (int[]) itr.next(); if(pos[1]>y) hasUpperNeighbour = true; else if(pos[1<y) hasLowerNeighbour = true; if(pos[0]>x) hasNorthNeighbour = true; else if(pos[0]<x) hasSouthNeighbour = true; if(pos[2]>z) hasEastNeighbour = true; else if(pos[2]<z) hasWestNeighbour = true; } if(hasUpperNeighbour) { if(hasLowerNeighbour) //... } else if(hasLowerNeighbour) { //... } else { //... }
  2. What is the "right" position ? Note that slots positions are determined in the Container class, not by the Gui
  3. You don't call an event, unless you want someone else to catch it. You register to the event, to receive the calls.
  4. Because i am only making a client-side mod. Why would i want to make my mod require a specific server plugin as well? I simply want to show a client-side gui since my mod does not affect the server whatsoever. Then why do you want to use chat commands ? By staying on client side, you can handle any client input, why use something that make client interact with server ? Just build your own chat GUI, if you want it to look like the chat command. You can open it with your own key, and then handle any input message locally.
  5. Can't you chain if statement instead of checking...8 conditions inside each one ? It will be a lot easier to read and find the issue.
  6. Fixes: Render class Main mod file @EventHandler public void init(FMLInitializationEvent e) { EntityRegistry.addSpawn(EntityTest.class, 6, 2, 4, EnumCreatureType.creature); EntityRegistry.registerEntity(EntityTest.class, "Test", 1,this, 40,3,false ); EntityList.entityEggs.put(1, new EntityEggInfo(1, 0xFFFFFF, 0x000000); //RenderingRegistry.registerEntityRenderingHandler(EntityTest.class, new RenderTest(new ModelBiped(), 2F));TODO:Put on client side } } [/spoiler]
  7. I fixed the issue in my code I hope it will easier for future readers this way. public static List getItemDataList(){ NBTTagList itemList = new NBTTagList(); GameData.writeItemData(itemList);//writes data from idMap in GameData to given Taglist List<ItemData> data=new ArrayList(); NBTBase base; for(int i =0; i< itemList.tagCount; i++) { base = itemList.tagAt(i);//gets back the Tags from itemList if(base instanceof NBTTagCompound)//found a Compound type of Tag data.add(new ItemData((NBTTagCompound)base));//builds an ItemData instance from the Compound Tag, and adds it to data list } return data; } Then you can extract desired info from the data list Iterator itr = getItemDataList().iterator(); while(itr.hasNext()) { ItemData iData = (ItemData) itr.next(); iData.getModId();//mod id iData.getItemType();//item name at registration iData.getItemId();//item id }
  8. new ResourceLocation("textures/entity/Creep.png"); Where did you put that texture ?
  9. Usually you only use one of them. Can you post both code ?
  10. worldObj.playSoundAtEntity(this, "griffinimod:shot", 1.0F, 1.0F); This should work, assuming you have sound at: mcp/src/minecraft/assets/griffinimod/sound/shot.ogg
  11. public String getArmorTextureFile(ItemStack itemstack) I am pretty sure this method do not exist anymore in 1.6. Change to the following: public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer)
  12. Do you use a TileEntityRenderer or a BlockRenderer ? Did you change some methods regarding rendering and icons in your block class ?
  13. I'd say you forgot to bind a texture before rendering your model.
  14. Modify your first post, you can change the title here.
  15. This is probably a bug from this old version. Use a more recent one.
  16. What I would do: Minecraft mc = Minecraft.getMinecraft(); boolean changed = false; @Override public void tickEnd(EnumSet<TickType> type, Object... tickData) { if(type.contains(TickType.RENDER) && mc.thePlayer!=null){ if(mc.thePlayer.getCurrentEquippedItem() != null){ ItemStack currItem = mc.thePlayer.getCurrentEquippedItem(); if(currItem.getItem().itemID == MainClass.MagicGauntlet.itemID){ if(Keyboard.isKeyDown(Keyboard.KEY_Z)){ if(!changed){ ReflectionHelper.setPrivateValue(c, o, 5D, 36); changed = true; } return; } } } if(changed){ ReflectionHelper.setPrivateValue(c, o, 1D, 36); changed = false; } } } This is to avoid all unnecessary reflection uses.
  17. Hum, after thinking a bit, the more suited data is the idMap in GameData. It is a private Map, which contains ItemData for each item id. The ItemData contains modid, and item registration name. NBTTagList itemList = new NBTTagList(); GameData.writeItemData(itemList); List<ItemData> data=new ArrayList(); NBTBase base; for(int i =0; i< itemList.tagCount; i++) { base = itemList.tagAt(i); if(base instanceof NBTTagCompound) data.add(new ItemData((NBTTagCompound)base)); }
  18. Huh ? No, you can't, except if the block has a tileentity (or some ItemStack, which I don't know how you'd get it) Well, you have to differentiate powered and unpowered state. Just try to place a glass block next to that powered block of yours, or place your block on a powered area, then unpower it. You'll see why this is necessary. This might fix both of your issues. If not, use a TileEntity (you don't have to rewrite all, just move most things from block and TickHandler into the TileEntity) By the way, you won't need your TickHandler with a TileEntity.
  19. You might want to generate your custom portal in both dimensions ?
  20. TileEntity can save without limits all types of values within the world save. With blocks, as soon as the world unload, they are reset to default, and you can only have 16 bits of additional values. (your Array of String will never be saved by a block, consider it is only temporary) You can have gui and inventories with TileEntity, though it is not necessary. Have a look at this repository, this mod does things close to what you want.
  21. Where is redstone power used in your code ? I don't see any difference between a powered or unpowered block ? Also, you may want to use a TileEntity.
  22. You may want to give a list of your mods, and your maximum PermGen value. One of them could be...unoptimised ?
  23. Isn't receiving the packet on spawn enough ? Client can then compute the data however you want.
  24. Ho, you can find a public call in GameRegistry class, sorry about that. About this method, the name it compares with is the name given by the modder at the registration of the item/block: registerBlock(block,name) or registerItem(item,name), which is not necessarily equal to the name given in the item own class. It may be more simple to use the itemsList in Item class, along with player.getHeldItem().itemID; but then it wouldn't use the mod id.
  25. Yes, it should be in PreInit event. What version of Forge are you using ?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.