Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fr.altiscraft.altiscraft.proxy;
- import org.lwjgl.input.Keyboard;
- import cpw.mods.fml.client.FMLClientHandler;
- import cpw.mods.fml.client.registry.ClientRegistry;
- import cpw.mods.fml.client.registry.RenderingRegistry;
- import cpw.mods.fml.common.FMLCommonHandler;
- import cpw.mods.fml.common.eventhandler.SubscribeEvent;
- import cpw.mods.fml.common.gameevent.InputEvent;
- import cpw.mods.fml.common.gameevent.TickEvent;
- import cpw.mods.fml.relauncher.SideOnly;
- import fr.altiscraft.altiscraft.common.GuiCarte;
- import fr.altiscraft.altiscraft.common.GuiCustomMainMenu;
- import fr.altiscraft.altiscraft.common.GuiEchapMenu;
- import fr.altiscraft.altiscraft.common.GuiInv;
- import fr.altiscraft.altiscraft.common.GuiMort;
- import fr.altiscraft.altiscraft.common.TileEntityATM;
- import fr.altiscraft.altiscraft.common.TileEntityBarriereFerme;
- import fr.altiscraft.altiscraft.common.TileEntityBarriereOuverte;
- import fr.altiscraft.altiscraft.common.TileEntityBasket;
- import fr.altiscraft.altiscraft.common.TileEntityChemine;
- import fr.altiscraft.altiscraft.common.TileEntityChemineVide;
- import fr.altiscraft.altiscraft.common.TileEntityCoco;
- import fr.altiscraft.altiscraft.common.TileEntityDrapeau;
- import fr.altiscraft.altiscraft.common.TileEntityLampadaire;
- import fr.altiscraft.altiscraft.common.TileEntityPanneauInterdit;
- import fr.altiscraft.altiscraft.common.TileEntityPanneauSTOP;
- import fr.altiscraft.altiscraft.common.TileEntityPieton;
- import fr.altiscraft.altiscraft.common.TileEntityPoubelle;
- import fr.altiscraft.altiscraft.common.TileEntityVATM;
- import fr.altiscraft.altiscraft.common.TileEntityVLampadaire;
- import fr.altiscraft.altiscraft.common.TileEntityVentilateur;
- import fr.altiscraft.altiscraft.common.TileEntityVolet;
- import net.minecraft.client.Minecraft;
- import net.minecraft.client.audio.PositionedSoundRecord;
- import net.minecraft.client.gui.GuiGameOver;
- import net.minecraft.client.gui.GuiIngameMenu;
- import net.minecraft.client.gui.GuiMainMenu;
- import net.minecraft.client.gui.GuiScreen;
- import net.minecraft.client.gui.GuiScreenServerList;
- import net.minecraft.client.gui.inventory.GuiInventory;
- import net.minecraft.client.settings.GameSettings;
- import net.minecraft.client.settings.KeyBinding;
- import net.minecraft.inventory.Container;
- import net.minecraft.util.ResourceLocation;
- import net.minecraftforge.client.event.GuiScreenEvent;
- import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent;
- public class ClientProxy extends CommonProxy {
- public GuiMainMenu ph;
- public Minecraft mc;
- public GameSettings gameSettings;
- public static int tesrRenderId;
- public static boolean GPS = false;
- public Container thePlayer;
- public static void setGPS(boolean gPS) {
- GPS = gPS;
- }
- public static boolean isGPS() {
- return GPS;
- }
- public void registerRender() {
- FMLCommonHandler.instance().bus().register(this);
- System.out.println("Méthode côté client");
- ClientRegistry.registerKeyBinding(keyBindInv);
- ClientRegistry.registerKeyBinding(keyBindCarte);
- ClientRegistry.registerKeyBinding(keyBindGPS);
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityATM.class, new TileEntityATMSpecialRenderer());
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityVentilateur.class, new TileEntityVentilateurSpecialRenderer());
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityVATM.class, new TileEntityVATMSpecialRenderer());
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCoco.class, new TileEntityCocoSpecialRenderer());
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLampadaire.class, new TileEntityLampadaireSpecialRenderer());
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityVLampadaire.class, new TileEntityVLampadaireSpecialRenderer());
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPoubelle.class, new TileEntityPoubelleSpecialRenderer());
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBarriereFerme.class, new TileEntityBarriereFermeSpecialRenderer());
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBarriereOuverte.class, new TileEntityBarriereOuverteSpecialRenderer());
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPanneauSTOP.class, new TileEntityPanneauSTOPSpecialRenderer());
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPanneauInterdit.class, new TileEntityPanneauInterditSpecialRenderer());
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBasket.class, new TileEntityBasketSpecialRenderer());
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPieton.class, new TileEntityPietonSpecialRenderer());
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDrapeau.class, new TileEntityDrapeauSpecialRenderer());
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityVolet.class, new TileEntityVoletSpecialRenderer());
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityChemine.class, new TileEntityChemineSpecialRenderer());
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityChemineVide.class, new TileEntityChemineVideSpecialRenderer());
- tesrRenderId = RenderingRegistry.getNextAvailableRenderId();
- RenderingRegistry.registerBlockHandler(new TESRInventoryRenderer());
- }
- private static KeyBinding keyBindInv = new KeyBinding("Inventaire d'AltisCraft", 21, "key.categories.inventory");
- private static KeyBinding keyBindCarte = new KeyBinding("Carte", 50, "key.categories.inventory");
- private static KeyBinding keyBindGPS = new KeyBinding("GPS", Keyboard.KEY_G, "key.categories.inventory");
- @SubscribeEvent @SideOnly(cpw.mods.fml.relauncher.Side.CLIENT) public void onTickGuiMainMenu(TickEvent.ClientTickEvent event) {Minecraft mc = FMLClientHandler.instance().getClient();GuiScreen currentScreen = mc.currentScreen;if ((mc.currentScreen != null) && (mc.currentScreen.getClass().equals(GuiMainMenu.class))){mc.displayGuiScreen(new GuiCustomMainMenu());}}
- @SubscribeEvent @SideOnly(cpw.mods.fml.relauncher.Side.CLIENT) public void onTickGuiF3(TickEvent.ClientTickEvent event) {Minecraft mc = FMLClientHandler.instance().getClient();GuiScreen currentScreen = mc.currentScreen;if ((mc.currentScreen != null) && (mc.currentScreen.getClass().equals(GuiIngameMenu.class))){mc.displayGuiScreen(new GuiEchapMenu());}}
- @SubscribeEvent @SideOnly(cpw.mods.fml.relauncher.Side.CLIENT) public void onTickGuiEchap(TickEvent.ClientTickEvent event) {Minecraft mc = FMLClientHandler.instance().getClient();GuiScreen currentScreen = mc.currentScreen;if ((mc.currentScreen != null) && (mc.currentScreen.getClass().equals(GuiGameOver.class))){mc.displayGuiScreen(new GuiMort());}}
- @SubscribeEvent @SideOnly(cpw.mods.fml.relauncher.Side.CLIENT) public void onTickInv(TickEvent.ClientTickEvent event) {Minecraft mc = FMLClientHandler.instance().getClient();GuiScreen currentScreen = mc.currentScreen;if ((mc.currentScreen != null) && (mc.currentScreen.getClass().equals(GuiInventory.class))) {Minecraft.getMinecraft().displayGuiScreen(new GuiInv());}}
- @SubscribeEvent
- public void onInv(InputEvent.KeyInputEvent event) {
- if (keyBindInv.isPressed()) {
- keyInvTyped();
- }
- }
- @SubscribeEvent
- public void initGuiScreenServerListEvent(InitGuiEvent.Post event) {
- if(event.gui instanceof GuiScreenServerList)
- {
- event.setCanceled(true);
- }
- }
- @SubscribeEvent
- public void onCarte(InputEvent.KeyInputEvent event) {
- if (keyBindCarte.isPressed()) {
- keyCarteTyped();
- }
- }
- @SubscribeEvent
- public void onGPS(InputEvent.KeyInputEvent event) {
- if (keyBindGPS.isPressed()) {
- keyGPSTyped();
- }
- }
- private void keyInvTyped() {
- Minecraft.getMinecraft().displayGuiScreen(new GuiInv());
- Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
- }
- private void keyGPSTyped() {
- if(this.isGPS())
- {
- this.setGPS(false);
- }
- else
- {
- this.setGPS(true);
- }
- }
- private void keyCarteTyped() {
- Minecraft.getMinecraft().displayGuiScreen(new GuiCarte());
- Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
- }
- public void GuiScreenEvent(GuiScreenEvent event){
- if(event.gui instanceof GuiInventory){
- event.setCanceled(true);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement