Jump to content

Compilation Error


Ultadoer

Recommended Posts

I get acompilation error whenever I use this code

 

package mod.mcreator;

import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.client.registry.RenderingRegistry;

import net.minecraft.world.biome.Biome;
import net.minecraft.world.World;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.EnumHand;
import net.minecraft.util.DamageSource;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIRestrictSun;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAILeapAtTarget;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.Entity;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.model.ModelZombie;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.Minecraft;

import java.util.Random;
import java.util.Iterator;
import java.util.ArrayList;

@SuppressWarnings("unchecked")
public class mcreator_caveKobold {

	public int mobid = 23;
	public static Object instance;

	public void load(FMLInitializationEvent event) {
	}

	public void generateNether(World world, Random random, int chunkX, int chunkZ) {
	}

	public void generateSurface(World world, Random random, int chunkX, int chunkZ) {
	}

	public int addFuel(ItemStack fuel) {
		return 0;
	}

	@SideOnly(Side.CLIENT)
	public void registerRenderers() {
		RenderLiving customRender = new RenderLiving(Minecraft.getMinecraft().getRenderManager(), new mcreator_caveKobold.ModelCaveKobold(), 0) {

			protected ResourceLocation getEntityTexture(Entity par1Entity) {
				return new ResourceLocation("cavekoboldred.png");
			}
		};
		RenderingRegistry.registerEntityRenderingHandler(mcreator_caveKobold.EntitycaveKobold.class, customRender);
	}

	public void serverLoad(FMLServerStartingEvent event) {
	}

	public void preInit(FMLPreInitializationEvent event) {
		EntityRegistry.registerModEntity(new ResourceLocation("testenvironmentmod:cavekobold"), mcreator_caveKobold.EntitycaveKobold.class,
				"cavekobold", mobid, instance, 64, 1, true, (102 << 16) + (102 << 8) + 102, (153 << 16) + (0 << 8) + 51);
		EntityRegistry.addSpawn(mcreator_caveKobold.EntitycaveKobold.class, 20, 3, 30, EnumCreatureType.MONSTER,
				new Biome[]{Biome.REGISTRY.getObject(new ResourceLocation("extreme_hills")),});
	}

	public static Biome[] allbiomes(net.minecraft.util.registry.RegistryNamespaced<ResourceLocation, Biome> in) {
		Iterator<Biome> itr = in.iterator();
		ArrayList<Biome> ls = new ArrayList<Biome>();
		while (itr.hasNext()) {
			ls.add(itr.next());
		}
		return ls.toArray(new Biome[ls.size()]);
	}

	public static class EntitycaveKobold extends EntityMob {

		World world = null;

		public EntitycaveKobold(World var1) {
			super(var1);
			world = var1;
			experienceValue = 8;
			this.isImmuneToFire = false;
			addRandomArmor();
			setNoAI(!true);
			this.tasks.addTask(1, new EntityAIWander(this, 1));
			this.tasks.addTask(2, new EntityAILookIdle(this));
			this.tasks.addTask(3, new EntityAISwimming(this));
			this.tasks.addTask(4, new EntityAILeapAtTarget(this, (float) 0.8));
			this.targetTasks.addTask(5, new EntityAIHurtByTarget(this, true));
			this.tasks.addTask(6, new EntityAIRestrictSun(this));
		}

