Everything posted by TominoCZ
-
[1.7.10]Set NBT Tag for blocks
Do I really have to learn the long code ?
-
[1.7.10]Set NBT Tag for blocks
It's pretty complicated... I made a block that opens a gui. You can click "host game" there.. and now I want to save the name of the player to the block.. and if a player with the same name clicks that blocks, another type of gui opens... I want it cuz I want to reset the host player name after the block breaks(of course when you place a new one, it will reset the value...) And I don't have any TileEntity... I don't even know how to make one....
-
[1.7.10]Set NBT Tag for blocks
Actually no.. I need to set NBT Tag of a block at specific location(I'd use world.getBlock())..
-
[1.7.10]Set NBT Tag for blocks
I can add the tags for players like this: NBTTagCompound tag = player.getEntityData(); tag.setInteger("IsHost", 1); But how can I add such a tag to a block?
-
[1.7.10]Load(and generate) dimension/world from a schematic file
I want to make my mod to generate a dimension from a schematic file and if the dimension is not already in the world folder(not generated)... Is there some kind of easy way of doing that?
-
[1.7.10]Gui rendering repeatively
You're right.. I fixed the problem right before you answered this question.. but thanks alot! I used this.buttonList.Clear();
-
[1.7.10]Gui rendering repeatively
When I click a button in my gui, the sound plays alot of times instead of just once because th e gui is being spawned multiple times. this im my gui class: public class GuiConfirm extends GuiScreen { public boolean doesGuiPauseGame() { return false; } @Override public void drawScreen(int x, int y, float ticks) { this.buttonList.add(new GuiButton(0, this.width / 2 - 90, this.height / 2, 64, 20, I18n.format("Yes", new Object[0]))); this.buttonList.add(new GuiButton(1, this.width / 2 + 20, this.height / 2, 64, 20, I18n.format("No", new Object[0]))); fontRendererObj.drawString("Teleport to the PAYDAY2 Dimension?", this.width / 2 - 90, this.height / 2 - 50, 0x000000); GL11.glColor4f(1, 1, 1, 1); drawDefaultBackground(); super.drawScreen(x, y, ticks); //I know this makes the looping.. but I tried other ways of rendering it once and nothing works.. } @Override protected void actionPerformed(GuiButton button) { if (button.id == 0){ this.mc.displayGuiScreen((GuiScreen) null); this.mc.setIngameFocus(); } if (button.id == 1){ this.mc.displayGuiScreen((GuiScreen) null); this.mc.setIngameFocus(); } } } How can I make the Gui spawn only once?
-
[1.7.10]Gui openable only for one player
Actually nevermind.. I used block replacing...
-
[1.7.10]Gui openable only for one player
Well if I navigate to the BlockContrainer.class in net.minecraft.block then there is nothing like counting players or anything similar. the code itself seems a little too short.
-
[1.7.10]Gui openable only for one player
My GuiLobby class: public class GuiLobby extends GuiScreen{ public boolean doesGuiPauseGame() { return false; } int guiWidth = 256; int guiHeight = 168; @Override public void drawScreen(int x, int y, float ticks){ int guiX = (width - guiWidth) /2 ; int guiY = (height - guiHeight) /2 ; GL11.glColor4f(1, 1, 1, 1); drawDefaultBackground(); mc.renderEngine.bindTexture(new ResourceLocation(Main.MODID + ":" + "textures/gui/Lobby.png")); drawTexturedModalRect(guiX, guiY, 0, 0, guiWidth, guiHeight); fontRendererObj.drawString("CRIME.NET", guiX + 40, guiY + 5, 0x404040); super.drawScreen(x, y, ticks); } } This is what the gui looks like for now by the way... http://s30.postimg.org/v3tnvkze9/2015_09_06_18_19_03.png[/img] So how can I make it that when another player is already in the gui, nobody else can open it(on a LAN/server of course)?
-
[1.7.10]Client crashes when opened GUI on a server[SOLVED!]
GUYS NVM cuz: I removed both @SideOnly in the Main class and tossed everything in the Init method except the registering of the GuiHandler. Then it works even on the server. It was crashing, because the GuiHandler registered only on the server, not the client(that's why I removed the @SideOnly()).
-
[1.7.10]Client crashes when opened GUI on a server[SOLVED!]
Download the log files here: http://www65.zippyshare.com/v/E1qgvxY1/file.html
-
[1.7.10]Client crashes when opened GUI on a server[SOLVED!]
My Block class: public class LobbyBlock extends Block{ public LobbyBlock(Material rock) { super(rock); this.setBlockName("LobbyBlock"); this.setBlockTextureName(Main.MODID + ":" + "0"); this.setCreativeTab(Tabs.CreativeTab); this.setLightLevel(1F); this.setLightOpacity(2555); } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { //player.openGui(Main.instance, 0, world, x, y, z); FMLNetworkHandler.openGui(player, Main.instance, 0, world, x, y, z); return true; } } My GuiHandler class: public class GuiHandler implements IGuiHandler { public GuiHandler (){ } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { if(ID == 0){ return new GuiLobby(); } return null; } @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { // TODO Auto-generated method stub return null; } } My Main class: @Mod(modid = Main.MODID, name = Main.NAME, version = "PreAlpha 0.0.3") public class Main { @Instance(Main.MODID) public static Main instance; public static final String MODID = "PAYDAY2"; public static final String NAME = "PAYDAY 2"; public static final String VERSION = "PreAlpha 0.0.3"; public Main() { } @EventHandler @SideOnly(Side.CLIENT) public void preInit(FMLPreInitializationEvent event) { Blocks.registerBlocks(); Items.registerItems(); Recipes.initShapedRecipes(); Recipes.initShalessRecipes(); } @EventHandler @SideOnly(Side.SERVER) public void Init(FMLInitializationEvent event) { NetworkRegistry.INSTANCE.registerGuiHandler(Main.instance, new GuiHandler()); Blocks.registerBlocks(); Items.registerItems(); Recipes.initShapedRecipes(); Recipes.initShalessRecipes(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { } } Now if I start the Server and the Client, join the server and click the block, the Client crashes. No exact information in the log. Maybe its the GuiHandler.. Maybe the "new GuiLobby();" crashes it... I really don't know. Any ideas why it crashes everytime?
-
[1.7.10] open my custom hud/gui after clicking my custom block[SOLVED]
It works! Now it opens a gui with a text! But now there's an only problem.. it's not compatible with a server.. Do you know how to do that please?
-
[1.7.10] open my custom hud/gui after clicking my custom block[SOLVED]
Well, I haven't found any tutorial about GUI so far. Everything was a different video... If you know, where I could find one, tell me please.
-
[1.7.10] open my custom hud/gui after clicking my custom block[SOLVED]
Ok, thanks for information. I just hope I can make it . Because the block is the main thing.. without it.. you can't do anything in the mod .
-
[1.7.10] open my custom hud/gui after clicking my custom block[SOLVED]
I got this code in my custom block's class file: package com.tominocz.PAYDAY2; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.audio.SoundHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; public class LobbyBlock extends Block{ SoundHandler sh; public LobbyBlock(Material rock) { super(rock); this.setBlockName("LobbyBlock"); this.setBlockTextureName(Main.MODID + ":" + "0"); this.setCreativeTab(Main.PAYDAY2Tab); this.setLightLevel(1F); this.setLightOpacity(2555); } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { if (world.isRemote) { return true; } else { //HERE I WANT THE CODE FOR OPENING MY CUSTOM GUI/HUD System.out.println("clicked"); return false; } } } And I got this in the main class: package com.tominocz.PAYDAY2; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = Main.MODID, version = Main.VERSION) public class Main { public static final String MODID = "PAYDAY2"; public static final String NAME = "PAYDAY 2 RELOADED"; public static final String VERSION = "0.01"; public static CreativeTabs PAYDAY2Tab = new PAYDAY2Tab(MODID); public static Block LobbyBlock = new LobbyBlock(Material.rock); public static Item Logo = new PAYDAY2Logo(); @EventHandler public void preInit(FMLPreInitializationEvent event) { GameRegistry.registerBlock(LobbyBlock, "LobbyBlock"); GameRegistry.registerItem(Logo, "Logo"); } @EventHandler public void Init(FMLInitializationEvent event) { } @EventHandler public void postInit(FMLPostInitializationEvent event) { } } Now I need the code to open my custom gui/hud like when opening a chest or a crafting table.. but I also want to add buttons in there.. Is it possible?
-
[1.7.10] Make my custom block clickable
Ok, I've figured it out this way: public class LobbyBlock extends Block{ public float eyeHeight; public LobbyBlock(Material rock) { super(rock); this.setBlockName("LobbyBlock"); this.setBlockTextureName(Main.MODID + ":" + "0"); this.setCreativeTab(Main.PAYDAY2Tab); this.setLightLevel(1F); this.setLightOpacity(2555); } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { if (world.isRemote) { return true; } else { System.out.println("test"); return true; } } }
-
[1.7.10] Make my custom block clickable
so I add: ..... this.onBlockActivated(); } @Override public void onBlockActivated(){ [action] } to the block's class right? And another question... does it matter if I don't put the "@Override" there?
-
[1.7.10] Make my custom block clickable
I'm making a mod including some custom blocks. Now I need to make them clickable(like chests or workbenches). This is an example of the code of my custom block: public class LobbyBlock extends Block{ public LobbyBlock(Material rock) { super(rock); this.setBlockName("LobbyBlock"); this.setBlockTextureName(Main.MODID + ":" + "0"); this.setCreativeTab(Main.PAYDAY2Tab); this.setLightLevel(1F); this.setLightOpacity(2555); } } And this is the code I currently have in the main class: @Mod(modid = Main.MODID, version = Main.VERSION) public class Main { public static final String MODID = "PAYDAY2"; public static final String NAME = "PAYDAY 2 RELOADED"; public static final String VERSION = "0.01"; public static Block LobbyBlock = new LobbyBlock(Material.rock); @EventHandler public void preInit(FMLPreInitializationEvent event) { GameRegistry.registerBlock(LobbyBlock, "LobbyBlock"); } @EventHandler public void Init(FMLInitializationEvent event) { } @EventHandler public void postInit(FMLPostInitializationEvent event) { } } What should I add to make it do what I want(the clickableness )?
-
[1.8] Draw an image in main menu
Can you make a sample code of this for me please? I am.. not even a beginner.. I just don't understand everything.. Could you do this for me please? The code I mean..
-
[1.8] Draw an image in main menu
I want to have an image showing in the main menu. Now what would the code look like, if I wanted to do such thing? Any ideas(please be specific)?
-
[1.8 MCP] Changing gui scale by a code when pressing a button
Nah. Didn't find anything.
-
[1.8 MCP] Changing gui scale by a code when pressing a button
I want to automatically switch the gui scale to "Auto" when pressing my button. Any Ideas what would the code look like?
-
[1.8] MCP: Disable menu music, play my own custom music in the menu
Use PlaySoundEvent to cancel the main menu music. How?
IPS spam blocked by CleanTalk.