Jump to content

[1.8.9][SMP]block setting or item summoning not working on dedicated server?


thvardhan

Recommended Posts

hello, in my mod i have block which have this method

 

    @Override
    public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state) {
    	
    	
    	
        	ExtraFunctions.musicKit(worldIn, pos);
       // 	ExtraFunctions.chat(worldIn, pos, "a");
    	
    		
    	//	drops(worldIn, pos);
    
    	
    }

 

 

if i run this on server (dedicated server) and connect to it with my client (modded) none of these drops work. however items and entities are working fine,

 

this is my method

 

	public static void musicKit(World worldIn,BlockPos pos)
{
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Blocks.jukebox));
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Items.record_11));
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Items.record_13));
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Items.record_blocks));
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Items.record_cat));
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Items.record_chirp));
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Items.record_far));
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Items.record_mall));
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Items.record_mellohi));
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Items.record_stal));
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Items.record_strad));
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Items.record_wait));
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Items.record_ward));


}

 

	public static void summonItemAsDrop(BlockPos pos, World worldIn,ItemStack stack) {

	 float f = 0.5F;
	double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
        double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
        double d2 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
        EntityItem entityitem = new EntityItem(worldIn, (double)pos.getX() + d0, (double)pos.getY() + d1, (double)pos.getZ() + d2,stack);
        entityitem.setDefaultPickupDelay();
        worldIn.spawnEntityInWorld(entityitem);

}

 

error log (from dedicated server)

[16:07:34] [server thread/INFO]: thvardhan joined the game
[16:07:37] [server thread/WARN]: Can't keep up! Did the system time change, or is the server overloaded? Running 2446ms behind, skipping 48 tick(s)
[16:07:43] [server thread/FATAL]: Error executing task
java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityPlayerSP
at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_60]
at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_60]
at net.minecraft.util.Util.runTask(Util.java:23) [util.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:736) [MinecraftServer.class:?]
at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:365) [DedicatedServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:681) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:548) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_60]
Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityPlayerSP
at com.thvardhan.ytstuff.blocks.AntVenomLuckyBlock.onBlockDestroyedByPlayer(AntVenomLuckyBlock.java:70) ~[AntVenomLuckyBlock.class:?]
at net.minecraft.server.management.ItemInWorldManager.removeBlock(ItemInWorldManager.java:288) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.removeBlock(ItemInWorldManager.java:278) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:317) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.onBlockClicked(ItemInWorldManager.java:164) ~[itemInWorldManager.class:?]
at net.minecraft.network.NetHandlerPlayServer.processPlayerDigging(NetHandlerPlayServer.java:551) ~[NetHandlerPlayServer.class:?]
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:56) ~[C07PacketPlayerDigging.class:?]
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:12) ~[C07PacketPlayerDigging.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_60]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_60]
at net.minecraft.util.Util.runTask(Util.java:22) ~[util.class:?]
... 5 more
Caused by: java.lang.ClassNotFoundException: net.minecraft.client.entity.EntityPlayerSP
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) ~[launchwrapper-1.12.jar:?]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_60]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_60]
at com.thvardhan.ytstuff.blocks.AntVenomLuckyBlock.onBlockDestroyedByPlayer(AntVenomLuckyBlock.java:70) ~[AntVenomLuckyBlock.class:?]
at net.minecraft.server.management.ItemInWorldManager.removeBlock(ItemInWorldManager.java:288) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.removeBlock(ItemInWorldManager.java:278) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:317) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.onBlockClicked(ItemInWorldManager.java:164) ~[itemInWorldManager.class:?]
at net.minecraft.network.NetHandlerPlayServer.processPlayerDigging(NetHandlerPlayServer.java:551) ~[NetHandlerPlayServer.class:?]
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:56) ~[C07PacketPlayerDigging.class:?]
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:12) ~[C07PacketPlayerDigging.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_60]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_60]
at net.minecraft.util.Util.runTask(Util.java:22) ~[util.class:?]
... 5 more
Caused by: net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerException: Exception in class transformer net.minecraftforge.fml.common.asm.transformers.SideTransformer@305f7627 from coremod FMLCorePlugin
at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:234) ~[forgeSrc-1.8.9-11.15.1.1722.jar:?]
at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) ~[launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) ~[launchwrapper-1.12.jar:?]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_60]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_60]
at com.thvardhan.ytstuff.blocks.AntVenomLuckyBlock.onBlockDestroyedByPlayer(AntVenomLuckyBlock.java:70) ~[AntVenomLuckyBlock.class:?]
at net.minecraft.server.management.ItemInWorldManager.removeBlock(ItemInWorldManager.java:288) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.removeBlock(ItemInWorldManager.java:278) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:317) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.onBlockClicked(ItemInWorldManager.java:164) ~[itemInWorldManager.class:?]
at net.minecraft.network.NetHandlerPlayServer.processPlayerDigging(NetHandlerPlayServer.java:551) ~[NetHandlerPlayServer.class:?]
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:56) ~[C07PacketPlayerDigging.class:?]
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:12) ~[C07PacketPlayerDigging.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_60]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_60]
at net.minecraft.util.Util.runTask(Util.java:22) ~[util.class:?]
... 5 more
Caused by: java.lang.RuntimeException: Attempted to load class net/minecraft/client/entity/EntityPlayerSP for invalid side SERVER
at net.minecraftforge.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:49) ~[forgeSrc-1.8.9-11.15.1.1722.jar:?]
at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:230) ~[forgeSrc-1.8.9-11.15.1.1722.jar:?]
at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) ~[launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) ~[launchwrapper-1.12.jar:?]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_60]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_60]
at com.thvardhan.ytstuff.blocks.AntVenomLuckyBlock.onBlockDestroyedByPlayer(AntVenomLuckyBlock.java:70) ~[AntVenomLuckyBlock.class:?]
at net.minecraft.server.management.ItemInWorldManager.removeBlock(ItemInWorldManager.java:288) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.removeBlock(ItemInWorldManager.java:278) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:317) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.onBlockClicked(ItemInWorldManager.java:164) ~[itemInWorldManager.class:?]
at net.minecraft.network.NetHandlerPlayServer.processPlayerDigging(NetHandlerPlayServer.java:551) ~[NetHandlerPlayServer.class:?]
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:56) ~[C07PacketPlayerDigging.class:?]
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:12) ~[C07PacketPlayerDigging.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_60]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_60]
at net.minecraft.util.Util.runTask(Util.java:22) ~[util.class:?]
... 5 more

 

 

P.S. i tried doing if coditions for world isremote and !isremote

Link to comment
Share on other sites

i dont know how to tell server when block is broken with proxy

 

Proxies are just sided code.  If the code only runs on the client, then you have to use packets to tell the server anything.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

mmmmmmmm.... for example if i add if(!world.isremote) my code works fine in SSP but doesnt in SMP in other words all placing/summoning is done on server so i should i have a packet system to tell my client about changes on server ?  mmmmmmmm..... is there is any other easy way? because i cant quite understand the packet system..

Link to comment
Share on other sites

Until a few weeks ago I hated everything packet too. But they really do help, basically what seems to be happening is that onBlockDestroyedByPlayer is only client side so it fails to tell the dedicated server that the block has been destroyed. So what you want to do is tell the server that the block has been destroyed. You do this with packets.

Link to comment
Share on other sites

sorry for late update i have changed a few things here

 

first this is my block now

 

package com.thvardhan.ytstuff.blocks;

import java.util.Random;

