Jump to content

[SOLVED][1.8]Keybindings crash server


blfngl

Recommended Posts

Hey, I've been searching for a solution for a few days now but haven't been able to find anything that fixes my problem. My keybindings crash the server version of the mod, and setting them up in my client proxy doesn't seem to fix it. Help?

 

Client Proxy:

package blfngl.fallout.proxy;

import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelSpider;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.eventhandler.EventBus;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import blfngl.fallout.Fallout;
import blfngl.fallout.entity.EntityAnt;
import blfngl.fallout.entity.EntityFeralGhoul;
import blfngl.fallout.entity.EntityGhoulReaver;
import blfngl.fallout.entity.EntityGhoulRoamer;
import blfngl.fallout.entity.projectile.EntityGrenade;
import blfngl.fallout.gui.GuiRadBar;
import blfngl.fallout.render.RenderAnt;
import blfngl.fallout.render.RenderFeralGhoul;
import blfngl.fallout.render.RenderGhoulReaver;
import blfngl.fallout.render.RenderGhoulRoamer;
import blfngl.fallout.util.FalloutKeyBinding;

public class ClientProxy extends CommonProxy
{
@Override
@SideOnly(Side.CLIENT)
public void initRender()
{
	EventBus eventBus = FMLCommonHandler.instance().bus();
	eventBus.register(new FalloutKeyBinding());

	//FMLCommonHandler.instance().bus().register(new KeyInputHandler());

	MinecraftForge.EVENT_BUS.register(new GuiRadBar(Minecraft.getMinecraft()));
	RenderingRegistry.registerEntityRenderingHandler(EntityGrenade.class, new RenderSnowball(Minecraft.getMinecraft().getRenderManager(), Fallout.grenade, Minecraft.getMinecraft().getRenderItem()));

	RenderingRegistry.registerEntityRenderingHandler(EntityFeralGhoul.class, new RenderFeralGhoul(Minecraft.getMinecraft().getRenderManager(), new ModelBiped(), 0.5F));
	RenderingRegistry.registerEntityRenderingHandler(EntityGhoulRoamer.class, new RenderGhoulRoamer(Minecraft.getMinecraft().getRenderManager(), new ModelBiped(), 0.5F));
	RenderingRegistry.registerEntityRenderingHandler(EntityGhoulReaver.class, new RenderGhoulReaver(Minecraft.getMinecraft().getRenderManager(), new ModelBiped(), 0.5F));
	RenderingRegistry.registerEntityRenderingHandler(EntityAnt.class, new RenderAnt(Minecraft.getMinecraft().getRenderManager(), new ModelSpider(), 0.5F));

	/**RenderingRegistry.registerEntityRenderingHandler(EntityBullet.class, new RenderSnowball(Fallout.emptySyringe));
	LanguageRegistry.instance().addStringLocalization("entity.bullet.fallout.name", "fallout");

	RenderingRegistry.registerEntityRenderingHandler(EntityMissile.class, new RenderSnowball(Fallout.emptySyringe));
	LanguageRegistry.instance().addStringLocalization("entity.rocket.fallout.name", "fallout");

	RenderingRegistry.registerEntityRenderingHandler(EntityLaser.class, new RenderSnowball(Fallout.emptySyringe));
	LanguageRegistry.instance().addStringLocalization("entity.missile.fallout.name", "fallout");

	RenderingRegistry.registerEntityRenderingHandler(EntityPellet.class, new RenderSnowball(Fallout.emptySyringe));
	LanguageRegistry.instance().addStringLocalization("entity.pellet.fallout.name", "fallout");

	RenderingRegistry.registerEntityRenderingHandler(EntitySpear.class, new RenderSnowball(Items.arrow));
	LanguageRegistry.instance().addStringLocalization("entity.spear.fallout.name", "fallout");

	RenderingRegistry.registerEntityRenderingHandler(EntityPlasma.class, new RenderSnowball(Items.slime_ball));*/
}
}

 

 

FalloutKeyBinding:

package blfngl.fallout.util;

import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import org.lwjgl.input.Keyboard;

import blfngl.fallout.player.FalloutPlayer;

public class FalloutKeyBinding
{
public static int keyReload = Keyboard.KEY_R;

@SideOnly(Side.CLIENT)
public KeyBinding reloadKey = new KeyBinding("Reload", keyReload, "key.categories.fallout");

public FalloutKeyBinding()
{
	ClientRegistry.registerKeyBinding(reloadKey);
}

@SubscribeEvent
@SideOnly(Side.CLIENT)
public void KeyInputEvent(KeyInputEvent event)
{
	EntityPlayer player = Minecraft.getMinecraft().thePlayer;

	if (reloadKey.isKeyDown())
	{
		FalloutPlayer props = FalloutPlayer.get(player);
		props.setReloadingState(1);
		System.out.println(player.getName() + " is reloading!");
	}
}
}

 

 

I also register my client proxy in the event bus within the preInit method of my main file.

 

preInit()

