Jump to content

The_Fireplace

Forge Modder
  • Posts

    243
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by The_Fireplace

  1. I am making ammo for my gun, and I want it to render like the item used as ammo(like the egg renders when thrown). It crashes when it is fired, and it appears to be because of the rendering code. Here is what I have:

    RenderCoal.java

     

     

    public class RenderCoal extends RenderEntity {
    
    private EnumAmmo ammo;
    
    public RenderCoal(RenderManager p_i46185_1_, EnumAmmo ammo) {
    	super(p_i46185_1_);
    	this.ammo = ammo;
    }
    
    protected ResourceLocation getEntityTexture(Entity entity)
        {
    	if(this.ammo == EnumAmmo.COAL)
            return new ResourceLocation("minecraft:items/coal");
    	else if(this.ammo == EnumAmmo.CHARGED_COAL)
    	return new ResourceLocation("unlogicii:items/charged_coal");
    	else if(this.ammo == EnumAmmo.DESTABILIZED_COAL)
    	return new ResourceLocation("unlogicii:items/destabilized_coal");
    	else if(this.ammo == EnumAmmo.SEMIREFINED_COAL)
    	return new ResourceLocation("unlogicii:items/semirefined_coal");
    	else if(this.ammo == EnumAmmo.REFINED_COAL)
    	return new ResourceLocation("unlogicii:items/refined_coal");
    	else
    	return new ResourceLocation("minecraft:items/coal");
        }
    }
    

     

     

    ClientProxy.java

     

     

    public class ClientProxy extends CommonProxy {
    @Override
    public void registerRenderers(){
    	RenderingRegistry.registerEntityRenderingHandler(EntityCoal.class, new RenderCoal(Minecraft.getMinecraft().getRenderManager(), EnumAmmo.COAL));
    }
    }
    

     

     

    EntityCoal.java

     

     

    public class EntityCoal extends EntityThrowable {
    
    public EntityCoal(World worldIn) {
    	super(worldIn);
    }
    
    public EntityCoal(World worldIn, EntityLivingBase p_i1780_2_)
        {
            super(worldIn, p_i1780_2_);
        }
    
    public EntityCoal(World worldIn, double p_i1781_2_, double p_i1781_4_, double p_i1781_6_)
        {
            super(worldIn, p_i1781_2_, p_i1781_4_, p_i1781_6_);
        }
    
    @Override
    protected void onImpact(MovingObjectPosition p_70184_1_) {
    	if (p_70184_1_.entityHit != null)
            {
                p_70184_1_.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 1.0F);
            }
    
    	if (!this.worldObj.isRemote)
            {
                this.setDead();
            }
    }
    
    }
    

     

     

    In my Pre-Init in the main class

     

     

    registerEntity(EntityCoal.class, "ammo_coal");
    proxy.registerRenderers();
    

     

     

    And the registerEntity code(also in the main class)

     

     

    public static void registerEntity(Class entityClass, String name){
    	int entityID = EntityRegistry.findGlobalUniqueEntityId();
    	EntityRegistry.registerGlobalEntityID(entityClass, name, entityID);
    	EntityRegistry.registerModEntity(entityClass, name, entityID, instance, 32, 1, true);
    }
    

     

     

    And lastly, the crash report

     

     

    [11:04:51] [Client thread/FATAL]: Reported exception thrown!

    net.minecraft.util.ReportedException: Post-rendering entity in world

    at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:425) ~[RenderManager.class:?]

    at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(RenderManager.java:334) ~[RenderManager.class:?]

    at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(RenderManager.java:301) ~[RenderManager.class:?]

    at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:657) ~[RenderGlobal.class:?]

    at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1350) ~[EntityRenderer.class:?]

    at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1263) ~[EntityRenderer.class:?]

    at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1088) ~[EntityRenderer.class:?]

    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1107) ~[Minecraft.class:?]

    at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?]

    at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]

    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]

    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]

    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]

    at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]

    at GradleStart.main(Unknown Source) [start/:?]

    Caused by: java.lang.NullPointerException

    at net.minecraft.client.renderer.entity.Render.doRenderShadowAndFire(Render.java:307) ~[Render.class:?]

    at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:388) ~[RenderManager.class:?]

    ... 17 more

    [11:04:51] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:660]: ---- Minecraft Crash Report ----

    // Oops.

     

    Time: 3/28/15 11:04 AM

    Description: Post-rendering entity in world

     

    java.lang.NullPointerException: Post-rendering entity in world

    at net.minecraft.client.renderer.entity.Render.doRenderShadowAndFire(Render.java:307)

    at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:388)

    at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(RenderManager.java:334)

    at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(RenderManager.java:301)

    at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:657)

    at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1350)

    at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1263)

    at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1088)

    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1107)

    at net.minecraft.client.Minecraft.run(Minecraft.java:376)

    at net.minecraft.client.main.Main.main(Main.java:117)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

    at java.lang.reflect.Method.invoke(Unknown Source)

    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

    at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)

    at GradleStart.main(Unknown Source)

     

     

    A detailed walkthrough of the error, its code path and all known details is as follows:

    ---------------------------------------------------------------------------------------

     

    -- Head --

    Stacktrace:

    at net.minecraft.client.renderer.entity.Render.doRenderShadowAndFire(Render.java:307)

     

    -- Entity being rendered --

    Details:

    Entity Type: ammo_coal (the_fireplace.unlogicii.entity.coal.EntityCoal)

    Entity ID: 95638

    Entity Name: entity.ammo_coal.name

    Entity's Exact location: 235.84, 6.15, 35.80

    Entity's Block location: 235.00,6.00,35.00 - World: (235,6,35), Chunk: (at 11,0,3 in 14,2; contains blocks 224,0,32 to 239,255,47), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)

    Entity's Momentum: 0.63, 0.59, -1.18

    Entity's Rider: ~~ERROR~~ NullPointerException: null

    Entity's Vehicle: ~~ERROR~~ NullPointerException: null

     

    -- Renderer details --

    Details:

    Assigned renderer: the_fireplace.unlogicii.renderers.RenderCoal@e75a138

    Location: 0.37,1.75,-0.35 - World: (0,1,-1), Chunk: (at 0,0,15 in 0,-1; contains blocks 0,0,-16 to 15,255,-1), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,0,-512 to 511,255,-1)

    Rotation: 151.85417

    Delta: 0.36080897

    Stacktrace:

    at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:388)

    at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(RenderManager.java:334)

    at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(RenderManager.java:301)

    at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:657)

    at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1350)

    at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1263)

     

    -- Affected level --

    Details:

    Level name: MpServer

    All players: 1 total; [EntityPlayerSP['Player5'/61, l='MpServer', x=235.06, y=4.00, z=36.92]]

    Chunk stats: MultiplayerChunkCache: 289, 289

    Level seed: 0

    Level generator: ID 01 - flat, ver 0. Features enabled: false

    Level generator options:

    Level spawn location: 249.00,4.00,64.00 - World: (249,4,64), Chunk: (at 9,0,0 in 15,4; contains blocks 240,0,64 to 255,255,79), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)

    Level time: 28133 game time, 28133 day time

    Level dimension: 0

    Level storage version: 0x00000 - Unknown?

    Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)

    Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false

    Forced entities: 16 total; [EntityPig['Pig'/37, l='MpServer', x=284.63, y=4.00, z=-7.25], EntityPig['Pig'/39, l='MpServer', x=300.78, y=4.00, z=-19.06], EntityPlayerSP['Player5'/61, l='MpServer', x=235.06, y=4.00, z=36.92], EntityPig['Pig'/40, l='MpServer', x=300.91, y=4.00, z=-6.03], EntitySheep['Sheep'/41, l='MpServer', x=295.97, y=4.00, z=104.06], EntityHorse['Horse'/42, l='MpServer', x=302.66, y=4.00, z=112.06], EntityChicken['Chicken'/10, l='MpServer', x=156.66, y=4.00, z=95.56], EntityPig['Pig'/48, l='MpServer', x=308.41, y=4.00, z=-8.78], EntityHorse['Horse'/49, l='MpServer', x=306.97, y=4.00, z=105.34], EntitySheep['Sheep'/19, l='MpServer', x=166.94, y=4.00, z=-40.97], EntitySheep['Sheep'/20, l='MpServer', x=171.88, y=4.00, z=-23.06], EntitySheep['Sheep'/21, l='MpServer', x=160.84, y=4.00, z=-18.91], EntitySheep['Sheep'/22, l='MpServer', x=166.06, y=4.00, z=-14.03], EntityCoal['entity.ammo_coal.name'/95638, l='MpServer', x=235.84, y=6.15, z=35.80], EntitySheep['Sheep'/28, l='MpServer', x=205.19, y=4.00, z=-42.72], EntitySheep['Sheep'/29, l='MpServer', x=221.88, y=4.00, z=-42.94]]

    Retry entities: 0 total; []

    Server brand: fml,forge

    Server type: Integrated singleplayer server

    Stacktrace:

    at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:392)

    at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2600)

    at net.minecraft.client.Minecraft.run(Minecraft.java:398)

    at net.minecraft.client.main.Main.main(Main.java:117)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

    at java.lang.reflect.Method.invoke(Unknown Source)

    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

    at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)

    at GradleStart.main(Unknown Source)

     

    -- System Details --

    Details:

    Minecraft Version: 1.8

    Operating System: Windows 7 (amd64) version 6.1

    Java Version: 1.8.0_25, Oracle Corporation

    Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

    Memory: 831594088 bytes (793 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB)

    JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

    FML: MCP v9.10 FML v8.0.42.1338 Minecraft Forge 11.14.1.1338 5 mods loaded, 5 mods active

    mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

    FML{8.0.42.1338} [Forge Mod Loader] (forgeSrc-1.8-11.14.1.1338.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

    Forge{11.14.1.1338} [Minecraft Forge] (forgeSrc-1.8-11.14.1.1338.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

    fireplacecore{2.1.3.0} [Fireplace Core] (fireplacecore-deobf.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

    unlogicii{2.0.0.1} [unLogic II] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

    Loaded coremods (and transformers):

    Launched Version: 1.8

    LWJGL: 2.9.1

    OpenGL: Intel® HD Graphics GL version 3.1.0 - Build 9.17.10.3347, Intel

    GL Caps: Using GL 1.3 multitexturing.

    Using GL 1.3 texture combiners.

    Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.

    Shaders are available because OpenGL 2.1 is supported.

    VBOs are available because OpenGL 1.5 is supported.

     

    Using VBOs: No

    Is Modded: Definitely; Client brand changed to 'fml,forge'

    Type: Client (map_client.txt)

    Resource Packs: []

    Current Language: English (US)

    Profiler Position: N/A (disabled)

    [11:04:51] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:660]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Lance\Documents\unlogic-ii\eclipse\.\crash-reports\crash-2015-03-28_11.04.51-client.txt

    AL lib: (EE) alc_cleanup: 1 device not closed

    Java HotSpot 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release

     

     

    If anyone knows how to fix the crash(and make it render correctly), your help would be appreciated.

  2. Probably because the date you inserted into the new entity says that it should be dead (0 health, etc.).

    How exactly do I fix this issue? I have tried multiple times, and they all have failed. Here is what I have tried:

    private void createEntity(LivingDropsEvent event){
    EntityLivingBase entity;
    World worldIn = event.entityLiving.worldObj;
    int id = EntityList.getEntityID(event.entityLiving);
    NBTTagCompound storedData = event.entityLiving.getEntityData();
    ItemStack weapon = event.entityLiving.getHeldItem();
    entity = (EntityLivingBase) EntityList.createEntityByID(id, worldIn);
        entity.setLocationAndAngles(event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, MathHelper.wrapAngleTo180_float(worldIn.rand.nextFloat() * 360.0F), 0.0F);
        entity.rotationYawHead = entity.rotationYaw;
        entity.renderYawOffset = entity.rotationYaw;
        storedData.setInteger("health", (int) event.entityLiving.getMaxHealth());
        ((EntityLivingBase) entity).readFromNBT(storedData);
        entity.setCurrentItemOrArmor(0, weapon);
    worldIn.spawnEntityInWorld(entity);
    }
    

    private void createEntity(LivingDropsEvent event){
    EntityLivingBase entity;
    World worldIn = event.entityLiving.worldObj;
    int id = EntityList.getEntityID(event.entityLiving);
    NBTTagCompound storedData = event.entityLiving.getEntityData();
    ItemStack weapon = event.entityLiving.getHeldItem();
    entity = (EntityLivingBase) EntityList.createEntityByID(id, worldIn);
        entity.setLocationAndAngles(event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, MathHelper.wrapAngleTo180_float(worldIn.rand.nextFloat() * 360.0F), 0.0F);
        entity.rotationYawHead = entity.rotationYaw;
        entity.renderYawOffset = entity.rotationYaw;
        entity.setHealth(event.entityLiving.getMaxHealth());
        ((EntityLivingBase) entity).readFromNBT(storedData);
        entity.setCurrentItemOrArmor(0, weapon);
    worldIn.spawnEntityInWorld(entity);
    }
    

  3. This code (supposedly)worked in 1.7.10, but I can't find any way to update it to 1.8. Anyone have any ideas?

    @SubscribeEvent
    public void renderCape(RenderPlayerEvent event){
    	if(event.entityPlayer instanceof AbstractClientPlayer){
    		((AbstractClientPlayer) event.entityPlayer).func_152121_a(Type.CAPE, new ResourceLocation("modid:textures/player/cape/cape.png"));
    	}
    }
    

    func_152121_a does not exist in 1.8, and I can't find anything with the same parameters, or any other way to do it.

  4. I know there have been threads about this in the past, but none of the previous solutions are working for me.

    I run the following command to set up the workspace

    gradlew setupDecompWorkspace eclipse
    

    I have also, as attempts to fix this with solutions from other modders' threads, tried the following(they all resulted in the same thing when I tried opening the project):

    gradlew setupDecompWorkspace eclipse --refresh-dependencies
    

    gradlew setupDecompWorkspace --refresh-dependencies eclipse
    

    gradlew setupDecompWorkspace --refresh-dependencies
    gradlew eclipse
    

    gradlew cleancache --refresh-dependencies setupDecompWorkspace eclipse
    

    And no, there are no spaces in the path to the forgeroot/eclipse

     

    I am using forge-1.8-11.14.1.1338

  5. So, I am making it so mobs are reborn at full health during LivingDropsEvent, and it works, except for some data not remaining the same as the original. Here is the void being called during the LivingDropsEvent:

     

     

    private void createEntity(LivingDropsEvent event){
    NBTTagCompound storedData = event.entityLiving.getEntityData();//As you can see, I am storing the NBT here...
    EntityLivingBase entity;
    World worldIn = event.entityLiving.worldObj;
    int id = EntityList.getEntityID(event.entityLiving);
    ItemStack weapon = event.entityLiving.getHeldItem();
    entity = (EntityLivingBase) EntityList.createEntityByID(id, worldIn);
        entity.setLocationAndAngles(event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, MathHelper.wrapAngleTo180_float(worldIn.rand.nextFloat() * 360.0F), 0.0F);
        entity.rotationYawHead = entity.rotationYaw;
        entity.renderYawOffset = entity.rotationYaw;
        ((EntityLivingBase) entity).writeToNBT(storedData);//...and writing it to the new entity here
        entity.setCurrentItemOrArmor(0, weapon);
    worldIn.spawnEntityInWorld(entity);
    }
    

     

     

    Some of the data not staying the same that I have noticed is:

    Villager color always becomes the brown one

    Rabbit color always becomes the brown one

    Baby villagers become fully grown, probably does that for other animals as well

     

    Any help would be appreciated.

  6. As the title says, the game crashes when I use bonemeal on my custom crop. Here is the crash report:

     

     

    [09:40:07] [server thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Cannot get property PropertyInteger{name=age, clazz=class java.lang.Integer, values=[0, 1, 2, 3, 4, 5]} as it does not exist in BlockState{block=unlogicii:quartz_crop, properties=[age]}
    java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Cannot get property PropertyInteger{name=age, clazz=class java.lang.Integer, values=[0, 1, 2, 3, 4, 5]} as it does not exist in BlockState{block=unlogicii:quartz_crop, properties=[age]}
    at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_25]
    at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_25]
    at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:677) [FMLCommonHandler.class:?]
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:655) [MinecraftServer.class:?]
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:598) [MinecraftServer.class:?]
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:164) [integratedServer.class:?]
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:478) [MinecraftServer.class:?]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_25]
    Caused by: java.lang.IllegalArgumentException: Cannot get property PropertyInteger{name=age, clazz=class java.lang.Integer, values=[0, 1, 2, 3, 4, 5]} as it does not exist in BlockState{block=unlogicii:quartz_crop, properties=[age]}
    at net.minecraft.block.state.BlockState$StateImplementation.getValue(BlockState.java:158) ~[blockState$StateImplementation.class:?]
    at the_fireplace.unlogicii.blocks.BlockQuartzCrop.canGrow(BlockQuartzCrop.java:75) ~[blockQuartzCrop.class:?]
    at net.minecraft.item.ItemDye.applyBonemeal(ItemDye.java:117) ~[itemDye.class:?]
    at net.minecraft.item.ItemDye.onItemUse(ItemDye.java:51) ~[itemDye.class:?]
    at net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(ForgeHooks.java:562) ~[ForgeHooks.class:?]
    at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:132) ~[itemStack.class:?]
    at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:446) ~[itemInWorldManager.class:?]
    at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:595) ~[NetHandlerPlayServer.class:?]
    at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:61) ~[C08PacketPlayerBlockPlacement.class:?]
    at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:96) ~[C08PacketPlayerBlockPlacement.class:?]
    at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:18) ~[PacketThreadUtil$1.class:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_25]
    at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_25]
    at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:676) ~[FMLCommonHandler.class:?]
    ... 5 more
    [09:40:07] [server thread/INFO]: Stopping server
    [09:40:07] [server thread/INFO]: Saving players
    [09:40:07] [server thread/INFO]: Saving worlds
    [09:40:07] [server thread/INFO]: Saving chunks for level 'New UnLogic II Test Zone'/Overworld
    [09:40:08] [server thread/INFO]: Saving chunks for level 'New UnLogic II Test Zone'/Nether
    [09:40:08] [server thread/INFO]: Saving chunks for level 'New UnLogic II Test Zone'/The End
    [09:40:08] [server thread/INFO] [FML]: Unloading dimension 0
    [09:40:08] [server thread/INFO] [FML]: Unloading dimension -1
    [09:40:08] [server thread/INFO] [FML]: Unloading dimension 1
    [09:40:08] [server thread/INFO] [FML]: Applying holder lookups
    [09:40:08] [server thread/INFO] [FML]: Holder lookups applied
    [09:40:08] [Client thread/FATAL]: Unreported exception thrown!
    java.lang.IllegalArgumentException: Cannot get property PropertyInteger{name=age, clazz=class java.lang.Integer, values=[0, 1, 2, 3, 4, 5]} as it does not exist in BlockState{block=unlogicii:quartz_crop, properties=[age]}
    at net.minecraft.block.state.BlockState$StateImplementation.getValue(BlockState.java:158) ~[blockState$StateImplementation.class:?]
    at the_fireplace.unlogicii.blocks.BlockQuartzCrop.canGrow(BlockQuartzCrop.java:75) ~[blockQuartzCrop.class:?]
    at net.minecraft.item.ItemDye.applyBonemeal(ItemDye.java:117) ~[itemDye.class:?]
    at net.minecraft.item.ItemDye.onItemUse(ItemDye.java:51) ~[itemDye.class:?]
    at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:133) ~[itemStack.class:?]
    at net.minecraft.client.multiplayer.PlayerControllerMP.func_178890_a(PlayerControllerMP.java:407) ~[PlayerControllerMP.class:?]
    at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1483) ~[Minecraft.class:?]
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:2033) ~[Minecraft.class:?]
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1021) ~[Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:345) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?]
    at GradleStart.main(GradleStart.java:45) [start/:?]
    [09:40:08] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:568]: ---- Minecraft Crash Report ----
    // But it works on my machine.
    
    Time: 3/5/15 9:40 AM
    Description: Unexpected error
    
    java.lang.IllegalArgumentException: Cannot get property PropertyInteger{name=age, clazz=class java.lang.Integer, values=[0, 1, 2, 3, 4, 5]} as it does not exist in BlockState{block=unlogicii:quartz_crop, properties=[age]}
    at net.minecraft.block.state.BlockState$StateImplementation.getValue(BlockState.java:158)
    at the_fireplace.unlogicii.blocks.BlockQuartzCrop.canGrow(BlockQuartzCrop.java:75)
    at net.minecraft.item.ItemDye.applyBonemeal(ItemDye.java:117)
    at net.minecraft.item.ItemDye.onItemUse(ItemDye.java:51)
    at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:133)
    at net.minecraft.client.multiplayer.PlayerControllerMP.func_178890_a(PlayerControllerMP.java:407)
    at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1483)
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:2033)
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1021)
    at net.minecraft.client.Minecraft.run(Minecraft.java:345)
    at net.minecraft.client.main.Main.main(Main.java:117)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)
    at GradleStart.main(GradleStart.java:45)
    
    
    A detailed walkthrough of the error, its code path and all known details is as follows:
    ---------------------------------------------------------------------------------------
    
    -- Head --
    Stacktrace:
    at net.minecraft.block.state.BlockState$StateImplementation.getValue(BlockState.java:158)
    at the_fireplace.unlogicii.blocks.BlockQuartzCrop.canGrow(BlockQuartzCrop.java:75)
    at net.minecraft.item.ItemDye.applyBonemeal(ItemDye.java:117)
    at net.minecraft.item.ItemDye.onItemUse(ItemDye.java:51)
    at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:133)
    at net.minecraft.client.multiplayer.PlayerControllerMP.func_178890_a(PlayerControllerMP.java:407)
    at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1483)
    
    -- Affected level --
    Details:
    Level name: MpServer
    All players: 1 total; [EntityPlayerSP['Player80'/0, l='MpServer', x=484.02, y=1.00, z=-41.16]]
    Chunk stats: MultiplayerChunkCache: 25, 25
    Level seed: 0
    Level generator: ID 01 - flat, ver 0. Features enabled: false
    Level generator options: 
    Level spawn location: 468.00,4.00,-65.00 - World: (468,4,-65), Chunk: (at 4,0,15 in 29,-5; contains blocks 464,0,-80 to 479,255,-65), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,0,-512 to 511,255,-1)
    Level time: 12589 game time, 12589 day time
    Level dimension: 0
    Level storage version: 0x00000 - Unknown?
    Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
    Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
    Forced entities: 1 total; [EntityPlayerSP['Player80'/0, l='MpServer', x=484.02, y=1.00, z=-41.16]]
    Retry entities: 0 total; []
    Server brand: fml,forge
    Server type: Integrated singleplayer server
    Stacktrace:
    at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:350)
    at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2488)
    at net.minecraft.client.Minecraft.run(Minecraft.java:374)
    at net.minecraft.client.main.Main.main(Main.java:117)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)
    at GradleStart.main(GradleStart.java:45)
    
    -- System Details --
    Details:
    Minecraft Version: 1.8
    Operating System: Windows 7 (amd64) version 6.1
    Java Version: 1.8.0_25, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 791447800 bytes (754 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB)
    JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
    FML: MCP v9.10 FML v8.0.26.1306 Minecraft Forge 11.14.1.1306 5 mods loaded, 5 mods active
    mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
    FML{8.0.26.1306} [Forge Mod Loader] (forgeSrc-1.8-11.14.1.1306.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
    Forge{11.14.1.1306} [Minecraft Forge] (forgeSrc-1.8-11.14.1.1306.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
    fireplacecore{2.1.1.0} [Fireplace Core] (fireplacecore-deobf.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
    unlogicii{2.0.0.1} [unLogic II] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
    Launched Version: 1.8
    LWJGL: 2.9.1
    OpenGL: Intel(R) HD Graphics GL version 3.1.0 - Build 9.17.10.3347, Intel
    GL Caps: Using GL 1.3 multitexturing.
    Using GL 1.3 texture combiners.
    Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
    Shaders are available because OpenGL 2.1 is supported.
    VBOs are available because OpenGL 1.5 is supported.
    
    Using VBOs: No
    Is Modded: Definitely; Client brand changed to 'fml,forge'
    Type: Client (map_client.txt)
    Resource Packs: []
    Current Language: English (US)
    Profiler Position: N/A (disabled)
    [09:40:09] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:568]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Lance\Documents\unlogic-ii\eclipse\.\crash-reports\crash-2015-03-05_09.40.08-client.txt
    AL lib: (EE) alc_cleanup: 1 device not closed
    Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
    

     

     

    And here is the crop's code:

     

     

    public class BlockQuartzCrop extends BlockCrops{
        public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 5);
    
    public BlockQuartzCrop(){
            this.setTickRandomly(true);
            float f = 0.5F;
            this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
    	setUnlocalizedName("quartz_crop");
    	//this.setDefaultState(this.blockState.getBaseState().withProperty(AGE, Integer.valueOf(0)));
            this.setHardness(0.0F);
            this.setStepSound(soundTypeGrass);
            this.disableStats();
    }
    
    @Override
    public Item getSeed(){
    	return UnLogicII.quartz_seeds;
    }
    
    @Override
    public Item getCrop(){
    	return Item.getItemFromBlock(Blocks.quartz_block);
    }
    
    @Override
    protected boolean canPlaceBlockOn(Block ground)
        {
            return ground == UnLogicII.obsidian_farmland;
        }
    
    @Override
    public void grow(World worldIn, BlockPos pos, IBlockState state)
        {
            int i = ((Integer)state.getValue(AGE)).intValue() + MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5);
    
            if (i > 5)
            {
                i = 5;
            }
    
            worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(i)), 2);
        }
    
    @Override
    public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
        {
            return (worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this));
        }
    
    @Override
    public Item getItemDropped(IBlockState state, Random rand, int fortune)
        {
            return ((Integer)state.getValue(AGE)).intValue() == 5 ? this.getCrop() : this.getSeed();
        }
    
    @Override
    public boolean canGrow(World worldIn, BlockPos pos, IBlockState state, boolean isClient)
        {
            return ((Integer)state.getValue(AGE)).intValue() < 5;
        }
    
    @Override
        public java.util.List<ItemStack> getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
        {
            java.util.List<ItemStack> ret = super.getDrops(world, pos, state, fortune);
            int age = ((Integer)state.getValue(AGE)).intValue();
            Random rand = world instanceof World ? ((World)world).rand : new Random();
    
            if (age >= 5)
            {
                int k = 3 + fortune;
    
                for (int i = 0; i < 3 + fortune; ++i)
                {
                    if (rand.nextInt(15) <= age)
                    {
                        ret.add(new ItemStack(this.getSeed(), 1, 0));
                    }
                }
            }
            return ret;
        }
    }
    

     

     

  7. You don't need a mod for that. Just go to your Minecraft, remove all servers and add the default one. Copy the servers.dat file in .minecraft to your mod pack main directory.

    Wouldt that remove other servers the user has added every time the pack updates? Just because I want to add the official server doesn't mean no other server will be running the modpack.

  8. When I press Q and throw the Item, the custom EntityItem goes a random direction rather than the direction the player is facing. Here is my code:

     

    package the_fireplace.unlogic.entities;
    
    import java.util.ArrayList;
    import java.util.List;
    
    import the_fireplace.unlogic.unbase;
    import net.minecraft.block.material.Material;
    import net.minecraft.entity.Entity;
    import net.minecraft.entity.item.EntityItem;
    import net.minecraft.init.Items;
    import net.minecraft.item.ItemStack;
    import net.minecraft.util.AxisAlignedBB;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.World;
    
    public class EntityEnderPearlDust extends EntityItem {
    int transformTime = 0;
        /** The health of this EntityItem. (For example, damage for tools) */
        private int health;
    public EntityEnderPearlDust(World world){
    	super(world);
            this.health = 5;
            this.hoverStart = (float)(Math.random() * Math.PI * 2.0D);
            this.setSize(0.25F, 0.25F);
            this.yOffset = this.height / 2.0F;
            this.delayBeforeCanPickup = 50;
    }
    public EntityEnderPearlDust(World world, double x,
    		double y, double z, ItemStack is) {
    	super(world, x, y, z, is);        
            this.setEntityItemStack(is);
            this.lifespan = (is.getItem() == null ? 6000 : is.getItem().getEntityLifespan(is, world));
            this.delayBeforeCanPickup = 50;
    }
    public EntityEnderPearlDust(World world, double x, double y, double z){
    	super(world);
            this.health = 5;
            this.hoverStart = (float)(Math.random() * Math.PI * 2.0D);
            this.setSize(0.25F, 0.25F);
            this.yOffset = this.height / 2.0F;
            this.setPosition(x, y, z);
            this.rotationYaw = (float)(Math.random() * 360.0D);
            this.motionX = (double)((float)(Math.random() * 0.20000000298023224D - 0.10000000149011612D));
            this.motionY = 0.20000000298023224D;
            this.motionZ = (double)((float)(Math.random() * 0.20000000298023224D - 0.10000000149011612D));
            this.delayBeforeCanPickup = 50;
    }
    @Override
    public void onUpdate()
    {
    	super.onUpdate();
    	int j = MathHelper.floor_double( this.posX );
    	int i = MathHelper.floor_double( this.posY );
    	int k = MathHelper.floor_double( this.posZ );
    	transformTime++;
    	if ( transformTime > 60 )
    	{
    		if ( !transform() )
    			transformTime = 0;
    	}
    }
    public static boolean isSameItem(ItemStack ol, ItemStack op)
    {
    	return ol != null && op != null && ol.isItemEqual( op );
    }
    public boolean transform()
    {
    	World world = this.worldObj;
    	if(!world.isRemote){
    	ItemStack item = getEntityItem();
    		AxisAlignedBB region = AxisAlignedBB.getBoundingBox( posX - 1, posY - 1, posZ - 1, posX + 1, posY + 1, posZ + 1 );
    		List<Entity> l = worldObj.getEntitiesWithinAABBExcludingEntity( this, region );
    
    		EntityItem redstone = null;
    		EntityItem glowstone = null;
    		EntityItem gold = null;
    
    		for (Entity e : l)
    		{
    			if ( e instanceof EntityItem && !e.isDead )
    			{
    				ItemStack other = ((EntityItem) e).getEntityItem();
    				if ( other != null && other.stackSize > 0 )
    				{
    					if ( isSameItem( other, new ItemStack( Items.redstone ) ) )
    						redstone = (EntityItem) e;
    
    					if ( isSameItem( other, new ItemStack( Items.glowstone_dust ) ) )
    						glowstone = (EntityItem) e;
    
    					if ( isSameItem( other, new ItemStack( Items.gold_ingot ) ) )
    						gold = (EntityItem) e;
    				}
    			}
    		}
    
    		if ( redstone != null && glowstone != null )
    		{
    			getEntityItem().stackSize--;
    			redstone.getEntityItem().stackSize--;
    			glowstone.getEntityItem().stackSize--;
    			if( gold != null ){
    				gold.getEntityItem().stackSize--;
    				if ( gold.getEntityItem().stackSize <= 0 ){
    					gold.setDead();
    				}
    				worldObj.spawnEntityInWorld( new EntityItem( worldObj, posX, posY, posZ, new ItemStack(unbase.AntiGold)));
    			}
    
    			if ( getEntityItem().stackSize <= 0 )
    				setDead();
    
    			if ( redstone.getEntityItem().stackSize <= 0 )
    				redstone.setDead();
    
    			if ( glowstone.getEntityItem().stackSize <= 0 )
    				glowstone.setDead();
    
    			ItemStack Output = new ItemStack(unbase.UnlogicGem, 2);
    			worldObj.spawnEntityInWorld( new EntityItem( worldObj, posX, posY, posZ, Output ) );
    
    			return true;
    		}}
    
    	return false;
    }
    }
    
    

     

    If you need to see any more code, please, let me know

  9. I have an item that spawns a Snowman when right clicked, however, the snowman vanishes after between 1/2 and 2 seconds.

    Here is my code:

     

    @Override
    public ItemStack onItemRightClick(ItemStack is, World world, EntityPlayer player){
    if (!world.isRemote)
            {
            	Entity entity=new EntitySnowman(world);
            	entity.posX=player.posX;
            	entity.posZ=player.posZ;
                	entity.posY=player.posY;
                    world.spawnEntityInWorld(entity);
            }
            return is;
    }
    

     

    If there's any more info you need, please, let me know.

  10. Here's an example of the class you need to include in your mod to hide items from NEI:

     

    package the_fireplace.unlogic.compat.nei;
    
    import net.minecraft.item.ItemStack;
    import net.minecraftforge.oredict.OreDictionary;
    import the_fireplace.unlogic.unbase;
    import the_fireplace.unlogic.config.UnLogicConfigValues;
    import codechicken.nei.api.API;
    import codechicken.nei.api.IConfigureNEI;
    import codechicken.nei.api.ItemInfo;
    import cpw.mods.fml.common.Mod;
    import cpw.mods.fml.common.Optional;
    
    @Optional.Interface(iface = "codechicken.nei.api.API", modid = "NotEnoughItems")
    public class NEIUnLogicConfig implements IConfigureNEI {
    
    @Optional.Method(modid="NotEnoughItems")
    @Override
    public String getName() {
    	return unbase.class.getAnnotation(Mod.class).name();
    }
    
    @Optional.Method(modid="NotEnoughItems")
    @Override
    public String getVersion() {
    	return unbase.class.getAnnotation(Mod.class).version();
    }
    
    @Optional.Method(modid="NotEnoughItems")
    @Override
    public void loadConfig() {
    	API.hideItem(new ItemStack(unbase.BlazeCake));
    	API.hideItem(new ItemStack(unbase.ChocolateCake));
    	API.hideItem(new ItemStack(unbase.QCrop, 1, OreDictionary.WILDCARD_VALUE));
    	API.hideItem(new ItemStack(unbase.DepletionFurnaceOn));
    }
    }
    

     

    It is important that the class name be NEI[insert mod name here]Config

  11. onArmorTick is called on the client side only (it's intended for animations / rendering updates).
    That is not actually true. It fires on both sides.

    Hi DieSieben

     

    Are you sure?  The only caller appears to be InventoryPlayer.decrementAnimations(), which says

        /**

        * Decrement the number of animations remaining. Only called on client side. This is used to handle the animation of

        * receiving a block.

        */

     

    Let's see what a breakpoint in my debugger says...

    [....]

    Ah well you're right, it breaks on both client and server.

     

    Sorry about that Fireplace.

    onArmorTick() is probably fine.  I'd suggest wrapping your damage code in

    if (!world.isRemote) {
    
    }
    

    and getting rid of the datawatcher (you don't need it on the server (not even sure it works on server), use isBurning() instead) and seeing if that helps.

     

    -TGG

    Ah, that makes sense. Fixed that part of it.

    It still, instead of going away when broken, spawns back in the same slot again, fully restored. Anyone know why it is doing that?

  12. I've created a set of armor that, if worn, will take damage when the player is on fire. However, when it is broken, a new one appears in the same armor slot as the one that was broken. The second problem with it is that it randomly repairs itself instead of taking damage. Here is my code:

     

    public class IceArmor extends ItemArmor {
    
    public IceArmor(ArmorMaterial p_i45325_1_, int p_i45325_2_, int p_i45325_3_) {
    	super(p_i45325_1_, p_i45325_2_, p_i45325_3_);
    }
    @Override
    public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
    	if(stack.getItem() == unbase.IceHelmet || stack.getItem() == unbase.IceChestplate || stack.getItem() == unbase.IceBoots) {
    		return "unlogic:textures/models/armor/ice1.png";
    	}
    	if(stack.getItem() == unbase.IceLeggings) {
    		return "unlogic:textures/models/armor/ice2.png";
    	}
    	return null;
    }
    private static int tickCounter = 0;
    @Override
        public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
    	ItemStack helmet = player.getCurrentArmor(3);
    	ItemStack plate = player.getCurrentArmor(2);
    	ItemStack legs = player.getCurrentArmor(1);
    	ItemStack boots = player.getCurrentArmor(0);
    	int a = 0; 
    	int b = 0; 
    	int c = 0; 
    	int d = 0;
    	if(helmet != null){
    		if(helmet.getItem() == unbase.IceHelmet){
    			a = 1;
    		}else{
    			a = 0;
    		}
    	}
    	if(plate != null){
    		if(plate.getItem() == unbase.IceChestplate){
    			b = 1;
    		}else{
    			b = 0;
    		}
    	}
    	if(legs != null){
    		if(legs.getItem() == unbase.IceLeggings){
    			c = 1;
    		}else{
    			c = 0;
    		}
    	}
    	if(boots != null){
    		if(boots.getItem() == unbase.IceBoots){
    			d = 1;
    		}else{
    			d = 0;
    		}
    	}
    	if(a+b+c+d > 0){
    	player.addPotionEffect(new PotionEffect(Potion.fireResistance.getId(), 20));
    	if((player.getDataWatcher().getWatchableObjectByte(0) & 1 << 0) != 0){
    		tickCounter = tickCounter + 1;
    		if(tickCounter >= 40){
    			tickCounter = tickCounter - 40;
    			if(a == 1){
    				helmet.damageItem(4-(b+c+d), player);
    				if(helmet.getItemDamage() <= 0){
    					a = 0;
    				}//TODO: Make it so it doesn't re-appear after breaking
    			}
    			if(b == 1){
    				plate.damageItem(4-(a+c+d), player);
    				if(helmet.getItemDamage() <= 0){
    					b = 0;
    				}//TODO: Make it so it doesn't re-appear after breaking
    			}
    			if(c == 1){
    				legs.damageItem(4-(b+a+d), player);
    				if(helmet.getItemDamage() <= 0){
    					c = 0;
    				}//TODO: Make it so it doesn't re-appear after breaking
    			}
    			if(d == 1){
    				boots.damageItem(4-(b+c+a), player);
    				if(helmet.getItemDamage() <= 0){
    					d = 0;
    				}//TODO: Make it so it doesn't re-appear after breaking
    			}
    		}
    	}
    	}
    }
    }
    

     

  13. You need to register your EventHandler to the EventBus.

    Ok, I've done that, and it still does the same thing. Here is the new code:

    Main Class:

     

    @Mod(modid = "modcompat", name="Mod Compatibility Patch", version="1.0.0", acceptedMinecraftVersions = "1.7.2,1.7.10", guiFactory = "the_fireplace.modcompat.config.ModCompatGuiFactory")
    public class ModCompatBase {
    @Instance(value = "modcompat")
            public static ModCompatBase instance;
    public static Configuration config;
            public static Property FIRSTTIME_PROPERTY;
    
    public static void syncConfig() {
    FIRSTTIME_PROPERTY = config.get(Configuration.CATEGORY_GENERAL, ModCompatConfigValues.FIRSTTIME_NAME, ModCompatConfigValues.FIRSTTIME_DEFAULT);
    ModCompatConfigValues.FIRSTTIME = FIRSTTIME_PROPERTY.getBoolean();
    // get other properties here
    if(ModCompatConfigValues.FIRSTTIME) {
    	System.out.println("[ModCompat]Doing one-time scan...");
    	FIRSTTIME_PROPERTY.set(false);
    }
    if (config.hasChanged()) {
                    config.save();
    }
    }
    @EventHandler
    public void PreInit(FMLPreInitializationEvent event){
    //Config code
    config = new Configuration(event.getSuggestedConfigurationFile());
            config.load();
    syncConfig();
    }
    @EventHandler
    public void Init(FMLInitializationEvent event){
    MinecraftForge.EVENT_BUS.register(new ConfigChangedHandler());
    }
    }
    

     

    And the ConfigChangedHandler:

     

    public class ConfigChangedHandler {
    @SubscribeEvent
    public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs) {
       	 System.out.println("[ModCompat]Config Changed");
         if(eventArgs.modID.equals("modcompat")){
            ModCompatBase.syncConfig();
          	 System.out.println("[ModCompat]ModCompat Config Changed");
         }
    }
    }
    

     

    EDIT: Another piece of possibly important information: My config is in a subcategory of the main GUI Config, like the way the Minecraft Forge config GUI is set up.

  14. When I set my config option to true in the Config GUI, it doesn't save the change. I set up a System.out.println("[ModCompat] Code Activated"); in the onConfigChanged code, as shown below, and it doesn't activate after setting the config in the Config GUI.

     

    @Mod(modid = "modcompat", name="Mod Compatibility Patch", version="1.0.0", acceptedMinecraftVersions = "1.7.2,1.7.10", guiFactory = "the_fireplace.modcompat.config.ModCompatGuiFactory")
    public class ModCompatBase {
    @Instance(value = "modcompat")
            public static ModCompatBase instance;
    public static Configuration config;
            public static Property FIRSTTIME_PROPERTY;
    
    public static void syncConfig() {
    FIRSTTIME_PROPERTY = config.get(Configuration.CATEGORY_GENERAL, ModCompatConfigValues.FIRSTTIME_NAME, ModCompatConfigValues.FIRSTTIME_DEFAULT);
    ModCompatConfigValues.FIRSTTIME = FIRSTTIME_PROPERTY.getBoolean();
    // get other properties here
    if(ModCompatConfigValues.FIRSTTIME) {
    	System.out.println("[ModCompat]Doing one-time scan...");
    	FIRSTTIME_PROPERTY.set(false);
    }
    if (config.hasChanged()) {
                    config.save();
    }
    }
    @EventHandler
    public void PreInit(FMLPreInitializationEvent event){
    //Config code
    config = new Configuration(event.getSuggestedConfigurationFile());
            config.load();
    syncConfig();
    }
    
    @SubscribeEvent
    public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs) {
    System.out.println("[ModCompat] Code Activated");
         if(eventArgs.modID.equals("modcompat")){
            syncConfig();
            }
    }
    }
    

     

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.