import com.thvardhan.ytstuff.CommonProxy;
import com.thvardhan.ytstuff.functions.ExtraFunctions;
import com.thvardhan.ytstuff.items.ModItems;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.world.World;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class AntVenomLuckyBlock extends Block {


public AntVenomLuckyBlock(String unlocalizedName, Material material, float hardness, float resistance) {
        super(material);
        this.setUnlocalizedName(unlocalizedName);
        this.setCreativeTab(CommonProxy.tabYTStuffMod);
        this.setHardness(hardness);
        this.setResistance(resistance);
        this.setBlockBounds(0, 0, 0, 1, 0.9F, 1);
    }

public AntVenomLuckyBlock(String unlocalizedName, float hardness, float resistance) {
        this(unlocalizedName, Material.rock, 0, 10000);
    }

    public AntVenomLuckyBlock(String unlocalizedName) {
        this(unlocalizedName, 2.0f, 10.0f);
    }
    
    @Override
    public boolean isOpaqueCube() {
    	return false;
    }
    
    @SideOnly(Side.CLIENT)
    public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
    {
        for (int i = 0; i < 3; ++i)
        {
            int j = rand.nextInt(2) * 2 - 1;
            int k = rand.nextInt(2) * 2 - 1;
            double d0 = (double)pos.getX() + 0.5D + 0.25D * (double)j;
            double d1 = (double)((float)pos.getY() + rand.nextFloat());
            double d2 = (double)pos.getZ() + 0.5D + 0.25D * (double)k;
            double d3 = (double)(rand.nextFloat() * (float)j);
            double d4 = ((double)rand.nextFloat() - 0.5D) * 0.125D;
            double d5 = (double)(rand.nextFloat() * (float)k);
            worldIn.spawnParticle(EnumParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5, new int[0]);
        }
    }
    
    
    @Override
    public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
    	
    	
    	if(!world.isRemote && player != null && !(player instanceof FakePlayer)){
          	drops(world, pos,player);
          	ExtraFunctions.setOneBlock(world, pos, Blocks.air);
    	}
    	
    	
    	return true;
    	
    	
    }
    

    

    private static void drops(World worldIn,BlockPos pos,EntityPlayer player){

	Random rand=new Random();
	switch(rand.nextInt(50)){
	default:{
    		ExtraFunctions.lookUp(worldIn, pos,player);
		break;
	}
	case 0:{

    		ExtraFunctions.lookUp(worldIn, pos,player);
		break;
	}
	case 1:{
		ExtraFunctions.foodKit(worldIn, pos);
		break;    			
	}
	case 2:{
		ExtraFunctions.chat(worldIn, pos, EnumChatFormatting.BLACK+"Special Troll",player);
		break;    			
	}
	case 3:{
		Enchantment[] e={Enchantment.protection,Enchantment.fireProtection,Enchantment.blastProtection,Enchantment.featherFalling,Enchantment.fireProtection};
		ExtraFunctions.addEnchantsMany(new ItemStack(Items.diamond_boots), e, 5, worldIn, pos);
		break;    			
	}case 4:{
		ExtraFunctions.materialKit(worldIn, pos);
		break;    			
	}case 5:{
		ExtraFunctions.tntFix(worldIn, pos, 64);
		break;    			
	}case 6:{
		ExtraFunctions.burgerStruct(worldIn, pos);
		break;    			
	}case 7:{
		ExtraFunctions.materialKit(worldIn, pos);
		break;    			
	}case 8:{
		ExtraFunctions.holeDeathTrap(worldIn, pos);
		break;    			
	}case 9:{
		ExtraFunctions.endWellStruct(worldIn, pos);
		break;    			
	}case 10:{
		ExtraFunctions.hellWellStructure(worldIn, pos);
		break;    			
	}case 11:{
		ExtraFunctions.orcArmy(worldIn, pos, 20, false, 0);
		break;    			
	}case 12:{
		ExtraFunctions.summonItemWithLoop(worldIn, pos, Items.golden_apple, 15, 1, 5);
		break;    			
	}case 13:{
		ExtraFunctions.summonItemWithLoop(worldIn, pos, Items.apple, 64, 0, 0);
		break;    			
	}case 14:{
		ExtraFunctions.mountain(worldIn, pos);
		break;    			
	}case 15:{
		ExtraFunctions.summonAntVenom(worldIn, pos, 0, true, 10);
		break;    			
	}case 16:{
		ExtraFunctions.summonBunny(worldIn, pos, 0, true, 5);
		break;    			
	}case 17:{
		ExtraFunctions.summonBlaze(worldIn, pos, 20);
		break;    			
	}case 18:{
		ExtraFunctions.potionKit(worldIn, pos);
		break;    			
	}case 19:{
		ExtraFunctions.musicKit(worldIn, pos);
		break;    			
	}case 20:{
		ExtraFunctions.setTntWithBlock(worldIn, pos);
		break;    			
	}case 21:{
		ExtraFunctions.setOneBlock(worldIn, pos, Blocks.flowing_lava);
		break;    			
	}case 22:{
		ExtraFunctions.setOneBlock(worldIn, pos, Blocks.bedrock);
		ExtraFunctions.chat(worldIn, pos, EnumChatFormatting.BLACK+"Try to break me :V",player);
		break;    			
	}case 23:{
		ExtraFunctions.chat(worldIn, pos, EnumChatFormatting.AQUA+"This Lucky Block You Just Opened Is Buged  Please Open Other One ",player);
		break;    			
	}case 24:{
		ExtraFunctions.setOneBlock(worldIn, pos, ModBlocks.danTDMLuckyBlock);
		break;    			
	}case 25:{
		ExtraFunctions.summonEnchantedItemAsDrop(worldIn, pos, Items.wooden_sword, EnumChatFormatting.BLUE+"Mama", Enchantment.featherFalling, 100);
		break;    			
	}case 26:{
		ExtraFunctions.summonDanTDM(worldIn, pos, 5, false, 0);
		break;    			
	}case 27:{
		ExtraFunctions.summonGhost(worldIn, pos, 25, false, 0);
		break;    			
	}case 28:{
		ExtraFunctions.setTntWithBlock(worldIn, pos);
		break;    			
	}case 29:{
		ExtraFunctions.setOneBlock(worldIn, pos, Blocks.cake);
		break;    			
	}case 30:{
		ExtraFunctions.summonBlockAsDrop(pos, worldIn, Blocks.iron_block);
		break;    			
	}case 31:{
		ExtraFunctions.summonPopularMMO(worldIn, pos, 5);
		break;    			
	}case 32:{
		ExtraFunctions.summonBunny(worldIn, pos, 0, true, 25);
		break;    			
	}case 33:{
		ExtraFunctions.burgerStruct(worldIn, pos);
		break;    			
	}case 34:{
		ExtraFunctions.foodKit(worldIn, pos);
		break;    			
	}case 35:{
		ExtraFunctions.summonBlockAsDrop(pos, worldIn, Blocks.cake);
		break;    			
	}case 36:{
		ExtraFunctions.summonBlockAsDrop(pos, worldIn, Blocks.dragon_egg);
		break;    			
	}case 37:{
		ExtraFunctions.summonBlockAsDrop(pos, worldIn, Blocks.bed);
		break;    			
	}case 38:{
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(ModItems.ytBoots));
		break;    			
	}case 39:{
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(ModItems.ytChestplate));
		break;    			
	}case 40:{
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(ModItems.levinSword));
		break;    			
	}case 41:{
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(ModItems.ytHelmet));
		break;    			
	}case 42:{
		ExtraFunctions.summonItemWithLoop(worldIn, pos, Items.diamond, 64, 0, 0);
		break;    			
	}case 43:{
		ExtraFunctions.summonItemStackWithLoop(worldIn, pos, new ItemStack(Blocks.gold_block),55, 1, 5);
		break;    			
	}case 44:{
		ExtraFunctions.summonItemStackWithLoop(worldIn, pos, new ItemStack(Items.emerald), 54, 0, 0);
		break;    			
	}case 45:{
		ExtraFunctions.trollChat(worldIn, pos,player);
		break;    			
	}case 46:{
		ExtraFunctions.giveBlocks(worldIn, pos, new ItemStack(ModBlocks.antVenomLuckyBlock),5,player);
		break;    			
	}case 47:{
		ExtraFunctions.redstoneKit(worldIn, pos);
		break;    			
	}case 48:{
		ExtraFunctions.summonSkeleton(worldIn, pos, 20);
		break;    			
	}case 49:{
		ExtraFunctions.materialKit(worldIn, pos);
		break;    			
	}case 50:{
		ExtraFunctions.summonGhost(worldIn, pos, 25, false, 5);
		break;    			
	}


	}
    }



}

 

 

and this extra functions

 

package com.thvardhan.ytstuff.functions;

import java.util.Random;

import com.mojang.realmsclient.gui.ChatFormatting;
import com.thvardhan.ytstuff.blocks.ModBlocks;
import com.thvardhan.ytstuff.entity.EntityAntVenom;
import com.thvardhan.ytstuff.entity.EntityCaptainSparklez;
import com.thvardhan.ytstuff.entity.EntityDanTDM;
import com.thvardhan.ytstuff.entity.EntityGhost;
import com.thvardhan.ytstuff.entity.EntityISquid;
import com.thvardhan.ytstuff.entity.EntityLogDotZip;
import com.thvardhan.ytstuff.entity.EntityPopularMMO;
import com.thvardhan.ytstuff.entity.EntitySerialPlayer;
import com.thvardhan.ytstuff.entity.EntitySkyDoesMinecraft;
import com.thvardhan.ytstuff.entity.EntitySuperGirlyGamer;
import com.thvardhan.ytstuff.entity.EntityTruemu;
import com.thvardhan.ytstuff.items.ModItems;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityTNTPrimed;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.monster.EntityIronGolem;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.passive.EntityCow;
import net.minecraft.entity.passive.EntityPig;
import net.minecraft.entity.passive.EntityRabbit;
import net.minecraft.entity.passive.EntitySquid;
import net.minecraft.entity.passive.EntityWolf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;

public class ExtraFunctions {


    /**
     * Summon Blocks As Drop With Loops
     * Par World,BlockPos,Block,loop(how many items you want to summon),style(1=down-top, anything else simple.),skip(ONLY USE FOR STYLE=1)
     * 
     */
    
