Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

urbanxx001

Members
  • Posts

    177
  • Joined

  • Last visited

Everything posted by urbanxx001

  1. As the title says, I was wondering what the updated method/process for addScheduledTask is. I need this for an event similar to: @SubscribeEvent public void onEntityJoin(final EntityJoinWorldEvent event) { Minecraft.getInstance() //(not recognized)--> .addScheduledTask(new Runnable() { @Override public void run() { } }); } For the FML setup event I've used: event.enqueueWork(() -> { } But I'm not sure what's required for a simple event. The context for this is collecting what language the client is using and then sending a packet to sync with the server. But the packet must be delayed or it fails in this event. Edit: Actually I can do the same thing when the player loads a container needing it. So the event's probably unnecessary
  2. Edit: I figured it out, thanks to Poopoodice's answer in another thread saying that online mode in server properties must be set to false. This was required because I received an invalid session error after attempting to join the server.
  3. Of course this is your thread and we're here to help you. If the place you're trying to access the items is a part of the inventory object (the block, tile entity, container, etc. classes) then it's easier. But if you're still in the process of creating your inventory, I'd suggest any of the following: -Forge docs on Tile Entities -Minecraft By Example topics. -Examine the source code for objects like Chests. Outside of block/TE/container, an easy way is the player's containerMenu value that I mentioned before, which is whatever menu is currently open: Container container = player.containerMenu
  4. Sorry, yes Luis is right it's just a helper function for resourcelocation: public static ResourceLocation getLocation(String name) { return new ResourceLocation(MOD_ID, name); } As he and diesieben said though, if it's a simple problem like calling openGui and registering the screen, then packets are unnecessary, but you need to describe it in more detail.
  5. The inputs are just a template- in this case it's two strings, but they can be ints, chars, etc. or none at all, depending if you need to initially send info across sides. I'd suggest reading Forge's documentation on packets first if you haven't used them before: Forge Docs Networking You usually send the packet by invoking handler methods: ModPacketHandler.sendToServer(new C2SPacketForContainer(input1, input2)); Where the handler class has packet registration and the methods: The register methods are called in common setup.
  6. Yeah the VillagerUtil was used in conjunction with the POI Forge registry, but you're right it's superfluous and I should stick with the simpler way. Thank you Ash
  7. To begin where are you trying to access info for the container? From the server or client? If it's the latter you'll need to send a C2S packet. Then the easiest way to collect info is when the player opens the inventory, since they have a containerMenu variable. The packet would look something like:
  8. Ah ok glad you found a solution. For the Start sub class of LivingEntityUseItemEvent, cancelling it or setting duration <= 0 should prevent it as well.
  9. I'm not sure how the change in platform is causing the error, but your best bet would be to create a fresh environment on your Mac and then copy all the class files over if you haven't already
  10. So I'm nearly finished with a version of my mod and, although I haven't done mapping changes in awhile, I'm confident that I have the correct MCP name so that an instance of reflection runs properly. However, the new method name isn't recognized during load in the real environment (I'm aware it needs to be changed back to run in dev). I cross-referenced both the output.srg as well as a Discord bot and they tell me that: func_221052_a in PointOfInterestType.class should be registerBlockStates Attached is the relevant class and log file. Any help is appreciated. Loading Output Log Villager Util class:
  11. Here's the class for attempt 1. For attempt 2 I've also tried assigning random UUID's and/or random modifier names for each item instance, but they still remain linked.
  12. Hi MadAlchemist, if you open the AbstractZombieModel class, you can see that the following controls the arms-out zombie pose: public void setupAnim(T p_225597_1_, float p_225597_2_, float p_225597_3_, float p_225597_4_, float p_225597_5_, float p_225597_6_) { super.setupAnim(p_225597_1_, p_225597_2_, p_225597_3_, p_225597_4_, p_225597_5_, p_225597_6_); ModelHelper.animateZombieArms(this.leftArm, this.rightArm, this.isAggressive(p_225597_1_), this.attackTime, p_225597_4_); } public abstract boolean isAggressive(T p_212850_1_); So the easiest way to apply this to a player model is copy the AbstractZombieModel class, but have it extend PlayerModel rather than BipedModel. You may need to add another animateZombieArms line that takes in this.leftSleeve and this.rightSleeve from PlayerModel. Finally you'll want your entity renderer to copy the AbstractZombieRenderer class (and add a CapeLayer from PlayerRenderer to your constructor if certain players have capes). Then player skins should fit your custom zombie.
  13. 1) For this your best bet is to create a LivingAttackEvent and/or LivingDamageEvent to check the damage received, and also check if the player is wearing your armor. Both events have values for source and amount that can help you determine what to do from a "lethal" attack. 2) What you describe would most easily be enacted as a repair item for your armor, like how the phantom membrane restores elytra. Then each time the durability (or a special durability) is repaired by anvil or crafting, you can increment an NBT value to count how many times it's been repaired. 3) I would take a look at the BipedArmorLayer class for how vanilla armor is rendered. You can then specify that model in the item class with: @Nullable @Override public <A extends BipedModel<?>> A getArmorModel(LivingEntity entityLiving, ItemStack itemStack, EquipmentSlotType armorSlot, A _default) { return (A) new MyArmorModel(); } and then the texture with something such as: @Nullable @Override public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlotType slot, String type) { if(!"overlay".equals(type)) return "mod_id:textures/models/armor/my_armor.png"; else { return "mod_id:textures/models/armor/my_armor_overlay.png"; } } Hope this helps
  14. From this post, I've modified the original armor attribute of my custom item. The biggest change between that post and now is that the attribute multimap is immutable, so it needs to be copied to a mutable map, adjusted, and then copied to an immutable one again. Normally it would be easier to create a new armor material, however the value I need depends on a variable (extraArmor) in the item class. The armor value changes correctly, but only when one instance of the item is present in the inventory. If another one is there, then the armor of the newest instance overwrites the previous item(s). I've tired alternatives such as adding a new armor modifier (Attempt 2) or using an ItemAttributeModifierEvent instead of getAttributeModifiers, but they all face the same problem. I'm not sure why they would change since the extraArmor value isn't static and isn't called or updated statically as far as I'm aware. If anyone can help I'd be grateful. Attempt 1: Edit original values Attempt 2: Add unique modifier
  15. I'm sending a packet with a character as input, but when handling it it's interpreted as a Chinese character. Is there special decoding to convert it correctly, and if so how? Thanks Edit: Nevermind my write method was the issue.
  16. Adding that did the trick! Thank you so much
  17. Ah ok, thanks. Iterating over spawners vs entity types makes more sense. I've modified the event to mirror mincount, maxcount etc. as well: Although the entity is still refusing to spawn lol. I've debugged the event to see if the custom mob is being added to the spawns, and it is. I've tried registering the spawns outright vs adding on biome load, but it doesn't make a difference. I think the problem lies somewhere in the actual entity class that's preventing it, I'll take a thorough look tomorrow. I appreciate your help.
  18. These are SRG names, which are semi-obfuscated. In your PizzaItem constructor you can rename p_i48487_1_ to "properties" or whatever you wish. Any input parameters like this can be renamed, it's only when you're referencing actual variable or method names from the source that you can't rename them.
  19. I'm only quoting so that you receive a notification, because normally replies don't notify for some reason. Anyway Your best bet to create an aura would be a render overlay like how the player is on fire, and activate it from a RenderLivingEvent: @Mod.EventBusSubscriber(modid = Main.MOD_ID) public class ForgeSubscribeEvents { @SubscribeEvent public void onRenderEntity(RenderLivingEvent.Post event) { //code here } } In the event you'll handle pushing and popping the render matrix stack, which is what the post on greyminecraftcoder is talking about, despite being a bit outdated. I've tried tackling it here in 1.16.X but with little success. It might be easier to go the particle route if you still want to do that though. This would be handled by a LivingUpdateEvent which you've probably already done: @SubscribeEvent public static void onLivingUpdate(final LivingEvent.LivingUpdateEvent event) { //code here } However bending which way the particles face as per the link so that they're concentric to the player would still likely involve the matrix stack.
  20. I'd recommend a tutorial based on McJty's code, HarryTalks, as well as MBE80 by TGG. From your previous thread it looks like you want to create a mob that floats and passes through walls. I would take a look at how the Vex handles it.
  21. Yup it uses a ton of ASM voodoo magic
  22. Hi Rinjikii, packages are essentially the same as folder directories that you'd use on your computer. When creating your mod you'll place your java files in packages, while your resources, which contains blockstates, textures, etc., uses folders. Once you have the conventional directory com.author_name.mod_name, the package structure is up to you.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.