Jump to content

Lumby

Members
  • Posts

    50
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Lumby's Achievements

Stone Miner

Stone Miner (3/8)

0

Reputation

  1. I found it, thank you for your help! EntityPlayer seems to be extended by EntityPlayerMP and AbstractClientPlayer, the latter I'm guessing is the one that handles client side code. The AbstractClientPlayer is instantiated by EntityPlayerSP, which is where I found the other openBook() implementation. My question now is, how do I emulate this approach on my item? Do I simply have two if conditions like so, where the conditions check whether world.isRemote to execute client side or server side specific code?: @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { ItemStack itemstack = playerIn.getHeldItem(handIn); if (!worldIn.isRemote){ //emulate EntityPlayerMP code by doing a bunch of packet stuff }else if(worldIn.isRemote){ //emulate ENtityPlayerSP code like so this.mc.displayGuiScreen(new myCustomItemGUI(this, stack, true)); } return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemstack); }
  2. Hi, I want to create a letter item where if you use it the item opens a GUI for you to type in, which then adds that string to the NBTTagcompound of the item, just like ItemWritableBook. ItemWritableBook, however, simply called player.openBook() which leads to an empty method with no code, so I don't understand how the entire process should be undertaken. Are there any possible resources or mods that have a similar functionality that someone can point me towards as an example? Thanks in advance!
  3. ItemBase is the class you extended for your fishing rod class, can you post what your ItemBase class looks like so we can see what's wrong with it?
  4. Hi, in one of my slots I want to check if all the items in a shulker box are the same before allowing it to be placed in the container slot. I am however running into some trouble with navigating the NBTTagCompound. From my understanding, the items are listed in the NBTBase BlockEntityTag of the tag compound, but I don't understand how to get the "Items" tag list out of the BlockEntityTag. I tried converting it to a string, but it would take a lot of difficult parsing to go through the whole string to see if all the items are the same. Is there any way to iterate through every item within the NBTTagCompound or is my current solution with parsing strings the best there is? Thanks in advance! Working in version 1.12.2 Below is what I have so far in case it may help: public boolean isItemValid(ItemStack stack) { if(stack.getItem() == Item.getItemFromBlock(Blocks.PURPLE_SHULKER_BOX)) { NBTTagCompound tags = stack.getTagCompound(); if(tags.hasKey("BlockEntityTag", 10)){ NBTBase blockEntityTag = tags.getTag("BlockEntityTag"); String tagString = blockEntityTag.toString(); } return true; } return false; }
  5. Figured it out, the forge version that I was running was also 1.12.2, but just slightly behind the one I developed my mod in. (1.12.2 - 14.21.1.2387 instead of 1.12.2 - 14.23.5.2768). Updated and issue was resolved
  6. Didn't really follow any tutorial, more of a hobbled attempt on any and everything I can find on the internet As for final step of exporting the mod itself, I just followed the docs. Edited build.gradle, ran the command in cmd, then copied the file in build/libs to the mods folder in minecraft.
  7. Hi, I just built my mod using gradlew.bat but it won't run in minecraft. When I start up it gives me the error: "The mods listed below can't run in Minecraft 1.12, *My mod name* (my modid) requires Minecraft 1.12.2, try to find an update or remove *My mod name*" I am able to run it fine in eclipse, but as soon as I try to run the built version in Minecraft it gives me this error. Any ideas what might be the cause? Thanks! below is my fml-client-latest.log
  8. My goal is to basically be able to place down a special modded block and create an area that only spawns my custom mob
  9. Hi, I want to make a mod in 1.12 where you can create a structure in game (like creating a village) that spawns specific mobs within the structure (like a witch hut). I cannot however, find the code that governs these processes, can anyone point me in the right direction to look? For example a class name that contains the relevant code, a mod previously created that does something similar, or really any advice would be greatly appreciated. Thanks in advance!
  10. I was making my crop block when I realized that the updateTick() method for vanilla BlockCrops doesn't have any checks for whether it's currently server-side or client-side. Nonetheless, the resulting block I made which extended BlockCrops and overrides said method seems to work perfectly. Why is that? Is updateTick() only called from the server-side, hence I do not need to worry about sides when dealing with updateTick()?
  11. Thanks for the help! Is there any case where the objects are not singletons that I should look out for then? I'm guessing players obviously aren't, but is there anything else?
  12. Try using a normal character like "S" instead of "/", as / is an escape character in java.
  13. Hi, after a bit of time I've realized that minecraft mods involve a lot of checking whether two objects are equal or not, be it items, blocks, biomes, etc. Since my mod performs so many of these checks, I'm starting to worry that if these comparisons are not coded efficiently, it would start slowing down minecraft a lot. Most of the time, I just use the good ol' Object#equals() method to check whether an object is the same (same as in #getBlock() is Blocks.DIRT or something like that). Is this the most efficient method? Or is there a better way to do things like this, specifically for checking Items, Blocks, and Biomes? Thanks in advance for the help.
  14. Turns out I didn't set the light level of the dimension low enough that hostile mobs can spawn. As soon as I lowered the light level, they started to spawn like crazy
  15. I've created a custom dimension and added my custom biome into it successfully. The Biome is able to correctly affect the day/night cycle and the water color, yet I am unable to get it to spawn any mobs naturally. As far as I'm aware, the biome is the one handling which mobs get to spawn via the spawnableCreatureList/spawnableMonsterList. I've tried adding entities (My custom demon entity, cows, and enderman) to both lists and neither worked. Any ideas what might be the problem? Custom Biome Class: public class BiomeNightmare extends Biome{ public BiomeNightmare() { super(new BiomeProperties("Nightmare").setBaseBiome("sky").setWaterColor(12255232).setRainDisabled()); topBlock = ModBlocks.NightmareBlock.getDefaultState(); fillerBlock = ModBlocks.NightmareBlock.getDefaultState(); this.spawnableCaveCreatureList.clear(); this.spawnableCreatureList.clear(); this.spawnableMonsterList.clear(); this.spawnableWaterCreatureList.clear(); this.spawnableMonsterList.add(new SpawnListEntry(EntityDemon.class, 10, 4, 4)); } }
×
×
  • Create New...

Important Information

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