Jump to content

Recommended Posts

Posted

I have made a living drops event for my food item so sheep drop lambchops but every single mob is dropping the item?!?!?

 

This is the code

package assassinhero.parallelworlds;

import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.passive.EntityCow;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.living.LivingDropsEvent;

public class ParallelWorldsSheepDropsEvent {

public static double rand;

@ForgeSubscribe
public void onEntityDrop(LivingDropsEvent event){
	rand = Math.random();
	if(event.entityLiving instanceof EntitySheep);

	if(rand < 1.00){
		event.entityLiving.dropItem(ParallelWorlds.RawLambChop.itemID, 3);
	}


	}

}

STOP CRUCIFYING NEW MODDERS!!!!

Posted

dunno whats wrong with yours but if i were to do what you wanted it to i would write

package ashtonsmod.common;

import net.minecraft.block.Block;
import net.minecraft.block.BlockBreakable;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntitySheep;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;

public class BatDrops {

          public static double rand;

          @ForgeSubscribe
          public void onEntityDrop(LivingDropsEvent event) {
                  if (event.source.getDamageType().equals("player")) {
                       rand = Math.random();
                        if (event.entityLiving instanceof EntitySheep) {
                             if (rand < 1.00d){ 
                                event.entityLiving.dropItem(ParallelWorlds.RawLambChop.itemID, 3);
                           }
                     }}}

Use examples, i have aspergers.

Examples make sense to me.

Posted

if(event.entityLiving instanceof EntitySheep);

You do realise that if does absolutely fucking nothing?

Then ; at the end says that you're done with the block essentally you wrote:

if(event.entityLiving instanceof EntitySheep)
{
}

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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