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

Alekseyev

Members
  • Posts

    46
  • Joined

  • Last visited

Recent Profile Visitors

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

Alekseyev's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Bumping in hope of someone having an idea
  2. You create a new Capability every time you call getCapability. Return your already existing instance instead. You're trying to cast the LazyOptional of the capability to the capability itself. Instead you should retrieve it by using one the methods that exist for that purpose. I was linked this article some time ago by helpful persons, and it helped me greatly in understanding LazyOptionals (which function mostly the same as regular Optionals) https://www.baeldung.com/java-optional
  3. Hi, I ran into a problem: The night vision's effect of brightening up the surroundings is handled in LightTexture#updateLightmap(float partialTicks) and checks for the potion effect, after which a value (usually 1, if the effect is about to expire 0.7 + a sinus curve) is retrieved. How would I implement my own night vision effect, say, at lower intensity? I don't think it's possible to change that vanilla method to account for another check.
  4. Considering how you updated your post for 1.12, I thought you might want to do it for 1.14 as well: In 1.14, the WorkbenchContainer also has a "player" field, so the detour over the slot is no longer needed. Instead of using reflection, I used access transformers for the CraftingInventory's container field (called field_70465_c) as well as the PlayerContainer's and WorkbenchContainer's player field: In accesstransformer.cfg: public net.minecraft.inventory.CraftingInventory field_70465_c # container of CraftingInventory, used for conditional crafing recipes public net.minecraft.inventory.container.PlayerContainer field_82862_h # player of PlayerContainer, used for conditional crafting recipes public net.minecraft.inventory.container.WorkbenchContainer field_192390_i # player of WorkbenchContainer, used for conditional crafting recipes The findPlayer method can then be changed as follows: private static PlayerEntity findPlayer(CraftingInventory inv) { try { Container container = inv.field_70465_c; if (container instanceof PlayerContainer) { return ((PlayerContainer) container).player; } else if (container instanceof WorkbenchContainer) { return ((WorkbenchContainer) container).player; } else { // don't know the player return null; } } catch (Exception e) { throw Throwables.propagate(e); } }
  5. Oh wow, I am dumb. No idea how I missed that file on Github. I always forget about how you don't have to import things from the same package...
  6. @Choonster in your TestMod3 you use a "RecipeUtil.ShapedPrimer", but you don't seem to import it anywhere, nor can I find such a file in the minecraft/forge sources.
  7. Which would be +20 ticks per second if your game runs at full speed, and less if the processor can't keep up with all the things it has to compute.
  8. Could be fixed for the most part by setting the getRenderLayer to CUTOUT or CUTOUT_MIPPED.
  9. You could also have the inventoryTick function check the modulo of ticksExisted of the entity so that the rest of the code only fires every x ticks.
  10. Are you sure that your texture has transparent areas? Could be missing an alpha channel in the PNG.
  11. Hi, I designed a custom block model and got it to load in the world. However, I am facing two issues: 1: The floor below the block is not rendered. 2: The lighting on the model itself is broken on some faces (notably the upper and lower parts of those at an angle. (The textures and z-fighting will be fixed later, but that's not so important right now.)
  12. Would it also be an option to replace the Item Set with one of your own choice via reflection?
  13. I thought about the following: Instead of checking the charge value and being updated on it, the client just has a boolean for "1000 or higher". The server then only sends an update packet whenever the charge value crosses this treshold. However, there is a problem: I also want the charge to be displayed on the HUD later (in the form of a bar of varying size), and to calculate that size, you'd need the value again...
  14. Hi, I can successfully use LivingHurtEvent or LivingDamageEvent to set damage caused by a certain source to zero or cancel the event right away. However, other effects associated with damage still play, notably the hurt sound and the screenshake. How would I go about removing these depending on the damage source, say, for example, drowning or being on fire?
  15. HarvestCheck is fired between the destruction of a block and the (optional) creation of drops. I am not 100% sure whether it only fires for blocks with a harvest level of 1 or higher, but I remember something like this. It definitely also includes ordinary blocks like stone or snow, that require a tool to be collected. Haven't used the other event myself yet and no documemtation at hand.
×
×
  • Create New...

Important Information

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