Failender
Forge Modder-
Posts
1091 -
Joined
-
Last visited
Everything posted by Failender
-
Sorry I guess my post wasnt that clear. I am triing to show a title (the new function that came with 1.8 ( https://pbs.twimg.com/media/Bnbf3cCIgAEcUP_.png ) I got a block with a tileentity, and if the block is getting destroyed I want to show a title (like you lost) to the owner.
-
1. Are you registering your tileentity? 2. Show your creation of the tileentity
-
I am triing to show a title for an entityPlayer. unfortunately I was unable to find a function that could help me to archieve what I want.. Any one here that knows how this could be done? Greetz Failender
-
[1.7.10] item consume not happening until after logout?
Failender replied to ArtisanGaming's topic in Modder Support
If you want to consume the item you should at one point check if the !world.isRemote Otherway it might happen that ure only triing to consume on the client side. Which is not necessary because the client gets told by the server -
[1.8] custom gui with textured buttons and scrollpanes
Failender replied to Failender's topic in Modder Support
Thank you that worked perfectly. Now you got an idea with the scrollable gui? Like paint a 1000x1000 gui on a 500x500 gui and then scroll around it? -
Hello everyone, I'm working on creating an own GUI. For this I want two things. 1. Buttons with textures (like of items or sth like that) 2. That the user can scroll around in the gui (like in thaumcraft morellonomicon) To the first. I overwrote the GuiButton and the drawButton method. But unfortunally I'm not sure which String I need to feed it at for mc.getTextureManager().bindTexture(new ResourceLocation(location)); to bind the correct texture Thank you for the help Failender public class TextureButton extends GuiButton{ private String location; public TextureButton(int buttonId, int x, int y, int widthIn, int heightIn, String location) { super(buttonId, x, y, widthIn, heightIn, ""); this.width = 200; this.height = 20; this.enabled = true; this.visible = true; this.id = buttonId; this.xPosition = x; this.yPosition = y; this.width = widthIn; this.height = heightIn; this.displayString = ""; this.location = location; } public void drawButton(Minecraft mc, int mouseX, int mouseY) { if (this.visible) { FontRenderer fontrenderer = mc.fontRendererObj; mc.getTextureManager().bindTexture(new ResourceLocation(location)); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; int k = this.getHoverState(this.hovered); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.blendFunc(770, 771); this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + k * 20, this.width / 2, this.height); this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + k * 20, this.width / 2, this.height); this.mouseDragged(mc, mouseX, mouseY); int l = 14737632; if (packedFGColour != 0) { l = packedFGColour; } else if (!this.enabled) { l = 10526880; } else if (this.hovered) { l = 16777120; } this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - / 2, l); } } Thank you for your help, Failender
-
[1.8][SOLVED] Custom Attribute/Attribute Modifier Help
Failender replied to NovaViper's topic in Modder Support
You cant just add another variable to the method. I would highly recommend you to learn more about java and how it works. For now. I guess you want to reduce the damage taken from an explosion if the affected entity is an EntityMetalZertum. The event got the event.entity . You can check if the entity is an instance of EntityMetalZertum and if it is an EntityMetalZertum you can cast it to one and then get the blastResist from it. -
[1.8][SOLVED] Custom Attribute/Attribute Modifier Help
Failender replied to NovaViper's topic in Modder Support
1. You need to initialize the entity (In this case EntityMetalZertum) before using it or youll get a nullpointerexception 2. You can cast a float to a double if needed -
[1.8][SOLVED] Custom Attribute/Attribute Modifier Help
Failender replied to NovaViper's topic in Modder Support
You got to check if the damage type is an explosion. Which is done. After you found that out you might want to access the value of the damage taken, which is event.ammount. This variable is the ammount of damage the player would take. -
Well. You cant just create a world generator and expect it to work. You need to tell Forge that you create one and that it should use it. I guess MinecraftForge.TERRAIN_GEN_BUS should be what you are looking for. But I need to say that I'm not sure. I never worked with Terrain generating. So I might be wrong. Just triing to give u some hints what to look for
-
[1.8][SOLVED] Custom Attribute/Attribute Modifier Help
Failender replied to NovaViper's topic in Modder Support
I'm not sure what you are asking for you? You already got the solution. If you aren't just test it. -
[1.8][SOLVED] Custom Attribute/Attribute Modifier Help
Failender replied to NovaViper's topic in Modder Support
check out event.ammount -
Nevermind i found it
-
It seemed to be working. But it seems like there is an error when he tries to safe the String owner. Any Ideas? [03:52:13] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:568]: #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2015-02-23_03.52.13-server.txt [03:52:13] [Client thread/INFO] [FML]: Waiting for the server to terminate/save. [03:52:13] [server thread/ERROR] [FML]: A TileEntity type de.failender.challengemod.tileentities.TileEntityResearch has throw an exception trying to write state. It will not persist. Report this to the mod author java.lang.IllegalArgumentException: Empty string not allowed at net.minecraft.nbt.NBTTagString.<init>(NBTTagString.java:23) ~[NBTTagString.class:?] at net.minecraft.nbt.NBTTagCompound.setString(NBTTagCompound.java:105) ~[NBTTagCompound.class:?] at de.failender.challengemod.tileentities.TileEntityResearch.writeToNBT(TileEntityResearch.java:33) ~[TileEntityResearch.class:?] at net.minecraft.world.chunk.storage.AnvilChunkLoader.writeChunkToNBT(AnvilChunkLoader.java:382) [AnvilChunkLoader.class:?] at net.minecraft.world.chunk.storage.AnvilChunkLoader.saveChunk(AnvilChunkLoader.java:183) [AnvilChunkLoader.class:?] at net.minecraft.world.gen.ChunkProviderServer.saveChunkData(ChunkProviderServer.java:246) [ChunkProviderServer.class:?] at net.minecraft.world.gen.ChunkProviderServer.saveChunks(ChunkProviderServer.java:305) [ChunkProviderServer.class:?] at net.minecraft.world.WorldServer.saveAllChunks(WorldServer.java:938) [WorldServer.class:?] at net.minecraft.server.MinecraftServer.saveAllWorlds(MinecraftServer.java:363) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.stopServer(MinecraftServer.java:395) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.stopServer(IntegratedServer.java:328) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:531) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:745) [?:1.7.0_55]
-
Just one more question so I'll get it right. The method u showed me sends the nbt package, which is server sided, to the client. Is this method called everytime the client tries to read the nbt of that tileentity?
-
Perfect. It works now. Thank you very much!
-
I create my own tileentity. Right now its only use is to safe its owner and return it The Problem is, that even if the setOwner method is called correctly and the String seems to be set properly, the TileEntity is ALWAYS returning null and I have no idea why I guess im missing one little part that is ruining it, but I cant find it [02:10:57] [server thread/INFO] [sTDOUT]: [de.failender.challengemod.blocks.ResearchCenter:onBlockActivated:48]: null public class TileEntityResearch extends TileEntity{ private String owner; public void setOwner(String owner) { this.owner = owner; } public String getOwner() { return owner; } @Override public void readFromNBT(NBTTagCompound compound) { compound.getString("rc"); super.readFromNBT(compound); } @Override public void writeToNBT(NBTTagCompound compound) { compound.setString("rc", owner); super.writeToNBT(compound); } I registered my tileentity like so GameRegistry.registerTileEntity(TileEntityResearch.class, "researchcenterentity"); And created my own block using the TileEntitiy public class ResearchCenter extends Block{ public ResearchCenter() { super(Material.rock); setCreativeTab(CreativeTabs.tabTools); } @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { if (!worldIn.isRemote) { TileEntityResearch rc = (TileEntityResearch) worldIn.getTileEntity(pos); rc.setOwner(placer.getName()); } super.onBlockPlacedBy(worldIn, pos, state, placer, stack); } @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) { if (!worldIn.isRemote) { TileEntityResearch rc = (TileEntityResearch) worldIn.getTileEntity(pos); System.out.println(rc.getOwner()); } return super.onBlockActivated(worldIn, pos, state, playerIn, side, hitX, hitY, hitZ); } @Override public boolean hasTileEntity(IBlockState state) { return true; } @Override public TileEntity createTileEntity(World world, IBlockState state) { // TODO Auto-generated method stub return new TileEntityResearch(); } }
-
This is your 3rd post in 24h asking this. 1. Stop spamming posts 2. Look at your other post. You already got an answer.
-
[1.8] Updated block, not rendering texture when placed
Failender replied to arie2002's topic in Modder Support
I had the same problem. My solution was to DONT use BlockContainer, since they are somehow weird. The alternative to BlockContainer was to extend Block and override the methods hasTileEntity and createNewTileEntity -
How to get the EntityPlayerMP from the command sender
Failender replied to AyyyyLmao's topic in Modder Support
I need to get to get the EntityClientPlayerMP, but i cant cast it to EntityPlayerMP .-. java.lang.ClassCastException: net.minecraft.client.entity.EntityClientPlayerMP cannot be cast to net.minecraft.entity.player.EntityPlayerMP If you are creating a command the /execute method will give u a ICommandSender. make a if statement if this is instanceof EntityPlayerMP. If it is an instanceof EntityPlayerMP you can cast it to one and use it how you wish. This method works, I'm actually using it in my own mod. -
How to get the EntityPlayerMP from the command sender
Failender replied to AyyyyLmao's topic in Modder Support
There are 2 types of icommand sender. player and console. so check if the sender is an instance of player and if it is an player cast it to entityplayermp -
For 3. That is kinda easy. Just use a loop where u count one variable and then check at new Blockpos(x+counter,y,z) (or z if u want to go in a different direction
-
works excellent. thank you again diesieben007. also fixxed some other strange bugs i had with tileentities!
-
How to get the EntityPlayerMP from the command sender
Failender replied to AyyyyLmao's topic in Modder Support
Reworked my message, sorry larsgerrits you're right. You have to do two things Lmao. 1. check if sender is an instance of player 2. if it is an instance of player cast it to EntityPlayerMP