		protected void applyEntityAttributes() {
			super.applyEntityAttributes();
			this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.25D);
			this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(15D);
			if (this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE) != null)
				this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(4D);
		}

		protected void addRandomArmor() {
		}

		@Override
		protected Item getDropItem() {
			return null;
		}

		@Override
		protected net.minecraft.util.SoundEvent getAmbientSound() {
			return (net.minecraft.util.SoundEvent) net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation("entity.bat.hurt"));
		}

		@Override
		protected net.minecraft.util.SoundEvent getHurtSound(DamageSource ds) {
			return (net.minecraft.util.SoundEvent) net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation("entity.armorstand.break"));
		}

		@Override
		protected net.minecraft.util.SoundEvent getDeathSound() {
			return (net.minecraft.util.SoundEvent) net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation("block.anvil.destroy"));
		}

		@Override
		public void onStruckByLightning(EntityLightningBolt entityLightningBolt) {
			super.onStruckByLightning(entityLightningBolt);
			int i = (int) this.posX;
			int j = (int) this.posY;
			int k = (int) this.posZ;
			Entity entity = this;
		}

		@Override
		public void fall(float l, float d) {
			super.fall(l, d);
			int i = (int) this.posX;
			int j = (int) this.posY;
			int k = (int) this.posZ;
			Entity entity = this;
		}

		/**
		 * Called when the entity is attacked.
		 */
		@Override
		public boolean attackEntityFrom(DamageSource source, float amount) {
			boolean retval = super.attackEntityFrom(source, amount);
			int i = (int) this.posX;
			int j = (int) this.posY;
			int k = (int) this.posZ;
			Entity entity = this;
			return retval;
		}

		@Override
		public void onDeath(DamageSource source) {
			super.onDeath(source);
			int i = (int) this.posX;
			int j = (int) this.posY;
			int k = (int) this.posZ;
			Entity entity = this;
		}

		@Override
		public boolean processInteract(EntityPlayer entity, EnumHand hand) {
			boolean retval = super.processInteract(entity, hand);
			int i = (int) this.posX;
			int j = (int) this.posY;
			int k = (int) this.posZ;
			ItemStack itemstack = entity.getHeldItem(hand);
			return retval;
		}

		@Override
		public void onKillEntity(EntityLivingBase entity) {
			super.onKillEntity(entity);
			int i = (int) this.posX;
			int j = (int) this.posY;
			int k = (int) this.posZ;
		}

		@Override
		public void onEntityUpdate() {
			super.onEntityUpdate();
			int i = (int) this.posX;
			int j = (int) this.posY;
			int k = (int) this.posZ;
			Entity entity = this;
		}

		@Override
		public void onCollideWithPlayer(EntityPlayer entity) {
			super.onCollideWithPlayer(entity);
			int i = (int) this.posX;
			int j = (int) this.posY;
			int k = (int) this.posZ;
		}

		@Override
		protected float getSoundVolume() {
			return 1.0F;
		}
	}

	/**
	 * ModelZombie - Either Mojang or a mod author Created using Tabula 7.0.0
	 */
	public static class ModelCaveKobold extends ModelBase {

		public ModelRenderer Body;
		public ModelRenderer HeadBase;
		public ModelRenderer RightArm;
		public ModelRenderer RightLeg;
		public ModelRenderer LeftLeg;
		public ModelRenderer LeftArm;
		public ModelRenderer JawBottom;
		public ModelRenderer JawTopLeft;
		public ModelRenderer JawTopRight;

		public ModelCaveKobold() {
			this.textureWidth = 64;
			this.textureHeight = 64;
			this.LeftLeg = new ModelRenderer(this, 0, 16);
			this.LeftLeg.setRotationPoint(-1.9F, 11.2F, 0.2F);
			this.LeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F);
			this.setRotateAngle(LeftLeg, -0.4363323129985824F, 0.0F, 0.0F);
			this.JawTopLeft = new ModelRenderer(this, 24, 32);
			this.JawTopLeft.setRotationPoint(-1.8F, -4.4F, -2.0F);
			this.JawTopLeft.addBox(-1.5F, -1.5F, 0.0F, 5, 3, 7, 0.0F);
			this.setRotateAngle(JawTopLeft, -0.10471975511965977F, -3.490658503988659F, 0.0F);
			this.Body = new ModelRenderer(this, 16, 16);
			this.Body.setRotationPoint(0.0F, 1.9F, 0.0F);
			this.Body.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, 0.0F);
			this.setRotateAngle(Body, 0.2617993877991494F, 0.0F, 0.0F);
			this.JawBottom = new ModelRenderer(this, 0, 52);
			this.JawBottom.setRotationPoint(-4.4F, -2.6F, -9.1F);
			this.JawBottom.addBox(0.0F, 0.0F, 0.0F, 9, 3, 8, 0.0F);
			this.HeadBase = new ModelRenderer(this, 32, 0);
			this.HeadBase.setRotationPoint(0.0F, 1.0F, 0.0F);
			this.HeadBase.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.0F);
			this.setRotateAngle(HeadBase, -0.2617993877991494F, 0.0F, 0.0F);
			this.RightLeg = new ModelRenderer(this, 0, 16);
			this.RightLeg.mirror = true;
			this.RightLeg.setRotationPoint(1.9F, 11.2F, 0.1F);
			this.RightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F);
			this.setRotateAngle(RightLeg, -0.4363323129985824F, 0.0F, 0.0F);
			this.LeftArm = new ModelRenderer(this, 40, 16);
			this.LeftArm.setRotationPoint(-5.0F, 2.0F, 0.0F);
			this.LeftArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F);
			this.setRotateAngle(LeftArm, -1.7749998492782333F, -0.10000736613927509F, 0.10000736613927509F);
			this.RightArm = new ModelRenderer(this, 40, 16);
			this.RightArm.mirror = true;
			this.RightArm.setRotationPoint(5.0F, 2.0F, 0.0F);
			this.RightArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F);
			this.setRotateAngle(RightArm, -1.7756979809790308F, 0.10000736613927509F, -0.10000736613927509F);
			this.JawTopRight = new ModelRenderer(this, 0, 32);
			this.JawTopRight.setRotationPoint(3.7F, -4.4F, -2.8F);
			this.JawTopRight.addBox(-1.5F, -1.5F, 0.0F, 5, 3, 7, 0.0F);
			this.setRotateAngle(JawTopRight, -0.10471975511965977F, -2.7750735106709836F, 0.017453292519943295F);
			this.Body.addChild(this.LeftLeg);
			this.HeadBase.addChild(this.JawTopLeft);
			this.HeadBase.addChild(this.JawBottom);
			this.Body.addChild(this.HeadBase);
			this.Body.addChild(this.RightLeg);
			this.Body.addChild(this.LeftArm);
			this.Body.addChild(this.RightArm);
			this.HeadBase.addChild(this.JawTopRight);
		}

		@Override
		public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
			this.Body.render(f5);
		}

		/**
		 * This is a helper function from Tabula to set the rotation of model
		 * parts
		 */
		public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) {
			super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
			this.HeadBase.rotateAngleY = f3 / (180F / (float) Math.PI);
			this.HeadBase.rotateAngleX = f4 / (180F / (float) Math.PI);
			this.LeftArm.rotateAngleX = MathHelper.cos(f * 1.0F) * -1.0F * f1;
			this.RightArm.rotateAngleX = MathHelper.cos(f * 1.0F) * 1.0F * f1;
			this.LeftLeg.rotateAngleX = MathHelper.cos(f * 0.6662F + (float) Math.PI) * 2.0F * f1 * 0.5F;
			this.RightLeg.rotateAngleX = MathHelper.cos(f * 0.6662F) * 2.0F * f1 * 0.5F;
		}
	}
}

 

