error illegal start of expression

Started by Creeper_990_ on Fri, 09/18/2020 - 17:48

Topic category: Help with modding (Java Edition)

Last seen on 19:06, 21. Nov 2020
Joined Jul 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
error illegal start of expression
Fri, 09/18/2020 - 17:48

I have looked at many of this same problem for forum posts. None helped. PLZZZZ help. I imported an entity and i saved thats it... I dont know why it has an error.

Last seen on 19:06, 21. Nov 2020
Joined Jul 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
my code is:  package net…
Fri, 09/18/2020 - 17:48

my code is: 

package net.mcreator.doomcraft.entity;

import net.minecraftforge.registries.ObjectHolder;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.fml.network.NetworkHooks;
import net.minecraftforge.fml.network.FMLPlayMessages;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.common.DungeonHooks;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.api.distmarker.Dist;

import net.minecraft.world.gen.Heightmap;
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.DamageSource;
import net.minecraft.network.IPacket;
import net.minecraft.item.SpawnEggItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;
import net.minecraft.entity.projectile.PotionEntity;
import net.minecraft.entity.projectile.ArrowEntity;
import net.minecraft.entity.projectile.AbstractArrowEntity;
import net.minecraft.entity.monster.MonsterEntity;
import net.minecraft.entity.ai.goal.SwimGoal;
import net.minecraft.entity.ai.goal.RangedAttackGoal;
import net.minecraft.entity.ai.goal.RandomWalkingGoal;
import net.minecraft.entity.ai.goal.NearestAttackableTargetGoal;
import net.minecraft.entity.ai.goal.MeleeAttackGoal;
import net.minecraft.entity.ai.goal.LookRandomlyGoal;
import net.minecraft.entity.ai.goal.HurtByTargetGoal;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.IRendersAsItem;
import net.minecraft.entity.IRangedAttackMob;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.EntitySpawnPlacementRegistry;
import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.Entity;
import net.minecraft.entity.CreatureAttribute;
import net.minecraft.client.renderer.model.ModelRenderer;
import net.minecraft.client.renderer.entity.model.EntityModel;
import net.minecraft.client.renderer.entity.SpriteRenderer;
import net.minecraft.client.renderer.entity.MobRenderer;
import net.minecraft.client.Minecraft;

import net.mcreator.doomcraft.procedures.FireGoblinEntityIsHurtProcedure;
import net.mcreator.doomcraft.itemgroup.DoomcraftmiscellaneousItemGroup;
import net.mcreator.doomcraft.DoomcraftModElements;

import java.util.Map;
import java.util.HashMap;

import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.mojang.blaze3d.matrix.MatrixStack;

@DoomcraftModElements.ModElement.Tag
public class FireGoblinEntity extends DoomcraftModElements.ModElement {
    public static EntityType entity = null;
    @ObjectHolder("doomcraft:entitybulletfire_goblin")
    public static final EntityType arrow = null;
    public FireGoblinEntity(DoomcraftModElements instance) {
        super(instance, 73);
        FMLJavaModLoadingContext.get().getModEventBus().register(this);
    }

    @Override
    public void initElements() {
        entity = (EntityType.Builder.<CustomEntity>create(CustomEntity::new, EntityClassification.MONSTER).setShouldReceiveVelocityUpdates(true)
                .setTrackingRange(84).setUpdateInterval(3).setCustomClientFactory(CustomEntity::new).immuneToFire().size(1.4f, 1.4f))
                        .build("fire_goblin").setRegistryName("fire_goblin");
        elements.entities.add(() -> entity);
        elements.items.add(() -> new SpawnEggItem(entity, -4484297, -1048569, new Item.Properties().group(DoomcraftmiscellaneousItemGroup.tab))
                .setRegistryName("fire_goblin"));
        elements.entities.add(() -> (EntityType.Builder.<ArrowCustomEntity>create(ArrowCustomEntity::new, EntityClassification.MISC)
                .setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(1).setCustomClientFactory(ArrowCustomEntity::new)
                .size(0.5f, 0.5f)).build("entitybulletfire_goblin").setRegistryName("entitybulletfire_goblin"));
    }

    @Override
    public void init(FMLCommonSetupEvent event) {
        for (Biome biome : ForgeRegistries.BIOMES.getValues()) {
            biome.getSpawns(EntityClassification.MONSTER).add(new Biome.SpawnListEntry(entity, 20, 2, 4));
        }
        EntitySpawnPlacementRegistry.register(entity, EntitySpawnPlacementRegistry.PlacementType.ON_GROUND, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES,
                MonsterEntity::canMonsterSpawn);
        DungeonHooks.addDungeonMob(entity, 180);
    }

