-
Posts
24 -
Joined
-
Last visited
Everything posted by SonPlaying
-
That automatically adds when i implement IArmorMaterial, but ok.
-
I'm trying to make an armor set... i saw other modders go through this perfectly w/o errors, but i do. public enum ModArmorMaterial implements IArmorMaterial { ; // ruby_layer_1 ruby_layer_2 // this constructor \/ is the error WOOD(Main.MOD_ID + ":wood", 5, new int[] { 1, 1, 1, 1 }, 6, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0.3f, () -> { return Ingredient.fromItems(Items.OAK_WOOD, Items.ACACIA_WOOD, Items.SPRUCE_WOOD, Items.BIRCH_WOOD, Items.DARK_OAK_WOOD); }); private static final int[] MAX_DAMAGE_ARRAY = new int[] { 13, 16, 15, 11 }; private final String name; private final int maxDamageFactor; private final int[] damageReductionAmountArray; private final int enchantability; private final SoundEvent soundEvent; private final float toughness; private final Supplier<Ingredient> repairMaterial; ModArmorMaterial(String name, int maxDamageFactor, int[] damageReductionAmountArray, int enchantability, SoundEvent soundEvent, float toughness, Supplier<Ingredient> repairMaterial) { this.name = name; this.maxDamageFactor = maxDamageFactor; this.damageReductionAmountArray = damageReductionAmountArray; this.enchantability = enchantability; this.soundEvent = soundEvent; this.toughness = toughness; this.repairMaterial = repairMaterial; } @Override public int getDurability(EquipmentSlotType slotIn) { // TODO Auto-generated method stub return MAX_DAMAGE_ARRAY[slotIn.getIndex()] + this.maxDamageFactor; } @Override public int getDamageReductionAmount(EquipmentSlotType slotIn) { // TODO Auto-generated method stub return this.damageReductionAmountArray[slotIn.getIndex()]; } @Override public int getEnchantability() { // TODO Auto-generated method stub return this.enchantability; } @Override public SoundEvent getSoundEvent() { // TODO Auto-generated method stub return this.soundEvent; } @Override public Ingredient getRepairMaterial() { // TODO Auto-generated method stub return this.repairMaterial.get(); } @OnlyIn(Dist.CLIENT) @Override public String getName() { // TODO Auto-generated method stub return this.name; } @Override public float getToughness() { // TODO Auto-generated method stub return this.toughness; } @Override public float func_230304_f_() { // TODO Auto-generated method stub return 0; } } I don't know what to do. Am i forgetting something? Suggestion fixes suggest me to either add void modifier or change to constructor.
-
That errors too for some reason, saying that EffectInstance is undefined. I'm not on my PC right now.
-
It says i should change my effect registry to Effect. You told me to register it as a Potion, right? I registered the items as then i put it in my item : But it errors and says that i should change the effect type to Effect
-
I'm not in my PC right now, so I'll try it later.
-
Yes, it does work but that's not what i want.
-
It just adds the food that gives the effect separately one by one. Main question is, how to make a custom single effect(such as absorption, regeneration) that reduces the damage received on the user, regenerates the user, and makes the player fireproof. In other words, a mix of all those effects(regeneration, resistance, fire resitance) in one custom effect, so the food doesn't give the effects separately.
-
I guess so. I guess I'll look around the forum first before posting my own question.
-
How do i play a minecraft's cloud(particle that appears when an entity is killed) on the player's position? Also, how do i play a dragon's roar sound, too?
-
Yes, it works. I've put return this == REGISTRY.EFFECT_NAME.get(); and it works. But it's different though. I've put heal, right? It's really fast for some reason. How do i slow it down? Do i just change the float value?
-
I put that without the recipe, because i want the effect to be given when a player eats a certain food, but it didn't add anything. Is it an effect? Is it a potion item? I didn't add anything that relates to those both
-
I can't find i way to remove(consume) an item after onItemRightClick... help please? I tried doing @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { playerIn.heal(1.0f); return ActionResult.resultConsume(playerIn.getHeldItem(handIn)); } but it still doesn't do anything.
-
I am trying to make a custom forge effect that is a mix of resistance, regen, and fire resist. But i can only find heal at LivingEntity. Help?
-
i only registered public static final RegistryObject<SecondWindEffect> SECOND_WIND_EFFECT = EFFECTS.register("second_wind_effect", () -> new SecondWindEffect(EffectType.BENEFICIAL, 152512));
-
I registered the effect in my registryhandler. I put the type EffectType.BENEFICIAL... wait, what do you mean effect type? Is it POTION_TYPE? Do i have to register that as well?
-
My effect does nothing in this code package com.sonplaying.bufffood.effects; import javax.annotation.Nullable; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.potion.Effect; import net.minecraft.potion.EffectType; public class SecondWindEffect extends Effect { public SecondWindEffect(EffectType typeIn, int liquidColorIn) { super(typeIn, liquidColorIn); } @Override public void performEffect(LivingEntity a, int amplifier) { if (a.getHealth() < a.getMaxHealth()) { a.heal(1.0F); } } public void affectEntity(@Nullable Entity source, @Nullable Entity indirectSource, LivingEntity a, int amplifier, double health) { this.performEffect(a, amplifier); } } What's wrong with this?
-
-
sorry java memory is decaying.
-
Java says that it needs to, I can void it instead but it errors, saying that it needs a return type.
-
I am trying to make an item that gives you effect if you right click it... so i add this code to my item subclass : package com.sonplaying.bufffood.items; import com.sonplaying.bufffood.Main; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.potion.EffectInstance; import net.minecraft.potion.Effects; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.world.World; public class SecondWind extends Item { public SecondWind() { super(new Item.Properties() .group(Main.TAB)); } public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { playerIn.addPotionEffect(new EffectInstance(Effects.SPEED, 30*20, 0)); return null; } } But it crashes when i right click it. Help?
-
So... deferredregister.create is not recognizable by my Eclipse. the forge mdk i'm using is the latest 1.16.2
-
Nevermind... i just simply forgot a code...🤧
-
Hello, i am a beginner in Java Modding. So i added this in one of my ItemFood items : protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player) { if(!worldIn.isRemote) { player.addPotionEffect(new PotionEffect(effect.getPotion(), effect.getDuration(), effect.getAmplifier(), effect.getIsAmbient(), effect.doesShowParticles())); } } I have some other itemfoods that have this code too... yet when i eat the food that is from this one... my minecraft crashes. When i eat the other ones... its fine. The whole class that makes the errored food : package com.sonplaying.items; import com.sonplaying.Main; import com.sonplaying.init.ModItems; import com.sonplaying.util.IHasModel; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class HealthyFood extends ItemFood implements IHasModel { PotionEffect effect; public HealthyFood(String name, int amount, float saturation, boolean isWolfFood, PotionEffect effect) { super(amount, saturation, isWolfFood); setUnlocalizedName(name); setRegistryName(name); setCreativeTab(Main.bufffoodtab); ModItems.ITEMS.add(this); } protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player) { if(!worldIn.isRemote) { player.addPotionEffect(new PotionEffect(effect.getPotion(), effect.getDuration(), effect.getAmplifier(), effect.getIsAmbient(), effect.doesShowParticles())); } } @SideOnly(Side.CLIENT) public boolean hasEffect(ItemStack stack) { return true; } @Override public void registerModels() { Main.proxy.registerItemRenderer(this, 0, "inventory"); } } Item Add : public static final Item health_bread = new HealthyFood("health_bread", 5, 2.6f, false, new PotionEffect(MobEffects.REGENERATION, 15*20, 0, false, true)); Crash Report https://pastebin.com/EBsNQfRJ