Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Egietje

Forge Modder
  • Joined

  • Last visited

Everything posted by Egietje

  1. Hello, I want to update an old mod but I don't have the source of it, but I do have the normal download with .class files but I wonder how I can convert them all at once, maybe with gradle or something? EDIT : The original version is 1.5.2 and the version I want to make it is 1.10.2
  2. Why don't you use a 2 classes, a block class and an item class?
  3. Well, after putting System.out.println in the boolean methods it looks like they aren't spawning under Y 55... Here are the Y coordinates:
  4. Did you register the models?
  5. But it isn't getting suspended when I set the breakpoint to the getCanSpawnHer method
  6. When I set a breakpoint to the cunstructor it suspends
  7. I have a breakpoint but it doesn't suspend anything...
  8. I mean the breakpoint
  9. Ehm, how do I do that?
  10. I also lowered the y level to 55, here is the full class: package com.Egietje.KokkieMod.mobs.grot; import java.util.UUID; import javax.annotation.Nullable; import com.Egietje.KokkieMod.init.KokkieSounds; import com.Egietje.KokkieMod.mobs.KokkieLoot; import com.google.common.base.Predicate; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackMelee; import net.minecraft.entity.ai.EntityAIBeg; import net.minecraft.entity.ai.EntityAIFollowOwner; import net.minecraft.entity.ai.EntityAIFollowParent; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAILeapAtTarget; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAIMate; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget; import net.minecraft.entity.ai.EntityAIOwnerHurtTarget; import net.minecraft.entity.ai.EntityAIPanic; import net.minecraft.entity.ai.EntityAISit; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAITargetNonTamed; import net.minecraft.entity.ai.EntityAITempt; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.passive.EntityChicken; import net.minecraft.entity.passive.EntityHorse; import net.minecraft.entity.passive.EntityRabbit; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.entity.passive.EntityTameable; import net.minecraft.entity.passive.EntityWolf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.init.Items; import net.minecraft.init.SoundEvents; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.datasync.DataParameter; import net.minecraft.network.datasync.DataSerializers; import net.minecraft.network.datasync.EntityDataManager; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumHand; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraft.util.datafix.DataFixer; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.EnumDifficulty; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.World; import net.minecraft.world.storage.loot.LootTableList; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class EntityGrotKokkie extends EntityTameable { private static final DataParameter<Float> DATA_HEALTH_ID = EntityDataManager .<Float>createKey(EntityGrotKokkie.class, DataSerializers.FLOAT); private float headRotationCourse; private float headRotationCourseOld; public EntityGrotKokkie(World worldIn) { super(worldIn); this.setSize(0.4F, 0.6F); this.setTamed(false); } protected void initEntityAI() { this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAIAttackMelee(this, 1.0D, true)); this.tasks.addTask(3, new EntityAIMate(this, 1.0D)); this.tasks.addTask(4, new EntityAIWander(this, 1.0D)); this.tasks.addTask(5, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(6, new EntityAILookIdle(this)); this.tasks.addTask(7, new EntityAILeapAtTarget(this, 0.4F)); this.tasks.addTask(8, new EntityAIFollowParent(this, 1.1D)); this.tasks.addTask(9, new EntityAITempt(this, 0.9D, Items.CHICKEN, false)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true, new Class[0])); this.targetTasks.addTask(2, new EntityAITargetNonTamed(this, EntityAnimal.class, false, new Predicate<Entity>() { public boolean apply(@Nullable Entity p_apply_1_) { return p_apply_1_ instanceof EntitySheep || p_apply_1_ instanceof EntityRabbit || p_apply_1_ instanceof EntityChicken; } })); } @Override protected ResourceLocation getLootTable() { return KokkieLoot.ENTITIES_GROT; } @Override public boolean isBreedingItem(@Nullable ItemStack stack) { return stack == null ? false : stack.getItem() == Items.CHICKEN; } protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.30000001192092896D); this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(2.0D); this.getAttributeMap().registerAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(0.5D); } protected void updateAITasks() { this.dataManager.set(DATA_HEALTH_ID, Float.valueOf(this.getHealth())); } protected void entityInit() { super.entityInit(); this.dataManager.register(DATA_HEALTH_ID, Float.valueOf(this.getHealth())); } protected void playStepSound(BlockPos pos, Block blockIn) { this.playSound(SoundEvents.ENTITY_ITEMFRAME_REMOVE_ITEM, 0.15F, 1.0F); } public static void func_189788_b(DataFixer p_189788_0_) { EntityLiving.func_189752_a(p_189788_0_, "GrotKokkie"); } protected SoundEvent getAmbientSound() { return this.isAngry() ? KokkieSounds.GROT_KOKKIE_ANGRY : (this.rand.nextInt(2) == 0 ? KokkieSounds.GROT_KOKKIE_AMBIENCE : KokkieSounds.GROT_KOKKIE_AMBIENCE); } protected SoundEvent getHurtSound() { return KokkieSounds.GROT_KOKKIE_HURT; } protected SoundEvent getDeathSound() { return KokkieSounds.GROT_KOKKIE_DEATH; } /** * Returns the volume for the sounds this mob makes. */ protected float getSoundVolume() { return 0.4F; } /** * Called to update the entity's position/logic. */ public void onUpdate() { super.onUpdate(); this.headRotationCourseOld = this.headRotationCourse; this.headRotationCourse += (0.0F - this.headRotationCourse) * 0.4F; } @SideOnly(Side.CLIENT) public float getInterestedAngle(float p_70917_1_) { return (this.headRotationCourseOld + (this.headRotationCourse - this.headRotationCourseOld) * p_70917_1_) * 0.15F * (float) Math.PI; } public float getEyeHeight() { return this.height; } public int getVerticalFaceSpeed() { return this.isSitting() ? 20 : super.getVerticalFaceSpeed(); } public boolean attackEntityAsMob(Entity entityIn) { boolean flag = entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), (float) ((int) this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue())); if (flag) { this.applyEnchantments(this, entityIn); } return flag; } public EntityGrotKokkie createChild(EntityAgeable ageable) { EntityGrotKokkie kokkie = new EntityGrotKokkie(this.worldObj); return kokkie; } public boolean canMateWith(EntityAnimal otherAnimal) { if (otherAnimal == this) { return false; } else if (!(otherAnimal instanceof EntityGrotKokkie)) { return false; } else { EntityGrotKokkie entitywolf = (EntityGrotKokkie) otherAnimal; return this.isInLove() && entitywolf.isInLove(); } } public boolean isAngry() { return (((Byte) this.dataManager.get(TAMED)).byteValue() & 2) != 0; } public void setAngry(boolean angry) { byte b0 = ((Byte) this.dataManager.get(TAMED)).byteValue(); if (angry) { this.dataManager.set(TAMED, Byte.valueOf((byte) (b0 | 2))); } else { this.dataManager.set(TAMED, Byte.valueOf((byte) (b0 & -3))); } } public boolean shouldAttackEntity(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_) { if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast)) { return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer && !((EntityPlayer) p_142018_2_).canAttackPlayer((EntityPlayer) p_142018_1_) ? false : !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse) p_142018_1_).isTame(); } else { return false; } } public void setAttackTarget(@Nullable EntityLivingBase entitylivingbaseIn) { super.setAttackTarget(entitylivingbaseIn); if (entitylivingbaseIn == null) { this.setAngry(false); } else { this.setAngry(true); } } public void writeEntityToNBT(NBTTagCompound compound) { super.writeEntityToNBT(compound); compound.setBoolean("Angry", this.isAngry()); } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ public void readEntityFromNBT(NBTTagCompound compound) { super.readEntityFromNBT(compound); this.setAngry(compound.getBoolean("Angry")); } public void onLivingUpdate() { super.onLivingUpdate(); if (!this.worldObj.isRemote && this.getAttackTarget() == null && this.isAngry()) { this.setAngry(false); } } @Override public boolean getCanSpawnHere() { return super.getCanSpawnHere() && !this.worldObj.canBlockSeeSky(this.getPosition()) && this.getPosition().getY() < 55; } }
  11. Thanks, but they also spawned higher than 64..?
  12. Will return super.getCanSpawnHere() && this.worldObj.canBlockSeeSky(this.getPosition()) && this.getPosition().getY() < 64; work?
  13. Just wait until he uploads another tutorial
  14. I know, but how can I make it so they only spawn under 64 y levels?
  15. Dude, do you have any models and textures?!
  16. Hello, I want to make a mob that only spawns in caves (can't see sky using this.worldObj.canBlockSeeSky) and make it so it only spawns < 64 y to prevent it from spawning under trees but how would I make it spawn only under 64 y levels?
  17. Dude, you shouldn't have copied my example, it was just to show how...
  18. And then in your items class it would be something like this: public class PlasticItems { public static ArmorMaterial plastic_armor_material; public static Item PLASTIC_HELMET; public static Item PLASTIC_CHESTPLATE; public static Item PLASTIC_LEGGINGS; public static Item PLASTIC_BOOTS; public static void init() { plastic_armor_material = EnumHelper.addArmorMaterial("plastic_armor_material", "", 473, new int[] {3, 6, 8, 3}, 17, SoundEvents.ENTITY_EGG_THROW, 3); PLASTIC_HELMET = new ItemPlasticArmor(plastic_armor_material, EntityEquipmentSlot.HEAD, "plastic_helmet").setCreativeTab(CreativeTabs.COMBAT); PLASTIC_CHESTPLATE = new ItemPlasticArmor(plastic_armor_material, EntityEquipmentSlot.CHEST, "plastic_chestplate").setCreativeTab(CreativeTabs.COMBAT); PLASTIC_LEGGINGS = new ItemPlasticArmor(plastic_armor_material, EntityEquipmentSlot.LEGS, "plastic_leggings").setCreativeTab(CreativeTabs.COMBAT); PLASTIC_BOOTS = new ItemPlasticArmor(plastic_armor_material, EntityEquipmentSlot.FEET, "plastic_boots").setCreativeTab(CreativeTabs.COMBAT); } public static void register() { GameRegistry.register(PLASTIC_HELMET); GameRegistry.register(PLASTIC_CHESTPLATE); GameRegistry.register(PLASTIC_LEGGINGS); GameRegistry.register(PLASTIC_BOOTS); } }
  19. First: put it in a code field Second: It should look a little like this public class ItemPlasticArmor extends ItemArmor { public ItemPlasticArmor(ArmorMaterial materialIn, EntityEquipmentSlot equipmentSlotIn, String name) { super(materialIn, 0, equipmentSlotIn); this.setUnlocalizedName(name); this.setRegistryName(name); } public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) { if (slot == EntityEquipmentSlot.HEAD || slot == EntityEquipmentSlot.CHEST || slot == EntityEquipmentSlot.FEET) { return "ID:textures/models/armor/armor_layer_1.png"; } else if (slot == EntityEquipmentSlot.LEGS) { return "ID:textures/models/armor/armor_layer_2.png"; } else { return null; } } }
  20. I know, it works thanks!
  21. And then hurting them by entityInAABB.attackEntityFrom(DamageSource.causePlayerDamage(player), 1.0F);
  22. No, I was f*cking around, but this works, right? for (int i = 0; i < entitiesInAABB.size(); i++) { EntityLivingBase entityInAABB = entitiesInAABB.get(i); //Hurt entityInAABB }

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.