    public static void summonBlockWithLoop(World worldIn, BlockPos pos,Block block,int loop,int style,int skip) {

    	 float f = 0.5F;
		double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
         double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
         double d2 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
         EntityItem entityitem = new EntityItem(worldIn, (double)pos.getX() + d0, (double)pos.getY() + d1, (double)pos.getZ() + d2, new ItemStack(block));
         entityitem.setDefaultPickupDelay();
         for(int i=0;i<=loop-1;i++){
        	 
        	 if(style==1){
        		 EntityItem entityitem1 = new EntityItem(worldIn, (double)pos.getX() , (double)pos.getY() +i+skip, (double)pos.getZ() , new ItemStack(block));
        	worldIn.spawnEntityInWorld(entityitem1);}
        	 else{
        		 EntityItem entityitem1 = new EntityItem(worldIn, (double)pos.getX() + d0, (double)pos.getY() + d1, (double)pos.getZ() + d2, new ItemStack(block));
        		 worldIn.spawnEntityInWorld(entityitem1);
        	 }
        	 }

         }
    	
    
    
/**
     * 
     * Summons A Block Like A Drop
     */

public static void summonBlockAsDrop(BlockPos pos, World worldIn,Block block) {

	 float f = 0.5F;
	double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
        double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
        double d2 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
        EntityItem entityitem = new EntityItem(worldIn, (double)pos.getX() + d0, (double)pos.getY() + d1, (double)pos.getZ() + d2, new ItemStack(block));
        entityitem.setDefaultPickupDelay();
        worldIn.spawnEntityInWorld(entityitem);

}


    
/**
     * 
     * Summons A Item Like A Drop
     */

public static void summonItemAsDrop(BlockPos pos, World worldIn,ItemStack stack) {

	 float f = 0.5F;
	double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
        double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
        double d2 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
        EntityItem entityitem = new EntityItem(worldIn, (double)pos.getX() + d0, (double)pos.getY() + d1, (double)pos.getZ() + d2,stack);
        entityitem.setDefaultPickupDelay();
        worldIn.spawnEntityInWorld(entityitem);

}




/**
 * 
 * Summons A Zombie
 * Pars- World,pos,loop(ammount of Zombie)
 */

public static void summonZombie(World worldIn,BlockPos pos,int loop) {


		for(int i=0;i<=loop-1;i++){

    		EntityZombie z = new EntityZombie(worldIn);
    		
    		z.setPosition(pos.getX(),pos.getY(), pos.getZ());
    		
    	worldIn.spawnEntityInWorld(z);
		}


	}


/**
 * Set Tnt on top of random block.
 * from location of block broken to x+5 x-5 z+5 z-5
 * @param worldIn
 * @param pos
 */

public static void setTntWithBlock(World worldIn,BlockPos pos) {

		Block random;
	Random rand = new Random();
	switch(rand.nextInt(5)){
	case 0:{
			random=Blocks.diamond_block;
			break;
			}
	case 1:{
			random=Blocks.obsidian;
			break;
			}
	case 2:{
			 random=Blocks.dirt;
			 break;
			}
	case 3:{
		 random = Blocks.log;
		 break;
		}
	case 4:{
		 random = Blocks.anvil;
		 break;
	}
	default:{
		 random = Blocks.dragon_egg;
		 break;
	}
	}

	for(int i=0;i<=4;i++)
	{
		BlockPos a=new BlockPos(pos.getX()+5, pos.getY(), pos.getZ()-2+i);
		worldIn.setBlockState(a, random.getDefaultState(),3);
		BlockPos b=new BlockPos(a.getX(), a.getY()+1, a.getZ());
		worldIn.setBlockState(b, Blocks.tnt.getDefaultState(),3);
		BlockPos c=new BlockPos(b.getX(),b.getY()+1,b.getZ());
		worldIn.setBlockState(c, Blocks.fire.getDefaultState(), 3);
	}
	for(int i=0;i<=4;i++)
	{
		BlockPos a=new BlockPos(pos.getX()-5, pos.getY(), pos.getZ()+2-i);
		worldIn.setBlockState(a, random.getDefaultState(),3);

		BlockPos b=new BlockPos(a.getX(), a.getY()+1, a.getZ());
		worldIn.setBlockState(b, Blocks.tnt.getDefaultState(),3);
		BlockPos c=new BlockPos(b.getX(),b.getY()+1,b.getZ());
		worldIn.setBlockState(c, Blocks.fire.getDefaultState(), 3);
	}
	for(int i=0;i<=4;i++)
	{
		BlockPos a=new BlockPos(pos.getX()-2+i, pos.getY(), pos.getZ()+5);
		worldIn.setBlockState(a, random.getDefaultState(),3);

		BlockPos b=new BlockPos(a.getX(), a.getY()+1, a.getZ());
		worldIn.setBlockState(b, Blocks.tnt.getDefaultState(),3);
		BlockPos c=new BlockPos(b.getX(),b.getY()+1,b.getZ());
		worldIn.setBlockState(c, Blocks.fire.getDefaultState(), 3);
	}
	for(int i=0;i<=4;i++)
	{
		BlockPos a=new BlockPos(pos.getX()+2-i, pos.getY(), pos.getZ()-5);
		worldIn.setBlockState(a, random.getDefaultState(),3);

		BlockPos b=new BlockPos(a.getX(), a.getY()+1, a.getZ());
		worldIn.setBlockState(b, Blocks.tnt.getDefaultState(),3);
		BlockPos c=new BlockPos(b.getX(),b.getY()+1,b.getZ());
		worldIn.setBlockState(c, Blocks.fire.getDefaultState(), 3);
	}


}


/**
 * 
 * @param worldIn
 * @param pos
 * @param item in game name
 * @param item changed name
 * @param enchantment
 * @param amplifier
 */


public static void summonEnchantedItemAsDrop(World worldIn, BlockPos pos,
		Item i, String name, Enchantment e, int amp) {

	ItemStack itemE=new ItemStack(i);
	itemE.addEnchantment(e, amp);
	itemE.setStackDisplayName(name);
	summonItemAsDrop(pos, worldIn, itemE);
}




/**
 * 
 * Summons A logdotzip (medium)
 * Pars- World,pos
 */

public static void summonLogdotzip(World worldIn,BlockPos pos) {


		Random rand=new Random();

		for(int i=0;i<=rand.nextInt(3)+1;i++){

    		EntityLogDotZip l = new EntityLogDotZip(worldIn);
    		
    		l.setPosition(pos.getX(),pos.getY(), pos.getZ());
    		
    	worldIn.spawnEntityInWorld(l);
		}


	}


/**
 * 
 * Tp to Random Loc.
 * 
 */


public static void tpPlayer(EntityPlayer player) {
	player.setPosition(player.posX, player.serverPosY=(int)player.posY+500, player.posZ);


}




/**
 * 
 * Summons A Wolf
 * Pars- World,pos,loop(ammount of Wolf)
 */

public static void summonWolf(World worldIn,BlockPos pos,int loop) {


		for(int i=0;i<=loop-1;i++){

    		EntityWolf z = new EntityWolf(worldIn);
    		
    		z.setPosition(pos.getX(),pos.getY(), pos.getZ());
    		
    	worldIn.spawnEntityInWorld(z);
		}


	}


/**
 * 
 * Summons A Blaze
 * Pars- World,pos,loop(ammount of Blaze)
 */


public static void summonBlaze(World worldIn,BlockPos pos,int loop) {


		for(int i=0;i<=loop-1;i++){

    		EntityBlaze z = new EntityBlaze(worldIn);
    		
    		z.setPosition(pos.getX(),pos.getY(), pos.getZ());
    		z.setHealth(100);
    		
    	worldIn.spawnEntityInWorld(z);
		}


	}



public static void setOneBlock(World worldIn,BlockPos pos,Block block){


	worldIn.setBlockState(pos, block.getDefaultState(), 2);



}


 /**
     * Summon Items As Drop With Loops
     * Par World,BlockPos,Item,loop(how many items you want to summon),style(1=down-top, anything else simple.),skip(ONLY USE FOR STYLE=1)
     * 
     */
    
    public static void summonItemWithLoop(World worldIn, BlockPos pos,Item item,int loop,int style,int skip) {

    	 float f = 0.5F;
		double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
         double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
         double d2 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
   
         for(int i=0;i<=loop-1;i++){
        	 
        	 if(style==1){
        		 EntityItem entityitem1 = new EntityItem(worldIn, (double)pos.getX() , (double)pos.getY() +i+skip, (double)pos.getZ() , new ItemStack(item));
        		 entityitem1.setDefaultPickupDelay();
        	worldIn.spawnEntityInWorld(entityitem1);}
        	 else{
        		 EntityItem entityitem1 = new EntityItem(worldIn, (double)pos.getX() + d0, (double)pos.getY() + d1, (double)pos.getZ() + d2, new ItemStack(item));
        		 entityitem1.setDefaultPickupDelay();
        		 worldIn.spawnEntityInWorld(entityitem1);
        	 }
        	 }

         }




/**
 * 
 * Summons A PopularMMO
 * Pars- World,pos,loop(ammount of popularmmo)
 */

public static void summonPopularMMO(World worldIn,BlockPos pos,int loop) {



		for(int i=0;i<=loop-1;i++){

    		EntityPopularMMO e = new EntityPopularMMO(worldIn);
    		
    		e.setPosition(pos.getX(),pos.getY(), pos.getZ());
    		e.setAlwaysRenderNameTag(true);

    	worldIn.spawnEntityInWorld(e);
		}


	}







 /**
     * Summon ItemsStack As Drop With Loops
     * Par World,BlockPos,Itemstack,loop(how many items you want to summon),style(1=down-top, anything else simple.),skip(ONLY USE FOR STYLE=1)
     * 
     */
    
    public static void summonItemStackWithLoop(World worldIn, BlockPos pos,ItemStack item,int loop,int style,int skip) {

    	 float f = 0.5F;
		double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
         double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
         double d2 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
         EntityItem entityitem = new EntityItem(worldIn, (double)pos.getX() + d0, (double)pos.getY() + d1, (double)pos.getZ() + d2, item);
         entityitem.setDefaultPickupDelay();
         for(int i=0;i<=loop-1;i++){
        	 
        	 if(style==1){
        		 EntityItem entityitem1 = new EntityItem(worldIn, (double)pos.getX() , (double)pos.getY() +i+skip, (double)pos.getZ() , item);
        	worldIn.spawnEntityInWorld(entityitem1);}
        	 else{
        		 EntityItem entityitem1 = new EntityItem(worldIn, (double)pos.getX() + d0, (double)pos.getY() + d1, (double)pos.getZ() + d2, item);
        		 worldIn.spawnEntityInWorld(entityitem1);
        	 }
        	 }

         }

    
    

/**
 * 
 * Summons A Skeleton
 * Pars- World,pos,loop(ammount of Skeleton)
 */

public static void summonSkeleton(World worldIn,BlockPos pos,int loop) {


		for(int i=0;i<=loop-1;i++){

    		EntitySkeleton e = new EntitySkeleton(worldIn);
    		e.setCustomNameTag("Eagle Hunters");
    		e.setPosition(pos.getX(),pos.getY(), pos.getZ());
    		e.setAlwaysRenderNameTag(true);
    		e.setCurrentItemOrArmor(0, new ItemStack(Items.bow));
    		
    	worldIn.spawnEntityInWorld(e);
		}


	}


/**
 * 
 * lets make a troll chat 
 */
public static void trollChat(World worldIn,BlockPos pos, EntityPlayer player){


		player.addChatMessage(new ChatComponentText(ChatFormatting.BLUE+"It Was A Troll... Or Maybe...."));


}


public static void toVoid(World worldIn,BlockPos pos){


		int h=pos.getY();
		for(int i=0;i<=h;i++)
		{
			BlockPos air=new BlockPos(pos.getX(),pos.getY()-i,pos.getZ());
			worldIn.setBlockState(air, Blocks.air.getDefaultState(), 2);
		}


}


/**
 * contains Some Stuff!
 * @param worldIn
 * @param pos
 */

