Topic category: Advanced modding
So I tried my best to create a custom creeper mob, and apparently everything is fine with the class itself however, if I try to start a client, a fatal error appears and I can't detect the reason of that error, but I know that the error comes from the Creeper Class. If someone can look what causes this major error and knows how to fix it, please reply!
Log :
[
Executing gradle command: clean runClient
Build info: MCreator 1.8.0, 64-bit, 11225 MB, Windows 10, JVM 1.8.0_172
(c) 2018 Microsoft Corporation. Alle Rechte vorbehalten.
C:\Pylo\MCreator180\forge>gradlew -Dorg.gradle.daemon=false -Dorg.gradle.parallel=false -Dorg.gradle.jvmargs="-Xms625m -Xmx2048m" clean runClient
Error occurred parsing version!
This mapping 'snapshot_20171003' was designed for MC 1.12! Use at your own peril.
#################################################
ForgeGradle 2.3-SNAPSHOT-ee3e3df
https://github.com/MinecraftForge/ForgeGradle
#################################################
Powered by MCP
http://modcoderpack.com
by: Searge, ProfMobius, R4wk, ZeuX
Fesh0r, IngisKahn, bspkrs, LexManos
#################################################
:clean
:deobfCompileDummyTask
:deobfProvidedDummyTask
:sourceApiJava
:compileApiJava UP-TO-DATE
:processApiResources UP-TO-DATE
:apiClasses UP-TO-DATE
:sourceMainJava
:compileJava
:processResources
:classes
:jar
:getVersionJson
:extractNatives SKIPPED
:extractUserdev
:getAssetIndex UP-TO-DATE
:getAssets
Current status: 581/1305 44%
Current status: 1063/1305 81%
Current status: 1135/1305 86%
:makeStart
:runClient
2018-11-02 21:46:54,110 main WARN Disabling terminal, you're running in an unsupported environment.
[21:46:54] [main/INFO] [GradleStart]: Extra: []
[21:46:54] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/aditu_000/.mcreator/gradle/caches/minecraft/assets, --assetIndex, 1.12, --accessToken{REDACTED}, --version, 1.12.2, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]
[21:46:54] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[21:46:54] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[21:46:54] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker
[21:46:54] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker
[21:46:54] [main/INFO] [FML]: Forge Mod Loader version 14.23.4.2705 for Minecraft 1.12.2 loading
[21:46:54] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_172, running on Windows 10:amd64:10.0, installed at C:\Pylo\MCreator180\jdk\jre
[21:46:55] [main/ERROR] [FML]: Apache Maven library folder was not in the format expected. Using default libraries directory.
[21:46:55] [main/ERROR] [FML]: Full: C:\Users\aditu_000\.mcreator\gradle\caches\modules-2\files-2.1\org.apache.maven\maven-artifact\3.5.3\7dc72b6d6d8a6dced3d294ed54c2cc3515ade9f4\maven-artifact-3.5.3.jar
[21:46:55] [main/ERROR] [FML]: Trimmed: c:/users/aditu_000/.mcreator/gradle/caches/modules-2/files-2.1/org.apache.maven/maven-artifact/3.5.3/
[21:46:55] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
[21:46:55] [main/INFO] [FML]: Ignoring missing certificate for coremod FMLCorePlugin (net.minecraftforge.fml.relauncher.FMLCorePlugin), we are in deobf and it's a forge core plugin
[21:46:55] [main/INFO] [FML]: Ignoring missing certificate for coremod FMLForgePlugin (net.minecraftforge.classloading.FMLForgePlugin), we are in deobf and it's a forge core plugin
[21:46:55] [main/INFO] [FML]: Searching C:\Pylo\MCreator180\forge\run\.\mods for mods
[21:46:55] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker
[21:46:55] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin
[21:46:55] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin
[21:46:55] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[21:46:55] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[21:46:55] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[21:46:55] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[21:46:55] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[21:46:55] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[21:47:00] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
[21:47:00] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[21:47:00] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 354352 bytes for Chunk::new
# An error report file with more information is saved as:
# C:\Pylo\MCreator180\forge\run\hs_err_pid1348.log
#
# Compiler replay data is saved as:
# C:\Pylo\MCreator180\forge\run\replay_pid1348.log
:runClient FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':runClient'.
> Process 'command 'C:\Pylo\MCreator180\jdk\bin\java.exe'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1 mins 58.908 secs
C:\Pylo\MCreator180\forge>
Task completed with return code 0 in 123834 milliseconds
]
Class :
[
package mod.mcreator;
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 java.util.Collection;
import javax.annotation.Nullable;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.World;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.DamageSource;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIAttackMelee;
import net.minecraft.entity.ai.EntityAIAvoidEntity;
import net.minecraft.entity.ai.EntityAICreeperSwell;
import net.minecraft.entity.ai.EntityAISwimming;
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.Entity;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.model.ModelCreeper;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.ai.EntityAIWanderAvoidWater;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.passive.EntityOcelot;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.datasync.DataParameter;
import net.minecraft.network.datasync.DataSerializers;
import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.datafix.DataFixer;
import net.minecraft.world.World;
import net.minecraft.world.storage.loot.LootTableList;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraft.entity.EntityAreaEffectCloud;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.potion.PotionEffect;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionType;
import net.minecraft.potion.PotionUtils;
import net.minecraft.client.Minecraft;
import java.util.Random;
import java.util.Iterator;
import java.util.HashMap;
import java.util.ArrayList;
public class mcreator_lightningCreeper {
public static Object instance;
public static int mobid = 45;
public static int mobid2 = 46;
public void preInit(FMLPreInitializationEvent event) {
EntityRegistry.registerModEntity(new ResourceLocation("testenvironmentmod:lightningcreeper"), EntitylightningCreeper.class,
"lightningcreeper", mobid, instance, 64, 1, true, -2629151, -16777216);
Biome[] spawnBiomes = {Biome.REGISTRY.getObject(new ResourceLocation("extreme_hills")),
Biome.REGISTRY.getObject(new ResourceLocation("smaller_extreme_hills")),
Biome.REGISTRY.getObject(new ResourceLocation("mutated_extreme_hills")),
Biome.REGISTRY.getObject(new ResourceLocation("mutated_extreme_hills_with_trees")),};
EntityRegistry.addSpawn(EntitylightningCreeper.class, 10, 1, 3, EnumCreatureType.MONSTER, spawnBiomes);
}
public void load(FMLInitializationEvent event) {
}
public void serverLoad(FMLServerStartingEvent event) {
}
public void registerRenderers() {
RenderLiving customRender = new RenderLiving(Minecraft.getMinecraft().getRenderManager(), new ModelCreeper(), 0) {
protected ResourceLocation getEntityTexture(Entity par1Entity) {
return new ResourceLocation("lightningcreeper.png");
}
};
RenderingRegistry.registerEntityRenderingHandler(EntitylightningCreeper.class, customRender);
}
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;
}
public static class EntitylightningCreeper extends EntityMob {
private static final DataParameter<Integer> STATE = EntityDataManager.<Integer>createKey(EntitylightningCreeper.class, DataSerializers.VARINT);
private static final DataParameter<Boolean> POWERED = EntityDataManager.<Boolean>createKey(EntitylightningCreeper.class, DataSerializers.BOOLEAN);
private static final DataParameter<Boolean> IGNITED = EntityDataManager.<Boolean>createKey(EntitylightningCreeper.class, DataSerializers.BOOLEAN);
/**
* Time when this creeper was last in an active state (Messed up code here, probably causes creeper animation to go
* weird)
*/
private int lastActiveTime;
/** The amount of time since the creeper was close enough to the player to ignite */
private int timeSinceIgnited;
private int fuseTime = 30;
/** Explosion radius for this creeper. */
private int explosionRadius = 3;
private int droppedSkulls;
public EntitylightningCreeper(World worldIn)
{
super(worldIn);
this.setSize(0.6F, 1.7F);
}
protected void initEntityAI()
{
this.tasks.addTask(1, new EntityAISwimming(this));
this.tasks.addTask(3, new EntityAIAvoidEntity(this, EntityOcelot.class, 6.0F, 1.0D, 1.2D));
this.tasks.addTask(4, new EntityAIAttackMelee(this, 1.0D, false));
this.tasks.addTask(5, new EntityAIWanderAvoidWater(this, 0.8D));
this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
this.tasks.addTask(6, new EntityAILookIdle(this));
this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false, new Class[0]));
}
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.25D);
}
@Override
protected Item getDropItem() {
return new ItemStack(mcreator_electricCharge.block, (int) (1)).getItem();
}
/**
* The maximum height from where the entity is alowed to jump (used in pathfinder)
*/
public int getMaxFallHeight()
{
return this.getAttackTarget() == null ? 3 : 3 + (int)(this.getHealth() - 1.0F);
}
public void fall(float distance, float damageMultiplier)
{
super.fall(distance, damageMultiplier);
this.timeSinceIgnited = (int)((float)this.timeSinceIgnited + distance * 1.5F);
if (this.timeSinceIgnited > this.fuseTime - 5)
{
this.timeSinceIgnited = this.fuseTime - 5;
}
}
protected void entityInit()
{
super.entityInit();
this.dataManager.register(STATE, Integer.valueOf(-1));
this.dataManager.register(POWERED, Boolean.valueOf(false));
this.dataManager.register(IGNITED, Boolean.valueOf(false));
}
public static void registerFixesCreeper(DataFixer fixer)
{
EntityLiving.registerFixesMob(fixer, EntitylightningCreeper.class);
}
/**
* (abstract) Protected helper method to write subclass entity data to NBT.
*/
public void writeEntityToNBT(NBTTagCompound compound)
{
super.writeEntityToNBT(compound);
if (((Boolean)this.dataManager.get(POWERED)).booleanValue())
{
compound.setBoolean("powered", true);
}
compound.setShort("Fuse", (short)this.fuseTime);
compound.setByte("ExplosionRadius", (byte)this.explosionRadius);
compound.setBoolean("ignited", this.hasIgnited());
}
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound compound)
{
super.readEntityFromNBT(compound);
this.dataManager.set(POWERED, Boolean.valueOf(compound.getBoolean("powered")));
if (compound.hasKey("Fuse", 99))
{
this.fuseTime = compound.getShort("Fuse");
}
if (compound.hasKey("ExplosionRadius", 99))
{
this.explosionRadius = compound.getByte("ExplosionRadius");
}
if (compound.getBoolean("ignited"))
{
this.ignite();
}
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
if (this.isEntityAlive())
{
this.lastActiveTime = this.timeSinceIgnited;
if (this.hasIgnited())
{
this.setCreeperState(1);
}
int i = this.getCreeperState();
if (i > 0 && this.timeSinceIgnited == 0)
{
this.playSound(SoundEvents.ENTITY_CREEPER_PRIMED, 1.0F, 0.5F);
}
this.timeSinceIgnited += i;
if (this.timeSinceIgnited < 0)
{
this.timeSinceIgnited = 0;
}
if (this.timeSinceIgnited >= this.fuseTime)
{
this.timeSinceIgnited = this.fuseTime;
this.explode();
}
}
super.onUpdate();
}
protected SoundEvent getHurtSound(DamageSource damageSourceIn)
{
return SoundEvents.ENTITY_CREEPER_HURT;
}
protected SoundEvent getDeathSound()
{
return SoundEvents.ENTITY_CREEPER_DEATH;
}
/**
* Called when the mob's health reaches 0.
*/
public void onDeath(DamageSource cause)
{
super.onDeath(cause);
if (this.world.getGameRules().getBoolean("doMobLoot"))
{
if (cause.getTrueSource() instanceof EntitySkeleton)
{
int i = Item.getIdFromItem(Items.RECORD_13);
int j = Item.getIdFromItem(Items.RECORD_WAIT);
int k = i + this.rand.nextInt(j - i + 1);
this.dropItem(Item.getItemById(k), 1);
}
else if (cause.getTrueSource() instanceof EntitylightningCreeper && cause.getTrueSource() != this && ((EntitylightningCreeper)cause.getTrueSource()).getPowered() && ((EntitylightningCreeper)cause.getTrueSource()).ableToCauseSkullDrop())
{
((EntitylightningCreeper)cause.getTrueSource()).incrementDroppedSkulls();
this.entityDropItem(new ItemStack(Items.SKULL, 1, 4), 0.0F);
}
}
}
public boolean attackEntityAsMob(Entity entityIn)
{
return true;
}
/**
* Returns true if the creeper is powered by a lightning bolt.
*/
public boolean getPowered()
{
return ((Boolean)this.dataManager.get(POWERED)).booleanValue();
}
/**
* Params: (Float)Render tick. Returns the intensity of the creeper's flash when it is ignited.
*/
@SideOnly(Side.CLIENT)
public float getCreeperFlashIntensity(float p_70831_1_)
{
return ((float)this.lastActiveTime + (float)(this.timeSinceIgnited - this.lastActiveTime) * p_70831_1_) / (float)(this.fuseTime - 2);
}
/**
* Returns the current state of creeper, -1 is idle, 1 is 'in fuse'
*/
public int getCreeperState()
{
return ((Integer)this.dataManager.get(STATE)).intValue();
}
/**
* Sets the state of creeper, -1 to idle and 1 to be 'in fuse'
*/
public void setCreeperState(int state)
{
this.dataManager.set(STATE, Integer.valueOf(state));
}
/**
* Called when a lightning bolt hits the entity.
*/
public void onStruckByLightning(EntityLightningBolt lightningBolt)
{
super.onStruckByLightning(lightningBolt);
this.dataManager.set(POWERED, Boolean.valueOf(true));
}
protected boolean processInteract(EntityPlayer player, EnumHand hand)
{
ItemStack itemstack = player.getHeldItem(hand);
if (itemstack.getItem() == Items.FLINT_AND_STEEL)
{
this.world.playSound(player, this.posX, this.posY, this.posZ, SoundEvents.ITEM_FLINTANDSTEEL_USE, this.getSoundCategory(), 1.0F, this.rand.nextFloat() * 0.4F + 0.8F);
player.swingArm(hand);
if (!this.world.isRemote)
{
this.ignite();
itemstack.damageItem(1, player);
return true;
}
}
return super.processInteract(player, hand);
}
/**
* Creates an explosion as determined by this creeper's power and explosion radius.
*/
private void explode()
{
if (!this.world.isRemote)
{
boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.world, this);
float f = this.getPowered() ? 2.0F : 1.0F;
this.dead = true;
int x = (int) this.posX;
int y = (int) this.posY;
int z = (int) this.posZ;
{
java.util.HashMap<String, Object> $_dependencies = new java.util.HashMap<>();
$_dependencies.put("x", x);
$_dependencies.put("y", y);
$_dependencies.put("z", z);
$_dependencies.put("world", world);
mcreator_strikeLightning.executeProcedure($_dependencies);
}
this.setDead();
this.spawnLingeringCloud();
}
}
private void spawnLingeringCloud()
{
Collection<PotionEffect> collection = this.getActivePotionEffects();
if (!collection.isEmpty())
{
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.world, this.posX, this.posY, this.posZ);
entityareaeffectcloud.setRadius(2.5F);
entityareaeffectcloud.setRadiusOnUse(-0.5F);
entityareaeffectcloud.setWaitTime(10);
entityareaeffectcloud.setDuration(entityareaeffectcloud.getDuration() / 2);
entityareaeffectcloud.setRadiusPerTick(-entityareaeffectcloud.getRadius() / (float)entityareaeffectcloud.getDuration());
for (PotionEffect potioneffect : collection)
{
entityareaeffectcloud.addEffect(new PotionEffect(potioneffect));
}
this.world.spawnEntity(entityareaeffectcloud);
}
}
public boolean hasIgnited()
{
return ((Boolean)this.dataManager.get(IGNITED)).booleanValue();
}
public void ignite()
{
this.dataManager.set(IGNITED, Boolean.valueOf(true));
}
/**
* Returns true if an entity is able to drop its skull due to being blown up by this creeper.
*
* Does not test if this creeper is charged; the caller must do that. However, does test the doMobLoot gamerule.
*/
public boolean ableToCauseSkullDrop()
{
return this.droppedSkulls < 1 && this.world.getGameRules().getBoolean("doMobLoot");
}
public void incrementDroppedSkulls()
{
++this.droppedSkulls;
}
}
}
]
This is most likely caused by a bug in modeler that exported non working mob model.
Oh okay, thanks! Okay I just started up Mcreator again and Minecraft is running now and I changed nothing in the code