Everything posted by urabaros
-
Item textures doesn't load.
-
Item textures doesn't load.
I'm SURE that did everything right, but it just doesn't load. I'm trying to create a custom armor and I already did it before. I simply can't comprehend where is the problem, textures from Armor's Item just don't show up (but the armor texture itself while wearing works fine). public static final RegistryObject<Item> LAVA_BOOTS = ITEMS.register("lava_boots", () -> new ArmorItem(LavaMaterial.LAVA_ARMOR, EquipmentSlotType.FEET, new Item.Properties().group(ItemGroup.COMBAT))); Json: { "parent": "item/generated", "textures": { "layer0": "lavaarmor:armor/lava_boots" } } Everyting looks completely fine for me! I don't what happened! My path: My main class: @Mod(LavaArmor.MODID) public class LavaArmor { public static final String MODID = "lavaarmor"; public LavaArmor() { IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); bus.addListener(this::setup); ItemInit.ITEMS.register(bus); MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(EventHandler.class); } @SuppressWarnings("deprecation") private void setup(final FMLCommonSetupEvent event) { DeferredWorkQueue.runLater(() -> { }); } }
- ArmorMaterial broke...
-
ArmorMaterial broke...
The first thing was fized by uploading mappings, I was using official insted of snapshot. Yea, Items., but when I write something like this it don't work and I don't remember what should I import. NONE_ARMOR("lava", 9900, new int[] {4, 5, 6, 4}, 17, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 99f, 12.5f, () -> Ingredient.fromItems(Items.LAVA_BUCKET));
-
ArmorMaterial broke...
Hi! I don't know why, but when I write this line: NONE_ARMOR("none", 9900, new int[] {4, 5, 6, 7}, 17, SoundEvents.LAVA_AMBIENT, 99f, 12.5f, () -> Ingredient.fromItems(ItemInit.NONE_INGOT.get())); my code break apart. I don't know why, actually, I've coppied it from my another project where it works right. ANd also!!! How should I set a vanilla item as a repair material? I can't figure it out My entire class: public class LavaMaterial implements IArmorMaterial { NONE_ARMOR("none", 9900, new int[] {4, 5, 6, 7}, 17, SoundEvents.LAVA_AMBIENT, 99f, 12.5f, () -> Ingredient.fromItems(ItemInit.NONE_INGOT.get())); private static final int[] baseDurability = { 128, 144, 169, 112}; private final String name; private final int durabilityMultiplier; private final int[] armorVal; //boots leggings chest helmet private final int enchantability; private final SoundEvent equipSound; private final float toughness; private final float knockbackResistence; private final Ingredient repairIngredient; LavaMaterial(String name, int durabilityMultiplier, int[] armorVal, int enchantability, SoundEvent equipSound, float toughness, float knockbackResistence, Supplier<Ingredient> repairIngredient) { this.name = name; this.durabilityMultiplier =durabilityMultiplier; this.armorVal = armorVal; this.enchantability = enchantability; this.equipSound = equipSound; this.toughness = toughness; this.knockbackResistence = knockbackResistence; this.repairIngredient = repairIngredient.get(); } @Override public int getDurabilityForSlot(EquipmentSlotType slotIn) { // TODO Auto-generated method stub return this.baseDurability[slotIn.getIndex()] * this.durabilityMultiplier; } @Override public int getDefenseForSlot(EquipmentSlotType slotIn) { // TODO Auto-generated method stub return this.armorVal[slotIn.getIndex()]; } @Override public int getEnchantmentValue() { // TODO Auto-generated method stub return this.enchantability; } @Override public SoundEvent getEquipSound() { // TODO Auto-generated method stub return this.equipSound; } @Override public Ingredient getRepairIngredient() { // TODO Auto-generated method stub return this.repairIngredient; } @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 getKnockbackResistance() { // TODO Auto-generated method stub return this.knockbackResistence; } }
-
Geckolib animation
Hm... public boolean isPanic() { //LOGGER.info("The AttackingEntity will be: " + this.getAttackingEntity()); return this.goalSelector.getRunningGoals().anyMatch(goal -> goal.getGoal().getClass() == PanicGoal.class); } private <E extends IAnimatable> PlayState predicate(AnimationEvent<E> event) { if(isPanic()) { event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.akirathedemon.panic", true)); return PlayState.CONTINUE; } if (this.prevPosX == this.getPosX() && this.prevPosY == this.getPosY() && this.prevPosZ == this.getPosZ()) { event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.akirathedemon.nod", true)); return PlayState.CONTINUE; } else { event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.akirathedemon.walk", true)); return PlayState.CONTINUE; } It looks completely right for me. Is there something that can prevent it from working?
-
Geckolib animation
Thanks! It's perfectly working: if (this.prevPosX == this.getPosX() && this.prevPosY == this.getPosY() && this.prevPosZ == this.getPosZ()) { return PlayState.STOP; } else { event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.examplemod.walk", true)); return PlayState.CONTINUE; } And do you know, how can I check if the specific goal is running? Should I just (GoalSelector.getRunningGoals == new SwimGoal) or something like that?
-
Geckolib animation
Yea, I understand that, so I'm asking how exactly should I check. Because animations doesn't really work when I do this: if (event.isMoving()) { event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.examplemode.walk", true)); return PlayState.CONTINUE; } return PlayState.STOP;
-
Geckolib animation
Hi! I have troubles understanding how Geckolib animation works. I've already created a model and an animation, and put them in game. Now my entity is contstantly playing this animation, and I don't know how to make that this animation would only play when entity is wolking/looking around/eating. My entity class: public class ExampleEntity extends CreatureEntity implements IAnimatable { private AnimationFactory factory = new AnimationFactory(this); public ExampleEntity(EntityType<? extends CreatureEntity> type, World worldIn) { super(type, worldIn); this.ignoreFrustumCheck = true; // TODO Auto-generated constructor stub } public static AttributeModifierMap.MutableAttribute setAttributes() { return MobEntity.func_233666_p_().createMutableAttribute(Attributes.MAX_HEALTH, 20.0f) .createMutableAttribute(Attributes.ATTACK_DAMAGE, 5.0f) .createMutableAttribute(Attributes.ATTACK_SPEED, 3.0f) .createMutableAttribute(Attributes.MOVEMENT_SPEED, 1.5f); } @Override protected void registerGoals() { super.registerGoals(); this.goalSelector.addGoal(0, new SwimGoal(this)); this.goalSelector.addGoal(1, new LookRandomlyGoal(this)); this.goalSelector.addGoal(2, new LookAtGoal(this, PlayerEntity.class, 8.0f)); this.goalSelector.addGoal(1, new PanicGoal(this, 0.7d)); this.goalSelector.addGoal(1, new WaterAvoidingRandomWalkingGoal(this, 0.5d, 100f)); this.goalSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, PlayerEntity.class, true)); } @Override protected int getExperiencePoints(PlayerEntity player) { // TODO Auto-generated method stub return 10; } @Override protected SoundEvent getDeathSound() { // TODO Auto-generated method stub return SoundEvents.ENTITY_HOGLIN_DEATH; } private <E extends IAnimatable> PlayState predicate(AnimationEvent<E> event) { event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.akirathedemon.walk", true)); return PlayState.CONTINUE; } @Override public void registerControllers(AnimationData data) { data.addAnimationController(new AnimationController(this, "controller", 0, this::predicate)); } @Override public AnimationFactory getFactory() { return this.factory; } }
-
How to update your mod from 1.16.4 to 1.16.5
Thank you so much! It worked!
-
How to update your mod from 1.16.4 to 1.16.5
Ok! That's hard. I think you are right, I use mappings that i've found on forge's discord: mappingsVersion = 20210309-1.16.5 How should I refractor the code..? What I did: I've created a new package with forge 1.16.5 files, than I've done /gradlew build and /gradlew genEclipseRuns, then I've edited build.gradle and gradle.properties. My gradle.properties: modVersion = "1.5.1" modMinecraftVersion = 1.16.4 modForgeVersion = 35.1.5 mappingsChannel = snapshot mappingsVersion = 20210309-1.16.5 modID = tutorialmod modGroup = tutorialmod modFileName = AkiraTheDemon
-
How to update your mod from 1.16.4 to 1.16.5
I'm really lost. Please, if someone has some instructions, i'm really desperate, I can't find anything that soesn't break ny code How to update your mode: 1) download version of forge you want, unzip the package and call it what you want. 2) copy src folder to the new forge package. 3) using cmd, run gradlew eclipse and gradlew genEclipseRuns, then run gradlew -PUPDATE_MAPPINGS_CHANNEL="snapshot" -PUPDATE_MAPPINGS="20210309-1.16.5" updateMappings (but use version of mappings you want) 4) open build.gradlew txt file and edit mappings channel: 'official', version: '1.16.5' to mappings channel: "snapshot", version: "20210309-1.16.5" 5) bingo That's just a remonding for me
-
Adding potionEffect to Attacking entity
Thanks!
-
Adding potionEffect to Attacking entity
Thank you! It works! In case someone need the same thing, here is the right code: @SubscribeEvent public static void onLivingAttackEvent(LivingAttackEvent event) { if (event.getEntityLiving().getItemStackFromSlot(EquipmentSlotType.HEAD).getItem() == ItemInit.CUSTOM_HELMET.get()) { if (event.getSource().getTrueSource().getEntity() instanceof MobEntity) { ((MobEntity)event.getSource().getTrueSource().getEntity()).addPotionEffect(new EffectInstance(Effects.SLOWNESS, 700, 1)); ((MobEntity)event.getSource().getTrueSource().getEntity()).addPotionEffect(new EffectInstance(Effects.WEAKNESS, 700, 1)); } } } But for some reason I can add Poison or Instance damage to mobs 😕 it simply doesn't appear in the game
-
Adding potionEffect to Attacking entity
Sorry
-
Adding potionEffect to Attacking entity
Yea! @SubscribeEvent public static void onLivingAttackEvent(LivingAttackEvent event) { if (event.getEntityLiving().getItemStackFromSlot(EquipmentSlotType.HEAD).getItem() == ItemInit.CUSTOM_HELMET.get()) { event.getSource().getTrueSource().getEntity().onKillCommand(); } } It works this way with onKillCommand, but I can't understand how to convert Entity to EntityLiving, because I can add potion effects only to EntityLiving.
-
Adding potionEffect to Attacking entity
Yea, I was registering it wrong! Now it's: MinecraftForge.EVENT_BUS.register(EventHandler.class); And, of course, I've change my method to static. So it was working, but it was working wrong, because it was adding potion effect to player, so I've changed it to event.getEntityLiving().getAttackingEntity().addPotionEffect(new EffectInstance(Effects.WEAKNESS, 700, 1)); But now it just breaks as soon as mob attacks me. What can be the reason? May be I should fo it through .getLastDamageSource() or something else?
-
Adding potionEffect to Attacking entity
Ok, it seems right for me now, but it still doesn't work I've deleted particles line, because I think it's too much for my Java level right now 😕 public class EventHandler { @SubscribeEvent public void onLivingAttackEvent(LivingAttackEvent event) { if (event.getEntityLiving().getItemStackFromSlot(EquipmentSlotType.HEAD).getItem() == ItemInit.CUSTOM_HELMET.get()) { event.getEntityLiving().addPotionEffect(new EffectInstance(Effects.WEAKNESS, 700, 1)); event.getEntityLiving().addPotionEffect(new EffectInstance(Effects.SLOWNESS, 700, 1)); event.getEntityLiving().addPotionEffect(new EffectInstance(Effects.POISON, 700, 1 )); } } }
-
Adding potionEffect to Attacking entity
Yes, I was considering adding it to EventHandler, but I can't figure out how should I check if player is wearing armor or not. I'm adding particles with function addParticle: public class EventHandler { @SubscribeEvent public void onLivingAttackEvent(LivingAttackEvent event) { event.getEntityLiving().addPotionEffect(new EffectInstance(Effects.WEAKNESS, 700, 1)); event.getEntityLiving().addPotionEffect(new EffectInstance(Effects.SLOWNESS, 700, 1)); event.getEntityLiving().addPotionEffect(new EffectInstance(Effects.POISON, 700, 1 )); event.getEntity().world.addParticle(ParticleTypes.CLOUD, (double) event.getEntity().prevPosX, (double) event.getEntity().prevPosY - 0.15D, (double) event.getEntity().prevPosZ, 0.01D, 0.01D, 0.01D); } } P.s. i'm very sorry for my ignorance, but i'm really really want to learn it
-
Adding potionEffect to Attacking entity
Yes, that's logical... I've done that, but I think that I did something wrong. I placed this into my armor class: @SubscribeEvent public void onLivingAttackEvent(LivingAttackEvent event) { event.getEntityLiving().addPotionEffect(new EffectInstance(Effects.WEAKNESS, 700, 1)); event.getEntityLiving().addPotionEffect(new EffectInstance(Effects.SLOWNESS, 700, 1)); event.getEntityLiving().addPotionEffect(new EffectInstance(Effects.POISON, 700, 1 )); } And i have noooo idea how to add particles to this mob.
-
Adding potionEffect to Attacking entity
Sorrrrym what I am trying to do: If some mod is attacking player that wear special armor, this attacking mob shoud get posion effect.
-
Adding potionEffect to Attacking entity
Thanks, I think I accidently put it there, i've deleted it. I didn't find anything else, I've just searched in available functions of player.(functions that eclipse suggests) and it was the most applicable one. What function should I use instead? It doesn't really matter for me, but if you tell me how to do it anther way, I would be gla-a-ad.
-
Adding potionEffect to Attacking entity
Hi! I'm trying to add potion effect and particles to entity that is attaching player that wearing special armor. I've already added potion effect and particles to player and it works perfectly fine. What am I doing wrong with entity? @OnlyIn(Dist.CLIENT) @Override public void onArmorTick(ItemStack stack, World world, PlayerEntity player) { world.addParticle(ParticleTypes.SQUID_INK, (double)player.prevPosX, (double)player.prevPosY - 0.15D, (double)player.prevPosZ, 0.01D, 0.01D, 0.01D); if(world.isNightTime()) { player.addPotionEffect(new EffectInstance(Effects.NIGHT_VISION, 40, 0)); } LivingEntity entityIn = player.getAttackingEntity(); if(player.hitByEntity(entityIn)) { entityIn.addPotionEffect(new EffectInstance(Effects.SLOWNESS, 60, 0)); entityIn.addPotionEffect(new EffectInstance(Effects.POISON, 60, 0)); world.addParticle(ParticleTypes.LARGE_SMOKE, (double)entityIn.prevPosX, (double)entityIn.prevPosY + 1D, (double)entityIn.prevPosZ, 0.01D, 0.01D, 0.01D); } }
-
Armor with particles
Thanks! I'm going to try it out!
-
Armor with particles
Hi! Is there a way to add particles to armor? I know, it is possible to do with command block, but how can i do it with forge?
IPS spam blocked by CleanTalk.