    public static void redstoneKit(World worldIn,BlockPos pos)
    {
    	
    	summonItemWithLoop(worldIn, pos, Items.redstone, 64, 0, 0);
    	summonBlockWithLoop(worldIn, pos, Blocks.sticky_piston, 20, 0, 0);
    	summonItemWithLoop(worldIn, pos, Items.slime_ball, 40, 1, 5);
    	summonItemWithLoop(worldIn, pos, Items.repeater, 10, 0, 0);

    }
    
    
    
    public static void hellWellStructure(World worldIn,BlockPos pos){
    	
    	
    	worldIn.setBlockState(pos, Blocks.lava.getDefaultState(), 2);
    	worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY(),pos.getZ()+1), Blocks.nether_brick.getDefaultState(), 2);
    	worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY(),pos.getZ()-1), Blocks.nether_brick.getDefaultState(), 2);
    	worldIn.setBlockState(new BlockPos(pos.getX()-1,pos.getY(),pos.getZ()-1), Blocks.nether_brick.getDefaultState(), 2);
    	worldIn.setBlockState(new BlockPos(pos.getX()-1,pos.getY(),pos.getZ()), Blocks.nether_brick.getDefaultState(), 2);
    	worldIn.setBlockState(new BlockPos(pos.getX()+1,pos.getY(),pos.getZ()), Blocks.nether_brick.getDefaultState(), 2);
    	worldIn.setBlockState(new BlockPos(pos.getX()+1,pos.getY(),pos.getZ()-1), Blocks.nether_brick.getDefaultState(), 2);
    	worldIn.setBlockState(new BlockPos(pos.getX()-1,pos.getY(),pos.getZ()+1), Blocks.nether_brick.getDefaultState(), 2);
    	worldIn.setBlockState(new BlockPos(pos.getX()+1,pos.getY(),pos.getZ()+1), Blocks.nether_brick.getDefaultState(), 2);
    	
    	Random rand=new Random();
    	int r=rand.nextInt(5)+1;
    	for(int i=0;i<r;i++)
    	{
    		worldIn.setBlockState(new BlockPos(pos.getX()+1,pos.getY()+1+i,pos.getZ()+1), Blocks.nether_brick_fence.getDefaultState(), 2);
    		worldIn.setBlockState(new BlockPos(pos.getX()-1,pos.getY()+1+i,pos.getZ()-1), Blocks.nether_brick_fence.getDefaultState(), 2);
    		worldIn.setBlockState(new BlockPos(pos.getX()+1,pos.getY()+1+i,pos.getZ()-1), Blocks.nether_brick_fence.getDefaultState(), 2);
    		worldIn.setBlockState(new BlockPos(pos.getX()-1,pos.getY()+1+i,pos.getZ()+1), Blocks.nether_brick_fence.getDefaultState(), 2);
        	
    	}
    	
    	worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+r+1,pos.getZ()), Blocks.glowstone.getDefaultState(), 2);
    	//setting bricks and netherracks
    	worldIn.setBlockState(new BlockPos(pos.getX()+1,pos.getY()+r+1,pos.getZ()+1), Blocks.netherrack.getDefaultState(), 2);
    	worldIn.setBlockState(new BlockPos(pos.getX()-1,pos.getY()+r+1,pos.getZ()-1), Blocks.netherrack.getDefaultState(), 2);
    	worldIn.setBlockState(new BlockPos(pos.getX()-1,pos.getY()+r+1,pos.getZ()+1), Blocks.netherrack.getDefaultState(), 2);
    	worldIn.setBlockState(new BlockPos(pos.getX()+1,pos.getY()+r+1,pos.getZ()-1), Blocks.netherrack.getDefaultState(), 2);
    	worldIn.setBlockState(new BlockPos(pos.getX()+1,pos.getY()+r+2,pos.getZ()+1), Blocks.fire.getDefaultState(), 2);
    	worldIn.setBlockState(new BlockPos(pos.getX()-1,pos.getY()+r+2,pos.getZ()-1), Blocks.fire.getDefaultState(), 2);
    	worldIn.setBlockState(new BlockPos(pos.getX()-1,pos.getY()+r+2,pos.getZ()+1), Blocks.fire.getDefaultState(), 2);
    	worldIn.setBlockState(new BlockPos(pos.getX()+1,pos.getY()+r+2,pos.getZ()-1), Blocks.fire.getDefaultState(), 2);
    	
    	worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+r+1,pos.getZ()-1), Blocks.nether_brick.getDefaultState(), 2);
    	worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+r+1,pos.getZ()+1), Blocks.nether_brick.getDefaultState(), 2);
    	worldIn.setBlockState(new BlockPos(pos.getX()-1,pos.getY()+r+1,pos.getZ()), Blocks.nether_brick.getDefaultState(), 2);
    	worldIn.setBlockState(new BlockPos(pos.getX()+1,pos.getY()+r+1,pos.getZ()), Blocks.nether_brick.getDefaultState(), 2);
    	
    	
    	
    }
    
    
    public static void endWellStruct(World worldIn,BlockPos pos){
    	
    	
        	
        	worldIn.setBlockState(pos, Blocks.water.getDefaultState(), 2);
        	worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY(),pos.getZ()+1), Blocks.end_stone.getDefaultState(), 2);
        	worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY(),pos.getZ()-1), Blocks.end_stone.getDefaultState(), 2);
        	worldIn.setBlockState(new BlockPos(pos.getX()-1,pos.getY(),pos.getZ()-1), Blocks.end_stone.getDefaultState(), 2);
        	worldIn.setBlockState(new BlockPos(pos.getX()-1,pos.getY(),pos.getZ()), Blocks.end_stone.getDefaultState(), 2);
        	worldIn.setBlockState(new BlockPos(pos.getX()+1,pos.getY(),pos.getZ()), Blocks.end_stone.getDefaultState(), 2);
        	worldIn.setBlockState(new BlockPos(pos.getX()+1,pos.getY(),pos.getZ()-1), Blocks.end_stone.getDefaultState(), 2);
        	worldIn.setBlockState(new BlockPos(pos.getX()-1,pos.getY(),pos.getZ()+1), Blocks.end_stone.getDefaultState(), 2);
        	worldIn.setBlockState(new BlockPos(pos.getX()+1,pos.getY(),pos.getZ()+1), Blocks.end_stone.getDefaultState(), 2);
        	
        	Random rand=new Random();
        	int r=rand.nextInt(6)+1;
        	for(int i=0;i<r;i++)
        	{
        		worldIn.setBlockState(new BlockPos(pos.getX()+1,pos.getY()+1+i,pos.getZ()+1), Blocks.birch_fence.getDefaultState(), 2);
        		worldIn.setBlockState(new BlockPos(pos.getX()-1,pos.getY()+1+i,pos.getZ()-1), Blocks.birch_fence.getDefaultState(), 2);
        		worldIn.setBlockState(new BlockPos(pos.getX()+1,pos.getY()+1+i,pos.getZ()-1), Blocks.birch_fence.getDefaultState(), 2);
        		worldIn.setBlockState(new BlockPos(pos.getX()-1,pos.getY()+1+i,pos.getZ()+1), Blocks.birch_fence.getDefaultState(), 2);
            	
        	}
        	
        	worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+r+1,pos.getZ()), Blocks.beacon.getDefaultState(), 2);
        	//setting bricks and netherracks
        	worldIn.setBlockState(new BlockPos(pos.getX()+1,pos.getY()+r+1,pos.getZ()+1), Blocks.obsidian.getDefaultState(), 2);
        	worldIn.setBlockState(new BlockPos(pos.getX()-1,pos.getY()+r+1,pos.getZ()-1), Blocks.obsidian.getDefaultState(), 2);
        	worldIn.setBlockState(new BlockPos(pos.getX()-1,pos.getY()+r+1,pos.getZ()+1), Blocks.obsidian.getDefaultState(), 2);
        	worldIn.setBlockState(new BlockPos(pos.getX()+1,pos.getY()+r+1,pos.getZ()-1), Blocks.obsidian.getDefaultState(), 2);
        	worldIn.setBlockState(new BlockPos(pos.getX()+1,pos.getY()+r+2,pos.getZ()+1), Blocks.end_portal_frame.getDefaultState(), 2);
        	worldIn.setBlockState(new BlockPos(pos.getX()-1,pos.getY()+r+2,pos.getZ()-1), Blocks.end_portal_frame.getDefaultState(), 2);
        	worldIn.setBlockState(new BlockPos(pos.getX()-1,pos.getY()+r+2,pos.getZ()+1), Blocks.end_portal_frame.getDefaultState(), 2);
        	worldIn.setBlockState(new BlockPos(pos.getX()+1,pos.getY()+r+2,pos.getZ()-1), Blocks.end_portal_frame.getDefaultState(), 2);
        	
        	worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+r+1,pos.getZ()-1), Blocks.end_stone.getDefaultState(), 2);
        	worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+r+1,pos.getZ()+1), Blocks.end_stone.getDefaultState(), 2);
        	worldIn.setBlockState(new BlockPos(pos.getX()-1,pos.getY()+r+1,pos.getZ()), Blocks.end_stone.getDefaultState(), 2);
        	worldIn.setBlockState(new BlockPos(pos.getX()+1,pos.getY()+r+1,pos.getZ()), Blocks.end_stone.getDefaultState(), 2);
        	
        	
    	
    	
    }
    
    
    
    
    public static void addEnchantsMany(ItemStack stack,Enchantment[] e,int amp,World worldIn,BlockPos pos){
    	
    	for(int i=0;i<e.length;i++)
    	{
    		stack.addEnchantment(e[i], amp);
    	}
    	
    	summonItemAsDrop(pos, worldIn, stack);

    }
    
    
    public static void addRandomEnchtToRandomItems(World worldIn,ItemStack[] stack,Enchantment[] ench,int ampUpperLimit,BlockPos pos){
    	
    	
    		Random rand = new Random();
    		
    		
    		int r=rand.nextInt(stack.length);
    		int a=rand.nextInt(stack.length);
    		if(r==a){a-=1;}
    		for(int i=a;i<r;i++)
    		{
    			int y=rand.nextInt(ench.length);
    			int z=rand.nextInt(ench.length);
    			if(y==z){z-=1;}
    			for(int j=z;j<y;j++){
    				
    				int n=rand.nextInt(ench.length);
    				stack[i].addEnchantment(ench[n], rand.nextInt(ampUpperLimit)+1);	
    			
    			
    			
    			}
    			summonItemStackWithLoop(worldIn, pos, stack[i],1, 0, 0);
    			
    		}
    	
    	
    	
    }
   
    
    public static void holeDeathTrap(World worldIn,BlockPos pos){
    	
    	
    		int h=pos.getY();
    		for(int i=0;i<h;i++)
    		{
    			worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()-i,pos.getZ()), Blocks.air.getDefaultState(), 2);
    		}
    		
    	
    	
    }
    
    
    public static void mountain(World worldIn,BlockPos pos)
    {	
    	Random rand=new Random();
    	int r=rand.nextInt(6)+1;
    	
    	for(int i=0;i<r;i++)
    	{
    		for(int j=0;j<3;j++)
    		{
    			worldIn.setBlockState(new BlockPos(pos.getX()+j,pos.getY()+i,pos.getZ()+j), Blocks.diamond_block.getDefaultState(),2);
    			
    			
    		}
    		
    	}
    	
    }
    
    public static void mountainOne(World worldIn,BlockPos pos)
    {	
    	Random rand=new Random();
    	int r=rand.nextInt(6)+1;
    	
    	for(int i=0;i<r;i++)
    	{
    		for(int j=0;j<3;j++)
    		{
    			worldIn.setBlockState(new BlockPos(pos.getX()+j,pos.getY()+i,pos.getZ()+j), Blocks.emerald_block.getDefaultState(),2);
    			
    			
    		}
    		
    	}
    	
    }
    
