-
Posts
878 -
Joined
-
Last visited
Everything posted by Elix_x
-
Are you sure that on created is succesfully called?
-
The interesting thing about this method is that if nbt is already defined, it will not replace values. That means that you can run it infinite amunt of times, without woriing of defaulting your info... Is that what you mean? Or i misunderstood? Soryy, if yes...
-
Yes. That's made for it...
-
You can put it anywhere, it does not matter... Is it working now???
-
Okay, so let's begin optifying nbt manipulations: First create nbt helper method, that will "fix" missing tags. For you it will look something like: public static void fixNBT(ItemStack hammer){ NBTTagCompound cmp = hammer.stackTagCompound; if(cmp == null) { hammer.stackTagCompound = new NBTTagCompound(); cmp = hammer.stackTagCompound; } if(!cmp.hasKey("MiningArea")){ cmp.setString("MiningArea", "DEFAULT"); } hammer.stackTagCompound = cmp; } Than before each nbt manipulation (getting/setting included), just call this method... ps: i wrote this code from memory, so it may not have exact method names...
-
Well, then check that you do same nbt check where you set the string. Then check all names of tags.
-
Do you think that on new stack, your mining area string will magically exist??? Again, null check and new set, this time for string... And also, what the heck is this??? ItemStack hammer = new ItemStack(player.inventory.getCurrentItem().getItem());
-
I don't know. Sometimes without last line it is not working? Strange...
-
Does your code look something like this? If not - try, it's working for me. And also, hint: do fixTags method somewhere, that will do all null checks and fix missing tags. And all it before operating nbt... NBTTagCompound tag = itemstack.stackTagCompound; if(tag == null){ itemstack.stackTagCompound = new NBTTagCompound(); tag = itemstack.stackTagCompound; } ... do your stuff here... itemstack.stackTagCompound = tag;
-
By default stackTagCompound in itemstack is null. So when you get it, if it is null you set it to new tag...
-
[1.7.10] [Solved] Tile entity with .obj model follows mouse.
Elix_x replied to a topic in Modder Support
If your tileentity renderer doen't need te data, you can use null, but yours uses some, so in constructor initialise tileentity, and pass it instead of null... -
Probably second one is impossible... For first one just check if player is sneaking...
-
[1.7.10] Changing light value of shadow of block to be displayed....
Elix_x replied to Elix_x's topic in Modder Support
Problem is: these are not my blocks, these not even known blocks... What i'm trying ot do is with selection of zone, make all blocks within invisible... And this ligting is only problem left. I know about isOpaqueCube, and want to know if there's position sensitive version for it (like for opacity for example), Because otherwise it would be too much patching... OR there's other way around??? And also, i misspressed button , pressed thank you instead of quote... well... doesn't matter... -
[1.7.10] [Solved] Tile entity with .obj model follows mouse.
Elix_x replied to a topic in Modder Support
-
[1.7.10] Changing light value of shadow of block to be displayed....
Elix_x replied to Elix_x's topic in Modder Support
Well, i got some progress, but it still isn't as i want... From left to right: air, glass, what i'm doing. As you can see, with glass all looks like air, but what i do is not... What i tried to do: setting (or returning) opacity of blocks in zone to 0. Do you have any ideas??? -
Check wether a TileEntity is in the inventory or the world
Elix_x replied to ItsAMysteriousYT's topic in Modder Support
Do simplier: call another rendering method (like renderItem or what you want to call it) from IItemRenderer... Isn't that easier??? -
[1.7.10] Changing light value of shadow of block to be displayed....
Elix_x replied to Elix_x's topic in Modder Support
Okay, i tried to pacth it, and now i'm getting very strange error: [12:00:14] [main/INFO] [iZ Core]: ################################################## [12:00:14] [main/INFO] [iZ Core]: Patching Block [12:00:14] [main/INFO] [iZ Core]: ************************************************** [12:00:14] [main/INFO] [iZ Core]: Patching getLightOpacity [12:00:14] [main/INFO] [iZ Core]: Patching getLightOpacity Completed [12:00:14] [main/INFO] [iZ Core]: ************************************************** [12:00:14] [main/ERROR] [LaunchWrapper]: Unable to launch java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?] at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?] at GradleStart.main(Unknown Source) [start/:?] Caused by: java.lang.NoClassDefFoundError: net/minecraft/block/Block at net.minecraft.init.Bootstrap.func_151354_b(Bootstrap.java:457) ~[bootstrap.class:?] at net.minecraft.client.Minecraft.<init>(Minecraft.java:323) ~[Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:141) ~[Main.class:?] ... 8 more Caused by: java.lang.ClassNotFoundException: net.minecraft.block.Block at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) ~[launchwrapper-1.11.jar:?] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25] at net.minecraft.init.Bootstrap.func_151354_b(Bootstrap.java:457) ~[bootstrap.class:?] at net.minecraft.client.Minecraft.<init>(Minecraft.java:323) ~[Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:141) ~[Main.class:?] ... 8 more Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 66 at java.lang.String.charAt(Unknown Source) ~[?:1.8.0_25] at org.objectweb.asm.Type.getArgumentsAndReturnSizes(Type.java:417) ~[asm-debug-all-5.0.3.jar:5.0.3] at org.objectweb.asm.MethodWriter.visitMethodInsn(MethodWriter.java:906) ~[asm-debug-all-5.0.3.jar:5.0.3] at org.objectweb.asm.tree.MethodInsnNode.accept(MethodInsnNode.java:133) ~[asm-debug-all-5.0.3.jar:5.0.3] at org.objectweb.asm.tree.InsnList.accept(InsnList.java:162) ~[asm-debug-all-5.0.3.jar:5.0.3] at org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:816) ~[asm-debug-all-5.0.3.jar:5.0.3] at org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:726) ~[asm-debug-all-5.0.3.jar:5.0.3] at org.objectweb.asm.tree.ClassNode.accept(ClassNode.java:412) ~[asm-debug-all-5.0.3.jar:5.0.3] at code.elix_x.coremods.invisizones.core.InvisiZonesTransformer.patchBlock(InvisiZonesTransformer.java:98) ~[bin/:?] at code.elix_x.coremods.invisizones.core.InvisiZonesTransformer.transform(InvisiZonesTransformer.java:44) ~[bin/:?] at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) ~[launchwrapper-1.11.jar:?] at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) ~[launchwrapper-1.11.jar:?] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25] at net.minecraft.init.Bootstrap.func_151354_b(Bootstrap.java:457) ~[bootstrap.class:?] at net.minecraft.client.Minecraft.<init>(Minecraft.java:323) ~[Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:141) ~[Main.class:?] ... 8 more Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release And block transformer method: private byte[] patchBlock(String name, byte[] bytes) { String getLightOpacity = "getLightOpacity"; String getLightOpacityDesc = "(L" + InvisiZonesTranslator.getMapedClassName("world.IBlockAccess").replace(".", "/") + ";III)I"; ClassNode classNode = new ClassNode(); ClassReader classReader = new ClassReader(bytes); classReader.accept(classNode, 0); for(MethodNode method : classNode.methods){ if(method.name.equals(getLightOpacity) && method.desc.equals(getLightOpacityDesc)){ try{ logger.info("**************************************************"); logger.info("Patching getLightOpacity"); InsnList list = new InsnList(); list.add(new VarInsnNode(Opcodes.ALOAD, 0)); list.add(new VarInsnNode(Opcodes.ALOAD, 1)); list.add(new VarInsnNode(Opcodes.ILOAD, 2)); list.add(new VarInsnNode(Opcodes.ILOAD, 3)); list.add(new VarInsnNode(Opcodes.ILOAD, 4)); list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "code.elix_x.coremods.invisizones.core.InvisiZoneHooks".replace(".", "/"), "getLightOpacity", "(L" + InvisiZonesTranslator.getMapedClassName("block.Block").replace(".", "/") + ";L" + InvisiZonesTranslator.getMapedClassName("world.IBlockAccess").replace(".", "/") + "III)I", false)); list.add(new InsnNode(Opcodes.IRETURN)); list.add(new LabelNode()); method.instructions.insert(list); logger.info("Patching getLightOpacity Completed"); logger.info("**************************************************"); }catch(Exception e){ logger.info("Patching getLightOpacity Failed With Exception:"); e.printStackTrace(); logger.info("**************************************************"); } } } ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS); classNode.accept(writer); return writer.toByteArray(); } Any ideas, why is it happening? EDIT: Forgot one semicolon, now this is working... -
Opening a player's inventory on another player's screen
Elix_x replied to Asweez's topic in Modder Support
Like any other gui? -
[1.7.10] [Solved] Tile entity with .obj model follows mouse.
Elix_x replied to a topic in Modder Support
To make item render in 1.7.10, use MinecraftForgeClient.registerItemRenderer(item, IItemRenderer); Where iitem renderer is new class that implements it (Example: LuminaOrbItemRenderer), in constructor you pass it YourTileEntityRenderer (!!!WARNING: SAME OBJECT THAT YOU PASS TO bindTileEntitySpecialRenderer OR MINECRAFT WILL CRASH!!!) and where your return true to first methods, and in last, you just call terenderer.render ... -
Use events, onEntityTick (or similar to that). And than check for one of your items, and check for others around...
-
[1.7.10] Testing mod on server - with other players
Elix_x replied to Thornack's topic in Modder Support
Go to server.properties and set it to offline mode -
[1.7.10] [Solved] How do I get nbt data from a TileEntity?
Elix_x replied to a topic in Modder Support
No, only nbt is saved on drive. How do you think mc would now that this filed in this class made by him needs to be saved??? That's why you have write and read to nbt methods. Use those to store your information... Actually enough of information is given above... -
[1.7.10]TileEntity - NBT not working & GUI not updating.
Elix_x replied to dude22072's topic in Modder Support
By gui is not updating on sertain thing, you mean that progress bar isn't going or what? If first - you need crafting and crafters methods to sync client and server containers. This includes 3 methods: addCraftingToCrafters(ICrafting crafting) detectAndSendChanges updateProgressBar(int id, int amount) Using those, you are syncing data between client and server.