Jump to content

Marcelstrike

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by Marcelstrike

  1. in 1.16, there was a method in Item called addInformation which would let you add custom descriptions to items when you would hover over them, since it's gone in 1.17, I was wondering how to add descriptions to the items now? I was looking at the class for enchanted book items for reference but I couldn't wrap my head around it.
  2. Had no idea about transformers, they're just what I needed. One more question, so I managed to register my hook entity, and the renderer for it but right now whenever I cast my custom rod, the bobber is invisible, although it functions perfectly. I'm getting the following error [Render thread/FATAL]: Error executing task on Client java.lang.IndexOutOfBoundsException: readerIndex(55) + length(8) exceeds writerIndex(55): UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeHeapByteBuf(ridx: 55, widx: 55, cap: 256) at io.netty.buffer.AbstractByteBuf.checkReadableBytes0(AbstractByteBuf.java:1405) ~[netty-all-4.1.25.Final.jar%2334!:4.1.25.Final] at io.netty.buffer.AbstractByteBuf.readLong(AbstractByteBuf.java:812) ~[netty-all-4.1.25.Final.jar%2334!:4.1.25.Final] at net.minecraft.network.FriendlyByteBuf.readLong(FriendlyByteBuf.java:965) ~[forge-1.17.1-37.0.34_mapped_official_1.17.1-recomp.jar%2374!:?] at net.minecraft.network.FriendlyByteBuf.readUUID(FriendlyByteBuf.java:377) ~[forge-1.17.1-37.0.34_mapped_official_1.17.1-recomp.jar%2374!:?] at com.marcel.piscis.common.entity.CustomFishingHook.<init>(CustomFishingHook.java:30) ~[%2378!:?] Because of how one of my fishing hook constructors are public CustomFishingHook(FMLPlayMessages.SpawnEntity sp, Level world) { super(world.getPlayerByUUID(sp.getAdditionalData().readUUID()), world, 0, 0); } I've tried to see if there's any other way I can get player but it would give me null. My whole custom fishing hook entity currently looks like this https://hastebin.com/yebagaxejo.java Thanks for the help so far!
  3. Ok, so If I override the tick function in my CustomFishingHook, it's using a ton of private fields that are in FishingHook. Is there any way to make them protected or make them usable in the child class, or am I going to have to make new versions or literally every field and function? is there any way to change the FishingHook class directly? Just want to make sure that I'm not missing anything obvious
  4. Note taken! Is there any specific reason for this or is it just for good practice? Just tried using the debugger for a bit specifically on the tick function and I found this private boolean shouldStopFishing(Player p_37137_) { ItemStack itemstack = p_37137_.getMainHandItem(); ItemStack itemstack1 = p_37137_.getOffhandItem(); boolean flag = itemstack.is(Items.FISHING_ROD); boolean flag1 = itemstack1.is(Items.FISHING_ROD); if (!p_37137_.isRemoved() && p_37137_.isAlive() && (flag || flag1) && !(this.distanceToSqr(p_37137_) > 1024.0D)) { return false; } else { this.discard(); return true; } } So I made a CustomFishingHook, added this function and changed the item to my iron rod with the fixed reference but it still didn't work. Same behavior. Do I have to register my new CustomFishingHook entity or is it probably something else as well that I'd have to override or remake inside of FishingHook?
  5. So I'm trying to make a custom fishing rod by extending FishingRodItem. Everything seems alright in the code and the texture, but whenever I right click with it in hand I see the fishing hook entity shoot out, but it disappears instantly. I'm thinking that it's only alive for about 1 tick until it leaves, the rod never changes to the casted texture either. I tried making to make my own custom FishingHook entity instead of the default one to shoot out, but a lot of the fields are private and the custom fishing hook class I made didn't seem to change anything (Was having the same problem) so I'm not sure what could be the issue. Just need a push in the right direction. Here's the code for my fishing rod, thank you in advance! public class ItemIronRod extends FishingRodItem { public ItemIronRod(Properties props) { super(props); } private static final String NAME = "ironrod"; public static final Item SELF = new ItemIronRod(ModItemList.defaultItemProperties()).setRegistryName(NAME); @Override public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand hand) { ItemStack currentstack = player.getItemInHand(hand); int lurespeed; //if player is fishing if (player.fishing != null) { if (!level.isClientSide) { lurespeed = player.fishing.retrieve(currentstack); currentstack.hurtAndBreak(lurespeed, player, (p) -> { p.broadcastBreakEvent(hand); }); } level.playSound((Player)null, player.getX(), player.getY(), player.getZ(), SoundEvents.FISHING_BOBBER_RETRIEVE, SoundSource.NEUTRAL, 1.0F, 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F)); level.gameEvent(player, GameEvent.FISHING_ROD_REEL_IN, player); } else //if player is not fishing { if (!level.isClientSide) { lurespeed = EnchantmentHelper.getFishingSpeedBonus(currentstack); int luck = EnchantmentHelper.getFishingLuckBonus(currentstack); level.addFreshEntity(new FishingHook(player, level, luck, lurespeed)); //level.playSound((Player)null, player.getX(), player.getY(), player.getZ(), SoundEvents.ENDERMAN_TELEPORT, SoundSource.NEUTRAL, 0.5F, 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F)); } player.awardStat(Stats.ITEM_USED.get(this)); level.gameEvent(player, GameEvent.FISHING_ROD_CAST, player); } return InteractionResultHolder.sidedSuccess(currentstack, level.isClientSide()); } }
×
×
  • Create New...

Important Information

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