Link to comment
Share on other sites

That code is kind of long. What's the error and where does it occur?

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

The error message is as follows

C:\Pylo\MCreator179\forge\build\sources\main\java\mod\mcreator\mcreator_caveKobold.java:244: error: cannot find symbol
			this.setRotateAngle(LeftLeg, -0.4363323129985824F, 0.0F, 0.0F);
			    ^
  symbol: method setRotateAngle(ModelRenderer,float,float,float)
C:\Pylo\MCreator179\forge\build\sources\main\java\mod\mcreator\mcreator_caveKobold.java:248: error: cannot find symbol
			this.setRotateAngle(JawTopLeft, -0.10471975511965977F, -3.490658503988659F, 0.0F);
			    ^
  symbol: method setRotateAngle(ModelRenderer,float,float,float)
C:\Pylo\MCreator179\forge\build\sources\main\java\mod\mcreator\mcreator_caveKobold.java:252: error: cannot find symbol
			this.setRotateAngle(Body, 0.2617993877991494F, 0.0F, 0.0F);
			    ^
  symbol: method setRotateAngle(ModelRenderer,float,float,float)
C:\Pylo\MCreator179\forge\build\sources\main\java\mod\mcreator\mcreator_caveKobold.java:259: error: cannot find symbol
			this.setRotateAngle(HeadBase, -0.2617993877991494F, 0.0F, 0.0F);
			    ^
  symbol: method setRotateAngle(ModelRenderer,float,float,float)
