• 0

    posted a message on Spawning entity from event handler

    Im trying to port my mod from 1.10.2 to 1.12.2 but so much has changed .This code worked before but now the eggShell spawns but the chicken does not.

    	@SubscribeEvent
    	public void hatch(ItemExpireEvent e) {
    		if (e.getEntityItem().getItem().getItem() == Items.EGG) {
    			 System.out.println("egg Despawn");
    			int stack = e.getEntityItem().getItem().getCount();
    			for (int i = 1; i <= stack; i++) {
    				if (r.nextInt(100) <= hatchChance) {
    					System.out.println("Chick spawn" + (stack + 1));
    					newChick = new EntityChicken(e.getEntity().world);
    					newChick.setPosition(e.getEntity().posX, e.getEntity().posY, e.getEntity().posZ);
    					newChick.setGrowingAge(-23000);
    					e.getEntity().world.spawnEntity(newChick);
    					e.getEntity().world.spawnEntity(new EntityItem(e.getEntity().world, e.getEntity().posX,
    							e.getEntity().posY, e.getEntity().posZ, new ItemStack(ModItems.eggShell, 1)));
    				} else {
    					e.getEntity().world.spawnEntity(new EntityItem(e.getEntity().world, e.getEntity().posX,
    							e.getEntity().posY, e.getEntity().posZ, new ItemStack(ModItems.rottenEgg, 1)));
    				}
    
    Posted in: Modification Development
  • 1

    posted a message on PrimalCore: Early Game Survival, Expanded Nether, Monsters and Mystery

    Hey I just wanted to say thanks for making this mod i had attempted to make something a few years back that was extremely similar but at the time i just wasn't a good enough modder. you can see it here.My Mod.

    any way this mod has 90 percent of the stuff from my mod plus way more! some people might be mad and say you copied their ideas but i just want to thank you for doing what i couldn't. its almost perfectly what i was going for.all the way down to breaking flint on rocks. I still haven't done everything there is to do. Anyway if it was all your idea then I'm glad someone else thinks like me. and if you drew some inspiration from my abandoned mod then thanks for bringing one of my dreams to life. Either way peace and keep updating it because its one of my new favorites.

    Posted in: Minecraft Mods
  • 0

    posted a message on Shards

    do you still need this? what version?

    Posted in: Requests / Ideas For Mods
  • 0

    posted a message on Is there a mod or anything to get rid of squids completely?

    Here you go this was my first 1.12 mod hope you like it! https://minecraft.curseforge.com/projects/no-squids


    It may take a few minutes for them to approve the post.

    Posted in: Requests / Ideas For Mods
  • 0

    posted a message on Coal processing machine that creates diamonds.

    I may do this for you if Tim falls through but I don't want to steal his thunder.

    Posted in: Requests / Ideas For Mods
  • 0

    posted a message on LivingSpawnEvent Fires on Chunkload And login

    I had to rework allot but I got it fixed for now. Do the vanilla entities reset their ai every time the chunk loads? because it seems like pausing the game is breaking things until I reload. Thanks BTW

    Posted in: Modification Development
  • 0

    posted a message on LivingSpawnEvent Fires on Chunkload And login

    Hey guys ..Question. im using this code to make my pigs spawn twins and it works fine until i log out when i rejoin it calls spawn entity a second time and doubles the baby pigs . i think its called again when a chunk reloads but not sureis there a method like LivingEntityEvent that only fires when a entity spawns the first time? heres my code for my event handler. thanks in advance sorry for the red font idk what happened

    package bigdirty1985.opig.event;
    
    import com.google.common.eventbus.Subscribe;
    
    import bigdirty1985.opig.EntityAI.EntityAIRoot;
    import bigdirty1985.opig.Items.ModItems;
    import jline.internal.Log;
    import net.minecraft.entity.Entity;
    import net.minecraft.entity.EntityAgeable;
    import net.minecraft.entity.EntityLiving;
    import net.minecraft.entity.ai.EntityAIEatGrass;
    import net.minecraft.entity.item.EntityItem;
    import net.minecraft.entity.passive.EntityPig;
    import net.minecraft.init.Items;
    import net.minecraft.item.ItemStack;
    import net.minecraftforge.event.entity.EntityJoinWorldEvent;
    import net.minecraftforge.event.entity.living.LivingDropsEvent;
    import net.minecraftforge.event.entity.living.LivingSpawnEvent;
    import net.minecraftforge.event.entity.living.BabyEntitySpawnEvent;
    import net.minecraftforge.event.entity.living.LivingSpawnEvent;
    import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
    import scala.util.Random;
    
    public class OPigEventHandler {
    
    	EntityPig newPig;
    	@SubscribeEvent
    	public void pigSpawn(LivingSpawnEvent e) {
    		Entity ee = e.getEntity();
    		//EntityLiving el = (EntityLiving) ee;
    		if (e.getEntity() instanceof EntityPig){
    			Log.info("Pig Spawned!");
    			EntityPig ep = (EntityPig) ee;
    			makePigsHungry((EntityPig) e.getEntity());
    			if (ep.getGrowingAge() < 0) {
    				Log.info("Its a Baby!");
    				if(ep.getGrowingAge() >= -24000 ) {
    					Log.info("Twins!");
    					newPig = new EntityPig(ep.getEntityWorld());
    					newPig.setPosition(ep.posX, ep.posY, ep.posZ);
    					//newPig.setHealth(8);
    					newPig.setGrowingAge(-25000);
    					makePigsHungry(newPig);
    					ep.getEntityWorld().spawnEntityInWorld(newPig); //That spawns the Entity
    					}}
    				}
    				
    		}
    			
    	@SubscribeEvent
    	public void deadPig(LivingDropsEvent event) {
    		if (event.getEntity() instanceof EntityPig) {
    			// DEBUG
    			System.out.println("EntityPig drops event");
    			ItemStack itemStackToDrop = new ItemStack(ModItems.bacon, new Random().nextInt(3));
    			event.getDrops().add(new EntityItem(event.getEntity().worldObj, event.getEntity().posX,
    
    					event.getEntity().posY, event.getEntity().posZ, itemStackToDrop));
    
    		}
    
    	}
    
    	private void makePigsHungry(EntityPig e) {
    		e.tasks.addTask(5, new EntityAIRoot(e));
    		Log.info("Pig is hungry!");
    
    	}
    
    }
    
    Posted in: Modification Development
  • 0

    posted a message on spawning multiple Entities on mating

    Thanks for the response but i figured it out myself. BabyEntitySpawned would have been so much easier lol.but thats not what i did...


    I was playing with the health to differentiate my babies from the vanilla babies so that i wouldn't create a PigOcalypse but i instead used the growing age to keep from spawning more . I may change my method later to clean things up but this works for now.Thanks again!


    P.S. isChild i believe just returns a boolean. an entity is a child if its GrowingAge is less than 0.


    package bigdirty1985.opig.event;
    
    import com.google.common.eventbus.Subscribe;
    
    import bigdirty1985.opig.Items.ModItems;
    import jline.internal.Log;
    import net.minecraft.entity.Entity;
    import net.minecraft.entity.EntityAgeable;
    import net.minecraft.entity.EntityLiving;
    import net.minecraft.entity.ai.EntityAIEatGrass;
    import net.minecraft.entity.item.EntityItem;
    import net.minecraft.entity.passive.EntityPig;
    import net.minecraft.init.Items;
    import net.minecraft.item.ItemStack;
    import net.minecraftforge.event.entity.EntityJoinWorldEvent;
    import net.minecraftforge.event.entity.living.LivingDropsEvent;
    import net.minecraftforge.event.entity.living.LivingSpawnEvent;
    import net.minecraftforge.event.entity.living.BabyEntitySpawnEvent;
    import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
    import scala.util.Random;
    
    public class OPigEventHandler {
    
    	EntityPig newPig;
    	@SubscribeEvent
    	public void pigSpawn(EntityJoinWorldEvent e) {
    		Entity ee = e.getEntity();
    		//EntityLiving el = (EntityLiving) ee;
    		if (e.getEntity() instanceof EntityPig) {
    			Log.info("Pig Spawned!");
    			EntityPig ep = (EntityPig) ee;
    			makePigsHungry((EntityPig) e.getEntity());
    			if (ep.getGrowingAge() < 0) {
    				Log.info("Its a Baby!");
    				if(ep.getGrowingAge() >= -24000 ) {
    					Log.info("Twins!");
    					newPig = new EntityPig(ep.getEntityWorld());
    					newPig.setPosition(ep.posX, ep.posY, ep.posZ);
    					//newPig.setHealth(8);
    					newPig.setGrowingAge(-25000);
    					makePigsHungry(newPig);
    					ep.getEntityWorld().spawnEntityInWorld(newPig); //That spawns the Entity
    					}}
    				}
    				
    		}
    			
    	@SubscribeEvent
    	public void deadPig(LivingDropsEvent event) {
    		if (event.getEntity() instanceof EntityPig) {
    			// DEBUG
    			System.out.println("EntityPig drops event");
    			ItemStack itemStackToDrop = new ItemStack(ModItems.bacon, new Random().nextInt(3));
    			event.getDrops().add(new EntityItem(event.getEntity().worldObj, event.getEntity().posX,
    
    					event.getEntity().posY, event.getEntity().posZ, itemStackToDrop));
    
    		}
    
    	}
    
    	private void makePigsHungry(EntityPig e) {
    		e.tasks.addTask(1, new EntityAIEatGrass(e));
    		Log.info("Pig is hungry!");
    
    	}
    
    }
    Posted in: Modification Development
  • 0

    posted a message on spawning multiple Entities on mating

    I'm trying to Make pigs produce multiple offspring and modify the AI on spawn as well.The problem is that i cant get it to spawn a baby, and the adult that i was able to spawn had no AI at all. the pigs that spawn naturally are using my AI. anyway here's the code. thanks in advance.


    package bigdirty1985.opig.event;
    
    import com.google.common.eventbus.Subscribe;
    
    import bigdirty1985.opig.Items.ModItems;
    import jline.internal.Log;
    import net.minecraft.entity.Entity;
    import net.minecraft.entity.EntityAgeable;
    import net.minecraft.entity.EntityLiving;
    import net.minecraft.entity.ai.EntityAIEatGrass;
    import net.minecraft.entity.item.EntityItem;
    import net.minecraft.entity.passive.EntityPig;
    import net.minecraft.init.Items;
    import net.minecraft.item.ItemStack;
    import net.minecraftforge.event.entity.EntityJoinWorldEvent;
    import net.minecraftforge.event.entity.living.LivingDropsEvent;
    import net.minecraftforge.event.entity.living.LivingSpawnEvent;
    import net.minecraftforge.event.entity.living.BabyEntitySpawnEvent;
    import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
    import scala.util.Random;
    
    public class OPigEventHandler {
    
    	EntityPig newPig;
    	@SubscribeEvent
    	public void pigSpawn(EntityJoinWorldEvent e) {
    		Entity ee = e.getEntity();
    		//EntityLiving el = (EntityLiving) ee;
    		if (e.getEntity() instanceof EntityPig) {
    			Log.info("Pig Spawned!");
    			EntityPig ep = (EntityPig) ee;
    			makePigsHungry((EntityPig) e.getEntity(), e);
    			if (e.getEntity() instanceof EntityAgeable) {
    				Log.info("Its a Baby!");
    				if(ep.getHealth() != 8) {
    					Log.info("Twins!");
    					newPig = new EntityPig(ep.getEntityWorld());
    					newPig.setPosition(ep.posX, ep.posY, ep.posZ);
    					newPig.setHealth(8);
    					newPig.createChild(newPig);
    					//ep.getEntityWorld().spawnEntityInWorld(newPig); //That spawns the Entity
    					
    					}}
    				}
    				
    		}
    			
    	@SubscribeEvent
    	public void deadPig(LivingDropsEvent event) {
    		if (event.getEntity() instanceof EntityPig) {
    			// DEBUG
    			System.out.println("EntityPig drops event");
    			ItemStack itemStackToDrop = new ItemStack(ModItems.bacon, new Random().nextInt(3));
    			event.getDrops().add(new EntityItem(event.getEntity().worldObj, event.getEntity().posX,
    
    					event.getEntity().posY, event.getEntity().posZ, itemStackToDrop));
    
    		}
    
    	}
    
    	private void makePigsHungry(EntityPig e, EntityJoinWorldEvent event) {
    		e.tasks.addTask(1, new EntityAIEatGrass(e));
    		Log.info("Pig is hungry!");
    
    	}
    
    }
    
    Posted in: Modification Development
  • 0

    posted a message on Modifying Vanilla Mob behavior

    https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/mapping-and-modding-tutorials/2281106-tutorial-how-to-change-an-existing-mobs-ai


    To anyone wanting to know I found my solution here. I don't know if this forum is dead or people have just moved on. But thus is like the 5th topic that has gone unanswered.

    Posted in: Modification Development
  • 0

    posted a message on Modifying Vanilla Mob behavior

    I am trying to modify the behavior of vanilla mobs. for example Pigs.but i am wondering if there is a way to do it without making my own pig class.

    if i override pig that could interfere with other mods right? i have made custom mobs in 1.7.2 about 4 years ago. but i'm struggling to get back into modding. i think i can handle the ai tasks but i dont know how to get my classes structured to add to the task list. i hope i was clear enough with my problem.


    short version how could i make vanilla pigs try to eat grass like sheep. specifically where do i need to call AI.EatGrass(or whatever the method was)

    Posted in: Modification Development
  • 0

    posted a message on the aftermath hqm turtle leaf farm problem

    I'm playing on darcsotos aftermath. And I'm trying to write my own turtle program to shear leaves the problem is the turtle breaks the leaves but doesn't get the block I have tried turtle.attack() as well as turtle.dig() the turtle is equipped with shears and I have the shear selected.can anyone tell me what is wrong. If you need screen shots or anything let me know.thanks for any help.

    Posted in: Mod Packs
  • 0

    posted a message on help modifying tinkers recipes

    Hi I'm building a modpack for 1.10.2 using tinkers construct and crafttweaker and i've read the wiki for minetweaker but don't understand how to change tinkers recipes. back in 1.7.10 there was a mod called iguanas tinker tweaks that disabled crafting of wood and stone tools. i'm trying to find a way to recreate that feature for my pack . any suggestions ?

    Posted in: Mods Discussion
  • 0

    posted a message on Journey to the core / Enviromine / random things integration problem

    Umm guys??.....GULP! 2 blocks from my base.

    Posted in: Mods Discussion
  • 0

    posted a message on Journey to the core / Enviromine / random things integration problem

    I'll try to keep this short. i am having enviromine earthquakes in my random things pocket dimension(specter key) on JTTC. this is obviously unintended behavior and i cant seem to find the config option to disable earthquakes at all. let alone for specific dimensions. ive ctrl + f on enviromine cfg file but there is no quake options anywhere. help?

    Posted in: Mods Discussion
  • To post a comment, please or register a new account.