    @SubscribeEvent
    @OnlyIn(Dist.CLIENT)
    public void registerModels(ModelRegistryEvent event) {
        RenderingRegistry.registerEntityRenderingHandler(entity, renderManager -> {
            return new MobRenderer(renderManager, new Modelfiregob(), 0.7f) {
                @Override
                public ResourceLocation getEntityTexture(Entity entity) {
                    return new ResourceLocation("doomcraft:textures/firegoblinuv2.png");
                }
            };
        });
        RenderingRegistry.registerEntityRenderingHandler(arrow,
                renderManager -> new SpriteRenderer(renderManager, Minecraft.getInstance().getItemRenderer()));
    }
    public static class CustomEntity extends MonsterEntity implements IRangedAttackMob {
        public CustomEntity(FMLPlayMessages.SpawnEntity packet, World world) {
            this(entity, world);
        }

        public CustomEntity(EntityType<CustomEntity> type, World world) {
            super(type, world);
            experienceValue = 10;
            setNoAI(false);
        }

        @Override
        public IPacket<?> createSpawnPacket() {
            return NetworkHooks.getEntitySpawningPacket(this);
        }

        @Override
        protected void registerGoals() {
            super.registerGoals();
            this.targetSelector.addGoal(1, new NearestAttackableTargetGoal(this, LavamberEntity.CustomEntity.class, false, false));
            this.goalSelector.addGoal(2, new MeleeAttackGoal(this, 1.2, false));
            this.goalSelector.addGoal(3, new RandomWalkingGoal(this, 1));
            this.targetSelector.addGoal(4, new HurtByTargetGoal(this));
            this.goalSelector.addGoal(5, new LookRandomlyGoal(this));
            this.goalSelector.addGoal(6, new SwimGoal(this));
            this.goalSelector.addGoal(1, new RangedAttackGoal(this, 1.25, 20, 10) {
                @Override
                public boolean shouldContinueExecuting() {
                    return this.shouldExecute();
                }
            });
        }

        @Override
        public CreatureAttribute getCreatureAttribute() {
            return CreatureAttribute.UNDEFINED;
        }

        protected void dropSpecialItems(DamageSource source, int looting, boolean recentlyHitIn) {
            super.dropSpecialItems(source, looting, recentlyHitIn);
        }

        @Override
        public net.minecraft.util.SoundEvent getHurtSound(DamageSource ds) {
            return (net.minecraft.util.SoundEvent) ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("entity.generic.hurt"));
        }

