Jump to content

JayZX535

Members
  • Posts

    83
  • Joined

  • Last visited

Everything posted by JayZX535

  1. Hello all, I'm working with an entity that has a large number of layers (currently five, and I'll likely be adding a few more). Tl;dr, these entities can come in a LOT of different variations of coat color and markings. Up close, they look great, but if I get a little ways away, the ones that show multiple layers start to have Z fighting issues. You can see how the two entities with more markings here are showing that weird streaky pattern. That isn't supposed to be there. Most of the layers I have rely on transparency to blend well, and I've admittedly been fighting the GL system to make that work. I thought I had it figured out, but I'm wondering if I'm still missing something here. Minecraft doesn't have a good example of using multiple layers for something like this, so I'm struggling a little to figure out if I'm using the GL system properly. In the past, I countered this problem by using the same layer rendering system that horses use, and that appeared to work great. However, I've since switched to a system that colors the textures in the renderer itself (like sheep's wool does). This allows me to have many more diverse options of color, however I'm not at all sure how to make that work with the system the horse renderer uses. If I could switch back to that and retain the ability to color each layer independently I def would, but I'm not sure if that's possible or not. I've been trying to keep the layers as compact as possible, because there's enough of them that the entity starts to develop a slight "glow" when they're all enabled (I believe due to the semi-transparent outer layers). Right now they each have a size increase of 0.001. Stepping that up to 0.01 seemed to help with the Z fighting, but then I started getting the glow around the entity. The render code in the layer classes all runs along these lines: public void render(ModEntity entityIn, float p_212842_2_, float p_212842_3_, float p_212842_4_, float p_212842_5_, float p_212842_6_, float p_212842_7_, float p_212842_8_) { if (!entityIn.isInvisible() && entityIn.showThisMarkingLayer()) { this.bindTexture(this.getEntityTexture(entityIn)); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.enableBlend(); float[] afloat = entityIn.getColor().getColorComponentValues(entityIn.getShade()); GlStateManager.color3f(afloat[0], afloat[1], afloat[2]); this.getEntityModel().setModelAttributes(this.wolfmodel); this.wolfmodel.setLivingAnimations(entityIn, p_212842_2_, p_212842_3_, p_212842_4_); this.wolfmodel.render(entityIn, p_212842_2_, p_212842_3_, p_212842_5_, p_212842_6_, p_212842_7_, p_212842_8_); GlStateManager.disableBlend(); } } Is there something I could do to help stop the Z fighting? Also, is there a definitive order that I should be calling GL functions in? What I have appears to work but I'd rather get it spot on by the books if I can...
  2. Ahh thanks for the update! Hopefully ongoing progress continues to go well-- best of luck to Cadiboo on that! Since release for my mod isn't imminent, I may hold off on this feature until the mod gets a bit closer to going public, however it's great to know that there is a workaround in case I finish my release before the interface is ready. Thanks!
  3. Hey all, I'm starting to work with configs in 1.14 for the first time, and just coming from the 1.12.2 system where GUIs were basically automatic. However, it looks like that's not the case since the 1.13 update, and I'm finding conflicting reports on how it all works. Don't see anything in the docs either, unless I'm just really dang blind. Does anyone know the current state of this, if there's an easy way to accomplish this in the 1.14.4 system yet and, if not, do we have any word on when that'll be coming to 1.14.4?
  4. That's an excellent idea-- I was hesitant to do that just from the event directly, but I suppose since I'm running sufficient checks to ensure it's my block and item being used, there shouldn't be harm in it. I'll go ahead and do that then-- thanks!
  5. Bump. Issue still persists, not sure what's causing it. Also worth noting, I'm checking if the function is running via a print statement in onBlockActivated within my block. The ones here in the event run, but the one in that function does not. Since there's no if statements or anything to interfere with onBlockActivated, I assume this issue has to be with the event either not being sent properly, or with me needing to use a different method or something. Does PlayerInteractEvent.RightClickBlock actually call onBlockActivated? Or do I have the wrong event/method?
  6. Hey all, Got a bit of a stumper. I have a custom block that's supposed to run an interaction when clicked with a certain item. That's fine and great, I got that part working. However, because I'm using the onBlockActivated method, it doesn't fire when shift clicking (which I want it to do because I want it to activate a different function when shift clicked with that item). I looked it up and saw that this is an intended function, and that I need to override the PlayerInteractEvent.RightClickBlock event to make it allow the click. Which I did. Except no matter what I try, I can't get it to actually register the onBlockActivated event. It works as intended with a normal click. It's just shift clicking that's not working. My code is as follows: @SubscribeEvent public static void playerRightClickBlock(PlayerInteractEvent.RightClickBlock event) { if (event.getWorld().getBlockState(event.getPos()).getBlock() instanceof WCFoodBowlBlock) { if (WCFoodBowlTileEntity.isValidFood(event.getItemStack())) { System.out.println("Right Clicked on food bowl with valid item"); event.setUseBlock(Event.Result.ALLOW); } } } That print statement does fire. So the event is getting caught and running properly, and none of those if statements are throwing it off. I can only assume I either got the wrong event somehow, am using the wrong function to make the onBlockActivated method fire even while sneaking, or Forge itself has a bug. I'm using the latest stable version so if so, it must be something pretty recent... Thank you for your time, and have a great day!
  7. I announced that I'll be releasing the complete version of the mod's first update in 1.11, so I'll be continuing to work in 1.11 for now. There are a couple things here that were added unnecessarily, I'll take a look at those-- some can probably be deleted, while others may be for things I intend to alter later. I will definitely take a look at the EntityPlayer#openGUI part, as if that is the cause then this may be a simple fix. I'll update this later when I've had time to take a look at these suggestions. Thank you for your advice.
  8. Hello, all! I'm currently trying to develop a server-compatible mod for the first time, and I'm having some massive issues with my IItemHandler capability for a tileentity not properly syncing from the server to the client. It runs fine in singleplayer-- the inventory has expected behavior, as seen here: Everything seems to be working fine. I can drag stacks around, they register in the top, etc. No issues. (placeholder gui and .lang isn't set up, I know XD) But when I host from a server and connect to it... Clicking the item just ends with it glitching immediately back into its slot. Shift-clicking duplicates the item into the slot as a ghost item, which immediately disappears when clicked on. So this is definitely a big issue. One of the most requested features I had for the mod was server compatibility, so I'm not about to just give up, however this is my first experience with servers and there seem to be few good explanations/examples of how this even works. As I understand, IItemHandler doesn't automatically sync with the client the way IInventory does, but IInventory is an older, outdated method that's not the most effective one to use from what I've read. It sounds like I need to set up a packet system to sync the server to the client and back again, but I have very little idea of how to do that with an inventory. I've used packets before, but only ever for simple variables (i.e. ints and stuff), and I don't necessarily know enough about the inventories to know where I'd need to call/send these packets. So if anyone has experience/advice here, I would definitely appreciate it. If at all possible, I'd like to make this setup reusable-- though if that's not easily possible I understand. I want to keep the mod as clean as possible, without reusing code if I can help it, so if there's some way I can set this up automatically for future TileEntity inventories (i.e. a custom extension of the container class? Some way to automatically sync through my custom slot base class?) that is definitely preferable. Current code: Block TileEntity Container GUI GUIHandler I do use a custom slot class, but the only thing I added is a restriction for isItemValid (the slot is a food bowl, so I've restricted it to only accept my kibble items). You can see that code here: @Override public boolean isItemValid(ItemStack stack) { if (stack.isEmpty() || !(stack.getItem() instanceof ItemKibble)) return false; IItemHandler handler = this.getItemHandler(); ItemStack remainder; if (handler instanceof IItemHandlerModifiable) { IItemHandlerModifiable handlerModifiable = (IItemHandlerModifiable) handler; ItemStack currentStack = handlerModifiable.getStackInSlot(index); handlerModifiable.setStackInSlot(index, ItemStack.EMPTY); remainder = handlerModifiable.insertItem(index, stack, true); handlerModifiable.setStackInSlot(index, currentStack); } else { remainder = handler.insertItem(index, stack, true); } return remainder.isEmpty() || remainder.getCount() < stack.getCount(); } Thank you so much for your time, and have a great day!
×
×
  • Create New...

Important Information

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