@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
	System.out.println("Blfngl's Fallout mod loading...");

	FMLCommonHandler.instance().bus().register(new FalloutConfig());
	config = new Configuration(event.getSuggestedConfigurationFile());
	config.load();
	FalloutConfig.syncConfig();
	FalloutConfig.createModInfo(event);

	ChemEffectHandler.init();

	MinecraftForge.EVENT_BUS.register(new FalloutEventHandler());
	MinecraftForge.EVENT_BUS.register(new VanillaBlockDrops());
	FMLCommonHandler.instance().bus().register(new FalloutEventHandler());
	FMLCommonHandler.instance().bus().register(new VanillaBlockDrops());

	FMLCommonHandler.instance().bus().register(new ClientProxy());
	Entities.init();
}

 

Link to comment
Share on other sites

You can ONLY ever access client input (keyboard, mouse, etc.) on the CLIENT side - ANY attempt to do so on the server, i.e. when the world is not remote, will crash your game.

 

This includes things like inline initializations:

@SideOnly(Side.CLIENT)
public KeyBinding reloadKey = new KeyBinding("Reload", keyReload, "key.categories.fallout");

It doesn't matter that you put @SideOnly there, because that can only remove the reference, but you also try to assign it and that part is not removed, thus it crashes.

 

You CAN, however, put the @SideOnly annotation above your entire KeyBinding class, and that's what you should do, as well as make sure you only ever reference it on the client side.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Let me try and help you with love spells, traditional healing, native healing, fortune telling, witchcraft, psychic readings, black magic, voodoo, herbalist healing, or any other service your may desire within the realm of african native healing, the spirits and the ancestors. I am a sangoma and healer. I could help you to connect with the ancestors , interpret dreams, diagnose illness through divination with bones, and help you heal both physical and spiritual illness. We facilitate the deepening of your relationship to the spirit world and the ancestors. Working in partnership with one\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’s ancestors is a gift representing a close link with the spirit realm as a mediator between the worlds.*   Witchdoctors, or sorcerers, are often purveyors of mutis and charms that cause harm to people. we believe that we are here for only one purpose, to heal through love and compassion.*   African people share a common understanding of the importance of ancestors in daily life. When they have lost touch with their ancestors, illness may result or bad luck. Then a traditional healer, or sangoma, is sought out who may prescribe herbs, changes in lifestyle, a career change, or changes in relationships. The client may also be told to perform a ceremony or purification ritual to appease the ancestors.*   Let us solve your problems using powerful African traditional methods. We believe that our ancestors and spirits give us enlightenment, wisdom, divine guidance, enabling us to overcome obstacles holding your life back. Our knowledge has been passed down through centuries, being refined along the way from generation to generation. We believe in the occult, the paranormal, the spirit world, the mystic world.*   The services here are based on the African Tradition Value system/religion,where we believe the ancestors and spirits play a very important role in society. The ancestors and spirits give guidance and counsel in society. They could enable us to see into the future and give solutions to the problems affecting us. We use rituals, divination, spells, chants and prayers to enable us tackle the task before us.*   I have experience in helping and guiding many people from all over the world. My psychic abilities may help you answer and resolve many unanswered questions
    • Let me try and help you with love spells, traditional healing, native healing, fortune telling, witchcraft, psychic readings, black magic, voodoo, herbalist healing, or any other service your may desire within the realm of african native healing, the spirits and the ancestors. I am a sangoma and healer. I could help you to connect with the ancestors , interpret dreams, diagnose illness through divination with bones, and help you heal both physical and spiritual illness. We facilitate the deepening of your relationship to the spirit world and the ancestors. Working in partnership with one\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’s ancestors is a gift representing a close link with the spirit realm as a mediator between the worlds.*   Witchdoctors, or sorcerers, are often purveyors of mutis and charms that cause harm to people. we believe that we are here for only one purpose, to heal through love and compassion.*   African people share a common understanding of the importance of ancestors in daily life. When they have lost touch with their ancestors, illness may result or bad luck. Then a traditional healer, or sangoma, is sought out who may prescribe herbs, changes in lifestyle, a career change, or changes in relationships. The client may also be told to perform a ceremony or purification ritual to appease the ancestors.*   Let us solve your problems using powerful African traditional methods. We believe that our ancestors and spirits give us enlightenment, wisdom, divine guidance, enabling us to overcome obstacles holding your life back. Our knowledge has been passed down through centuries, being refined along the way from generation to generation. We believe in the occult, the paranormal, the spirit world, the mystic world.*   The services here are based on the African Tradition Value system/religion,where we believe the ancestors and spirits play a very important role in society. The ancestors and spirits give guidance and counsel in society. They could enable us to see into the future and give solutions to the problems affecting us. We use rituals, divination, spells, chants and prayers to enable us tackle the task before us.*   I have experience in helping and guiding many people from all over the world. My psychic abilities may help you answer and resolve many unanswered questions
    • Let me try and help you with love spells, traditional healing, native healing, fortune telling, witchcraft, psychic readings, black magic, voodoo, herbalist healing, or any other service your may desire within the realm of african native healing, the spirits and the ancestors. I am a sangoma and healer. I could help you to connect with the ancestors , interpret dreams, diagnose illness through divination with bones, and help you heal both physical and spiritual illness. We facilitate the deepening of your relationship to the spirit world and the ancestors. Working in partnership with one\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’s ancestors is a gift representing a close link with the spirit realm as a mediator between the worlds.*   Witchdoctors, or sorcerers, are often purveyors of mutis and charms that cause harm to people. we believe that we are here for only one purpose, to heal through love and compassion.*   African people share a common understanding of the importance of ancestors in daily life. When they have lost touch with their ancestors, illness may result or bad luck. Then a traditional healer, or sangoma, is sought out who may prescribe herbs, changes in lifestyle, a career change, or changes in relationships. The client may also be told to perform a ceremony or purification ritual to appease the ancestors.*   Let us solve your problems using powerful African traditional methods. We believe that our ancestors and spirits give us enlightenment, wisdom, divine guidance, enabling us to overcome obstacles holding your life back. Our knowledge has been passed down through centuries, being refined along the way from generation to generation. We believe in the occult, the paranormal, the spirit world, the mystic world.*   The services here are based on the African Tradition Value system/religion,where we believe the ancestors and spirits play a very important role in society. The ancestors and spirits give guidance and counsel in society. They could enable us to see into the future and give solutions to the problems affecting us. We use rituals, divination, spells, chants and prayers to enable us tackle the task before us.*   I have experience in helping and guiding many people from all over the world. My psychic abilities may help you answer and resolve many unanswered questions
    • Let me try and help you with love spells, traditional healing, native healing, fortune telling, witchcraft, psychic readings, black magic, voodoo, herbalist healing, or any other service your may desire within the realm of african native healing, the spirits and the ancestors. I am a sangoma and healer. I could help you to connect with the ancestors , interpret dreams, diagnose illness through divination with bones, and help you heal both physical and spiritual illness. We facilitate the deepening of your relationship to the spirit world and the ancestors. Working in partnership with one\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’s ancestors is a gift representing a close link with the spirit realm as a mediator between the worlds.*   Witchdoctors, or sorcerers, are often purveyors of mutis and charms that cause harm to people. we believe that we are here for only one purpose, to heal through love and compassion.*   African people share a common understanding of the importance of ancestors in daily life. When they have lost touch with their ancestors, illness may result or bad luck. Then a traditional healer, or sangoma, is sought out who may prescribe herbs, changes in lifestyle, a career change, or changes in relationships. The client may also be told to perform a ceremony or purification ritual to appease the ancestors.*   Let us solve your problems using powerful African traditional methods. We believe that our ancestors and spirits give us enlightenment, wisdom, divine guidance, enabling us to overcome obstacles holding your life back. Our knowledge has been passed down through centuries, being refined along the way from generation to generation. We believe in the occult, the paranormal, the spirit world, the mystic world.*   The services here are based on the African Tradition Value system/religion,where we believe the ancestors and spirits play a very important role in society. The ancestors and spirits give guidance and counsel in society. They could enable us to see into the future and give solutions to the problems affecting us. We use rituals, divination, spells, chants and prayers to enable us tackle the task before us.*   I have experience in helping and guiding many people from all over the world. My psychic abilities may help you answer and resolve many unanswered questions
    • Let me try and help you with love spells, traditional healing, native healing, fortune telling, witchcraft, psychic readings, black magic, voodoo, herbalist healing, or any other service your may desire within the realm of african native healing, the spirits and the ancestors. I am a sangoma and healer. I could help you to connect with the ancestors , interpret dreams, diagnose illness through divination with bones, and help you heal both physical and spiritual illness. We facilitate the deepening of your relationship to the spirit world and the ancestors. Working in partnership with one\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’s ancestors is a gift representing a close link with the spirit realm as a mediator between the worlds.*   Witchdoctors, or sorcerers, are often purveyors of mutis and charms that cause harm to people. we believe that we are here for only one purpose, to heal through love and compassion.*   African people share a common understanding of the importance of ancestors in daily life. When they have lost touch with their ancestors, illness may result or bad luck. Then a traditional healer, or sangoma, is sought out who may prescribe herbs, changes in lifestyle, a career change, or changes in relationships. The client may also be told to perform a ceremony or purification ritual to appease the ancestors.*   Let us solve your problems using powerful African traditional methods. We believe that our ancestors and spirits give us enlightenment, wisdom, divine guidance, enabling us to overcome obstacles holding your life back. Our knowledge has been passed down through centuries, being refined along the way from generation to generation. We believe in the occult, the paranormal, the spirit world, the mystic world.*   The services here are based on the African Tradition Value system/religion,where we believe the ancestors and spirits play a very important role in society. The ancestors and spirits give guidance and counsel in society. They could enable us to see into the future and give solutions to the problems affecting us. We use rituals, divination, spells, chants and prayers to enable us tackle the task before us.*   I have experience in helping and guiding many people from all over the world. My psychic abilities may help you answer and resolve many unanswered questions
  • Topics

×
×
  • Create New...

Important Information

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