/**
 * 
 * Summons A Ghost
 * Pars- World,pos,loop(amount of Ghosts)
 */

public static void summonGhost(World worldIn,BlockPos pos,int loop,boolean isRandom,int upperlimit) {

		int r=loop;
		if(isRandom)
		{
			Random rand=new Random();
			r=rand.nextInt(upperlimit)+2;
		}

		for(int i=0;i<=r-1;i++){

    		EntityGhost e = new EntityGhost(worldIn);
    		
    		e.setPosition(pos.getX(),pos.getY(), pos.getZ());
    		e.setAlwaysRenderNameTag(true);
    		
    	worldIn.spawnEntityInWorld(e);
		}


	}
    
/**
 * 
 * Summons Captain Sparklez army 
 * Pars- World,pos,loop(size of army)
 */

public static void summonCaptainSparklezWithCustomName(World worldIn,BlockPos pos,int loop,boolean isRandom,int upperlimit) {

		int r=loop;
		if(isRandom)
		{
			Random rand=new Random();
			r=rand.nextInt(upperlimit)+2;
		}

		for(int i=0;i<=r-1;i++){

    		EntityCaptainSparklez e = new EntityCaptainSparklez(worldIn);
    		e.setCustomNameTag("CaptainSparklez Army");
    		e.setPosition(pos.getX(),pos.getY(), pos.getZ());
    		e.setAlwaysRenderNameTag(true);
    		
    	worldIn.spawnEntityInWorld(e);
		}


	}


public static void foodKit(World worldIn,BlockPos pos){

	summonBlockAsDrop(pos, worldIn, Blocks.cake);
	summonItemStackWithLoop(worldIn, pos, new ItemStack(Items.golden_apple,1,1), 10, 1, 30);
	summonItemStackWithLoop(worldIn, pos, new ItemStack(Items.bread), 16, 1, 10);
	summonItemStackWithLoop(worldIn, pos, new ItemStack(Items.apple), 5, 0, 0);
	summonItemAsDrop(pos, worldIn, new ItemStack(Items.golden_apple));
	summonItemStackWithLoop(worldIn, pos, new ItemStack(Items.cooked_beef),34, 0, 0);

}

    
/**
 * 
 * lets make a chat
 */
public static void chat(World worldIn,BlockPos pos,String chat,EntityPlayer player){


		player.addChatMessage(new ChatComponentText(chat));


}

public static void materialKit(World worldIn,BlockPos pos)
{

	Random rand=new Random();
	summonItemStackWithLoop(worldIn, pos, new ItemStack(Items.diamond), rand.nextInt(50)+1, 1, rand.nextInt(5));
	summonItemStackWithLoop(worldIn, pos, new ItemStack(Items.gold_ingot), rand.nextInt(50)+1, 1, rand.nextInt(15));
	summonItemStackWithLoop(worldIn, pos, new ItemStack(Items.iron_ingot), rand.nextInt(30)+1, 1, rand.nextInt(10));
	summonItemStackWithLoop(worldIn, pos, new ItemStack(Items.emerald), rand.nextInt(40)+1, 1, rand.nextInt(4));
	summonItemStackWithLoop(worldIn, pos, new ItemStack(Items.coal), rand.nextInt(10)+1, 1, rand.nextInt(30));
	summonItemStackWithLoop(worldIn, pos, new ItemStack(Items.chest_minecart), rand.nextInt(10)+1, 0, 0);
	summonItemStackWithLoop(worldIn, pos, new ItemStack(Items.blaze_powder), rand.nextInt(64)+1, 1, rand.nextInt(15));

}

/**
 * 
 * Summons A AntVenom
 * Pars- World,pos,loop(amount of Ant)
 */

public static void summonAntVenom(World worldIn,BlockPos pos,int loop,boolean isRandom,int upperlimit) {

		int r=loop;
		if(isRandom)
		{
			Random rand=new Random();
			r=rand.nextInt(upperlimit)+2;
		}

		for(int i=0;i<=r-1;i++){

    		EntityAntVenom e = new EntityAntVenom(worldIn);
    		e.setPosition(pos.getX(),pos.getY(), pos.getZ());
    		e.setAlwaysRenderNameTag(true);
    		
    	worldIn.spawnEntityInWorld(e);
		}


	}

/**
 * 
 * Summons A Dan
 * Pars- World,pos,loop(amount of Dan)
 */

public static void summonDanTDM(World worldIn,BlockPos pos,int loop,boolean isRandom,int upperlimit) {

		int r=loop;
		if(isRandom)
		{
			Random rand=new Random();
			r=rand.nextInt(upperlimit)+2;
		}

		for(int i=0;i<=r-1;i++){

    		EntityDanTDM e = new EntityDanTDM(worldIn);
    		e.setPosition(pos.getX(),pos.getY(), pos.getZ());
    		e.setAlwaysRenderNameTag(true);
    	
    		
    	worldIn.spawnEntityInWorld(e);
		}


	}


public static void burgerStruct(World worldIn,BlockPos pos)
{


	for(int i=0;i<3;i++)
	{
		for(int j=0;j<3;j++){
		worldIn.setBlockState(new BlockPos(pos.getX()+j,pos.getY(),pos.getZ()+i), Blocks.iron_block.getDefaultState(), 2);
			}
	}

	for(int i=0;i<3;i++)
	{
		for(int j=0;j<3;j++){
		worldIn.setBlockState(new BlockPos(pos.getX()+j,pos.getY()+1,pos.getZ()+i), Blocks.diamond_block.getDefaultState(), 2);
			}
	}

	for(int i=0;i<3;i++)
	{
		for(int j=0;j<3;j++){
		worldIn.setBlockState(new BlockPos(pos.getX()+j,pos.getY()+2,pos.getZ()+i), Blocks.emerald_block.getDefaultState(), 2);
			}
	}



}





public static void burgerStructOne(World worldIn,BlockPos pos)
{


	for(int i=0;i<3;i++)
	{
		for(int j=0;j<3;j++){
		worldIn.setBlockState(new BlockPos(pos.getX()+j,pos.getY(),pos.getZ()+i), Blocks.glowstone.getDefaultState(), 2);
			}
	}

	for(int i=0;i<3;i++)
	{
		for(int j=0;j<3;j++){
		worldIn.setBlockState(new BlockPos(pos.getX()+j,pos.getY()+1,pos.getZ()+i), Blocks.dragon_egg.getDefaultState(), 2);
			}
	}

	for(int i=0;i<3;i++)
	{
		for(int j=0;j<3;j++){
		worldIn.setBlockState(new BlockPos(pos.getX()+j,pos.getY()+2,pos.getZ()+i), Blocks.beacon.getDefaultState(), 2);
			}
	}



}



/**
 * 
 * Summons A SP
 * Pars- World,pos,loop(amount of SP)
 */

public static void summonSP(World worldIn,BlockPos pos,int loop,boolean isRandom,int upperlimit) {

		int r=loop;
		if(isRandom)
		{
			Random rand=new Random();
			r=rand.nextInt(upperlimit)+2;
		}

		for(int i=0;i<=r-1;i++){

    		EntitySerialPlayer e = new EntitySerialPlayer(worldIn);
    		e.setPosition(pos.getX(),pos.getY(), pos.getZ());
    		e.setAlwaysRenderNameTag(true);
    	
    		
    	worldIn.spawnEntityInWorld(e);
		}


	}



public static void orcArmy(World worldIn,BlockPos pos,int loop,boolean isRandom,int upperlimit){


		Random rand=new Random();
		int r=loop;
		if(isRandom)
		{
			r=rand.nextInt(upperlimit)+2;
		}

		for(int i=0;i<=r-1;i++){

    		EntityZombie e = new EntityZombie(worldIn);
    		e.setPosition(pos.getX(),pos.getY(), pos.getZ());
    		e.setAlwaysRenderNameTag(true);
    		e.setCustomNameTag("Orc Army");
    		
    		e.setCurrentItemOrArmor(4, new ItemStack(ModItems.ytHelmet));
    		
    		switch(rand.nextInt(5))
    		{
    		case 1:{
    			e.setCurrentItemOrArmor(0, new ItemStack(Items.diamond_sword));
    			break;}
    		case 2:{
    			e.setCurrentItemOrArmor(0, new ItemStack(Items.golden_sword));
    			break;
    		}
    		case 3:{
    			e.setCurrentItemOrArmor(0, new ItemStack(Items.stone_axe));
    			break;
    		}
    		case 0:{
    			e.setCurrentItemOrArmor(0, new ItemStack(Items.iron_sword));
    			break;
    		}
    		
    		case 4:{
    			e.setCurrentItemOrArmor(0, new ItemStack(ModItems.devilSword));
    			
    		}
    		
    		}
    		
    		
    	worldIn.spawnEntityInWorld(e);
		}





}


