Jump to content

DorekoNeko

Members
  • Posts

    12
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

DorekoNeko's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. I read the docs about Capabilities. I will try to implement my own. Thanks for that! About the other advise; I am not good a trig and I don't know if what you said is also applicable to 3d rectangles. Is it? EDIT: I decided to use WorldSavedData instead of Capability but I can't make it work. I implemented it following the docs (here). I just changed the recommended "get" method to "forWorld' for convenience. I try to use the forWorld method in an item's onItemUse event but seems like it is only creating the object and nothing more. It doesn't call writeFromNBT or readFromNBT. Here is my code (scala): object IndestructibleBlocks { private final val DATA_NAME: String = ModItems.MODID + "_IndestructibleBlocksData" /** * Returns the IndestructubleBlockSave instance for this world and registers it if not exists * @param world * @return */ def forWorld(world: World): IndestructibleBlocksSave = { val storage: MapStorage = world.getPerWorldStorage storage.getOrLoadData(classOf[indestructibleBlocksSave], DATA_NAME).asInstanceOf[indestructibleBlocksSave] match { case instance: IndestructibleBlocksSave => instance case _ => val instance: IndestructibleBlocksSave = new IndestructibleBlocksSave() storage.setData(DATA_NAME, instance) instance } } class IndestructibleBlocksSave extends WorldSavedData(IndestructibleBlocks.DATA_NAME) { var data: NBTTagCompound = _ var hello: Int = 0 println(IndestructibleBlocks.DATA_NAME + " class created!") override def writeToNBT(compound: NBTTagCompound): NBTTagCompound = { println(IndestructibleBlocks.DATA_NAME + " readFromNBT called!") compound.setString("TESTING_HEHE", "Hello hehehe") compound } override def readFromNBT(nbt: NBTTagCompound): Unit = { println(IndestructibleBlocks.DATA_NAME + " readFromNBT called!") hello += 1 println("Try#1 => " + nbt.getString("test")) data = nbt } } } Here is the equivalent Java code to the above Scala code: public class IndestructibleBlocks { private static final String DATA_NAME = ModItems.MODID + "_IndestructibleBlocksData"; public static IndestructibleBlocksSave forWorld(World world) { MapStorage storage = world.getPerWorldStorage(); IndestructibleBlocksSave instance = (IndestructibleBlocksSave) storage.getOrLoadData(IndestructibleBlocksSave.class, DATA_NAME); } } public class IndestructibleBlocksSave implements WorldSavedData { private NBTTagCompound data; private int hello = 0; public IndestructibleBlocksSave() { super(IndestructibleBlocks.DATA_NAME); } public IndestructibleBlocksSave(String name) { super(name); } @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { System.out.println(IndestructibleBlocks.DATA_NAME + " readFromNBT called!"); compound.setString("TESTING_HEHE", "Hello hehehe"); return compound; } @Override public void readFromNBT(NBTTagCompound nbt) { System.out.println(IndestructibleBlocks.DATA_NAME + " readFromNBT called!"); hello += 1; System.out.println("Try#1 => " + nbt.getString("test")); this.data = nbt; } } Then in my onItemUse event I just do: @Override public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (!world.isRemote) { IndestructibleBlocksSave test = IndestructibleBlocks.forWorld(world); player.addChatMessage(new TextComponentString("Value = " + test.hello)); } return EnumActionResult.SUCCESS; } Hope I was clear enough.
  2. hi everyone. I am making a tool that marks an area and makes it undestructible by non op players. the thing is that I thought I could achieve this by adding custom metadata or NBT data to blocks but I guess I can't so I ended up saving an array with all the BlockPos objects affected and comparing it in the block destroyed event. So now I need that array to be saved and loaded with the world data. I know I can use NBT but all the tutorials I found about WorldSaveData are not compatible with1.10.2 apparently. can anyone point me in the right direction? Using Scala by the way. Thanks.
  3. Yes in the @Mod annotation serverSide = true. Thank you very much Animefan8888. Also. The mod I made has a set of translated messages in the assets folder. I noticed if I didn't reopen the client while in development, the messages didn't work well because it shows the "id" of the message. So that means that the translation happens in the client and the client is which has the language files. Is there a way to do the same but server side? I don't know if I should create another post for this question... No there is not another way to do this, as the server doesn't need to know the translations it is only server side, I suppose you could make a translator your self. Thank you for all your fast answers. I applauded you and hit the thanks button. Wish I could help you some time.
  4. Yes in the @Mod annotation serverSide = true. Thank you very much Animefan8888. Also. The mod I made has a set of translated messages in the assets folder. I noticed if I didn't reopen the client while in development, the messages didn't work well because it shows the "id" of the message. So that means that the translation happens in the client and the client is which has the language files. Is there a way to do the same but server side? I don't know if I should create another post for this question...
  5. Hi there guys. I am fairly new to the community and I see there is not a whole lot of documentation. Recently I developed an authentication mod which only implements one command for register and another one for login. So. There is only server-side implementation. But once deployed, I noticed that Forge client also needs the mod too, not only the server. So... Is there a way to deploy a forge mod only for server-side without the need for the client to have it? Thanks.
  6. Thanks for your answer. Very much appreciated. EDIT: Turns out that I can't do a single thing with MinecraftServer since it is not a singleton object and I need to have an instance of it to properly use it apparently. Do you know how can I get an instance of it? Or another way to check if it is running a server in dedicated mode? The only members I see in MinecraftServer are USER_CACHE_FILE, which is a File, getCurrentTimeMillis(), which returns the current time in milliseconds, and a main method. Also, I am programming in Scala, which is supposedly supported by Forge. EDIT 2: Nevermind. I just discover that with an EntityPlayer instance I can call the getServer() method. Thank you very much.
  7. Instead of generating UUIDS and assigning them to player entities, you could use just their nickname since there can only be one with the same nickname. So, you make an ArrayList of type String, for example, and then in the event when you are going to send the message to the player, you first check if the player's name exists in the previous mentioned list. If so, you don't send the message, and if it is not in the list, you send the message and add the name to the list.
  8. Hi. I am working in a mod that is only for server-side based on chat commands. For this I need to check if the client is playing on a private server or in single player mode. I tried using the "Minecraft.getMinecraft().getCurrentServerData().isOnLAN()" method but it crashed the game somehow. So. Does anyone know how to achieve this? Thanks.
  9. Thank you for the docs. However I still can't make this work. I will keep trying anyways. Thanks.
  10. As I said, I am new to this stuff. I saw a bunch of tutorials but they are all old. I moved the ModelLoader call to the preInit method, but I don't know what's that ClientProxy. Going to do a little research. I did update, but I updated to 1.9-12.16.0.1858-1.9, which is the latest now. The stacktrace remains the same: [22:15:26] [Client thread/ERROR] [FML]: Exception loading model for variant neitherlands:fallenStar#inventory for item "neitherlands:fallenStar", normal location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model neitherlands:item/fallenStar with loader VanillaLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:134) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:298) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:169) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:128) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:120) [simpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:535) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:381) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_77] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_77] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_77] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_77] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_77] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_77] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_77] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_77] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_77] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_77] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_77] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_77] at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) [idea_rt.jar:?] Caused by: java.io.FileNotFoundException: neitherlands:models/item/fallenStar.json at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:68) ~[simpleReloadableResourceManager.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:310) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.access$1100(ModelLoader.java:99) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:844) ~[ModelLoader$VanillaLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:130) ~[ModelLoaderRegistry.class:?] ... 25 more [22:15:26] [Client thread/ERROR] [FML]: Exception loading model for variant neitherlands:fallenStar#inventory for item "neitherlands:fallenStar", blockstate location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model neitherlands:fallenStar#inventory with loader VariantLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:134) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:306) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:169) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:128) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:120) [simpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:535) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:381) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_77] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_77] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_77] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_77] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_77] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_77] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_77] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_77] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_77] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_77] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_77] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_77] at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) [idea_rt.jar:?] Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:75) ~[ModelBlockDefinition.class:?] at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1159) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:130) ~[ModelLoaderRegistry.class:?] ... 25 more Also I noticed that the game seems to doesn't even find the mcmod.info (I just edited the default mcmod.info file) Also, is there any way to get info about mod developing in version 1.9? All the tutorials I saw are very old and seems to be a lot of changes since 1.8 or so.
  11. Hi. I'm new to the minecraft modding stuff. I did set up my IntelliJ IDEA and all runs perfect except because when I add a new item just for testing, the game can't locate the model/textures. I think this is something wrong with IntelliJ build output but I can't figure out how to solve the problem. This is my project structure: And here's my actual code: Neitherlands.java package neitherlands; import neitherlands.items.FallenStar; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.registry.GameRegistry; import org.apache.logging.log4j.Level; @Mod(modid = Neitherlands.MODID, version = Neitherlands.VERSION, name = Neitherlands.NAME) public class Neitherlands { public static final String MODID = "neitherlands"; public static final String NAME = "Neitherlands"; public static final String VERSION = "1.0"; public static Item fallenStar; @EventHandler public void preInit(FMLPreInitializationEvent event) { fallenStar = new FallenStar(); // Registering items GameRegistry.register(fallenStar); debug("hello world"); } @EventHandler public void init(FMLInitializationEvent event) { // Setting the texture model ModelLoader.setCustomModelResourceLocation(fallenStar, 0, new ModelResourceLocation(Neitherlands.MODID + ":" + "fallenStar", "inventory")); } public void debug(String msg) { FMLLog.log(Level.INFO, msg); } } FallenStar.java package neitherlands.items; import neitherlands.Neitherlands; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.common.registry.GameRegistry; public class FallenStar extends Item { private final String name = "fallenStar"; public FallenStar() { setRegistryName(Neitherlands.MODID, name); setUnlocalizedName(Neitherlands.MODID + "_" + name); setCreativeTab(CreativeTabs.tabMisc); setMaxStackSize(16); } public String getName() { return name; } } And of course, here's the stacktrace: [21:27:27] [Client thread/ERROR] [FML]: Exception loading model for variant neitherlands:fallenStar#inventory for item "neitherlands:fallenStar" java.lang.Exception: Could not load item model either from the normal location neitherlands:item/fallenStar or from the blockstate at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:309) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:169) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:127) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:120) [simpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:535) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:381) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_77] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_77] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_77] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_77] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_77] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_77] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_77] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_77] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_77] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_77] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_77] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_77] at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) [idea_rt.jar:?] Caused by: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model neitherlands:fallenStar#inventory with loader VariantLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:134) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:305) ~[ModelLoader.class:?] ... 24 more Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:75) ~[ModelBlockDefinition.class:?] at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1129) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:130) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:305) ~[ModelLoader.class:?] ... 24 more Thanks for any help. EDIT: Installing eclipse. Let's see if it works with it. EDIT 2: Apparently it was an error while creating the folders. I had a unique folder named "assets.neitherlands.models.item" instead of several folders like "assets", "neitherlands", "models", and "item". That's why it can't find the assets... Thank you all.
×
×
  • Create New...

Important Information

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