Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


Forge Modder
  • Posts

  • Joined

  • Last visited


  • Gender
  • URL
  • Location

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

TheMattyBoy's Achievements

Tree Puncher

Tree Puncher (2/8)



  1. Oh oops, didn't even notice that... Embarrassing... Right, thanks. Didn't I already sort of do this by doing world.getEntityByID(message.pianoId).getDistanceSqToEntity(p_apply_1_) < 900.0D in the predicate for finding the players? Alright, this is what I was having trouble with. If I tried to register a client packet on both sides the server would crash with a NoClassDefFoundError on whatever client-only class I was trying to access in my onMessage method in my message handler, and no amount of side checking or @SideOnly-ing would fix the error. How do I register a packet on both sides, while being able to access client only classes and methods, without the server immediately crashing with a NoClassDefFoundError or NoSuchMethodError?
  2. I'm trying to create a GUI that can play sounds of type MovingSound (as opposed to a normal PositionedSoundRecords, which is what World#playSound uses) when pressed, not only to the player using the GUI, but to everyone within range. Of course, GUI's are exclusively client sided, so I decided to use SimpleImpl to send a message about the sound to the server, but since I'm using a MovingSound I then have to play it through the SoundHandler in Minecraft (which is a client class) on all receiving clients. I'm kinda new to SimpleImpl and networking in general, but from my limited experience it would appear that you have to register your client packets only on the client side and server packets on the server side (if I didn't do this either the server would crash or my client would be kicked from the server, respectively). This, however, poses a problem as I'm trying to send a package that is only registered on the client from a package that is only registered on the server, meaning that I'm effectively trying to send a package that isn't registered (at least, that's how I think it works). I believe there's something wrong with how I register my packets, but as I say I'm new to networking so I don't really know. Help would be greatly appreciated! GitHub can be found here: https://github.com/TheMattyBoy00/petri-mod-2.0/tree/master/Petri_Mod-1.11.2/src/main/java/erikalebenjamattias/petrimod My GUI is here (it's long and messy, package is sent at line 324) (if you're wondering why I play the sound on the client and then send it to the server to play to all other clients nearby, it's to reduce latency for the person playing the piano [which is what the GUI is for if you hadn't guessed]): https://github.com/TheMattyBoy00/petri-mod-2.0/blob/master/Petri_Mod-1.11.2/src/main/java/erikalebenjamattias/petrimod/client/gui/GuiPianoKeyboard.java#L324 Package to send to server (a quick println shows that this does in fact find all the players it should that are in range): https://github.com/TheMattyBoy00/petri-mod-2.0/blob/master/Petri_Mod-1.11.2/src/main/java/erikalebenjamattias/petrimod/network/NotifyServerOfPianoPlayMessages.java Package to send to clients (println in the onMessage() method shows that it does not get called what so ever, and the constructor with the println only gets called on the server where it's called in the server package, despite it being a client event): https://github.com/TheMattyBoy00/petri-mod-2.0/blob/master/Petri_Mod-1.11.2/src/main/java/erikalebenjamattias/petrimod/network/NotifyClientOfPianoPlayMessages.java Packet handler: https://github.com/TheMattyBoy00/petri-mod-2.0/blob/master/Petri_Mod-1.11.2/src/main/java/erikalebenjamattias/petrimod/network/PetriPacketHandler.java Packets registered in the client proxy and server proxy respectively. This is where I think I might be doing something wrong.
  3. OK then. Why don't you register it like Minecraft has done it in LootTableList::register(ResourceLocation) (which is a public static method)? That does mean that you have to rename your "loot" folder to "loot_tables", and you probably want to create a sub folder called "chests" where you put your "loot_chest.json" file, but that shouldn't be too big of an issue. I would try doing something like public static ResourceLocation LOOT_CHEST; in your main mod class, then say LOOT_CHEST = LootTableList.register(new ResourceLocation("nm", "chests/loot_chest")); in your pre-initialization event (maybe another event) and then call this field in your chest.setLootTable method.
  4. Try adding .json to your resource location. Not entirely sure if necessary but I know you need for instance .png in resource locations for entity textures
  5. if(world.isRemote) checks if it's on the client, it should be if(!world.isRemote)
  6. So I have a crafting recipe that uses water bottles, which are technically a potion with only an NBT tag to separate them from other potions. Is it possible to check for this NBT tag in the new JSON format for making crafting recipes? If so, what's the syntax? I don't really want players to be able to craft the item with any potion... Here's what my JSON file looks like so far: { "type": "minecraft:crafting_shaped", "pattern": [ "iIw", "Db ", " Bi" ], "key": { "i": { "item": "minecraft:iron_ingot", "data": 0 }, "I": { "item": "minecraft:iron_block", "data": 0 }, "w": { "item": "minecraft:potion", "data": 0, "tag": {"Potion":"minecraft:water"} #<------ This is what isn't working, because I don't know the syntax (if at all possible) }, "D": { "item": "minecraft:dispenser", "data": 0 }, "b": { "item": "minecraft:bucket", "data": 0 }, "B": { "item": "minecraft:stone_button", "data": 0 } }, "result": { "item": "gadgetsngoodies:water_gun", "data": 0, "count": 1 } }
  7. Welp, I tried, it re-downloaded gradle and everything, but it still failed on ":applySourcePatches"... Think I might just wait for that patch of onArmorTick and hopefully it should be working by then
  8. Oh OK, guess I'll just have to wait then... Thanks for replying What do you mean by "rename the directory"? If I try to physically rename the folder ".gradle", Windows tells me that I must type a file name (maybe because .gradle is an extension and not a file name? Not sure on that one...)
  9. I've made a mod with a bunch of armor items that worked fine, until I tried updating the mod to 1.12. I dug through the code (ctrl + H is my friend) and found that the only place where Item#onArmorTick (a method that should update the armor every tick) gets called is in InventoryPlayer#setPickedItemStack, a method for handling pickblocking (so I could only fly my jetpack for a split second while pickblocking, which is no good), with a message from Forge saying "FORGE: Tick armor on animation ticks". How would I go about doing that (I don't have a separate class for rendering my armors or anything)? Also, I'm using forge-1.12-, which I know isn't the latest version, but that brings me onto my next problem: whenever I try setting up anything later than 2333 (using gradlew setupDecompWorkspace), it fails, giving me this: To honour the JVM settings for this build a new JVM will be forked. Please consi der using the daemon: https://docs.gradle.org/2.14/userguide/gradle_daemon.html. ################################################# ForgeGradle 2.3-SNAPSHOT-da858a8 https://github.com/MinecraftForge/ForgeGradle ################################################# Powered by MCP unknown http://modcoderpack.com by: Searge, ProfMobius, Fesh0r, R4wk, ZeuX, IngisKahn, bspkrs ################################################# :deobfCompileDummyTask :deobfProvidedDummyTask :getVersionJson :extractUserdev UP-TO-DATE :extractDependencyATs SKIPPED :extractMcpData SKIPPED :extractMcpMappings SKIPPED :genSrgs SKIPPED :downloadClient SKIPPED :downloadServer SKIPPED :splitServerJar SKIPPED :mergeJars SKIPPED :deobfMcSRG SKIPPED :decompileMc SKIPPED :fixMcSources :applySourcePatches Patching failed: net/minecraft/command/AdvancementCommand.java Cannot find hunk target 1: Cannot find hunk target @ 0 2: Cannot find hunk target @ 0 3: Cannot find hunk target @ 0 3/4 failed :applySourcePatches FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':applySourcePatches'. > com.cloudbees.diff.PatchException: Cannot find hunk target * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED Total time: 26.664 secs I do realize this may not be the right place to post this, I wasn't sure if this goes here or in Support & Bug Reports, but the latter seems to be more for players using Forge rather than modders, so that's why I chose this subforum.
  10. What I did was to just put Entity#setSize([width of grown animal] * [a factor that goes from the smallest size* when it's a baby, up to 1 when it's an adult], [height of grown animal] * [the same factor]); in EntityLivingBase#onLivingUpdate. In order to calculate the factor I would need to see your code for handling aging, unless you could figure it out yourself? *By the smallest size I mean say if the smallest version of the animal was 20% the size of the adult one, the "smallest size" would be 0.2, if it was 10% it would be 0.1 etc.
  11. I know, I was just pointing out that it happens and that I need to cancel certain key presses to compensate. Hey, thank you for bringing this to my attention! The KeyBinding class was just what I needed (even though I settled for a slightly different method in the end). I do believe my problems are solved now, thank you to all of you for your help! I really appreciate it! (For those wondering, this is what I settled on): entity.setVelocity(0, 0, 0); if(entity.posX != entity.prevPosX || entity.posY != entity.prevPosY || entity.posZ != entity.prevPosZ) { entity.setPositionAndUpdate(entity.prevPosX, entity.prevPosY, entity.prevPosZ); } if(entity == Minecraft.getMinecraft().player) { KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindForward.getKeyCode(), false); KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindBack.getKeyCode(), false); KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindLeft.getKeyCode(), false); KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindRight.getKeyCode(), false); if(((EntityPlayer)entity).capabilities.isFlying) { KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindJump.getKeyCode(), false); KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindSneak.getKeyCode(), false); } }
  12. Okay, I sort of solved it by doing this: entity.setVelocity(0, 0, 0); if(entity.posX != entity.prevPosX || entity.posY != entity.prevPosY || entity.posZ != entity.prevPosZ) { entity.setPositionAndUpdate(entity.prevPosX, entity.prevPosY, entity.prevPosZ); } but when you try to move, it starts jittering (seen as I'm teleporting the player every tick). Is there a way to cancel keyboard input from only the buttons [W], [A], [D], [SPACE] and [SHIFT]? I seem to remember there was an event for handling keyboard input, but I can't seem to find one.
  13. Well, there are a few reasons. First of all we have the annoying FOV change (I know I could probably fix this with an event). Slowness doesn't affect knockback, so you could just punch out the mobs (again, should be an easy fix but still). Also, I know it might sound dumb but I'd prefer it if you didn't have the slowness icon in the inventory. But the main reason is that slowness doesn't affect all mobs, such as bats, squid and flying players, and it doesn't block vertical movement, so it's easy to just jump out. If I were to use slowness together with constantly setting only motionY to 0, the game would treat mobs as though they were flying, and slowness would have no affect.
  14. Two things: first, I actually do want skeletons to shoot arrows and creepers to explode and what not. I don't want to freeze time, I merely want to freeze mobs in place so that they can't move/fly. Second, the player is an issue... If I allow the event on the client side, all mobs including the player start jittering like mad when stuck in the ice, and if I limit the event to server side only, it works fine for other mobs but the player doesn't get affected. Edit: It also brings a whole lot of other problems, such as, as you said, they don't take damage unless you do something about it, same with drowning, suffocating, you can't eat when in the ice, and probably a whole lot more that I haven't thought of... I really don't feel like coding a special case for ALL of these situations.
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.