Jump to content

braian hernandez

Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by braian hernandez

  1. Hello, im trying to add a new mob into my mod using GeckoLib as dependency, but when i see in-game, it dont have animations, but texture and model works fine.
    Animation part in my entity:

    // GeckoLib Animation

    private <E extends IAnimatable> PlayState predicate(AnimationEvent<E> event) {
    if (event.isMoving()) {
    event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.mutant_golem.walk", true));
    return PlayState.CONTINUE;
    }

    if(this.isDeadOrDying()){
    event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.mutant_golem.death", false));
    return PlayState.CONTINUE;
    }

    event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.mutant_golem.idle", true));
    return PlayState.CONTINUE;
    }

    @Override public void registerControllers(AnimationData data) {
    data.addAnimationController(new AnimationController(this,"controller", 0,this::predicate));
    }

    @Override public AnimationFactory getFactory() { return factory; }


    Im already check that event.isMoving() return true, but my mob dont do animations.

  2. On 6/24/2023 at 5:30 PM, EthanWatson said:

    I'm trying to edit all Netherite tools and armour to be unbreakable. But I don't know how to edit a vanilla item, only how to add a new modded item. Is there a way to edit the classes of vanilla items? Thanks.

    Well, like Capricocious say, its impossible to edit vanilla content directly, but, you can edit them in events, and add to them the property to be unbreakable.
    You just need to ensure what event you want to edit, also, other option is to create your own netherite items extending current vanilla, and when player gets a vanilla netherite item you override it, like in crafting recipes.

  3. On 7/5/2023 at 9:02 PM, codekloud said:

    Can anyone help? I want the spear item to have a different model in your hand than in your inventory.

    Hm... i do something similar in my mod in version 1.19.2, you need to edit model, im use the json file, so when it is in hand it have other dimensions, but if you want that the model in hand be tottaly diferent, you need to create an model, and then, you need to add renderer, so when you equip that, you render the model, like 3d model, or whatever you like.

  4. Could you give some code to see what you have done?

    To do that, first you need to find where the item receive enchantments.
    Then in that instance you add a if statment to do that.

    Other way is to copy enchants that the item will receive, and, then check if that some enchant have certain enchant, and remove it from the item, and re enchant to add in the level you want.

  5. 2 hours ago, MFMods said:

    you need to slow down. you can't just write two screens worth of mess and ask why it doesn't work.

    make a short event that does minimal modification of the item. then - only then when a minimal event works fine, write a real thing.

    you wrote up there "event.setCanceled(true);"    - are you sure you want that? are you sure you know what it does?

    you wrote " event.getInventory().setItem(1,output); " why would you do that? test that in a minimal event without all that mess, you'll see that it doesn't do what you expected.

    I use event,setCanceled(true) in various events, because i need to know if vanilla change something, actually i cancel:
    Regeneration Event
    Damage event
    Hurt event
    Attack event
    Some of the Gui event

    I dont know it that affect somehow, other events, i fix when i found error.


     

     

    4 hours ago, andreybadrey said:

    it is also possible that all the values that you change change on the server, but remain the same on the client, especially if you use capability, this is relevant for you...
    If this case is possible, then you have two options...
    option 1: duplicate your server code for the client side...
    option 2: write a sync system that will send batches of changes each time it changes...

    Now I suspect that you simply do not synchronize data with the server

    I have some packets, to sync all player capability and try to do same for all living entity, but it is hard, for that way i have another problem, when player leave and join again, something go wrong and max life dont render correctly, now i will work to fix that, and i dont know how to do for living entity dont leave and join again with the level, so they dont get all capability again, that change their rank capability, life, level and armor.


     

     

    4 hours ago, andreybadrey said:

    Hello, please upload the project to github, and give a link

    I'm going to do the same in my mod, and I'll try to help you

    Also try to use the trigger when the item is crafted in the item procedures

    public class TestItem extends Item {
    	public TestItem() {
    		super(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64).rarity(Rarity.COMMON));
    	}
    
    	@Override
    	public void onCraftedBy(ItemStack itemstack, Level world, Player entity) {
    		super.onCraftedBy(itemstack, world, entity);
    		customcode.execute(world, entity.getX(), entity.getY(), entity.getZ());
    	}
    }

    I also suspect that the event when an item is crafted, from player events, is being listened to in the crafting grid of the player's inventory window, but I could be wrong

    Also try to display the values you need through tooltips

    Sorry, first time that i request help, so i dont know that, sure, i have always upload github project.

    Code start in line 837

    https://github.com/JuanHernandezMorani/Perfect-Minecraft-rpg-1.19.2/blob/main/src/main/java/net/cheto97/rpgcraftmod/event/ModEvents.java
     

  6. Hi to everyone, i need help to render custom name on Crafted Items, for my mod in minecraft 1.19.2 forge, i try many forms, but cant add name and edit values like attack damage, durability, attack speed, attack reach, armor, armor thoughness.
    I have this:
    @SubscribeEvent
    public static void onCraftedItem(PlayerEvent.ItemCraftedEvent event) {
    Player entity = event.getEntity();
    int level = entity.getCapability(CustomLevelProvider.ENTITY_CUSTOMLEVEL).map(Customlevel::get).orElse(1);
    double luck = entity.getCapability(LuckProvider.ENTITY_LUCK).map(Luck::get).orElse(1.0);
    temStack output = event.getCrafting();
    if(luck > 10000){ luck = 10000; }
    int opt = selectTier(luck-1);
    if(!event.getEntity().getLevel().isClientSide()){ String name = output.getDisplayName().getString();
    switch (opt) {
    case 1 -> {
    Component iQualityComponent = Component.literal("[Crafted - Common] - {"+level+"} "+name).withStyle(ChatFormatting.GRAY);
     output.setHoverName(iQualityComponent);
    extra = 0.1*(double)((level/10000)+1);
    }
    *others cases*
    }
    Item item = output.getItem(); double lvlExtra = (level*0.00025)+1;
    if (item instanceof BowItem) { entity.getCapability(DexterityProvider.ENTITY_DEXTERITY).ifPresent(extraDamage -> { var customDamage = lvlExtra*(1 + (2+(extraDamage.get()*0.0015))*(4.15*0.35)*1.1)+(1.1*extra); output.setDamageValue((int)customDamage); event.setCanceled(true); event.getInventory().setItem(1,output); }); }

    else if(item instanceof CrossbowItem){ entity.getCapability(DexterityProvider.ENTITY_DEXTERITY).ifPresent(extraDamage -> { var customDamage = lvlExtra*(1 + (2+(extraDamage.get()*0.0015))*(4.15*0.35)*1.1)+(1.1*extra); output.setDamageValue((int)customDamage); event.setCanceled(true); event.getInventory().setItem(1,output); }); }

    else if(item instanceof TridentItem){ entity.getCapability(DexterityProvider.ENTITY_DEXTERITY).ifPresent(extraDamage -> { var customDamage = lvlExtra*((1+(extraDamage.get()*0.0025))*(2.15*0.25)*1.9)+(1.9*extra); output.setDamageValue((int)customDamage);
    event.setCanceled(true);
    event.getInventory().setItem(1,output); }); }

    else if(item instanceof PickaxeItem){ entity.getCapability(IntelligenceProvider.ENTITY_INTELLIGENCE).ifPresent(stat ->{ var customDamage = lvlExtra*((1+(stat.get()*0.0025))*(2.15*0.25)*1.9)+(1.9*extra); output.setDamageValue((int)customDamage); event.setCanceled(true);
    event.getInventory().setItem(1,output); }); }

    else if(item instanceof AxeItem){ entity.getCapability(StrengthProvider.ENTITY_STRENGTH).ifPresent(stat ->{ var customDamage = lvlExtra*((1+(stat.get()*0.0025))*(2.15*0.25)*1.9)+(1.9*extra); output.setDamageValue((int)customDamage); event.setCanceled(true);
    event.getInventory().setItem(1,output); }); }

    else if(item instanceof SwordItem){ entity.getCapability(StrengthProvider.ENTITY_STRENGTH).ifPresent(stat ->{ var customDamage = lvlExtra*((1+(stat.get()*0.0025))*(2.15*0.25)*1.9)+(1.9*extra); output.setDamageValue((int)customDamage); event.setCanceled(true);
    event.getInventory().setItem(1,output); }); }

    else if(item instanceof HoeItem){ entity.getCapability(AgilityProvider.ENTITY_AGILITY).ifPresent(stat ->{ var customDamage = lvlExtra*((1+(stat.get()*0.0025))*(2.15*0.25)*1.9)+(1.9*extra); output.setDamageValue((int)customDamage); event.setCanceled(true);
    event.getInventory().setItem(1,output); }); } } }


    I want to know how i can do to receive the item i do.

    When i use println, i can see that the hoverName is correctly apply, and if i try with a tag, it is added too, but not displayed.

×
×
  • Create New...

Important Information

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