reduced_shit_lifetime

This commit is contained in:
KitsuShadow
2016-01-29 06:12:48 -05:00
parent 5ba327799f
commit 46ca830234
7 changed files with 66 additions and 8 deletions

View File

@@ -7,6 +7,7 @@ import com.kitsu.medievalcraft.crafting.ModCrafting;
import com.kitsu.medievalcraft.entity.EntityITSpear;
import com.kitsu.medievalcraft.entity.EntityModelArrow;
import com.kitsu.medievalcraft.entity.EntityShit;
import com.kitsu.medievalcraft.entity.EntityShortLivedShit;
import com.kitsu.medievalcraft.entity.EntityTester;
import com.kitsu.medievalcraft.events.BucketHandle;
import com.kitsu.medievalcraft.events.EventHandle;
@@ -109,10 +110,11 @@ public class Main {
BucketHandle.INSTANCE.buckets.put(ModBlocks.blockTannin, ModItems.tanninBucket);
BucketHandle.INSTANCE.buckets.put(ModBlocks.blockSlackedLime, ModItems.slackBucket);
EntityRegistry.registerModEntity(EntityShit.class, "itemShit", 1, this, 64, 10, true);
//EntityRegistry.registerModEntity(EntityShit.class, "itemShit", 1, this, 64, 10, true);
EntityRegistry.registerModEntity(EntityModelArrow.class, "itemModelArrow", 2, this, 64, 10, true);
EntityRegistry.registerModEntity(EntityITSpear.class, "itemITSpear", 3, this, 64, 10, true);
EntityRegistry.registerModEntity(EntityTester.class, "itemTester", 4, this, 64, 10, true);
EntityRegistry.registerModEntity(EntityShortLivedShit.class, "itemShit", 5, this, 64, 10, true);
GameRegistry.registerFuelHandler(new FuelHandler());

View File

@@ -0,0 +1,25 @@
package com.kitsu.medievalcraft.entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class EntityShortLivedShit extends EntityItem {
public EntityShortLivedShit(World p_i1709_1_, double p_i1709_2_, double p_i1709_4_, double p_i1709_6_)
{
super(p_i1709_1_);
}
public EntityShortLivedShit(World world, double x, double y, double z,ItemStack stack) {
super(world, x, y, z, stack);
this.lifespan = 500;
}
public EntityShortLivedShit(World world)
{
super(world);
}
}

View File

@@ -18,6 +18,7 @@ import net.minecraftforge.client.event.MouseEvent;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.BiomeDictionary.Type;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.entity.item.ItemEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
@@ -442,6 +443,21 @@ public void splitLogEvent(PlayerInteractEvent event){
}
}
}
/*@SubscribeEvent
public void onItemShitJoinEvent(ItemEvent event){
if(!event.entity.worldObj.isRemote){
if(event.entity.getgetEntityItem().getItem() == ModItems.itemShit){
//System.out.println(event.entityItem.worldObj.getBlock((int)event.entityItem.posX, (int)event.entityItem.posY-2, (int)event.entityItem.posZ));
/*if(event.entityItem.worldObj.getBlock((int)event.entityItem.posX, (int)event.entityItem.posY-1, (int)event.entityItem.posZ)==Blocks.grass){
event.entityItem.setDead();
}
event.lifespan=200;
}
}
}*/
@SubscribeEvent
public void onLivingUpdateEventShit(LivingUpdateEvent event) {
@@ -454,6 +470,7 @@ public void splitLogEvent(PlayerInteractEvent event){
if ( rand.nextInt(1500) == 0 ) {
//Checks to see if the LivingUpdate is being applied to cow, if so:
if (event.entity instanceof EntityCow) {
event.entityLiving.dropItem(ModItems.itemShit, 1);
}
}

View File

@@ -1,16 +1,17 @@
package com.kitsu.medievalcraft.item.throwable;
import com.kitsu.medievalcraft.Main;
import com.kitsu.medievalcraft.entity.EntityShit;
import com.kitsu.medievalcraft.entity.EntityShortLivedShit;
import com.kitsu.medievalcraft.util.CustomTab;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import com.kitsu.medievalcraft.Main;
import com.kitsu.medievalcraft.entity.EntityShit;
import com.kitsu.medievalcraft.util.CustomTab;
import cpw.mods.fml.common.registry.GameRegistry;
public class ItemShit extends Item {
private String name = "itemShit";
@@ -24,7 +25,20 @@ public class ItemShit extends Item {
}
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
@Override
public boolean hasCustomEntity(ItemStack stack){
return true;
}
public Entity createEntity(World world, Entity location, ItemStack stack){
EntityShortLivedShit entity = new EntityShortLivedShit(world, location.posX, location.posY, location.posZ, stack);
entity.motionX = location.motionX;
entity.motionY = location.motionY;
entity.motionZ = location.motionZ;
return entity;
}
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
--stack.stackSize;