Jump to content

SHsuperCM

Members
  • Posts

    264
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by SHsuperCM

  1. Its not a TESR, it uses the MODEL enum type..
  2. Soo.. Might sound really stupid but I need help with this... I got 0 expirience with rendering, almost no expirience with TileEntities and I dont know even where to start..... I want to render the book from the enchantment table on my block, I dont know if I need it to be a tile entity or that stuff so I came here like any one who struggles with forge.. It should also be noted that I want the book to have a diffrent texture.... TNX for anyone willing to help!
  3. I said it is only called from client proxy. This is only called to make special types of items, I dont want to add 10 items and get them in a tab and I dont want to make 10 items and not get them in a tab, This is an automatic way to do special things to items using the enum constructor Calling for an item using its registry name and adding a getItem() really isnt that bad for the nothing you do to add the item.. it wont change much at all... You're right! LOCKED
  4. Really from my POV its a flawless system.. I dont get any errors and everything works fine in server/Lan/singleplayer....
  5. registerRenders() occurs only on the client proxy, not the server proxy...
  6. It works fine! I can get items place em and see them with /say @e[type=Item]
  7. I really dont understand what you mean... Im opening a server now...
  8. Also, Thanks for showing me this project! it has alot of usefull stuff!
  9. I've managed to make it even smaller text/item ratio! public class ModItems{ public static enum ModItemsEnum{ this_is_test(0) ,registry_name_here(0) ,this_is_also_the_unlocalized_name(0) ; private Item item; ModItemsEnum(Item INitem, int INspecial){ //Special ItemClass this.item = INitem; this.item.setUnlocalizedName(this.name()); this.item.setRegistryName(this.name()); if(INspecial == 0) this.item.setCreativeTab(Main.modCreativeTab); } ModItemsEnum(int INspecial){ //Normal Classless Items this(new Item(),INspecial); } public Item getItem(){ return this.item; } } public static boolean registerItems(){ try{ for(ModItemsEnum item : ModItemsEnum.values()){ GameRegistry.register(item.getItem()); } }catch(Exception e){ return false; } return true; } public static boolean registerRenders(){ try { for (ModItemsEnum item : ModItemsEnum.values()) { ModelLoader.setCustomModelResourceLocation(item.getItem(), 0, new ModelResourceLocation(item.getItem().getRegistryName(), "inventory")); } }catch(Exception e){ return false; } return true; } } Figured: why the H would I even need a diffrent string for the unlocalized name.. So its just the same! Thought I'd share... Dont really have a reason...
  10. That I know, I was giving an example.. I understand that registrynames are unchangeable because it would destroy items in the world if I do change.. But I have very spesific things in my mind that I know that will not change from time to time at all because the registry name is also how I get the actuall item objects(The registryname will be set to the object instance name "ish") So when I call items I will have to change it aswell so I know it wont change..... Sry for anyone who had to read that.. Me words bad no knows explain So I'm getting that I can do this anyways... Thanks!
  11. Any reason to not make: test_item_registry_name also be the unlocalized name? a.k.a: item.test_item_registry_name.name=Just A Test Item
  12. As it looks to me like a normal code but done diffrently...
  13. I'd look at: net.minecraftforge.common.config.Configuration ... Here is a class from an older mod I have: public class Config { public static Configuration config; public static void preInit() { config = new Configuration(new File(Reference.MAIN_FOLDER + "/Enabled_Modules.cfg")); try{ config.load(); // module on/off states \\ RingsHUD.Enabled = config.getBoolean("CheckpointHUD","Modules",true,"Whether to show the CheckpointHUD."); RingsHUD.DisableChat = config.getBoolean("DisableCPChat","Modules",true,"Whether to disable the checkpoint reached message in chat."); TIPCanceler.Enabled = config.getBoolean("ShowTips","Modules",true,"Whether to show Tips."); TimerGuiClass.Enabled = config.getBoolean("ShowTimer","Modules",true,"Whether to show the Timer."); }catch(Exception e){ System.out.println("Error loading config, returning to default variables."); }finally { config.save(); } } public static void setModule(String module, boolean to){ config.get("Modules",module,true).set(to); config.save(); preInit(); } } Ofc the preInit is called from the mod's preInit, But you can call it anytime I'm pretty sure to update it... Its my code so if something dont work dont blame me cuz im stupid I used the setModule(String module, boolean to) to set the module's state ingame, a.k.a in an options gui...
  14. Registry happens outside of the enum constructor is what I mean...
  15. That's what I'm thinking about right now... I'm just creating the items, and the registry happens only on preinit... (a.k.a im calling registerItems() in preInit, and also calling registerRenders() in clientProxy's preInit) So I dont actually think something would happen wrong...
  16. The point of the question in the forums is to find out if I can do it without that...
  17. I figured that, but what actually it does? because I can just have items and register them any time I want, and again I want to know what it really matters... Is there some inside super wierd code that doesnt get applied to item instances when they are being themselves?
  18. EDIT: Found a way to shrink it even more! Woop Woop! public class ModItems{ public static enum ModItemsEnum{ TESTITEM("this_is_test",0), ThisIsUnlocalizedName("registry_name_here",0), CanReallyBeAnything("this_is_registry_name",0); private Item item; ModItemsEnum(Item INitem, String INregistryName, int INspecial){ //Special ItemClass this.item = INitem; this.item.setUnlocalizedName(this.name()); this.item.setRegistryName(INregistryName); if(INspecial == 0) this.item.setCreativeTab(Main.modCreativeTab); } ModItemsEnum(String INregistryName, int INspecial){ //Normal Classless Items this(new Item(),INregistryName,INspecial); } public Item getItem(){ return this.item; } } public static boolean registerItems(){ try{ for(ModItemsEnum item : ModItemsEnum.values()){ GameRegistry.register(item.getItem()); } }catch(Exception e){ return false; } return true; } public static boolean registerRenders(){ try { for (ModItemsEnum item : ModItemsEnum.values()) { ModelLoader.setCustomModelResourceLocation(item.getItem(), 0, new ModelResourceLocation(item.getItem().getRegistryName(), "inventory")); } }catch(Exception e){ return false; } return true; } }
  19. Will adding items inside an enum and doing all things needed from there affect performence while loading the game/being in the game? I'm somewhat new to java and I dont know.. I'm asking this because I belive I made the simplest way of adding items and im not sure if its safe... All you need is 1 line for an item and it's resources... EDIT: IGNORE THIS VV new below public class ModItems{ public static enum ModItemsEnum{ TESTITEM("TestItem","this_is_test",0), ANOTHERTEST("UnLocalizedNameHere","registry_name_here",1), CanReallyBeAnything("IsThisGud","this_is_registry_name",0); private Item item; ModItemsEnum(Item INitem, String INunlocalizedName, String INregistryName, int INspecial){ //Special ItemClass this.item = INitem; this.item.setUnlocalizedName(INunlocalizedName); this.item.setRegistryName(INregistryName); if(INspecial == 0) this.item.setCreativeTab(Main.modCreativeTab); } ModItemsEnum(String INunlocalizedName, String INregistryName, int INspecial){ //Normal Classless Items this(new Item(),INunlocalizedName,INregistryName,INspecial); } public Item getItem(){ return this.item; } } public static boolean registerItems(){ try{ for(ModItemsEnum item : ModItemsEnum.values()){ GameRegistry.register(item.getItem()); } }catch(Exception e){ return false; } return true; } public static boolean registerRenders(){ try { for (ModItemsEnum item : ModItemsEnum.values()) { ModelLoader.setCustomModelResourceLocation(item.getItem(), 0, new ModelResourceLocation(item.getItem().getRegistryName(), "inventory")); } }catch(Exception e){ return false; } return true; } }
  20. Thanks! [CLOSED]
  21. Welp, Awnsered my question.... I can just type lines and dont care about anything... The problem is that I dont know if it affects performence still..
  22. By saying "useless entries" does the game actually require more power to handle entries that are not assigned to actual items? Adn do they have to be "item.something.name=something"? or I can just type lines and the game wont care?
  23. Is there a way to write comments on the .lang files? It'd be nice to sort stuff as I actually have OCD.... [sOLVED] # is ignored in lang files
×
×
  • Create New...

Important Information

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