public static void lookUp(World w,BlockPos pos,EntityPlayer p)
{


		double x=p.posX;
		double y=p.posY;
		double z=p.posZ;

		setOneBlock(w,new BlockPos(x,y+10,z), Blocks.anvil);



}


public static void summonBunny(World worldIn,BlockPos pos,int loop,boolean isRandom,int upperlimit) {

		int r=loop;
		if(isRandom)
		{
			Random rand=new Random();
			r=rand.nextInt(upperlimit)+2;
		}

		for(int i=0;i<=r-1;i++){

    		EntityRabbit e = new EntityRabbit(worldIn);
    		e.setPosition(pos.getX(),pos.getY(), pos.getZ());
    		e.setAlwaysRenderNameTag(true);
    		e.setRabbitType(99);
    		
    	worldIn.spawnEntityInWorld(e);
		}


	}

public static void giveBlocks(World worldIn,BlockPos pos,ItemStack block,int loop,EntityPlayer p){


		for(int i=0;i<loop;i++)
		{p.inventory.addItemStackToInventory(block);}


}

public static void tntFix(World worldIn,BlockPos pos,int amOfTnt)
{

		for(int i=0;i<amOfTnt;i++){
		 EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F),Minecraft.getMinecraft().thePlayer );
            entitytntprimed.fuse = worldIn.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8;
            worldIn.spawnEntityInWorld(entitytntprimed);

		}

}

public static void tntNearby(World worldIn,BlockPos pos,int amOfTnt)
{

		Random rand=new Random();
		for(int i=0;i<amOfTnt;i++){
		 EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldIn, (double)((float)pos.getX() + 0.5F)+rand.nextInt(20), (double)pos.getY()+rand.nextInt(20), (double)((float)pos.getZ() + 0.5F)+rand.nextInt(20),Minecraft.getMinecraft().thePlayer );
            entitytntprimed.fuse = worldIn.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8;
            worldIn.spawnEntityInWorld(entitytntprimed);

		}

}

public static void tntRain(World worldIn,BlockPos pos,int amOfTnt,int skip)
{

		for(int i=0;i<amOfTnt;i++){
		 EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY()+(skip*i), (double)((float)pos.getZ() + 0.5F),Minecraft.getMinecraft().thePlayer );
            entitytntprimed.fuse = worldIn.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8;
            worldIn.spawnEntityInWorld(entitytntprimed);

		}

}

public static void potionKit(World worldIn,BlockPos pos){

	Random rand=new Random();

	ExtraFunctions.summonItemStackWithLoop(worldIn, pos, new ItemStack(Items.ender_pearl), rand.nextInt(50)+1, 0, 0);
	ExtraFunctions.summonItemStackWithLoop(worldIn, pos, new ItemStack(Items.ender_eye), rand.nextInt(50)+1, 0, 0);	
	ExtraFunctions.summonItemStackWithLoop(worldIn, pos, new ItemStack(Items.magma_cream), rand.nextInt(50)+1, 0, 0);
	ExtraFunctions.summonItemStackWithLoop(worldIn, pos, new ItemStack(Items.brewing_stand),1, 0, 0);
	ExtraFunctions.summonItemStackWithLoop(worldIn, pos, new ItemStack(Items.fermented_spider_eye), rand.nextInt(50)+1, 0, 0);
	ExtraFunctions.summonItemStackWithLoop(worldIn, pos, new ItemStack(Items.speckled_melon), rand.nextInt(50)+1, 0, 0);
	ExtraFunctions.summonItemStackWithLoop(worldIn, pos, new ItemStack(Items.gold_nugget), rand.nextInt(50)+1, 0, 0);
	ExtraFunctions.summonItemStackWithLoop(worldIn, pos, new ItemStack(Items.spider_eye), rand.nextInt(50)+1, 0, 0);
	ExtraFunctions.summonItemStackWithLoop(worldIn, pos, new ItemStack(Items.nether_wart), rand.nextInt(50)+1, 0, 0);
	ExtraFunctions.summonItemStackWithLoop(worldIn, pos, new ItemStack(Items.glass_bottle), rand.nextInt(50)+1, 0, 0);
	ExtraFunctions.summonItemStackWithLoop(worldIn, pos, new ItemStack(Items.blaze_rod), rand.nextInt(50)+1, 0, 0);



}


public static void musicKit(World worldIn,BlockPos pos)
{
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Blocks.jukebox));
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Items.record_11));
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Items.record_13));
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Items.record_blocks));
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Items.record_cat));
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Items.record_chirp));
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Items.record_far));
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Items.record_mall));
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Items.record_mellohi));
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Items.record_stal));
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Items.record_strad));
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Items.record_wait));
		ExtraFunctions.summonItemAsDrop(pos, worldIn, new ItemStack(Items.record_ward));


}

public static void towerStruct(World worldIn,BlockPos pos)
{

		int flags=2;
		worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY(),pos.getZ()), Blocks.redstone_block.getDefaultState(), flags);
		worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+1,pos.getZ()), Blocks.lapis_block.getDefaultState(), flags);
		worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+2,pos.getZ()), Blocks.coal_block.getDefaultState(), flags);
		worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+3,pos.getZ()), Blocks.gold_block.getDefaultState(), flags);
		worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+4,pos.getZ()), Blocks.iron_block.getDefaultState(), flags);
		worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+5,pos.getZ()), Blocks.emerald_block.getDefaultState(), flags);
		worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+6,pos.getZ()), Blocks.diamond_block.getDefaultState(), flags);
		worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+7,pos.getZ()), Blocks.obsidian.getDefaultState(), flags);
		worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+8,pos.getZ()), Blocks.dragon_egg.getDefaultState(), flags);




}


/**
 * 
 * Summons A ghast? idk either...
 * Pars- World,pos,loop(amount of Ghast)
 */

public static void summonGhast(World worldIn,BlockPos pos,int loop,boolean isRandom,int upperlimit) {

		int r=loop;
		if(isRandom)
		{
			Random rand=new Random();
			r=rand.nextInt(upperlimit)+2;
		}

		for(int i=0;i<=r-1;i++){

    		EntityGhast e = new EntityGhast(worldIn);
    		e.setPosition(pos.getX(),pos.getY(), pos.getZ());
    		e.setAlwaysRenderNameTag(true);
    	
    		
    	worldIn.spawnEntityInWorld(e);
		}


	}

/**
 * 
 * Summons A wither boss...
 * Pars- World,pos,loop(amount of boss)
 */

public static void summonWitherBoss(World worldIn,BlockPos pos,int loop,boolean isRandom,int upperlimit) {

		int r=loop;
		if(isRandom)
		{
			Random rand=new Random();
			r=rand.nextInt(upperlimit)+2;
		}

		for(int i=0;i<=r-1;i++){

    		EntityWither e = new EntityWither(worldIn);
    		e.setPosition(pos.getX(),pos.getY(), pos.getZ());
    		e.setAlwaysRenderNameTag(true);
    	
    		
    	worldIn.spawnEntityInWorld(e);
		}


	}


public static void randomSixtyFourTower(World worldIn,BlockPos pos){

	Random rand = new Random();
	for(int i=0;i<64;i++)
	{
		int r=rand.nextInt(;
		if(r==0)
		{worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+i,pos.getZ()), Blocks.iron_block.getDefaultState(), 2);}
		else if(r==1)
		{worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+i,pos.getZ()), Blocks.diamond_block.getDefaultState(), 2);}
		else if(r==2)
		{worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+i,pos.getZ()), Blocks.gold_block.getDefaultState(), 2);}
		else if(r==3)
		{worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+i,pos.getZ()), Blocks.emerald_block.getDefaultState(), 2);}
		else if(r==4)
		{worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+i,pos.getZ()), Blocks.beacon.getDefaultState(), 2);}
		else if(r==5)
		{worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+i,pos.getZ()), Blocks.coal_block.getDefaultState(), 2);}
		else if(r==6)
		{worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+i,pos.getZ()), Blocks.redstone_block.getDefaultState(), 2);}
		else if(r==7)
		{worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+i,pos.getZ()), Blocks.dragon_egg.getDefaultState(), 2);}







	}
}

/**
 * 
 * Summons A jen
 * Pars- World,pos,loop(amount of jen)
 */

public static void summonSuperGirly(World worldIn,BlockPos pos,int loop,boolean isRandom,int upperlimit) {

		int r=loop;
		if(isRandom)
		{
			Random rand=new Random();
			r=rand.nextInt(upperlimit)+2;
		}

		for(int i=0;i<=r-1;i++){

    		EntitySuperGirlyGamer e = new EntitySuperGirlyGamer(worldIn);
    		e.setPosition(pos.getX(),pos.getY(), pos.getZ());
    		e.setAlwaysRenderNameTag(true);
    		
    	worldIn.spawnEntityInWorld(e);
		}


	}

public static void trollDiamondTrapWithChanceOfNotTroll(World worldIn,BlockPos pos,boolean isTrap)
{


		if(isTrap){
		worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()-1,pos.getZ()), Blocks.diamond_ore.getDefaultState(),2);
		worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()-2,pos.getZ()), Blocks.diamond_ore.getDefaultState(),2);
		worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()-3,pos.getZ()), Blocks.diamond_ore.getDefaultState(),2);
		worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()-4,pos.getZ()), Blocks.flowing_lava.getDefaultState(),2);

		}
		else
		{
			worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()-1,pos.getZ()), Blocks.diamond_ore.getDefaultState(),2);
			worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()-2,pos.getZ()), Blocks.diamond_ore.getDefaultState(),2);
			worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()-3,pos.getZ()), Blocks.diamond_ore.getDefaultState(),2);
			worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()-4,pos.getZ()), Blocks.flowing_water.getDefaultState(),2);

		}



}


