
kauan99
Members-
Posts
210 -
Joined
-
Last visited
Everything posted by kauan99
-
Which classes in minecraft source are relevant? I want the craft table to have a behaviour identical to the normal one, except it will have an inventory (like a hopper or chest) where the player can put items, and the craft grid will not be cleared after picking up the output recipe, allowing the player to pick as many stacks as can be crafted using the stacks in the crafting table internal chest, all at once. I need to know what classes that are part of the vanilla workbench behaviour I need to change. I'm guessing the block, the tile entity, the Gui and the Container. anything else? Also, if anyone has any tips on how to acomplish this, they are more than welcome to offer them.
-
[1.7.10] How do I draw 2 textures on the same face of a block
kauan99 replied to kauan99's topic in Modder Support
thanks! -
There's something similar to that, but I think it's regarding bone meal only (if bone meal can be used). For some stuff like most vanilla crops it works, but there's no way to be sure how ppl will implement that on their mods. The IGrowable interface should have the method you mentioned. I had to do an ugly hack to achieve what I wanted.
-
I need to draw 2 textures on each face of my block: one that depends on metadata (that I'll call state-texture for the purpose of this post), and another that depends only on the direction of the face (that I'll call stateless-texture). I was thinking maybe there was a way of drawing first the stateless-texture for each face, and then, drawing the state-texture (with parts of it being transparent. Is it possible?) over the other.
-
[1.7.10] How to get an Item given its numeric ID and metadata
kauan99 replied to kauan99's topic in Modder Support
I found a workaround and I won't be needing this afterall. -
Got it. I thought that was optional.
-
That's already there. It's what this line does: minecraft.renderEngine.bindTexture(state ? checkedResLoc : uncheckedResLoc); I just don't understand why the code resizes my textures to the point of being able to fit just part of the upper left corner in a rectangle that has exactly the same size as the textures.
-
Apparently, there are no such controls as check boxes. I'm trying to make my own. My idea is to inherit GuiButton. My main problem at the moment is I don't understand the code of drawButton method. Basically this is what I tried: import org.lwjgl.opengl.GL11; import mod.mymod.main.TheMod; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.util.ResourceLocation; public class GuiCheckBox extends GuiButton { private static final ResourceLocation checkedResLoc = new ResourceLocation(TheMod.MODID + ":" + "textures/gui/checked.png"); private static final ResourceLocation uncheckedResLoc = new ResourceLocation(TheMod.MODID + ":" + "textures/gui/unchecked.png"); private boolean state; public GuiCheckBox(int id, int x, int y, int width, int height) { super(id, x, y, width, height, ""); } public void actionPerformed() { state = !state; } public boolean isChecked() { return state; } @Override /** * Draws this button to the screen. */ public void drawButton(Minecraft minecraft, int x, int y) { if (this.visible) { minecraft.renderEngine.bindTexture(state ? checkedResLoc : uncheckedResLoc); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_BLEND); drawTexturedModalRect(xPosition, yPosition, 0, 0, 12, 12); mouseDragged(minecraft, x, y); } } } What it does is I draw the button, 12x12 (just like it's texture, which is also 12x12) but somehow I draw just a zoomed portion of it. If I draw a much bigger rectangle passing other numers as the last 2 arguments of drawTexturedModalRect I can see my over extended texture. What am I doing wrong? I hate copy-pasting code.
-
Is there something like a drop down list control? (Something like the "Message icon", "Font Face", "Font Size" and "Change Color" controls in this Post Reply GUI). I also need a scrollable list (sometimes known as a ListBox) where I could select one of the elements. A radio button or check box would be nice too.
-
Guys, I'm horrible at GUIs and everything remotely artistic (I got an F in Arts once and since then I'm blocked). I need a GUI example that I can copy. My GUI needs to have TextBoxes and buttons. Only that. Is there an API or something I could download? or an example, I don't know... Thanks.
-
I'm sorry I couldn't test your suggestion yet. As soon as I get my mod to build I will give feedback.
-
This is probably easy, I just can't figure it out on my own. How do I get the item's ID (like "modid:name"), given an Item or ItemStack?
-
[1.7.10] [SOLVED] need a few tips about IExtendedEntityProperties
kauan99 replied to kauan99's topic in Modder Support
that's the essence of the first part my solution, but since I need access to the players inventory to initialize my IEEP, and since that inventory is still null during the EntityConstructing event, that part of the solution alone wasn't enough. bellow is a simplified version of my code. public class EventHandler { @SubscribeEvent public void onEntityConstructing(EntityConstructing event) { if (event.entity instanceof EntityPlayerMP && XServerPlayer.get((EntityPlayerMP) event.entity) == null) { XServerPlayer.register((EntityPlayerMP)event.entity); } else if(event.entity instanceof EntityClientPlayerMP && XClientPlayer.get((EntityClientPlayerMP)event.entity) == null) { XClientPlayer.register((EntityClientPlayerMP) event.entity); } } } public class XServerPlayer //(same code is valid for XClientPlayer) { public static void register(EntityPlayerMP player) { XServerPlayer xPlayer = new XServerPlayer(player); player.registerExtendedProperties("propertyName", xPlayer); //register for the first player tick only FMLCommonHandler.instance().bus().register(xPlayer); } public void onPlayerFirstTick(PlayerTickEvent event) { this.initialize(); //unregister to stop receiving player tick events FMLCommonHandler.instance().bus().unregister(this); } } -
[1.7.10] [SOLVED] need a few tips about IExtendedEntityProperties
kauan99 replied to kauan99's topic in Modder Support
Can I make these two assumptions? 1) while Minecraft client is running during gameplay, it has only one instance of EntityClientPlayerMP , corresponding to the player. 2) for each client connected, there is one corresponding EntityPlayerMP instance in the server, and that instance is disposed off when that client's connection is closed. -
[1.7.10] [SOLVED] need a few tips about IExtendedEntityProperties
kauan99 replied to kauan99's topic in Modder Support
then I will have to use some sort of 2 step initialization of my IExtendedEntityProperties , because I need access to fields from EntityPlayer which of course are all uninitialized during EntityConstructing due to the fact that it is raised from inside Entity.<init> . I will instantiate it during EntityConstructing and will have to initialize it at some point latter. -
[1.7.10] [SOLVED] need a few tips about IExtendedEntityProperties
kauan99 replied to kauan99's topic in Modder Support
thanks. it's very confusing to me because the type hierarchy of EntityPlayer is a bit complex, and the call hierarchy of the methods that instantiate new players is also confusing and undocumented and goes through methods without human friendly names. So I can safely assume a new EntityPlayerMP will only be instantiated when one of these two FML events are raised: 1) PlayerEvent.PlayerLoggedInEvent 2) PlayerEvent.PlayerRespawnEvent what about client side? -
my implementation of IExtendedEntityProperties adds 3 extra equipment slots. I need to know for sure a few things first. I will probably have more questions latter, but I need the answer for these in order to realize the others: when exactly is the EntityConstructing event raised? Does it get raised more than once for each player during a session?
-
Oh I got it now! I use the func_xxx_xx names in all my code and the class will translate them in case I'm in dev environment. I mixed up the meaning of srg and mcp names again... But I should have understood that from reading the class, and if not from that, from the impossiblity to translate from deobfuscated to obfuscated due to possible duplicates
-
wow really cool stuff. Something like that should be into Forge universal, along with the methods and fields tables. Using that class in my case would be overkill, because I would have to ship the tables along with my mod.
-
one last thing: are those mcp tables (fields and methods) available somewhere for mods at runtime?
-
[1.7.10] [SOLVED] how to reference a field added by ASM at compile time?
kauan99 replied to kauan99's topic in Modder Support
Yes, I agree, that's a very good point. I usually end up ignoring a few when coding. In my real code I log those marked as "TODO" in this example. I just didn't want to clutter the solution with anything non essential. I was going to write something similar to your advice in the TODO comment, but I chose that short comment instead for simplicity.