Everything posted by RANKSHANK
-
[Fixed] Unregistering of RenderGameOverlayEvent does not work
Use an instance, For example I use public final class BuildController{ private BuildController(){instance = this;} private static BuildController instance; public static void bind(){ if(instance == null) MinecraftForge.EVENT_BUS.register(instance = new BuildController()); } public static void unbind(){ if(instance != null){ MinecraftForge.EVENT_BUS.unregister(instance); instance = null; } } } and it cleanly registered and unregistered the listeners in the class-
-
[Fixed] Unregistering of RenderGameOverlayEvent does not work
Use an instance, For example I use public final class BuildController{ private BuildController(){instance = this;} private static BuildController instance; public static void bind(){ if(instance == null) MinecraftForge.EVENT_BUS.register(instance = new BuildController()); } public static void unbind(){ if(instance != null){ MinecraftForge.EVENT_BUS.unregister(instance); instance = null; } } } and it cleanly registered and unregistered the listeners in the class-
-
edit nbt to spawned entity
I have a feeling that it's not being done locally, you'll need to send a packet to notify the client of the changes too
-
edit nbt to spawned entity
I have a feeling that it's not being done locally, you'll need to send a packet to notify the client of the changes too
-
Register New Block Texture Without Registering A New Block
check the debug texture that's outputted in the /jars directory to see if it's there, some code will need to be shown
-
Register New Block Texture Without Registering A New Block
check the debug texture that's outputted in the /jars directory to see if it's there, some code will need to be shown
-
Any way to store unique data per block placement?
Your supposed 'saving of resources' is flawed. if someone where to build a massive fence based structure and then those chunks where unloaded, rinse lather repeat, you would leave the print of all of those blocks in the system(the more you put, the slower saving and loading gets...), unless you used system resources to load and offload the values as needed, basically you either suffer one way or another... so tile entity is your best bet.
-
Any way to store unique data per block placement?
Your supposed 'saving of resources' is flawed. if someone where to build a massive fence based structure and then those chunks where unloaded, rinse lather repeat, you would leave the print of all of those blocks in the system(the more you put, the slower saving and loading gets...), unless you used system resources to load and offload the values as needed, basically you either suffer one way or another... so tile entity is your best bet.
-
edit nbt to spawned entity
getEntityData() doesn't guarantee that you'll get the data you want. In fact forge code: public NBTTagCompound getEntityData() { if (customEntityData == null) { customEntityData = new NBTTagCompound(); } return customEntityData; } this means you don't get any data aside from a new tag compound. the easiest way to work around this though is to pseudo load the entity ie EnitytMineCart e = yadda yadda initialization stuff; NBTTagCompound data = new NBTTagCompound(); e.writeToNBT(data); data.setString("EntityId", "SnowMan"); e.readFromNBT(data); w.spawnEntityInWorld(e);
-
edit nbt to spawned entity
getEntityData() doesn't guarantee that you'll get the data you want. In fact forge code: public NBTTagCompound getEntityData() { if (customEntityData == null) { customEntityData = new NBTTagCompound(); } return customEntityData; } this means you don't get any data aside from a new tag compound. the easiest way to work around this though is to pseudo load the entity ie EnitytMineCart e = yadda yadda initialization stuff; NBTTagCompound data = new NBTTagCompound(); e.writeToNBT(data); data.setString("EntityId", "SnowMan"); e.readFromNBT(data); w.spawnEntityInWorld(e);
-
Register New Block Texture Without Registering A New Block
sounds like you may need to either reflect to get access to the block's icon and replace it with your own, or reflect to replace the block instance with one of your own which will bind your custom texture
-
Register New Block Texture Without Registering A New Block
sounds like you may need to either reflect to get access to the block's icon and replace it with your own, or reflect to replace the block instance with one of your own which will bind your custom texture
-
Custom Items - ItemSpear?
Icon registry happens in the ItemSpear.class so it goes there
-
Custom Items - ItemSpear?
Icon registry happens in the ItemSpear.class so it goes there
-
Custom Items - ItemSpear?
well you will need to set the unlocalized name per item, and you can use that to access the file, if the file is directly related to the unlocalized name, otherwise you could create an if statement or add it to your constructor(not recommended due to side differences) so something like //pseudo code public void registerIcon(IconRegister i){ //if using unlocalized i.registerIcon("yourmod:" + getUnlocalizedName()); //item id switch switch(itemID){ case(woodSpearID): i.registerIcon("yourmod:wooden spear"; break; case(diamondSpearID): i.registerIcon("yourmod:diamond spear"; break; default: break } }
-
Custom Items - ItemSpear?
well you will need to set the unlocalized name per item, and you can use that to access the file, if the file is directly related to the unlocalized name, otherwise you could create an if statement or add it to your constructor(not recommended due to side differences) so something like //pseudo code public void registerIcon(IconRegister i){ //if using unlocalized i.registerIcon("yourmod:" + getUnlocalizedName()); //item id switch switch(itemID){ case(woodSpearID): i.registerIcon("yourmod:wooden spear"; break; case(diamondSpearID): i.registerIcon("yourmod:diamond spear"; break; default: break } }
-
Custom Items - ItemSpear?
Each item type can get it's own instance you could do something like public class Spear extends Item{ public final int damage; public Spear(int id, int dmg){ damage = dmg } } and then set the values on init Item spearWood = new ItemSpear(woodSpearID, 2); Item spearDiamond = new ItemSpear(diamSpearID, ;
-
Custom Items - ItemSpear?
Each item type can get it's own instance you could do something like public class Spear extends Item{ public final int damage; public Spear(int id, int dmg){ damage = dmg } } and then set the values on init Item spearWood = new ItemSpear(woodSpearID, 2); Item spearDiamond = new ItemSpear(diamSpearID, ;
-
What is Forge?
Lex explained quite a bit. you just failed to comprehend it-
-
What is Forge?
Lex explained quite a bit. you just failed to comprehend it-
-
How would I get a world based on dimension Id
like this? DimensionManager.getWorld(id) or are you looking for something else?
-
How would I get a world based on dimension Id
like this? DimensionManager.getWorld(id) or are you looking for something else?
-
Nested class with Networkmod dosen't switch as member ?
switch the modifier from static to public static
-
Nested class with Networkmod dosen't switch as member ?
switch the modifier from static to public static
-
How to access open gui on client from packet handler?
just send it to the gui: //pseudo code public void onPacketData(DataInpuStream d){ if(!Minecraft.getMinecraft.inGameHasFocus && Minecraft.getMinecraft().currentScreen instanceof YourGuiScreen) ((YourGuiScreen)Minecraft.getMinecraft().currentScreen()).handlePacketData(d); }
IPS spam blocked by CleanTalk.