/**
 * 
 * Summons A cow
 * Pars- World,pos,loop(amount of cows)
 */

public static void summonCowNearby(World worldIn,BlockPos pos,int loop,boolean isRandom,int upperlimit) {

		int r=loop;
		Random rand=new Random();

		if(isRandom)
		{
			r=rand.nextInt(upperlimit)+2;
		}

		for(int i=0;i<=r-1;i++){

    		EntityCow e = new EntityCow(worldIn);
    		e.setPosition(pos.getX()+rand.nextInt(30),pos.getY(), pos.getZ()+rand.nextInt(30));
    		e.setAlwaysRenderNameTag(true);
    		e.setEquipmentDropChance(0, 100F);
    		e.setCurrentItemOrArmor(0, new ItemStack(Items.golden_apple));
    		e.setEquipmentDropChance(1, 100F);
    		e.setCurrentItemOrArmor(1, new ItemStack(Items.gold_ingot));
    		e.setCustomNameTag("I AM SPECIAL");
    	worldIn.spawnEntityInWorld(e);
		}


	}


public static void summonPigNearby(World worldIn,BlockPos pos,int loop,boolean isRandom,int upperlimit) {

		int r=loop;
		Random rand=new Random();

		if(isRandom)
		{
			r=rand.nextInt(upperlimit)+2;
		}

		for(int i=0;i<=r-1;i++){

    		EntityPig e = new EntityPig(worldIn);
    		e.setPosition(pos.getX()+rand.nextInt(30),pos.getY(), pos.getZ()+rand.nextInt(30));
    		e.setAlwaysRenderNameTag(true);
    		e.setEquipmentDropChance(0, 100F);
    		e.setCurrentItemOrArmor(0, new ItemStack(Items.golden_apple,rand.nextInt(5)+1,1));
    		e.setEquipmentDropChance(1, 100F);
    		e.setCurrentItemOrArmor(1, new ItemStack(Blocks.diamond_block));
    		e.setCustomNameTag("I AM SPECIAL");
    	worldIn.spawnEntityInWorld(e);
		}


	}



public static void summonGolemNearby(World worldIn,BlockPos pos,int loop,boolean isRandom,int upperlimit) {

		int r=loop;
		Random rand=new Random();

		if(isRandom)
		{
			r=rand.nextInt(upperlimit)+2;
		}

		for(int i=0;i<=r-1;i++){

    		EntityIronGolem e = new EntityIronGolem(worldIn);
    		e.setPosition(pos.getX()+rand.nextInt(30),pos.getY(), pos.getZ()+rand.nextInt(30));
    		e.setAlwaysRenderNameTag(true);
    	worldIn.spawnEntityInWorld(e);
		}


	}


public static void summonCreepsNearby(World worldIn,BlockPos pos,int loop,boolean isRandom,int upperlimit) {

		int r=loop;
		Random rand=new Random();

		if(isRandom)
		{
			r=rand.nextInt(upperlimit)+2;
		}

		for(int i=0;i<=r-1;i++){

    		EntityCreeper e = new EntityCreeper(worldIn);
    		e.setPosition(pos.getX()+rand.nextInt(30),pos.getY(), pos.getZ()+rand.nextInt(30));
    		e.setAlwaysRenderNameTag(true);
    	worldIn.spawnEntityInWorld(e);
		}


	}



public static void summonSquidRain(World worldIn,BlockPos pos,int loop,boolean isRandom,int upperlimit) {

		int r=loop;
		Random rand=new Random();

		if(isRandom)
		{
			r=rand.nextInt(upperlimit)+2;
		}

		for(int i=0;i<=r-1;i++){

    		EntitySquid e = new EntitySquid(worldIn);
    		e.setPosition(pos.getX()+rand.nextInt(30),pos.getY()+20, pos.getZ()+rand.nextInt(30));
    		e.setAlwaysRenderNameTag(true);
    	worldIn.spawnEntityInWorld(e);
		}


	}


/**
 * 
 * Summons A Isquid
 * Pars- World,pos,loop(amount of squid)
 */

public static void summonISquid(World worldIn,BlockPos pos,int loop,boolean isRandom,int upperlimit) {

		int r=loop;
		if(isRandom)
		{
			Random rand=new Random();
			r=rand.nextInt(upperlimit)+2;
		}

		for(int i=0;i<=r-1;i++){

    		EntityISquid e = new EntityISquid(worldIn);
    		e.setPosition(pos.getX(),pos.getY(), pos.getZ());
    		e.setAlwaysRenderNameTag(true);
    	
    		
    	worldIn.spawnEntityInWorld(e);
		}


	}

/**
 * 
 * Summons A Sky
 * Pars- World,pos,loop(amount of Sky)
 */

public static void summonSkyDoesMinecraft(World worldIn,BlockPos pos,int loop,boolean isRandom,int upperlimit) {

		int r=loop;
		if(isRandom)
		{
			Random rand=new Random();
			r=rand.nextInt(upperlimit)+2;
		}

		for(int i=0;i<=r-1;i++){

    		EntitySkyDoesMinecraft e = new EntitySkyDoesMinecraft(worldIn);
    		e.setPosition(pos.getX(),pos.getY(), pos.getZ());
    		e.setAlwaysRenderNameTag(true);
    	
    		
    	worldIn.spawnEntityInWorld(e);
		}


	}

/**
 * 
 * Summons A Truemu
 * Pars- World,pos,loop(amount of truemu)
 */

public static void summonTruemu(World worldIn,BlockPos pos,int loop,boolean isRandom,int upperlimit) {

		int r=loop;
		if(isRandom)
		{
			Random rand=new Random();
			r=rand.nextInt(upperlimit)+2;
		}

		for(int i=0;i<=r-1;i++){

    		EntityTruemu e = new EntityTruemu(worldIn);
    		e.setPosition(pos.getX(),pos.getY(), pos.getZ());
    		e.setAlwaysRenderNameTag(true);
    	
    		
    	worldIn.spawnEntityInWorld(e);
		}


	}


public static void luckyBlockTower(World worldIn,BlockPos pos)
{

		worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY(),pos.getZ()), ModBlocks.youtube.getDefaultState(), 2);
		worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+1,pos.getZ()), ModBlocks.youtubeLuckyBlock.getDefaultState(), 2);
		worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+2,pos.getZ()), ModBlocks.antVenomLuckyBlock.getDefaultState(), 2);
		worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+3,pos.getZ()), ModBlocks.captainSparkelzLuckyBlock.getDefaultState(), 2);
		worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+4,pos.getZ()), ModBlocks.danTDMLuckyBlock.getDefaultState(), 2);
		worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+5,pos.getZ()), ModBlocks.gamingWithJenLuckyBlock.getDefaultState(), 2);
		worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+6,pos.getZ()), ModBlocks.iBallisticSquidLuckyBlock.getDefaultState(), 2);
		worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+7,pos.getZ()), ModBlocks.popularMMOLuckyBlock.getDefaultState(), 2);
		worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+8,pos.getZ()), ModBlocks.serialPlayerLuckyBlock.getDefaultState(), 2);
		worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+9,pos.getZ()), ModBlocks.skyDoesMinecraftLuckyBlock.getDefaultState(), 2);
		worldIn.setBlockState(new BlockPos(pos.getX(),pos.getY()+10,pos.getZ()), ModBlocks.trueMuLuckyBlock.getDefaultState(), 2);



}

}//CLASS END HERE




 

 

and this is error log

 

