HappyKiller1O1
Members-
Posts
581 -
Joined
-
Last visited
Everything posted by HappyKiller1O1
-
I don't understand what you mean. A player can already break and place blocks.
-
Honestly, almost every metadata item is just a form of the base (logs for example), so I don't see a point in have sub-type sensitivity. I guess it would be good in the case of a mod using meta for every item/block in their mod for some odd reason. How would I go about setting up a json file and doing this? Currently, I have something like this, and it works well for now: package com.happykiller.weightlimit.main.init; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.HashMap; import com.happykiller.weightlimit.main.ModMain; import net.minecraft.item.ItemStack; /** * Sets the weight value of all vanilla items using * the unlocalized name of each item. Other mod items can * be added by simply adding to the text file. * * Note: Will be making it more dynamic with an API * * @author HappyKiller * */ public class WeightValueHandler { /** * Stores weight values of every item. * * @param String Item or Blocks unlocalized name. * @param Float Item or Blocks weight value. */ public static HashMap<String, Float> weightValues = new HashMap<String, Float>(); /** * Sets all weight values read from "WeightValues.txt" */ public static void setWeightValues() { weightValues.clear(); InputStream input = ModMain.class.getResourceAsStream("/assets/wl/utils/WeightValues.txt"); try { BufferedReader buf = new BufferedReader(new InputStreamReader(input)); String weight = null; while((weight = buf.readLine()) != null) { weight = weight.trim(); String[] values = weight.split(":"); weightValues.put(values[0], Float.valueOf(values[1])); System.out.printf("Set %s with weight value of: %s", values[0], values[1]); } }catch(Exception e) { e.printStackTrace(); } } /** * Get's the current weight value, and stack size multiplier for current Item or Block * * @param stack The ItemStack of the Item or Block in question * @return Weight Value of said stack */ public static float getWeightValue(ItemStack stack) { String name = stack.getUnlocalizedName(); int valueMultiplier = stack.stackSize; if(weightValues.containsKey(name)) { System.out.println("Item: " + name + " has a value of: " + weightValues.get(name)); return weightValues.get(name) * valueMultiplier; }else { System.out.println("ERROR: The stack " + name + " is not found in Weight Values!"); } return 0.0F; } } I register the Weight values in my PreInit, and used an item to check if it worked. Anyway, a nice explanation of how to implement a json file for this would be appreciated.
-
@Ernio, @elix - Thank you both very much. My only question now is, what way would be best for server developers? If the mod is on a server, would the config, or json file be only looked up on the server? I ask this because, I do not want clients changing weight values from their config while on a server. Although, I don't know if this is truly possible, because I've never had to deal with it. @coolAlias - I was actually going to change them to floats today for exactly what you're saying, so thank you. Also, would using something like an interface for other mods to implement require an API? I assume so.
-
@LexManos I thought Mojang did.
-
So, with my mod I am adding a Weight Limit. With this, I need to make every item and block have it's own weight. I also would like to make it dynamic, in the sense that other mods items and blocks can be added to this list of items with weight. I have thought of making a text file containing the unlocalized names of items and blocks, with their weight value. This would make it quite easy to add other mod items to the list, and give them weight. The problem I find is, I'm not sure how to create a file for a potential server owner to edit, rather than the client if on a server. So, if I could have a tad bit of help on creating the file for a server owner, if the mod is loaded on one. Or, a completely different, and possible more efficient way of doing this. Please, let me know.
-
[1.8] Trouble with rendering something on the HUD
HappyKiller1O1 replied to HappyKiller1O1's topic in Modder Support
Seems my problem was not using the Post of RenderGameOverlayEvent. Thank you coolAlias! -
[1.8] Trouble with rendering something on the HUD
HappyKiller1O1 replied to HappyKiller1O1's topic in Modder Support
I posted this and realized my mistake then changed it. I'll change the post though as to not confuse. -
Windows honestly will only truly detect updates for an ATI graphics card. That's why it's important to go to the manufacture's website to check for updates.
-
I'm pretty sure this also means he may need to update his processor's graphics. You can simply go to the processor manufacturer's website, and find an update section.
-
[1.8] Trouble with rendering something on the HUD
HappyKiller1O1 replied to HappyKiller1O1's topic in Modder Support
Bump -
[1.7.10] [SOLVED] Having trouble with glTranslateF
HappyKiller1O1 replied to ADonkeyTaboggan's topic in Modder Support
Well, I know normally with OpenGL, if you don't push and pop it the matrix, it will edit other things too. I just tried doing some debugging, and it seems when I check for the HEALTH enum, it only moves the experience bar, like for some reason it's incorrect? Try messaging Erino if he doesn't reply to this post. He is very experienced in GL11, and could help you far more than I could. -
Alright, so I am trying to render some text onto the player HUD. It renders just fine, except the position changes when I go into fullscreen from a windowed screen. Windowed: Fullscreen: Here is where I render it: @SubscribeEvent public void onRenderHUD(RenderGameOverlayEvent event) { Minecraft mc = Minecraft.getMinecraft(); ExtendedPlayer props = ExtendedPlayer.get(mc.thePlayer); if(event.isCancelable() || event.type != ElementType.EXPERIENCE) { return; } int xPos = event.resolution.getScaledWidth() / 2 + 6; int yPos = event.resolution.getScaledHeight() / 2 - 6; mc.fontRendererObj.drawString(I18n.format(props.getCurrentWeight() + "/" + props.getMaxWeight(), new Object[0]), xPos, yPos, (props.isOverEncumbered() ? Color.RED.darker().getRGB() : 4210752)); }
-
[1.7.10] [SOLVED] Having trouble with glTranslateF
HappyKiller1O1 replied to ADonkeyTaboggan's topic in Modder Support
Hm alright, this could be because you're not pushing and popping the matrix. Although, I am not sure considering I have only worked with OpenGl a handful of times. Try this: public void renderGameOverlay(RenderGameOverlayEvent event) { if(event.type == ElementType.EXPERIENCE) { GL11.glPushMatrix(); GL11.glTranslatef(0.0F, (float)(-7), 0.0F); GL11.glPopMatrix(); } else { //GL11.glTranslatef(0.0F, (float)(0), 0.0F); <- There is no need to reset this if you're just editing the Experience bar } } Just trying to give you my knowledge to help. -
[1.7.10] [SOLVED] Having trouble with glTranslateF
HappyKiller1O1 replied to ADonkeyTaboggan's topic in Modder Support
Oh wait, I might be getting this wrong. The problem is that the experience bar and the overlay when in a gui is moving? Or that everything but the experience bar is moving? -
[1.7.10] [SOLVED] Having trouble with glTranslateF
HappyKiller1O1 replied to ADonkeyTaboggan's topic in Modder Support
It seems like it is moving everything BUT the experience bar. Try this: public void renderGameOverlay(RenderGameOverlayEvent event) { if(event.type == ElementType.EXPERIENCE) { GL11.glTranslatef(0.0F, (float)(0), 0.0F); } else { GL11.glTranslatef(0.0F, (float)(-7), 0.0F); } } -
Just look up a tutorial on how to make tools. When you are defining the multitool in your Main mod class, you only pass one parameter when it requires three. You could look through the ItemTool class to see how they use the float, and Set parameter you're missing.
-
[1.7.10] [SOLVED] Move Vanilla GUI Icons?
HappyKiller1O1 replied to Muramasa's topic in Modder Support
No problem! That code is untested though, and unless you change the event to be cancel-able, your game will crash saying "The event can not be canceled". -
[1.7.10] [SOLVED] Move Vanilla GUI Icons?
HappyKiller1O1 replied to Muramasa's topic in Modder Support
I'm pretty sure you can cancel the rendering of certain things (health, experience bar, hunger, etc.) by canceling the render, and re-rendering it where you'd like: @SubscribeEvent public void onRender(RenderGameOverlayEvent event) { if(event.type == ElementType.HEALTH) { event.setResult(Result.DENY); //You could also do "event.setCanceled(true)" but, this event is not Cancelable, and I forgot how to change that //Render it somewhere else } } -
[1.7.10] [SOLVED] Move Vanilla GUI Icons?
HappyKiller1O1 replied to Muramasa's topic in Modder Support
Yes, RenderGameOverlayEvent. -
[1.8] How to stop the player from sprinting?
HappyKiller1O1 replied to HappyKiller1O1's topic in Modder Support
You disable sprint by doing: player.setSprinting(false) within a tick handler. I have to set the state of the KeyBind, in order to stop the player for pressing or holding down CTRL (or whatever they have set it to) to sprint. @coolAlias So, I wasn't able to set the key state via ClientTickEvent (ExtendedPlayer couldn't get the props right). So I just check if it is a client world in #onLivingUpdate, and if so, set the KeyBind as false when OverEncumbered. -
In your MultiTool class your constructor takes three parameters: protected MultiShard(float p_i45333_1_, ToolMaterial p_i45333_2_, Set p_i45333_3_) When you register it, you only add one: multishard = new MultiShard(MultiShard).setUnlocalizedName("multishard").setCreativeTab(MCreativeTabs.tabTools).setTextureName(RefStrings.MODID + ":MultiTool"); You need every parameter in order for it to run.