Jump to content

That_Martin_Guy

Members
  • Posts

    197
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by That_Martin_Guy

  1. I can't really tell completely, but it looks like you're calling that outside a method, which you can't do. If it is inside of a method, post your code instead of showing the error.
  2. Take a look at capabilities. Create one that stores a string, and set the string when the player joins.
  3. I have a git project me and one other person is working on. I had to reinstall my operating system because of a bug, but now, after just having installed the very same linux distribution as I had before minecraft crashes with this: https://pastebin.com/ZS4Mv0Gf I doubt it's directly related to the project, as the other person can compile and run it just fine. I'm suspecting a driver issue, although that should be automatically detected by my distro (Manjaro XFCE edition with 4.14.27-1-MANJARO kernel). Any ideas?
  4. Do you know of any way to fix it? It's not really something gamebreaking but if I'm changing a single value to really make it detailed it's quite annoying to have to wait ~30 seconds even though I changed a single number...
  5. I am experiencing this in more than one minecraft forge project, any clue as to why this is happening?
  6. I have no doubt in my mind that things will change. I also don't doubt that it is for a good reason they (or you as a forge dev) make the changes. I simply would like to know the scale of it, so I can know if minecraft gets a mountain of changes like in 1.8 or not.
  7. I am creating a simple enemy that attacks the player, but I cannot make him actually deal damage to the player. All he does is run towards the player and make contact with him. No damage is dealt. Code: public EntitySpecGhost(World worldIn) { super(worldIn); this.setSize(1, 2.4f); } @Override protected void initEntityAI() { tasks.addTask(0, new EntityAISwimming(this)); tasks.addTask(1, new EntityAIAttackMelee(this, 2, true)); tasks.addTask(2, new EntityAILookIdle(this)); tasks.addTask(3, new EntityAIWatchClosest(this, EntityPlayer.class, 100)); tasks.addTask(4, new EntityAIWander(this, 1)); targetTasks.addTask(0, new EntityAIHurtByTarget(this, true)); } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(15); } @Nullable @Override protected SoundEvent getHurtSound(DamageSource damageSourceIn) { return null; } @Nullable @Override protected SoundEvent getDeathSound() { return null; } @Override protected void playStepSound(BlockPos pos, Block blockIn) { }
  8. I looked through the changes for 1.13 for the first time today, and I saw they are reworking the way items and blocks are implemented, along with other changes and additions like data packs and removal of metadata. Will this mean a lot for me as a forge modder? I can assume that things will break, but on what scale?
  9. Please re-read my post. I am completely certain that my login details are correct, since when it does open succesfully, I have my in game name, skin etc.
  10. I have my username and password inserted into the program arguments so I can get my skin and username in game, but whenever I try and open a new minecraft window after recently closing one it will tell me the following [19:27:10] [main/INFO]: Logging in with username & password Exception in thread "main" [19:27:11] [main/ERROR] [GradleStart]: -- Login failed! Invalid credentials. Invalid username or password. java.lang.RuntimeException: com.mojang.authlib.exceptions.InvalidCredentialsException: Invalid credentials. Invalid username or password. at com.google.common.base.Throwables.propagate(Throwables.java:240) at GradleStart.attemptLogin(GradleStart.java:103) at GradleStart.preLaunch(GradleStart.java:59) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:81) at GradleStart.main(GradleStart.java:26) Caused by: com.mojang.authlib.exceptions.InvalidCredentialsException: Invalid credentials. Invalid username or password. at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:77) at com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication.logInWithPassword(YggdrasilUserAuthentication.java:78) at com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication.logIn(YggdrasilUserAuthentication.java:61) at GradleStart.attemptLogin(GradleStart.java:98) ... 3 more Process finished with exit code 1 and won't open. It never does this if I wait for a second before opening up a new window. I am using Intellij IDEA and running on Linux. Any ideas?
  11. You have to manually rename the title to [SOLVED] or something of that nature.
  12. Currently there is no good way to access the various variables related to making the player able to sleep. You cannot make the player sleep on something that doesn't return true in the blocks isBed method (like vanilla blocks), change the amount of time the player has to sleep or otherwise interact with the mechanic without using reflection, changing the EntityPlayer object or some other operation that is neither as easy to use as, say, an event, or convenient to create. A way to hook into this mechanic would greatly simplify changing it and would benefit a lot of people I believe.
  13. I'd do this if I could, but a lot of the things that are done in the method are changing private/protected variables which I do not have access to. I suppose I could in a worst case scenario I could change them with reflection.
  14. Core mods don't seem like an option, and I don't think I'd find a way to create a hook for this certain scenario that would benefit anyone other than me and would therefore not be accepted. That leaves this option. But the method I'm looking for is in EntityPlayer, and I doubt I could override that in a good way without breaking things. So is there any solution here?
  15. I know you're implying something, but can you please just explain what it is? Telling me what not to do even though I already knew about it (?) isn't really helping...
  16. How would I remove something that's part of vanilla code?
  17. I am not asking how you make the player able sleep on your own bed/block, but rather how to make him sleep anywhere. Setting the spawnpoint isn't necessary, just making the player "fall over", have his screen fade to black etc. I think it'd be super unnecssary to create my own method to make the player do this, but I cannot find any other sleep related method besides trySleep in EntityPlayer, but it only allows him to sleep if the block at the specified position is an actual bed. Any ideas?
  18. No, definitely not. I and many other people on this forum recommend learning java before you try and mod. Trust me, I know from experience that it helps out immensly.
  19. Call setNoRepair in the items constructor or whenever you're creating the object.
  20. What is the use of the object you return in Item.onItemRightClick? In which circumstances should I use what EnumActionResult in its constructor? And why does the itemstack matter?
  21. I rewrote the method three times without figuring out the answer was this simple... Thanks!
  22. I'm creating a block that,when activated, will hurt the player if his inventory is empty, and if it isn't put a random item in the inventory into an itemstack list. It only sometimes does the intended behaviour, though, and I can't really tell when it does so. Block.onBlockActivated code: List<ItemStack> lostItems = playerIn.getCapability(Capabilities.LOST_ITEMS_CAPABILITY, null).getLostItems(); if(!lostItems.isEmpty()) { Random random = new Random(); if(playerIn.inventory.isEmpty()) { playerIn.attackEntityFrom(new HoleDamageSource(), 19.0f); } else { int itemIndex = random.nextInt(playerIn.inventory.getSizeInventory()); while(playerIn.inventory.getStackInSlot(itemIndex).isEmpty()) { itemIndex = random.nextInt(playerIn.inventory.getSizeInventory()); } playerIn.inventory.removeStackFromSlot(itemIndex); lostItems.add(playerIn.inventory.getStackInSlot(itemIndex)); } } else { playerIn.sendMessage(new TextComponentString("You reach in but find nothing inside")); } return true; EDIT: To clarify, sometimes it adds AIR items to the list when the inventory is empty (even though it shouldn't), but other times it hurts the player.
  23. I was following the original code too closely, apparently. Doing what you said seems to have fixed it! New saving and loading code: public static NBTTagCompound saveItemList(NBTTagCompound tag, List<ItemStack> itemStacks) { NBTTagList tagList = new NBTTagList(); for(int i = 0; i < itemStacks.size(); ++i) { ItemStack itemStack = itemStacks.get(i); if(!itemStack.isEmpty()) { NBTTagCompound compound = itemStack.writeToNBT(new NBTTagCompound()); tagList.appendTag(compound); } } if(!tagList.hasNoTags()) { tag.setTag("Items", tagList); } return tag; } public static void loadItemList(NBTTagCompound tag, List<ItemStack> itemStacks) { NBTTagList tagList = tag.getTagList("Items", 10); for(int i = 0; i < tagList.tagCount(); ++i) { NBTTagCompound compound = tagList.getCompoundTagAt(i); itemStacks.add(new ItemStack(compound)); } }
  24. ItemStackHandler uses a NonNullList. I do not want there to be a limit on how many items there are in the list, and any of the other features that class provides is useless for me.
  25. I created a capability which is supposed to store ItemStacks the player has dropped. I do this by having an ArrayList in my capability class. I can add and get the items correctly via the getLostItems getter, but whenever I rejoin the list is empty, indicating that the list isn't saved. I tried to match the saveAllItems and loadAllItems in the ItemStackHelper class, but I am not sure where I went wrong. Storage class: @Nullable @Override public NBTBase writeNBT(Capability<ILostItemsCapability> capability, ILostItemsCapability instance, EnumFacing side) { return ItemNBTHelper.saveItemList(new NBTTagCompound(), instance.getLostItems()); } @Override public void readNBT(Capability<ILostItemsCapability> capability, ILostItemsCapability instance, EnumFacing side, NBTBase nbt) { ItemNBTHelper.loadItemList((NBTTagCompound) nbt, instance.getLostItems()); } ItemNBTHelper: public static NBTTagCompound saveItemList(NBTTagCompound tag, List<ItemStack> itemStacks) { NBTTagList tagList = new NBTTagList(); for(int i = 0; i < itemStacks.size(); ++i) { ItemStack itemStack = itemStacks.get(i); if(!itemStack.isEmpty()) { NBTTagCompound compound = new NBTTagCompound(); compound.setByte("Slot", (byte)i); itemStack.writeToNBT(compound); tagList.appendTag(compound); } } if(!tagList.hasNoTags()) { tag.setTag("Items", tagList); } return tag; } public static void loadItemList(NBTTagCompound tag, List<ItemStack> itemStacks) { NBTTagList tagList = tag.getTagList("Items", 10); for(int i = 0; i < tagList.tagCount(); ++i) { NBTTagCompound compound = tagList.getCompoundTagAt(i); int slot = compound.getByte("Slot") & 255; if(slot >= 0 && slot < itemStacks.size()) { itemStacks.set(slot, new ItemStack(compound)); } } }
×
×
  • Create New...

Important Information

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