Jump to content

Gigi10012

Members
  • Posts

    19
  • Joined

  • Last visited

Everything posted by Gigi10012

  1. Hi, I Made animals mod for 1.6.2 It works fine on test run but when i created clean 1.6.2 workspace and added my compiled mod to mods folder and it said: cpw.mods.fml.common.LoaderException: java.lang.NoSuchMethodError: cpw.mods.fml.client.registry.RenderingRegistry.registerEntityRenderingHandler(Ljava/lang/Class;Lbgj;)V Why it cant register entity textures?
  2. What am i doing wrong?
  3. I'm using @NetworkMod(clientSideRequired=true, serverSideRequired=false, channels={"mychannel"}, packetHandler = PacketHandler.class) but it didnt work
  4. Ok. i added Gui Handler and changed code. Gui Handler: public class myGuiHandler implements IGuiHandler { //returns an instance of the Container you made earlier @Override public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { if(id == 0) { return new myGui1(player); } else if(id == 1) { return new myGui2(player); } return null; } //returns an instance of the Gui you made earlier @Override public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { if(id == 0) { return new myGui1(player); } else if(id == 1) { return new myGui2(player); } return null; } } on test run it says that mod tried to open gui without being a NetworkMod and on block to open GuiScreen i used: player.openGui(gigsMod.instance, 0, world, x, y, z); i have compiled it and placed it on mcpc-plus server but it gave strange error: at cpw.mods.fml.common.LoadController.transition(LoadController.java:147) at cpw.mods.fml.common.Loader.loadMods(Loader.java:516) at cpw.mods.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:85) at cpw.mods.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:350) at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:94) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:574) at net.minecraft.server.ThreadMinecraftServer.run(SourceFile:573) Caused by: java.lang.NoSuchMethodError: net.minecraft.block.Block.func_94330_A()Ljava/lang/String; at Gigi10012.gigisMod.preInit(gigisMod.java:59) 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 cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:494) 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 com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:192) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:172) 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 com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
  5. so its means its impossible to make block that opens GUI when more than two players are playing ? (i have already made block and GUI but they are working only on test mode) Heres My Code to open GUI: @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float a, float b, float c) { if(player.getCurrentEquippedItem() != null) { Item equipped = player.getCurrentEquippedItem() != null ? player.getCurrentEquippedItem().getItem() : null; Item it123 = Main.myitem; if(equipped.equals(it123)) { ModLoader.openGUI(player, new mygui(player)); } } return true; }
  6. I have created GUI. everything works fine on client but i cant install it on server (I'm using mcpc-plus server http://www.mcportcentral.co.za/)
  7. Hello, I want to Make mod that Adds Block, and When Player will right click it, it will open gui with buttons and textboxes. when player will click one of the buttons mod will execute server command as console. I made Mod that Adds Block but it can only open GUI when player is in singleplayer. when i start mcpc-plus 1.5.2 server it says that it cant find GuiScreen class. i wont my mod to work on server and players were able to place blocks on server, open GUI when they rightclick block and when they will click buttons it will execute server command as console. How to do this?
  8. Hello, I want to Make mod that gets Last Message that was sent to player and mod that forces Player to Execute Command. String s = (EntityPlayer)player.getLastMessage(); (EntityPlayer)player.executeCommand("/help"); How to do this?
  9. You know what is mcpc-plus? mcpc-plus is for forge servers. its like bukkit but on it you can install forge mods. it has plugins and mods folder. (I HAVE ALREADY WROTE THAT BUT NO ONE IS READING!)
  10. Plugin is in plugins folder and my mod is in Mods Folder. Mod Crashes Client when tries to execute plugin method because it cant find Plugin. When i was trying to re-compile mod it was giving errors. so to re-compile i added plugin to libs folder. If it's a public method which is loaded and available in the code, then make an import statment at the top of the file importing the package of the file where the method exitsts, then in the code use the class name and then . and then the method name and fill inn the parameters. Aka. basic java on how to call a specific function inside any kind of API, 3rd party or other code Read My Post. I said that i tried importing it
  11. 1. My Question is About using public method from plugin in my Mod 2. MCPC creates folder Mods - for mods and Plugins - for plugins. If i have mod in Mods Folder how to use plugin that is in plugins folder. I just wrote this code for example public void message() { Bukkit.broadcastMessage(ChatColor.RED + "TEST"); } I tried Adding my plugin to Build Path (External Jars) but when I started server and used test block to execute method client crashed!. So What I have to do in my mod to use that Plugin ? (To Re-Compile Mod i added my plugin jar file in lib folder)
  12. Its not question about Bukkit (its not question about: how to make bukkit plugin.) On forge server i have my plugin. My plugin has public method. So My Question is 'how to use my plugin to execute that method in my forge mod'? More Info: Server is using mcpc-plus-1.5.2-R1.1-forge738-B637.jar
  13. Hello, I created Bukkit Plugin with public method and i want to use it in my mod. I have created Mod but i dont know how to use My Bukkit Plugin Methods in my mod. Example Method: public void message() { Bukkit.broadcastMessage(ChatColor.RED + "TEST"); } How to use hook my mod into my plugin and execute method?
  14. I made Test packet from tutorial to send message but it don't works. here's my code: import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataOutput; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.network.INetworkManager; import net.minecraft.network.packet.Packet250CustomPayload; import cpw.mods.fml.common.network.IPacketHandler; import cpw.mods.fml.common.network.Player; import cpw.mods.fml.relauncher.Side; public class PacketHandler extends Packet { private String text; public PacketHandler(String text) { this.text = text; } public PacketHandler() { } @Override public void write(ByteArrayDataOutput out) { // TODO Auto-generated method stub } @Override public void read(ByteArrayDataInput in) throws ProtocolException { // TODO Auto-generated method stub } @Override public void execute(EntityPlayer player, Side side) throws ProtocolException { if (side.isClient()) { player.addChatMessage(text); } else { throw new ProtocolException("Cannot send this packet to the server!"); } } } mport net.minecraft.entity.player.EntityPlayer; import net.minecraft.network.packet.Packet250CustomPayload; import com.google.common.collect.BiMap; import com.google.common.collect.ImmutableBiMap; import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; import cpw.mods.fml.common.network.PacketDispatcher; import cpw.mods.fml.common.network.Player; import cpw.mods.fml.relauncher.Side; public abstract class Packet { public static final String CHANNEL = "demomod"; private static final BiMap<Integer, Class<? extends Packet>> idMap; static { ImmutableBiMap.Builder<Integer, Class<? extends Packet>> builder = ImmutableBiMap.builder(); builder.put(Integer.valueOf(0), PacketHandler.class); // more packets like this: // builder.put(Integer.valueOf(1), AnotherPacket.class); // builder.put(Integer.valueOf(2), YetAnotherPacket.class); idMap = builder.build(); } public static Packet constructPacket(int packetId) throws ProtocolException, ReflectiveOperationException { Class<? extends Packet> clazz = idMap.get(Integer.valueOf(packetId)); if (clazz == null) { throw new ProtocolException("Unknown Packet Id!"); } else { return clazz.newInstance(); } } public static class ProtocolException extends Exception { public ProtocolException() { } public ProtocolException(String message, Throwable cause) { super(message, cause); } public ProtocolException(String message) { super(message); } public ProtocolException(Throwable cause) { super(cause); } } public final int getPacketId() { if (idMap.inverse().containsKey(getClass())) { return idMap.inverse().get(getClass()).intValue(); } else { throw new RuntimeException("Packet " + getClass().getSimpleName() + " is missing a mapping!"); } } public final Packet250CustomPayload makePacket() { ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeByte(getPacketId()); write(out); return PacketDispatcher.getPacket(CHANNEL, out.toByteArray()); } public abstract void write(ByteArrayDataOutput out); public abstract void read(ByteArrayDataInput in) throws ProtocolException; public abstract void execute(EntityPlayer player, Side side) throws ProtocolException; } and on Gui Button Action I added this: PacketDispatcher.sendPacketToServer(new PacketHandler("Hello World!").makePacket()); But it don't sends message to player. why? Am I doing something wrong? (On Main Mod Class I'm using this: @NetworkMod(clientSideRequired = true, serverSideRequired = false)
  15. I read Packet Handling. this is what I found about sending packets: PacketDispatcher.sendPacketToPlayer(packet, (Player)player); and: package tutorial.generic; import net.minecraft.network.INetworkManager; import net.minecraft.network.packet.Packet250CustomPayload; import cpw.mods.fml.common.network.IPacketHandler; import cpw.mods.fml.common.network.Player; public class PacketHandler implements IPacketHandler { @Override public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player playerEntity) { // TODO Auto-generated method stub } } But what I have to write to send ItemStack to player?
  16. I have GuiScreen class and when player clicks button that method is called
  17. Then how to do this? How to give Item to player?
  18. Hello, I want to give item to player. Here's My Code: public void giveItem(ItemStack stack, EntityPlayer player) { player.inventory.addItemStackToInventory(stack); } When I use this method it gives item to player but if player is in survival gamemode and when player clicks that item it disappears. how to fix this?
×
×
  • Create New...

Important Information

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