        @Override
        public net.minecraft.util.SoundEvent getDeathSound() {
            return (net.minecraft.util.SoundEvent) ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("entity.generic.death"));
        }

        @Override
        public boolean attackEntityFrom(DamageSource source, float amount) {
            double x = this.getPosX();
            double y = this.getPosY();
            double z = this.getPosZ();
            Entity entity = this;
            Entity sourceentity = source.getTrueSource();
            {
                Map<String, Object> $_dependencies = new HashMap<>();
                $_dependencies.put("sourceentity", sourceentity);
                FireGoblinEntityIsHurtProcedure.executeProcedure($_dependencies);
            }
            if (source.getImmediateSource() instanceof ArrowEntity)
                return false;
            if (source.getImmediateSource() instanceof PotionEntity)
                return false;
            if (source == DamageSource.FALL)
                return false;
            if (source == DamageSource.CACTUS)
                return false;
            if (source == DamageSource.LIGHTNING_BOLT)
                return false;
            return super.attackEntityFrom(source, amount);
        }

        @Override
        protected void registerAttributes() {
            super.registerAttributes();
            if (this.getAttribute(SharedMonsterAttributes.MOVEMENT_SPEED) != null)
                this.getAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.4);
            if (this.getAttribute(SharedMonsterAttributes.MAX_HEALTH) != null)
                this.getAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(30);
            if (this.getAttribute(SharedMonsterAttributes.ARMOR) != null)
                this.getAttribute(SharedMonsterAttributes.ARMOR).setBaseValue(15);
            if (this.getAttribute(SharedMonsterAttributes.ATTACK_DAMAGE) == null)
                this.getAttributes().registerAttribute(SharedMonsterAttributes.ATTACK_DAMAGE);
            this.getAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(8);
        }

        public void attackEntityWithRangedAttack(LivingEntity target, float flval) {
            ArrowCustomEntity entityarrow = new ArrowCustomEntity(arrow, this, this.world);
            double d0 = target.getPosY() + (double) target.getEyeHeight() - 1.1;
            double d1 = target.getPosX() - this.getPosX();
            double d3 = target.getPosZ() - this.getPosZ();
            entityarrow.shoot(d1, d0 - entityarrow.getPosY() + (double) MathHelper.sqrt(d1 * d1 + d3 * d3) * 0.2F, d3, 1.6F, 12.0F);
            world.addEntity(entityarrow);
        }
    }

    @OnlyIn(value = Dist.CLIENT, _interface = IRendersAsItem.class)
    private static class ArrowCustomEntity extends AbstractArrowEntity implements IRendersAsItem {
        public ArrowCustomEntity(FMLPlayMessages.SpawnEntity packet, World world) {
            super(arrow, world);
        }

        public ArrowCustomEntity(EntityType<? extends ArrowCustomEntity> type, World world) {
            super(type, world);
        }

        public ArrowCustomEntity(EntityType<? extends ArrowCustomEntity> type, double x, double y, double z, World world) {
            super(type, x, y, z, world);
        }

        public ArrowCustomEntity(EntityType<? extends ArrowCustomEntity> type, LivingEntity entity, World world) {
            super(type, entity, world);
        }

        @Override
        public IPacket<?> createSpawnPacket() {
            return NetworkHooks.getEntitySpawningPacket(this);
        }

        @Override @OnlyIn(Dist.CLIENT) public ItemStack getItem() {
            return new ItemStack(, (int)(1));
        }

        @Override protected ItemStack getArrowStack() {
            return new ItemStack(, (int)(1));
        }
    }

    // Made with Blockbench 3.6.6
    // Exported for Minecraft version 1.15
    // Paste this class into your mod and generate all required imports
    public static class Modelfiregob extends EntityModel<Entity> {
        private final ModelRenderer leftleg;
        private final ModelRenderer rightleg;
        private final ModelRenderer body;
        private final ModelRenderer head;
        private final ModelRenderer ear1;
        private final ModelRenderer ear2;
        private final ModelRenderer eyes;
        private final ModelRenderer nose;
        private final ModelRenderer leftarm;
        private final ModelRenderer rightarm;
        private final ModelRenderer bag;
        private final ModelRenderer hair;
        public Modelfiregob() {
            textureWidth = 64;
            textureHeight = 64;
            leftleg = new ModelRenderer(this);
            leftleg.setRotationPoint(2.5F, 18.25F, 3.5F);
            leftleg.setTextureOffset(0, 0).addBox(-1.5F, -0.25F, -0.5F, 3.0F, 6.0F, 3.0F, 0.0F, false);
            leftleg.setTextureOffset(32, 23).addBox(-1.5F, 4.75F, -1.5F, 3.0F, 1.0F, 1.0F, 0.0F, false);
            rightleg = new ModelRenderer(this);
            rightleg.setRotationPoint(-2.5F, 18.25F, 3.5F);
            rightleg.setTextureOffset(0, 0).addBox(-1.5F, -0.25F, -0.5F, 3.0F, 6.0F, 3.0F, 0.0F, false);
            rightleg.setTextureOffset(0, 34).addBox(-1.5F, 4.75F, -1.5F, 3.0F, 1.0F, 1.0F, 0.0F, false);
            body = new ModelRenderer(this);
            body.setRotationPoint(0.0F, 24.0F, 0.0F);
            body.setTextureOffset(0, 0).addBox(-3.5F, -15.0F, 2.0F, 7.0F, 9.0F, 5.0F, 0.0F, false);
            body.setTextureOffset(23, 34).addBox(-2.5F, -14.0F, 1.0F, 5.0F, 7.0F, 1.0F, 0.0F, false);
            head = new ModelRenderer(this);
            head.setRotationPoint(0.0F, 24.0F, 0.0F);
            head.setTextureOffset(0, 14).addBox(-4.0F, -21.0F, 2.25F, 8.0F, 6.0F, 5.0F, 0.0F, false);
            ear1 = new ModelRenderer(this);
            ear1.setRotationPoint(6.0F, 3.0F, 5.5F);
            setRotationAngle(ear1, 0.0F, 0.0F, -0.5236F);
            ear1.setTextureOffset(12, 28).addBox(-3.2075F, -1.4085F, -1.75F, 4.0F, 2.0F, 1.0F, 0.0F, false);
            ear2 = new ModelRenderer(this);
            ear2.setRotationPoint(-4.75F, 3.1699F, 5.5F);
            setRotationAngle(ear2, 0.0F, 0.0F, 0.6981F);
            ear2.setTextureOffset(9, 25).addBox(-2.0F, -1.0F, -1.75F, 4.0F, 2.0F, 1.0F, 0.0F, false);
            eyes = new ModelRenderer(this);
            eyes.setRotationPoint(0.0F, 24.0F, 0.0F);
            eyes.setTextureOffset(21, 16).addBox(-3.0F, -20.0F, 2.25F, 2.0F, 2.0F, 0.0F, 0.1F, false);
            eyes.setTextureOffset(21, 14).addBox(1.0F, -20.0F, 2.25F, 2.0F, 2.0F, 0.0F, 0.1F, false);
            nose = new ModelRenderer(this);
            nose.setRotationPoint(0.0F, 24.0F, 0.0F);
            nose.setTextureOffset(19, 0).addBox(-1.0F, -19.0F, 1.25F, 2.0F, 3.0F, 1.0F, 0.0F, false);
            leftarm = new ModelRenderer(this);
            leftarm.setRotationPoint(5.0F, 9.0F, 4.0F);
            setRotationAngle(leftarm, 0.2618F, 0.0F, 0.0F);
            leftarm.setTextureOffset(23, 0).addBox(-1.5F, 0.0F, -2.0F, 3.0F, 8.0F, 4.0F, 0.0F, false);
            rightarm = new ModelRenderer(this);
            rightarm.setRotationPoint(-5.0F, 9.0F, 4.0F);
            setRotationAngle(rightarm, -0.2618F, 0.0F, 0.0F);
            rightarm.setTextureOffset(22, 22).addBox(-1.5F, 0.0F, -2.0F, 3.0F, 8.0F, 4.0F, 0.0F, false);
            bag = new ModelRenderer(this);
            bag.setRotationPoint(-0.5F, 10.5F, 7.5F);
            bag.setTextureOffset(10, 32).addBox(-1.5F, -0.5F, -0.5F, 4.0F, 6.0F, 2.0F, 0.0F, false);
            bag.setTextureOffset(32, 21).addBox(-1.5F, -1.5F, -0.5F, 4.0F, 1.0F, 1.0F, 0.0F, false);
            hair = new ModelRenderer(this);
            hair.setRotationPoint(2.0F, 3.0F, 5.0F);
            hair.setTextureOffset(0, 0).addBox(-3.0F, -4.0F, 1.0F, 0.0F, 4.0F, 1.0F, 0.0F, false);
            hair.setTextureOffset(24, 11).addBox(-2.0F, -2.0F, 1.0F, 0.0F, 2.0F, 1.0F, 0.0F, false);
            hair.setTextureOffset(2, 0).addBox(-2.0F, -3.0F, -1.0F, 0.0F, 3.0F, 1.0F, 0.0F, false);
            hair.setTextureOffset(19, 24).addBox(-2.0F, -2.0F, -2.0F, 0.0F, 2.0F, 1.0F, 0.0F, false);
            hair.setTextureOffset(3, 3).addBox(-4.0F, -2.0F, -2.0F, 0.0F, 2.0F, 1.0F, 0.0F, false);
            hair.setTextureOffset(2, 13).addBox(-3.75F, -2.0F, 0.0F, 0.0F, 2.0F, 1.0F, 0.0F, false);
            hair.setTextureOffset(0, 24).addBox(-1.0F, -2.0F, 0.0F, 0.0F, 2.0F, 1.0F, 0.0F, false);
            hair.setTextureOffset(25, 0).addBox(-3.0F, -2.0F, -1.0F, 0.0F, 2.0F, 1.0F, 0.0F, false);
            hair.setTextureOffset(0, 13).addBox(-3.0F, -5.0F, -2.0F, 0.0F, 5.0F, 1.0F, 0.0F, false);
        }

        @Override
        public void render(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue,
                float alpha) {
            leftleg.render(matrixStack, buffer, packedLight, packedOverlay);
            rightleg.render(matrixStack, buffer, packedLight, packedOverlay);
            body.render(matrixStack, buffer, packedLight, packedOverlay);
            head.render(matrixStack, buffer, packedLight, packedOverlay);
            ear1.render(matrixStack, buffer, packedLight, packedOverlay);
            ear2.render(matrixStack, buffer, packedLight, packedOverlay);
            eyes.render(matrixStack, buffer, packedLight, packedOverlay);
            nose.render(matrixStack, buffer, packedLight, packedOverlay);
            leftarm.render(matrixStack, buffer, packedLight, packedOverlay);
            rightarm.render(matrixStack, buffer, packedLight, packedOverlay);
            bag.render(matrixStack, buffer, packedLight, packedOverlay);
            hair.render(matrixStack, buffer, packedLight, packedOverlay);
        }

        public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
            modelRenderer.rotateAngleX = x;
            modelRenderer.rotateAngleY = y;
            modelRenderer.rotateAngleZ = z;
        }

        public void setRotationAngles(Entity e, float f, float f1, float f2, float f3, float f4) {
            this.rightleg.rotateAngleX = MathHelper.cos(f * 1.0F) * 1.0F * f1;
            this.rightarm.rotateAngleX = MathHelper.cos(f * 0.6662F + (float) Math.PI) * f1;
            this.leftleg.rotateAngleX = MathHelper.cos(f * 1.0F) * -1.0F * f1;
            this.leftarm.rotateAngleX = MathHelper.cos(f * 0.6662F) * f1;
        }
    }
}
 

Last seen on 20:45, 24. Nov 2020
Joined Apr 2010
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Code and logs on pastebin…
Sat, 09/19/2020 - 09:17

Code and logs on pastebin. Also this is code, not compile log