Jump to content

theishiopian

Members
  • Posts

    150
  • Joined

  • Last visited

Posts posted by theishiopian

  1. I have been attempting to make a spear for my mod, and up until now everything had been going fairly well by using the trident as a guide. The problem is that I absolutely cannot get the entity to render. As in, at all. 
    I am registering the renderer, and I've confirmed the event is being called for it.
     

    @OnlyIn(Dist.CLIENT)
    public void ClientSetup(FMLClientSetupEvent event)
    {
      if(Config.flailEnabled.get())ModItems.RegisterFlailOverrides();
    
      MinecraftForge.EVENT_BUS.addListener(ClientEvents::OnClick);
      MinecraftForge.EVENT_BUS.addListener(ClientEvents::OnKeyPressed);
    
      RenderingRegistry.registerEntityRenderingHandler(ModEntities.SPEAR.get(), RenderSpear::new);
    }

    The other 3 lines here work perfectly.

    Here is the renderer:

    public class RenderSpear extends EntityRenderer<SpearEntity>
    {
        public RenderSpear(EntityRendererManager manager)
        {
            super(manager);
        }
    
        @Override
        public void render(SpearEntity spearEntity, float yaw, float partialTicks, MatrixStack matrix, @NotNull IRenderTypeBuffer buffer, int light)
        {
            System.out.println("the funny");
            matrix.pushPose();
            //todo: translate/rotate/scale matrix
            Minecraft mc = Minecraft.getInstance();
    
            mc.getItemRenderer().render(spearEntity.spearItem, ItemCameraTransforms.TransformType.FIXED, false, matrix, buffer, light, OverlayTexture.NO_OVERLAY, mc.getItemRenderer().getModel(spearEntity.spearItem, spearEntity.level, null));
            matrix.popPose();
        }
    
        @Override
        public ResourceLocation getTextureLocation(@NotNull SpearEntity entity)
        {
            return null;
        }
    }

    The println at the top does not print, proving this method is not being called. 

    The entity itself works fine, I can throw it and deal damage just like a trident. It just won't render.

  2. I am attempting to add config entries for disabling items from being loaded. When I attempt to change the config however (with the game closed) not only does it not work, but the entries are erased from the .toml, and the first entry after the new entries is also removed.

    Config class: https://pastebin.com/67b9Ytf7

    The config file is attached, with different versions for the default, the edited one, and the broken one. The entries i edit are the first three, which i set to false. Notice how even the fourth entry is deleted, despite not being edited.

    Log: https://pastebin.com/d0bKF4Pa I already saw the 4 lines about the file being changed, but i have no idea what is changing it.

    parrying-common BEFORE LOAD.toml parrying-common BEFORE LOAD EDITED.toml parrying-common AFTER LOAD.toml

  3. I am attempting to make a weapon with a custom attribute, in this case armor penetration. Everything has made sense so far, except that the attribute map on the item requires a UUID, which from what i can tell, is just preset at random. 

    My current constructor looks like this:

    public WeaponMace(IItemTier tier, Properties properties, float baseDamage, double speed, int armorPen)
        {
            super(tier, properties);
    
            Builder<Attribute, AttributeModifier> builder = ImmutableMultimap.builder();
            float attackDamage = baseDamage + tier.getAttackDamageBonus();
            builder.put(Attributes.ATTACK_DAMAGE, new AttributeModifier(BASE_ATTACK_DAMAGE_UUID, "Weapon modifier", attackDamage, AttributeModifier.Operation.ADDITION));
            builder.put(Attributes.ATTACK_SPEED, new AttributeModifier(BASE_ATTACK_SPEED_UUID, "Weapon modifier", speed, AttributeModifier.Operation.ADDITION));
            builder.put(ModAttributes.ARMOR_PENETRATION.get(), new AttributeModifier(UUID.fromString("c7675e5c-2e25-4589-ace1-f0ad816b40b8"), "Weapon modifier", armorPen, AttributeModifier.Operation.ADDITION));
            this.defaultModifiers = builder.build();
        }

    Is this an ok way of doing this? 

  4. This is a follow up to an earlier post about not being able to use the knockback method. Well, since then I've learned a bit more about the nature of my problem. It turns out that knockback DOES work, but the catch is if I cancel the LivingAttackEvent that I'm calling the code from, then all attempts to modify the velocity of the player are nullified, even if i extract the mojang knockback code and reuse it (which I don't want to do in the long run, for legal reasons). As soon as I stop canceling the event, the knockback works. Unfortunately, I NEED to cancel the event, since its the whole point of the mod. What could be causing this interaction???

  5. Greetings, not sure if this is the right place for this, but I need some modding experts to help with a peculiar phenomenon. 

     

    My friend runs a modded server and recently updated the pack, which can be found here: https://www.curseforge.com/minecraft/modpacks/arcanes-pack

     

    After the most recent update, the console has started spamming the number "50". Thats it, nothing else, just 50. It happens whenever anyone places a block. 

     

    50.png.6afd8eab95c18ea5ad2cac4267656fd9.png

     

    We are searching the added mods for the cause, I'd guess its some sort of debug code, but in the mean time has anyone else had this happen?

  6. I'm trying to use the annotation based config system that forge offers, but the changes don't seem to be saved after a game restart. Is there an extra step I have to do to save the changes to the file?

     

    My config class:

    @net.minecraftforge.common.config.Config(modid = MODID)
        public static class Config
        {
        	@RequiresMcRestart
        	@RangeInt(min = 0) 
        	@Comment({"The duration of the non-extended immortality potion, in ticks","§eThere are 20 ticks to a second in Minecraft"})
        	public static int immortalityDurationShort = 200;
        	@RequiresMcRestart
        	@RangeInt(min = 0)
        	@Comment({"The duration of the extended immortality potion, in ticks","§eThere are 20 ticks to a second in Minecraft"})
        	public static int immortalityDurationLong = 400;
    
        	@RequiresMcRestart
        	@RangeInt(min = 0)
        	@Comment({"The minimum nuber of tries the world generator gets","§ewhen trying to generate philosopher's stone ore"})
        	public static int minGen = 64;
        	@RequiresMcRestart
        	@RangeInt(min = 0)
        	@Comment({"The minimum nuber of tries the world generator gets","§ewhen trying to generate philosopher's stone ore"})
        	public static int maxGen = 256;
        }

     

  7. I am trying to make an overlay of the vanilla health bar that changes the color of the first two hearts on the bar. The render works fine, and renders my hearts over the vanilla ones no problem. The trouble is that vanilla hearts tend to shake up and down under various conditions, and these movements are hardcoded and can't be accessed. The solution taken by tinkers construct appears to be to render their own health bar, which is something I'd like to avoid. Is there some way of masking out shapes underneath my render, IE erasing anything on the HUD behind my icons? Or perhaps some way of getting the shake that I don't see? I really REALLY don't want to cancel the vanilla render and make my own health bar if it can be at all avoided, as that would be a compatibility nightmare for other mods that do the same. Is there a decently efficient way to use reflection to get a reference to the field in GUIIngame that stores the y offset for each heart? I hesitate to do that since reflection tends to be rather intensive.

     

     

×
×
  • Create New...

Important Information

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