Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/15/20 in all areas

  1. Its exactly as useful as the normal Java Optional. isPresent replaces the null check if you just want to check if something is present. It also doesn't call the resolve function so that's where the Lazy part comes in. Your examples are also pretty bad. The way you would want to do it is like: cap.map(e -> e.amount() * e.amountMultiplier()).orElse(0) But ya the point is that LazyOptional gives you metadata about if it's present if all you care about is if it exists and delays the actual creation of the object you want until someone actually wants it.
    2 points
  2. Forge Version: 31.2.0 Minecraft Version: 1.15.2 Downloads: Changelog: (Direct) Installer: (AdFocus) (Direct) MDK: (AdFocus) (Direct) Intro: Here we go again for 1.15.2, this has a ton of bug fixes, developer improvements, as well as preliminary support for Java 13+ so we'll see how that goes. Changelog: New: Added hook to allow customized overlays when swimming in custom fluids. Added support for suppliers in FoodItem, allow easier modder extension. Added model data to BlockModelRenderer Added system for global loot functions, allowing modders to affect all loot tables using data. Added new early loading screen that shows before Vanilla even exists. Should seamlessly transition to vanilla. Can be disabled via config. Added new Data generation features. Revived the Forge lighting pipeline, to improve rendering performance. Disabled by default. Added hook to control hill biomes. Added PlantType to the extensible enums. Extended GUIUtils to be more useful. Added hook to override tool requirements when breaking blocks. Added hooks to allow buckets to be better used with custom fluids. Added hook to allow bees to use custom hives. Added ability to use stencil buffers for mods. Added constructor to Music Discs for easier modder extension. Fixes: Fixed lighting issue in GUIs for some models. Fixed bug causing equip tooltip to display when unnecessary. Fixed client desync when interact event is canceled on the client. Fixed invalid arguments passed to first person hand renderer. Fixed chunk watch and unwatch events not firing correctly. Fixed vanilla bug related to rendering states. Fixed error when players join servers in a dimension that doesn't exist. Fixed ItemStack TER not being called. Fixed custom teleporters not being used when moving from the end to overworld. Fixed custom teleporters triggering end game credits. Fixed set dimension command not setting position correctly. Fixed Conduit and Beacon activation on vanilla servers. Fixed potential issue with clients sending invalid data to server. Fixed javac compiling issues on some JDKs Fixed tps and gen commands not working. Fixed note blocks not changing state correctly. Fixed ownership leak in ItemStackHandler. Fixed server config loosing dimension type when using custom dimensions. Fixed vanilla bug that caused the byte order of buffers to be incorrect. Fixed buffer batching not copying all data correctly. Fixed tag serializing empty data. Fixed annotation processor skipping duplicate annotations. Fixed annotation processor incorrectly tagging child annotations. Fixed binary issues when using JDK 9+ and targeting J8. Fixed vanilla recursion issue in advancement loading. Fixed potential NPEs in RegistryObject. Fixed mod resource and data packs being sorted incorrectly. Fixed automatic event subscriber picking wrong mod id when in multi-mod sources. Fixed BackgroundScanHandler erroring on some servers. Fixed swim speed and reach distance not having localization info. Fixed milk buckets removing too many potion effects. Fixed chunk data save event being fired with null world in some cases. Fixed resource leak in vanilla loot table handler. Fixed hoppers not fully inserting into custom inventories with non-standard max stack values. Fixed null item stack being sent to player destroy item hook. Fixed some blocks being darker then they would be in vanilla. Fixed pressing escape not matching pressing done on the mod list screen. Fixed removedByPlayer not being called on the client when breaking blocks. Fixed infinite loading screen when mod resources error. Fixed fluid tanks calling changed events when simulating. Fixed tile entities persisting incorrectly when blockstate changes. Fixed CrowGrowEvents not firing for Bamboo Fixed vanilla screens where pressing escape doesn't match pressing done. Fixed mod duplication issue when using a symbolic links as your mods folder. Fixed server config directory remaining locked after server shutdown. Fixed level change event not firing during enchanting. Fixed duplicate call to chunk load events. Fixed typo in registry alias serialization causing infinite loop. Fixed particles not colliding with the ground correctly. Fixed model transformation ordering. Fixed OBJ models ignoring deffuseLighting setting. Fixed blockstate json serializer using incorrect string. Fixed incorrect argument passed in RenderPipeline potentially causing crash. Fixed FireBlock using flammability instead of spread speed when looking for places to spread.
    1 point
  3. That's the RECOMMENDED version, use the LATEST version.
    1 point
  4. try return an empty stack in slotClick() and for the "number" transfer
    1 point
  5. Everything looks right to me, compared it to a block drop json I have that I know works, seems like everything's right, it looks in the right folder and everything. Just to throw this out there, you aren't in creative mode, are you? Things don't drop in creative mode
    1 point
  6. It is in the Block class public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult blockRayTraceResult) For the decrementation, you get the value with: value = state.get(property) you set it with worldIn.setBlockState(pos, state.with(property, value)); You can figure the rest by yourself
    1 point
  7. You need to: Get the current value Subtract 1 Deal with what happens when this makes it go below the minimum allowed value Set the new value Its a vanilla class. Go find it inside your IDE.
    1 point
  8. Have you registered the Recipe/RecipeSerializer?
    1 point
  9. You should be able to use the 'getStateForPlacement' method found in Block.java to set the life value. This is the code I used for setting the direction of a block public BlockState getStateForPlacement(BlockItemUseContext context) { return this.getDefaultState().with(FACING, context.getPlacementHorizontalFacing().getOpposite()); } For your second problem maybe try using the 'interactWith' method which is found in the AbstractFurnaceBlock.java This is the code I have for a TileEntity I created protected void interactWith(World worldIn, BlockPos pos, PlayerEntity player) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof BrewerTileEntity) { player.openContainer((INamedContainerProvider)tileentity); player.addStat(Stats.INTERACT_WITH_FURNACE); } }
    1 point
  10. 1 point
  11. Congratulations, you shortened my code by TWO CHARACTERS.
    1 point
  12. Howdy The open source Botania mod does something similar with Items (eg a bag that can hold items)- that may have some clues for you. Off the cuff, it sounds you may have a mismatch between client and server. It's not obvious in vanilla but when you open a container (eg for a chest), the container on the server is bound to the vanilla object (usually a tileentity) but the client container is not (in the case of a chest, for example, it's given a freshly-created (empty) IInventory instead of a TileEntity). The client container is synchronised with the server using the GUI slots packets. eg this diagram http://greyminecraftcoder.blogspot.com/2020/04/containers-1144.html -TGG
    1 point
  13. Hi You may need to set a different rendertype eg public class StartupClientOnly { /** * Tell the renderer this is a solid block (default is translucent) * @param event */ @SubscribeEvent public static void onClientSetupEvent(FMLClientSetupEvent event) { RenderTypeLookup.setRenderLayer(yourBlockInstance, RenderType.getTranslucent()); } } where your main mod class has done this: MOD_EVENT_BUS.register(StartupClientOnly.class); although the default is translucent so that seems less likely. Are you sure that your block texture has an alpha channel with the proper values for transparency? -TGG
    1 point
  14. You need to set the render layer using RenderTypeLookup#setRenderLayer within your FMLClientSetupEvent to make blocks transparent. It takes in two parameters: the block and the RenderType. The RenderTypes are as follows: Solid - field_228615_R_ Cutout Mipped - field_228616_S_ Cutout - field_228617_T_ Translucent - field_228618_U_ Translucent (No Crumbling) - field_228619_V_ Leash - field_228620_W_ Water Mask - field_228621_X_ Glint - field_228622_Y_ Entity Glint - field_228623_Z_ Lightning - field_228624_aa_ What you are looking for is either cutout mipped or cutout so use either RenderType#field_228616_S_ or RenderType#field_228617_T_ to accomplish this.
    1 point
×
×
  • Create New...

Important Information

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