2016-07-11 12:36:30,186 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream
2016-07-11 12:36:30,189 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream
[12:36:30] [main/INFO] [GradleStart]: Extra: []
[12:36:30] [main/INFO] [GradleStart]: Running with arguments: [--tweakClass, net.minecraftforge.fml.common.launcher.FMLServerTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]
[12:36:30] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLServerTweaker
[12:36:30] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLServerTweaker
[12:36:30] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker
[12:36:30] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLServerTweaker
2016-07-11 12:36:31,669 WARN Disabling terminal, you're running in an unsupported environment.
[12:36:31] [main/INFO] [FML]: Forge Mod Loader version 11.15.1.1722 for Minecraft 1.8.9 loading
[12:36:31] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_60, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre1.8.0_60
[12:36:31] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
[12:36:32] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker
[12:36:32] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin
[12:36:32] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin
[12:36:32] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[12:36:32] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[12:36:32] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[12:36:32] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[12:36:32] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[12:36:32] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[12:36:32] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!
[12:36:33] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
[12:36:33] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[12:36:33] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[12:36:34] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[12:36:34] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker
[12:36:34] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker
[12:36:34] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.server.MinecraftServer}
[12:36:41] [server thread/INFO]: Starting minecraft server version 1.8.9
[12:36:41] [server thread/INFO] [FML]: MinecraftForge v11.15.1.1722 Initialized
[12:36:41] [server thread/INFO] [FML]: Replaced 204 ore recipies
[12:36:42] [server thread/INFO] [FML]: Found 0 mods from the command line. Injecting into mod discoverer
[12:36:42] [server thread/INFO] [FML]: Searching D:\hdd\Minecraft Mods 1.8\run\mods for mods
[12:36:44] [server thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load
[12:36:44] [server thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, ytstuff] at CLIENT
[12:36:44] [server thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, ytstuff] at SERVER
[12:36:45] [server thread/INFO] [FML]: Processing ObjectHolder annotations
[12:36:45] [server thread/INFO] [FML]: Found 384 ObjectHolder annotations
[12:36:45] [server thread/INFO] [FML]: Identifying ItemStackHolder annotations
[12:36:45] [server thread/INFO] [FML]: Found 0 ItemStackHolder annotations
[12:36:45] [server thread/INFO] [FML]: Configured a dormant chunk cache size of 0
[12:36:45] [Forge Version Check/INFO] [ForgeVersionCheck]: [Forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
[12:36:45] [server thread/INFO] [FML]: Applying holder lookups
[12:36:45] [server thread/INFO] [FML]: Holder lookups applied
[12:36:45] [server thread/INFO] [FML]: Injecting itemstacks
[12:36:45] [server thread/INFO] [FML]: Itemstack injection complete
[12:36:45] [server thread/INFO]: Loading properties
[12:36:45] [server thread/INFO]: Default game type: CREATIVE
[12:36:45] [server thread/INFO]: Generating keypair
[12:36:46] [server thread/INFO]: Starting Minecraft server on *:25565
[12:36:46] [server thread/INFO]: Using default channel type
[12:36:46] [Forge Version Check/INFO] [ForgeVersionCheck]: [Forge] Found status: UP_TO_DATE Target: null
[12:36:46] [server thread/INFO] [FML]: Injecting itemstacks
[12:36:46] [server thread/INFO] [FML]: Itemstack injection complete
[12:36:47] [server thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods
[12:36:47] [server thread/INFO]: Preparing level "world"
[12:36:47] [server thread/INFO] [FML]: Injecting existing block and item data into this server instance
[12:36:47] [server thread/INFO] [FML]: Applying holder lookups
[12:36:47] [server thread/INFO] [FML]: Holder lookups applied
[12:36:48] [server thread/INFO] [FML]: Loading dimension 0 (world) (net.minecraft.server.dedicated.DedicatedServer@1f611562)
[12:36:48] [server thread/INFO] [FML]: Loading dimension 1 (world) (net.minecraft.server.dedicated.DedicatedServer@1f611562)
[12:36:48] [server thread/INFO] [FML]: Loading dimension -1 (world) (net.minecraft.server.dedicated.DedicatedServer@1f611562)
[12:36:48] [server thread/INFO]: Preparing start region for level 0
[12:36:49] [server thread/INFO]: Preparing spawn area: 6%
[12:36:50] [server thread/INFO]: Preparing spawn area: 56%
[12:36:50] [server thread/INFO]: Done (3.420s)! For help, type "help" or "?"
[12:37:03] [user Authenticator #1/INFO]: UUID of player thvardhan is 690e6528-2ce3-4bae-9558-a58c75d506ec
[12:37:03] [Netty Server IO #1/INFO] [FML]: Client protocol version 2
[12:37:03] [Netty Server IO #1/INFO] [FML]: Client attempting to join with 4 mods : [email protected],[email protected],[email protected],[email protected]
[12:37:03] [server thread/INFO] [FML]: [server thread] Server side modded connection established
[12:37:03] [server thread/INFO]: thvardhan[/127.0.0.1:59537] logged in with entity id 195 at (233.51528534505817, 65.99657407350283, 232.19456449084808)
[12:37:03] [server thread/INFO]: thvardhan joined the game
[12:37:08] [server thread/FATAL]: Error executing task
java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityPlayerSP
at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_60]
at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_60]
at net.minecraft.util.Util.runTask(Util.java:23) [util.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:736) [MinecraftServer.class:?]
at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:365) [DedicatedServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:681) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:548) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_60]
Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityPlayerSP
at com.thvardhan.ytstuff.blocks.AntVenomLuckyBlock.drops(AntVenomLuckyBlock.java:148) ~[AntVenomLuckyBlock.class:?]
at com.thvardhan.ytstuff.blocks.AntVenomLuckyBlock.removedByPlayer(AntVenomLuckyBlock.java:73) ~[AntVenomLuckyBlock.class:?]
at net.minecraft.server.management.ItemInWorldManager.removeBlock(ItemInWorldManager.java:284) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.removeBlock(ItemInWorldManager.java:278) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:317) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.onBlockClicked(ItemInWorldManager.java:164) ~[itemInWorldManager.class:?]
at net.minecraft.network.NetHandlerPlayServer.processPlayerDigging(NetHandlerPlayServer.java:551) ~[NetHandlerPlayServer.class:?]
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:56) ~[C07PacketPlayerDigging.class:?]
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:12) ~[C07PacketPlayerDigging.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_60]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_60]
at net.minecraft.util.Util.runTask(Util.java:22) ~[util.class:?]
... 5 more
Caused by: java.lang.ClassNotFoundException: net.minecraft.client.entity.EntityPlayerSP
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) ~[launchwrapper-1.12.jar:?]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_60]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_60]
at com.thvardhan.ytstuff.blocks.AntVenomLuckyBlock.drops(AntVenomLuckyBlock.java:148) ~[AntVenomLuckyBlock.class:?]
at com.thvardhan.ytstuff.blocks.AntVenomLuckyBlock.removedByPlayer(AntVenomLuckyBlock.java:73) ~[AntVenomLuckyBlock.class:?]
at net.minecraft.server.management.ItemInWorldManager.removeBlock(ItemInWorldManager.java:284) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.removeBlock(ItemInWorldManager.java:278) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:317) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.onBlockClicked(ItemInWorldManager.java:164) ~[itemInWorldManager.class:?]
at net.minecraft.network.NetHandlerPlayServer.processPlayerDigging(NetHandlerPlayServer.java:551) ~[NetHandlerPlayServer.class:?]
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:56) ~[C07PacketPlayerDigging.class:?]
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:12) ~[C07PacketPlayerDigging.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_60]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_60]
at net.minecraft.util.Util.runTask(Util.java:22) ~[util.class:?]
... 5 more
Caused by: net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerException: Exception in class transformer net.minecraftforge.fml.common.asm.transformers.SideTransformer@305f7627 from coremod FMLCorePlugin
at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:234) ~[forgeSrc-1.8.9-11.15.1.1722.jar:?]
at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) ~[launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) ~[launchwrapper-1.12.jar:?]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_60]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_60]
at com.thvardhan.ytstuff.blocks.AntVenomLuckyBlock.drops(AntVenomLuckyBlock.java:148) ~[AntVenomLuckyBlock.class:?]
at com.thvardhan.ytstuff.blocks.AntVenomLuckyBlock.removedByPlayer(AntVenomLuckyBlock.java:73) ~[AntVenomLuckyBlock.class:?]
at net.minecraft.server.management.ItemInWorldManager.removeBlock(ItemInWorldManager.java:284) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.removeBlock(ItemInWorldManager.java:278) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:317) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.onBlockClicked(ItemInWorldManager.java:164) ~[itemInWorldManager.class:?]
at net.minecraft.network.NetHandlerPlayServer.processPlayerDigging(NetHandlerPlayServer.java:551) ~[NetHandlerPlayServer.class:?]
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:56) ~[C07PacketPlayerDigging.class:?]
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:12) ~[C07PacketPlayerDigging.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_60]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_60]
at net.minecraft.util.Util.runTask(Util.java:22) ~[util.class:?]
... 5 more
Caused by: java.lang.RuntimeException: Attempted to load class net/minecraft/client/entity/EntityPlayerSP for invalid side SERVER
at net.minecraftforge.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:49) ~[forgeSrc-1.8.9-11.15.1.1722.jar:?]
at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:230) ~[forgeSrc-1.8.9-11.15.1.1722.jar:?]
at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) ~[launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) ~[launchwrapper-1.12.jar:?]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_60]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_60]
at com.thvardhan.ytstuff.blocks.AntVenomLuckyBlock.drops(AntVenomLuckyBlock.java:148) ~[AntVenomLuckyBlock.class:?]
at com.thvardhan.ytstuff.blocks.AntVenomLuckyBlock.removedByPlayer(AntVenomLuckyBlock.java:73) ~[AntVenomLuckyBlock.class:?]
at net.minecraft.server.management.ItemInWorldManager.removeBlock(ItemInWorldManager.java:284) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.removeBlock(ItemInWorldManager.java:278) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:317) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.onBlockClicked(ItemInWorldManager.java:164) ~[itemInWorldManager.class:?]
at net.minecraft.network.NetHandlerPlayServer.processPlayerDigging(NetHandlerPlayServer.java:551) ~[NetHandlerPlayServer.class:?]
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:56) ~[C07PacketPlayerDigging.class:?]
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:12) ~[C07PacketPlayerDigging.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_60]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_60]
at net.minecraft.util.Util.runTask(Util.java:22) ~[util.class:?]
... 5 more
[12:37:10] [server thread/INFO]: thvardhan lost connection: TextComponent{text='Disconnected', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}
[12:37:10] [server thread/INFO]: thvardhan left the game
[12:37:20] [server thread/INFO]: Stopping server
[12:37:20] [server thread/INFO]: Saving players
[12:37:20] [server thread/INFO]: Saving worlds
[12:37:20] [server thread/INFO]: Saving chunks for level 'world'/Overworld
[12:37:20] [server thread/INFO]: Saving chunks for level 'world'/Nether
[12:37:20] [server thread/INFO]: Saving chunks for level 'world'/The End
[12:37:21] [server thread/INFO] [FML]: Unloading dimension 0
[12:37:21] [server thread/INFO] [FML]: Unloading dimension -1
[12:37:21] [server thread/INFO] [FML]: Unloading dimension 1
[12:37:21] [server thread/INFO] [FML]: Applying holder lookups
[12:37:21] [server thread/INFO] [FML]: Holder lookups applied
Exception in thread "AWT-EventQueue-0" Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release

Link to comment
Share on other sites

Glad you fixed it. For future reference, the server should be telling the client when a block breaks, not vice versa. The server owns its world, and the clients display it. That makes the server the authority on changes to that world.

 

The client should be telling the server what a player is trying to do in the world, not asserting what the effect is. That's because the player's attempt may be foiled by other actors (or server rules). It's the server's job to reconcile the activities of many players and other entities. If a bunch of clients all try to assert authority, then messy things happen (just look at the long Mojang bug thread about boat desync that only recently got fixed). Security could also be breached if a sever accepted a client's word about a change to the world.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

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.