Jump to content

Elix_x

Members
  • Posts

    878
  • Joined

  • Last visited

Everything posted by Elix_x

  1. It does not look like there's an event for that. And it may be nice to have one. So you can (if you know where to put the event) clone forge repo, create the event and PR it into forge. This is forge github repo BTW - https://github.com/MinecraftForge/MinecraftForge. And you could also try to use key-listening. Subscribe to the KeyInputEvent, it is fired after key bindings are updated and before they are read (& reset). Then use #isKeyDown() rather than #isPressed() to retrieve it's state without resetting it. If you want to then cancel the swap, call #unpressKey(). Remember though that this method only works for swapping by pressing F. User can still swap in the inventory GUI. Or a mod can programatically do that. If you want to detect your item suddenly being in the off-hand (whatever the way it got there), override Item#onUpdate(). It is called every tick your item is in player inventory. Now just check that passed stack is the same as the stack in the player's offhand and that's it. Now you just have to think of some logic to prevent detecting it every tick it is in the offhand.
  2. Thanks! So no forge stable 1.11.2 MCP yet? EDIT: Found ModCoderPack/MCPBot-Issues#360. Thanks for help.
  3. Good day. So you know how forge has minecraft.mappings in the build.gradle used for specifying MCP mappings. Well, for past year for snapshots it was pretty clear, just use snapshot_YYYYMMDD (because we had no stable versions). Now that 9.37 is released, how do i translate that into forge stable_???? format? Using stable_937 or stable_9.37 did not work. I tried looking at old build scripts, like 1.7.10, but their version translation makes no sense - 1.7.10 MCP mappings is stable_20 while the actual version is 9.37. TLDR: What should i use in minecraft.mappings in the build script to update MCP to 9.37? Thanks for help. If you have any questions - please ask.
  4. Crashes because some graphics cards dont support them, that is all. But yeah. That's probably it actually.
  5. Hello everybody! So i have a probably simple question, but it bothered me for a while: I am using VBOs for rendering of my objects. I noticed recently that there's a game setting that allows to turn on/off VBOs. What would be the consequences of me not respecting this setting (and more precisely using VBOS when VBOs are turned off)? I know that generally VBOs are better, but aren't supported on old graphic cards. So what would be the consequences, other than old graphic cards not being supported? Thanks for help.
  6. Entity being killed onlyon client means that it's considered as "memory garbage" - it's too far, not in render or does not meet client stay conditions. Try tracing origin of client entity remove packet and put a few breakpoints there to find which criteria is validated/invalidated.
  7. As TGG said, run dedicated server from your IDE and it will clear all obfuscated names.
  8. As Draco said, in almost all cases, you have an alternative. In in the worst case, when events don't exist, registry aliases don't work, you can try finding another way. For example, overriding the class and using reflection to subsitue instances. @Draco There's one problem though... Sometimes (*cough* *cough*) it may take a few months before forge either rejects or accepts your PR... Or it may never ever get neither accepted nor rejected...
  9. I already explained to Draco how to do this here: http://www.minecraftforge.net/forum/index.php?topic=42539.msg226463#msg226463. And won't rewrite all explanations here, but if you have any questions, please post them here and not there.
  10. Add @Override to your methods, to make sure you actually override these (naming is correct). Return false on isFull, isOpaque and isFullyOpaque (yes there are a lot of same pointless methods now).
  11. @trollworkout Did you read my previous post? It's totally possible and not hard at all. @Draco18s This is applicable in 1.8, hell that resource pack method works in 1.7.10 (but not needed). Since 1.9, we've got another way of doing this, with IBaked , in case we have to combine tons of layers (to not hurt performance). Just FMI (for my information), how are/were you actually using that dynamic atlas sprite?
  12. @Draco18s woooow... Stop it... Why so much pain? Srsly? Step 1: create a texture location, for example "cookiemod:zenyancookie" and use it in your block json. Step 2: Create custom IResourcePack implementation, throw it into default resource packs in minecraft using reflection. Step 3: once somebody asks for texture resource and it's your texture (check domain and location, location will be textures/senyancookie in this case), return resource that ImageIOs your png into output stream, which you clone into inout stream using apache stream utils and return. Step 3.5: If you want your image to persist between RP reloads, just output it into ByteArrayOutputStream , store byte[] and return ByteArrayInputStream from that array as resource.
  13. The textures are randomly generated (choose one): - On MC load. - On world load. - A few times while world running. - 9000+ times / tick (╯°□°)╯︵ ┻━┻ This choice will completely change the way it should be implemented.
  14. Can't you override ALL the commans with custom command? I mean, you copy list of all registered commands and then clear the orginal one. Now for each of those commands, you register your command "handler" instantiated with the command. In your command "handler", you implement command and redirect all method calls to original command, except for the method you want to change... This will work in 97% of the cases. If you want to get additional 3%, you can go for dynamic class generation of subclass of command with overriden methods. Though if you're not experienced enough with ASM, this is not recommended.
  15. You have to load it yourself. I have a model loader helper class here. If your model is static (aka one model for all states), you can load and bake it once and then forget about it (in this case, the entire class is not needed). Otherwise, you'll need to load each model separetly. If you have nig amount of models, that's where caching comes in. If you use this class, remember to register it in client proxy as reload listener. WARNING: If you DON'T use textures already used by other block or item, you have to map them to atlas yourself too. To do that, subscribe to TextureStitchEvent.Pre , load (don't bake) IModel and retrive & register all it's textures.
  16. Yes. registry.putObject with the same model location you retrieved it with. Note: i remember in some dev versions of forge, it did not allow me to replace it. If that's the case, rename your main model something else and load it manually. I was using it previously, but not anymore (it will take me some time to find this deleted piece of code). And yes, it is hard to find stuff there without knowing. Meanwhile, i found where i use this method to register custom model, though i don't retrive one.
  17. You can combine quads of 2 models, if you create a custom IBakedModel . First, create 2 model jsons - main one for fluid (should be the one loaded by mc) and one for other things. Subscribe to ModelBakeEvent , retrieve fluid base model from registry with resource location. Now load your second model (with carpets, blanks and stuff). Then you take these 2 models and pass them to your own IBakedModel . In your custom model, implement methods by redirecting to one of models. As for getQuads , create a list and add all quads from getQuads for both models. Now, you just have to replace fluid model in registry with custom one, a bit of debugging and it should work. I wrote a system that does that, though it may be too much for your needs (it allows per vertex modification), which you can find here.
  18. Separate thread or concurent future task should work here. Just rememeber to wrap action in runable and enqueue it to server to avoid concurency crashes.
  19. In some cases when method has no forge hooks, or other clear way of taking over calls, there is a an option that might* work if: -Method is NOT static. -Method is NOT private. -Method is NOT final. -Class is NOT final. -You have / can gain access to classes' all instances. When all of these (maybe not the * one, more about it in a second) are the case for you, you can create a class extending class that has the method and override it. Then what you have to do is replace all instances of class in question with your instance. It's easy if class is used as singleton, might be a bit harder if there are multiple instaces of it (but at that point, you always have a forge hook that allows accessing all/part of these instances). Remember a few things though: -Inner classes are not a problem, you'll just have to repeat process with its' external classes. -If the instance(s) is/are stored in a private or final field, that's not a problem either. You have a way around both with reflection, -If you have to default to vanilla(?) in overriden method, store instance that you replace and call it's method. It's very important, as other wise if other mods also use same replacement way... *-If there are multiple mods using this way for the same thing, and one of them does not do it properly, it will break all other mods. Also, just FYI, in case it will go to this point (like it did for me), using AOP (aspect oriented programming) java based language will not work (MC environment does not allow easy integration of such, if it is not integrated by forge). Or at least, it did not work for me as much as i tried to hook in Aspect J (you CAN hook it with a coremod, but at this point, there's no point).
  20. Technically, if they require to render everything with texture, it's shaders' problem. You should probably report that. Meanwhile, use other shaders (or if you're feeling like editing shaders, add boolean uniform in fragment shader to activate/deactivate texture, if it's false, use only color - without multiplying it by tex ).
  21. Hehe... Thanks! May have to wait an eternity though.
  22. Good day everybody! Today, i have met some problems with interactions system. I have items that have interactions for right clicking air, block and left clicking block. I am handling those with interaction events. But when i right click on block, right click air event is also called and both things happen. I have tried many things (cancelling, setting use item & block results to allow/deny), but none helped. By looking in code calling interaction methods, i understood that we cannot at the same time cancel further interaction (item methods + offhand) and make it successfull with events (basically, what i need). So, how can it be done? Code: @SubscribeEvent public void manipulate(PlayerInteractEvent event){ EntityPlayer player = event.getEntityPlayer(); ItemStack itemstack = event.getItemStack(); if(itemstack != null && itemstack.getItem() instanceof IColoringTool){ IColoringTool tool = (IColoringTool) itemstack.getItem(); if(event instanceof RightClickItem && tool.displayDefaultGui(player, itemstack)){ ColorfulBlocksBase.proxy.displayGuiSelectColor(itemstack); event.setCanceled(true); } if(event instanceof RightClickBlock && tool.colorBlocksOnRightClick(player, itemstack)){ for(BlockPos pos : tool.getTargettedBlocks(player, itemstack)){ if(tool.colorBlockProceed(player, itemstack, pos)){ ColoredBlocksManager.get(event.getWorld()).addRGBA(pos, tool.getCurrentColor(itemstack)); } } player.swingArm(event.getHand()); ((RightClickBlock) event).setUseItem(Result.ALLOW); ((RightClickBlock) event).setUseBlock(Result.ALLOW); } if(event instanceof LeftClickBlock && tool.pickColorOnLeftClick(player, itemstack)){ RGBA rgba = ColoredBlocksManager.get(event.getWorld()).getRGBA(new BlockPos(event.getPos())); if(rgba != null){ ColoringToolsManager.updateColor(player, rgba); player.swingArm(event.getHand()); ((LeftClickBlock) event).setUseItem(Result.DENY); ((LeftClickBlock) event).setUseBlock(Result.DENY); event.setCanceled(true); } } } if(event instanceof RightClickBlock){ if(itemstack != null && itemstack.getItem() == Items.POTIONITEM && itemstack.getItemDamage() == 0){ if(ColoredBlocksManager.get(event.getWorld()).hasRGBA(new BlockPos(event.getPos()))){ ColoredBlocksManager.get(event.getWorld()).removeRGBA(new BlockPos(event.getPos())); if(ColorfulBlocksBase.consumeWaterOnErase && !player.capabilities.isCreativeMode){ player.setItemStackToSlot(event.getHand() == EnumHand.MAIN_HAND ? EntityEquipmentSlot.MAINHAND : EntityEquipmentSlot.OFFHAND, new ItemStack(Items.GLASS_BOTTLE)); } ((RightClickBlock) event).setUseItem(Result.DENY); ((RightClickBlock) event).setUseBlock(Result.DENY); event.setCanceled(true); } } } } Thanks for help! If you have any questions - just ask!
  23. But how about hooking into packet pipeline with custom ChannelHandlerAdapter ? Or is this not a proper way?
  24. Minecraft world height is limited to 256 and many mods already use all height to generate high mountains. If you don't worry about not supporting most biome and world gen mods, that you can proceed. Otherwise, it's not possible (well, it is. But raising height limit above 256 is a pain, nearly impossible with forge, and will make every mod incompatible with yours). So, to raise height by 100 blocks during world gen, you should create custom ChunkProvider, that contains parent chunk provider (which would be used by default for world gen). For all block gen methods, you call parent.method and then raise all generated blocks by 100 and then add yours. Now when world is created you have to get current world's chunk provider, create you provider with this provider being parent and then set world's chunk provider to yours. You will probably need to use reflection. Also, make sure that you're doing this in correct dimension .
  25. I neither use ServerConnectionFromClientEvent. I am using PlayerLoggedInEvent and i added sysouts to the log. Following them, message is: given to net thread and sent, but never recieved and processed (given - net.send, sent - writeToByteBuf, receive - readFromByteBuf, process - handler.process). If i won't be able to do something about it, well i guess no auto syncing configuration... Also, it won't crash mc, but i will have hard times cleaning up incorrectly loaded things.
×
×
  • Create New...

Important Information

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