Jump to content

Zacomat

Members
  • Posts

    94
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Zacomat

  1. In my mod i have some item Substitution Aliases that I register with @SubscribeEvent public void onRegisterItem(RegistryEvent.Register<Item> event) { try { GameRegistry.addSubstitutionAlias("minecraft:compass", GameRegistry.Type.ITEM, GiacomosTeleport.myCompass); GameRegistry.addSubstitutionAlias("minecraft:map", GameRegistry.Type.ITEM, GiacomosTeleport.myEmptyMap); GameRegistry.addSubstitutionAlias("minecraft:filled_map", GameRegistry.Type.ITEM, GiacomosTeleport.myFilledyMap); } catch (ExistingSubstitutionException e) { e.printStackTrace(); } } But recipes and trades that use aliased items seem broken. I try to fix this in the init method: @EventHandler public void init(FMLInitializationEvent event) { //Overwriting some recipes to fix bugs: recipes that use maps or compasses are broken!!! RecipeSorter.register(MODID + ":mapextending", RecipesMyMapExtending.class, SHAPED, "after:minecraft:shaped before:minecraft:shapeless"); RecipeSorter.register(MODID + ":mapcloning", RecipesMyMapCloning.class, SHAPELESS, "after:minecraft:shaped before:minecraft:shapeless"); GameRegistry.addRecipe(new RecipesMyMapExtending()); GameRegistry.addRecipe(new RecipesMyMapCloning()); GameRegistry.addShapedRecipe(new ItemStack(myEmptyMap), "ppp", "pbp", "ppp", 'b', Items.COMPASS, 'p', Items.PAPER); GameRegistry.addShapedRecipe(new ItemStack(myCompass), " i ", "iri", " i ", 'r', Items.REDSTONE, 'i', Items.IRON_INGOT); //Overwriting items in trades: Fix cartographer trade compass for emeralds!!! VillagerProfession profession = VillagerRegistry.getById(1); VillagerCareer career = profession.getCareer(1); EmeraldForItems trade = (EmeraldForItems) career.getTrades(1).get(0); trade.buyingItem = Items.COMPASS; } This way it seems to work but is this the right way?
  2. I'd like to show more information on tooltip when the item that has mouseover is in the player inventory and hide that information if the item is in other container as chest, anvil, etc... Is there a way to find where the itemstack is? And check it in Item.addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)? Thanks
  3. To make it more clear... I use this loop to load destination area: for (int i = -radius; i <= radius; i++) { for (int j = -radius; j <= radius; j++) { worldserver.getChunkProvider().provideChunk((posX >> 4) + i, (posZ >> 4) + j); } } Then i use worldserver.getBlockState(pos1).getMaterial().blocksMovement() to see if a block is acceptable. But if there is a structure the block result free as if the structure is not loaded.
  4. I want to teleport a player far away from his position.The problem is that if there are structures i don't know how detect them. How can I prepare the destination area so that i can check if there are air blocks to put player in or search for nearby acceptable destination? Thx.
  5. I tried this but it does not work: @SubscribeEvent public void onRegisterEvent(RegistryEvent.Register<Item> event) { Items.MAP.setCreativeTab(null); try { GameRegistry.addSubstitutionAlias("minecraft:map", GameRegistry.Type.ITEM, MyMod.myEmptyMap); } catch (ExistingSubstitutionException e) { e.printStackTrace(); } } Still 2 items in the misc tab.
  6. Sry for my bad english
  7. But if you have to overwrite a method of the item in both sides? Let's say that you want to overwrite onItemRightClick?
  8. As cpw said this is a sided effect so the method addSubstitutionAlias must be called only in server side. The solution is to remove it from client proxy. Thx
  9. On the RegistryEvent.Register<Item> event I made a substitution alias: GameRegistry.addSubstitutionAlias("minecraft:map", GameRegistry.Type.ITEM, myEmptyMap); where myEmptyMap is an instance of com.example.MyEmptyMap that extends net.minecraft.item.ItemEmptyMap. In The constructor of net.minecraft.item.ItemEmptyMap there is the call to setCreativeTab(CreativeTabs.MISC); so I left my constructor empty. Why in the misc tab there are 2 minecraft:map items? How can i remove one? Thx
  10. But it's safe to spread the work over ticks?
  11. In FMLServerStartingEvent i get the BiomeProvider with event.getServer().getEntityWorld().getBiomeProvider(). Then in a separate thread i call biomeProvider.getBiomes(null, x, z, 1, 1, false); The server don't crash and it seems to work except for strange behaviours: the world generation is broken in some areas. It seems that i go to interfere with world generation... When is it safe to call biomeProvider.getBiomes? Or is there an other way to get biomes at a certain position?
  12. I need it work even with other mods that could modify the world generation... How could it be done? Can you give an example?
  13. This function contains a loop where the sample of the world occur. If you call it from FMLServerStartedEvent the server seems to freeze during the loading phase until the island is found, and that could take many seconds... So i break the search and call a piece of it from WorldTickEvent. Maybe there is a way to execute it from other thread? Without crashing the server
  14. I'm trying to find the mushroom island. In the FMLServerStartedEvent I make some init and subscribe to WorldTickEvent. In the WorldTickEvent I make a loop where i generate some BlockPos and call world.getBiome to see if I found it. The loop is broken after 1 millis to reduce the work per tick. If I find the BiomeMushroomIsland I unsubscribe to WorldTickEvent. This works but is there a faster and easier solution?
  15. I don't like to make string comparison with names of items as BiblioCraft because if i search for "book" in the name I will accept also bookshelf. I prefer to make a list with Item.getByNameOrId(String id). And have i to send to client the server list when player connect? Correct? Thx
  16. Could be a good practice when creating new books to extend ItemBook? This would automatically solve the problem...
  17. My last mod adds a block bookshelf that act as a container of books. In the method isItemValid of my slots i made a check like this: if (it instanceof ItemBook || it instanceof ItemWritableBook || it instanceof ItemEnchantedBook || it instanceof ItemWrittenBook) Is there a way to detect if an item is a book so all books from other mods can be inserted? Thx
  18. I want to use the standard throw sound played when throwing eggs or snowballs in my mod but i want to use my own subtitle. I made the sounds.json file this way: { "snatch":{ "category":"ambient", "sounds":[ {"name":"fishing:snatch1"}, {"name":"fishing:snatch2"} ], "subtitle": "subtitles.net.snatch" }, "swish": { "category":"ambient", "sounds":[ {"name":"fishing:swish"} ], "subtitle": "subtitles.net.swish" }, "splash": { "category":"ambient", "sounds":[ {"name":"fishing:splash"} ], "subtitle": "subtitles.net.splash" }, "throw": { "category":"ambient", "sounds":[ {"name":"minecraft:entity/egg/throw"} ], "subtitle": "subtitles.net.throw" } } and my own sounds work well. But when i launch minecraft i get this error: File minecraft:sounds/entity/egg/throw.ogg does not exist, cannot add it to event fishing:throw What is the correct filename and how can i list assets files of minecraft?
×
×
  • Create New...

Important Information

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