C:\Pylo\MCreator179\forge\build\sources\main\java\mod\mcreator\mcreator_caveKobold.java:264: error: cannot find symbol
			this.setRotateAngle(RightLeg, -0.4363323129985824F, 0.0F, 0.0F);
			    ^
  symbol: method setRotateAngle(ModelRenderer,float,float,float)
C:\Pylo\MCreator179\forge\build\sources\main\java\mod\mcreator\mcreator_caveKobold.java:268: error: cannot find symbol
			this.setRotateAngle(LeftArm, -1.7749998492782333F, -0.10000736613927509F, 0.10000736613927509F);
			    ^
  symbol: method setRotateAngle(ModelRenderer,float,float,float)
C:\Pylo\MCreator179\forge\build\sources\main\java\mod\mcreator\mcreator_caveKobold.java:273: error: cannot find symbol
			this.setRotateAngle(RightArm, -1.7756979809790308F, 0.10000736613927509F, -0.10000736613927509F);
			    ^
  symbol: method setRotateAngle(ModelRenderer,float,float,float)
C:\Pylo\MCreator179\forge\build\sources\main\java\mod\mcreator\mcreator_caveKobold.java:277: error: cannot find symbol
			this.setRotateAngle(JawTopRight, -0.10471975511965977F, -2.7750735106709836F, 0.017453292519943295F);
			    ^
  symbol: method setRotateAngle(ModelRenderer,float,float,float)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
8 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

 

Link to comment
Share on other sites

First: This is not a Java Forum!!!

Second: You are missing the given Method

[public] void setRotateAngle(ModelRenderer,float,float,float);

ModelBase only contains (closest match):

public void setRotationAngles(float, float, float, float, float, float, Entity);

Which a 1 Minute look at Minecraft src Code showed me...

Please don't just copy Code, but learn how to code Java!

And if you truly have a question - tell us what you intend to do and how you tried to do it, as well as any matching Stacktrace's...

Edited by Major Tuvok
Spelling Mistakes
Link to comment
Share on other sites

Help after that I am getting a new error!

C:\Pylo\MCreator179\forge\build\sources\main\java\mod\mcreator\mcreator_caveKobold.java:296: error: <identifier> expected
           public void setRotationAngles(ModelRenderer, float f, float f1, float f2, float f3, float f4, float f5, Entity entity) {
                                                      ^
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

 

Link to comment
Share on other sites

50 minutes ago, Major Tuvok said:

First: This is not a Java Forum!!!

Please don't just copy Code, but learn how to code Java!

 

3 minutes ago, Ultadoer said:

public void setRotationAngles(ModelRenderer, float f

You have a type ModelRenderer but no variable name.

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

ModelRenderer; is not a statement

 

http://www.cs.toronto.edu/~reid/web/javaparams.html

 

Also, welcome to my ignore list.

Edited by Draco18s

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

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.