├── .editorconfig ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── crash_report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE │ ├── bug_fix.md │ └── new_feature.md └── workflows │ ├── gradle.yml │ ├── pull_request.yml │ └── release.yml ├── .gitignore ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── build.gradle.kts ├── common ├── build.gradle.kts └── src │ ├── .gitignore │ ├── api │ └── java │ │ └── net │ │ └── caffeinemc │ │ └── mods │ │ └── lithium │ │ └── api │ │ └── inventory │ │ ├── LithiumCooldownReceivingInventory.java │ │ ├── LithiumDefaultedList.java │ │ ├── LithiumInventory.java │ │ └── LithiumTransferConditionInventory.java │ ├── gametest │ └── resources │ │ └── data │ │ └── lithium-gametest │ │ ├── gametest │ │ └── structure │ │ │ ├── ai_baby_pig_follow_parent.snbt │ │ │ ├── ai_johnny_witch_throw_regeneration.snbt │ │ │ ├── ai_villager_hide_in_home.snbt │ │ │ ├── armorstand_pushed_by_water.snbt │ │ │ ├── cart_signalstrength.snbt │ │ │ ├── comparator_update_collection.snbt │ │ │ ├── creeper_flee_from_cat.snbt │ │ │ ├── frog_jump.snbt │ │ │ ├── goat_jump.snbt │ │ │ ├── hopper_dc_interaction_change.snbt │ │ │ ├── hopper_interaction_change.snbt │ │ │ ├── hopper_interaction_change_v2.snbt │ │ │ ├── hopper_item_datacommand.snbt │ │ │ ├── hopper_storagecart_interaction.snbt │ │ │ ├── hopper_transfer_speed.snbt │ │ │ ├── item_sorter.snbt │ │ │ ├── itempickup.snbt │ │ │ ├── lava_push_speed.snbt │ │ │ ├── llama_pathfinding.snbt │ │ │ ├── moving_block_collision.snbt │ │ │ ├── pathfinding_avoid_lava.snbt │ │ │ ├── pathfinding_prefer_water_over_lava.snbt │ │ │ ├── pig_dispensed_onto_pressure_plate.snbt │ │ │ ├── spawn_almost_all_entities.snbt │ │ │ ├── tnt_above_world.snbt │ │ │ ├── tnt_below_world.snbt │ │ │ ├── tnt_block_shield_entity.snbt │ │ │ ├── tnt_knockback_entity.snbt │ │ │ └── tnt_minecart_rail_shielding.snbt │ │ ├── structure │ │ ├── test_environment │ │ └── lithium_default_environment.json │ │ └── test_instance │ │ ├── ai_baby_pig_follow_parent.json │ │ ├── ai_johnny_witch_throw_regeneration.json │ │ ├── ai_villager_hide_in_home.json │ │ ├── armorstand_pushed_by_water.json │ │ ├── cart_signalstrength.json │ │ ├── comparator_update_collection.json │ │ ├── creeper_flee_from_cat.json │ │ ├── frog_jump.json │ │ ├── goat_jump.json │ │ ├── hopper_dc_interaction_change.json │ │ ├── hopper_interaction_change.json │ │ ├── hopper_interaction_change_v2.json │ │ ├── hopper_item_datacommand.json │ │ ├── hopper_storagecart_interaction.json │ │ ├── hopper_transfer_speed.json │ │ ├── item_sorter.json │ │ ├── itempickup.json │ │ ├── lava_push_speed.json │ │ ├── llama_pathfinding.json │ │ ├── moving_block_collision.json │ │ ├── pathfinding_avoid_lava.json │ │ ├── pathfinding_prefer_water_over_lava.json │ │ ├── pig_dispensed_onto_pressure_plate.json │ │ ├── spawn_almost_all_entities.json │ │ ├── tnt_above_world.json │ │ ├── tnt_below_world.json │ │ ├── tnt_block_shield_entity.json │ │ ├── tnt_knockback_entity.json │ │ └── tnt_minecart_rail_shielding.json │ └── main │ ├── java │ └── net │ │ └── caffeinemc │ │ └── mods │ │ └── lithium │ │ ├── common │ │ ├── LithiumMod.java │ │ ├── ai │ │ │ ├── MemoryModificationCounter.java │ │ │ ├── WeightedListIterable.java │ │ │ ├── brain │ │ │ │ └── SensorHelper.java │ │ │ └── pathing │ │ │ │ ├── BlockStatePathingCache.java │ │ │ │ └── PathNodeCache.java │ │ ├── block │ │ │ ├── BlockCountingSection.java │ │ │ ├── BlockListeningSection.java │ │ │ ├── BlockStateFlagHolder.java │ │ │ ├── BlockStateFlags.java │ │ │ ├── TrackedBlockStatePredicate.java │ │ │ ├── entity │ │ │ │ ├── SetBlockStateHandlingBlockEntity.java │ │ │ │ ├── SetChangedHandlingBlockEntity.java │ │ │ │ ├── ShapeUpdateHandlingBlockBehaviour.java │ │ │ │ ├── SleepUntilTimeBlockEntityTickInvoker.java │ │ │ │ ├── SleepingBlockEntity.java │ │ │ │ ├── inventory_change_tracking │ │ │ │ │ ├── InventoryChangeEmitter.java │ │ │ │ │ ├── InventoryChangeListener.java │ │ │ │ │ └── InventoryChangeTracker.java │ │ │ │ └── inventory_comparator_tracking │ │ │ │ │ ├── ComparatorTracker.java │ │ │ │ │ └── ComparatorTracking.java │ │ │ └── redstone │ │ │ │ └── RedstoneWirePowerCalculations.java │ │ ├── client │ │ │ ├── ClientWorldAccessor.java │ │ │ └── SharedFields.java │ │ ├── config │ │ │ ├── LithiumConfig.java │ │ │ └── Option.java │ │ ├── entity │ │ │ ├── EntityClassGroup.java │ │ │ ├── EquipmentInfo.java │ │ │ ├── FluidCachingEntity.java │ │ │ ├── LithiumEntityCollisions.java │ │ │ ├── NavigatingEntity.java │ │ │ ├── PositionedEntityTrackingSection.java │ │ │ ├── TypeFilterableListInternalAccess.java │ │ │ ├── item │ │ │ │ ├── ItemEntityLazyIterationConsumer.java │ │ │ │ └── ItemEntityList.java │ │ │ ├── movement │ │ │ │ └── ChunkAwareBlockCollisionSweeper.java │ │ │ ├── projectile │ │ │ │ └── ProjectileEntityClassGroup.java │ │ │ └── pushable │ │ │ │ ├── EntityPushablePredicate.java │ │ │ │ ├── FeetBlockCachingEntity.java │ │ │ │ └── PushableEntityClassGroup.java │ │ ├── hopper │ │ │ ├── BlockStateOnlyInventory.java │ │ │ ├── ComparatorUpdatePattern.java │ │ │ ├── HopperCachingState.java │ │ │ ├── HopperHelper.java │ │ │ ├── InventoryHelper.java │ │ │ ├── LithiumDoubleInventory.java │ │ │ ├── LithiumDoubleStackList.java │ │ │ ├── LithiumStackList.java │ │ │ └── UpdateReceiver.java │ │ ├── initialization │ │ │ └── BlockInfoInitializer.java │ │ ├── reflection │ │ │ └── ReflectionUtil.java │ │ ├── services │ │ │ ├── PlatformEntityAccess.java │ │ │ ├── PlatformMappingInformation.java │ │ │ ├── PlatformMixinOverrides.java │ │ │ ├── PlatformModCompat.java │ │ │ ├── PlatformRuntimeInformation.java │ │ │ └── Services.java │ │ ├── shapes │ │ │ ├── CuboidVoxelSet.java │ │ │ ├── OffsetVoxelShapeCache.java │ │ │ ├── VoxelShapeAlignedCuboid.java │ │ │ ├── VoxelShapeAlignedCuboidOffset.java │ │ │ ├── VoxelShapeCaster.java │ │ │ ├── VoxelShapeEmpty.java │ │ │ ├── VoxelShapeHelper.java │ │ │ ├── VoxelShapeMatchesAnywhere.java │ │ │ ├── VoxelShapeSimpleCube.java │ │ │ ├── lists │ │ │ │ └── OffsetFractionalDoubleList.java │ │ │ └── pairs │ │ │ │ └── LithiumDoublePairList.java │ │ ├── tracking │ │ │ ├── VicinityCache.java │ │ │ ├── VicinityCacheProvider.java │ │ │ ├── block │ │ │ │ ├── ChunkSectionChangeCallback.java │ │ │ │ └── SectionedBlockChangeTracker.java │ │ │ └── entity │ │ │ │ ├── EntityMovementTrackerSection.java │ │ │ │ ├── MovementTrackerHelper.java │ │ │ │ ├── SectionedColliderEntityMovementTracker.java │ │ │ │ ├── SectionedEntityMovementListener.java │ │ │ │ ├── SectionedEntityMovementTracker.java │ │ │ │ ├── SectionedInventoryEntityMovementTracker.java │ │ │ │ ├── SectionedItemEntityMovementTracker.java │ │ │ │ └── ToggleableMovementTracker.java │ │ ├── util │ │ │ ├── ArrayConstants.java │ │ │ ├── ChunkConstants.java │ │ │ ├── DirectionConstants.java │ │ │ ├── Distances.java │ │ │ ├── POIRegistryEntries.java │ │ │ ├── Pos.java │ │ │ ├── change_tracking │ │ │ │ ├── ChangePublisher.java │ │ │ │ └── ChangeSubscriber.java │ │ │ ├── collections │ │ │ │ ├── BucketedList.java │ │ │ │ ├── DummyList.java │ │ │ │ ├── HashedReferenceList.java │ │ │ │ ├── LazyList.java │ │ │ │ ├── ListeningList.java │ │ │ │ ├── ListeningLong2ObjectOpenHashMap.java │ │ │ │ ├── LongJumpChoiceList.java │ │ │ │ ├── MaskedList.java │ │ │ │ ├── Object2BooleanCacheTable.java │ │ │ │ ├── PredicateFilterableList.java │ │ │ │ └── ReferenceMaskedList.java │ │ │ ├── deduplication │ │ │ │ └── LithiumInterner.java │ │ │ ├── lock │ │ │ │ ├── NullLock.java │ │ │ │ └── NullReadWriteLock.java │ │ │ ├── math │ │ │ │ ├── CompactSineLUT.java │ │ │ │ └── MutableVec3d.java │ │ │ └── tuples │ │ │ │ ├── Range6Int.java │ │ │ │ ├── RefIntPair.java │ │ │ │ ├── SortedPointOfInterest.java │ │ │ │ └── WorldSectionBox.java │ │ └── world │ │ │ ├── ChunkAwareEntityIterable.java │ │ │ ├── ChunkRandomSource.java │ │ │ ├── ChunkView.java │ │ │ ├── ClimbingMobCachingSection.java │ │ │ ├── GameEventDispatcherStorage.java │ │ │ ├── LithiumData.java │ │ │ ├── ServerWorldExtended.java │ │ │ ├── WorldHelper.java │ │ │ ├── block_pattern_matching │ │ │ ├── BlockPatternExtended.java │ │ │ └── BlockSearch.java │ │ │ ├── blockentity │ │ │ ├── BlockEntityGetter.java │ │ │ └── SupportCache.java │ │ │ ├── blockview │ │ │ └── SingleBlockBlockView.java │ │ │ ├── chunk │ │ │ ├── ChunkHolderExtended.java │ │ │ ├── ChunkStatusTracker.java │ │ │ ├── ClassGroupFilterableList.java │ │ │ ├── CompactingPackedIntegerArray.java │ │ │ ├── LithiumHashPalette.java │ │ │ └── heightmap │ │ │ │ └── CombinedHeightmapUpdate.java │ │ │ ├── explosions │ │ │ └── ClipContextAccess.java │ │ │ ├── interests │ │ │ ├── PointOfInterestSetExtended.java │ │ │ ├── PointOfInterestStorageExtended.java │ │ │ ├── RegionBasedStorageSectionExtended.java │ │ │ └── iterator │ │ │ │ ├── NearbyPointOfInterestStream.java │ │ │ │ ├── SinglePointOfInterestTypeFilter.java │ │ │ │ └── SphereChunkOrderedPoiSetSpliterator.java │ │ │ ├── listeners │ │ │ ├── WorldBorderListenerOnce.java │ │ │ └── WorldBorderPositionListenerMulti.java │ │ │ └── scheduler │ │ │ └── OrderedTickQueue.java │ │ └── mixin │ │ ├── LithiumMixinPlugin.java │ │ ├── ai │ │ ├── package-info.java │ │ ├── pathing │ │ │ ├── BlockStateBaseMixin.java │ │ │ ├── FlyNodeEvaluatorMixin.java │ │ │ ├── PathNavigationRegionMixin.java │ │ │ ├── PathfindingContextAccessor.java │ │ │ ├── PathfindingContextMixin.java │ │ │ ├── WalkNodeEvaluatorMixin.java │ │ │ └── package-info.java │ │ ├── poi │ │ │ ├── PoiManagerMixin.java │ │ │ ├── PoiSectionMixin.java │ │ │ ├── SectionStorageMixin.java │ │ │ ├── fast_portals │ │ │ │ ├── PoiManagerMixin.java │ │ │ │ ├── PortalForcerMixin.java │ │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ └── tasks │ │ │ │ ├── LocateHidingPlaceMixin.java │ │ │ │ ├── RaiderEntityAttackHomeGoalMixin.java │ │ │ │ └── package-info.java │ │ ├── raid │ │ │ ├── RaidMixin.java │ │ │ ├── Raider$ObtainRaidLeaderBannerGoalMixin.java │ │ │ ├── RaiderMixin.java │ │ │ └── package-info.java │ │ ├── sensor │ │ │ ├── package-info.java │ │ │ ├── replace_streams │ │ │ │ ├── package-info.java │ │ │ │ └── tempting │ │ │ │ │ ├── TemptingSensorMixin.java │ │ │ │ │ └── package-info.java │ │ │ └── secondary_poi │ │ │ │ ├── SecondaryPoiSensorMixin.java │ │ │ │ └── package-info.java │ │ ├── task │ │ │ ├── launch │ │ │ │ ├── BrainMixin.java │ │ │ │ └── package-info.java │ │ │ ├── memory_change_counting │ │ │ │ ├── BehaviorMixin.java │ │ │ │ ├── BrainMixin.java │ │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ ├── replace_streams │ │ │ │ ├── GateBehaviorMixin.java │ │ │ │ ├── ShufflingListMixin.java │ │ │ │ └── package-info.java │ │ │ └── run │ │ │ │ ├── long_jump_weighted_choice │ │ │ │ ├── LongJumpToRandomPosMixin.java │ │ │ │ └── package-info.java │ │ │ │ └── package-info.java │ │ └── useless_sensors │ │ │ ├── BrainAccessor.java │ │ │ ├── SensorAccessor.java │ │ │ ├── goat_item_sensor │ │ │ ├── GoatMixin.java │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ └── parent_animal_sensor │ │ │ ├── AgeableMobMixin.java │ │ │ └── package-info.java │ │ ├── alloc │ │ ├── chunk_random │ │ │ ├── LevelMixin.java │ │ │ ├── ServerLevelMixin.java │ │ │ └── package-info.java │ │ ├── composter │ │ │ ├── ComposterMixin.java │ │ │ └── package-info.java │ │ ├── deep_passengers │ │ │ ├── EntityMixin.java │ │ │ └── package-info.java │ │ ├── entity_iteration │ │ │ ├── ClassInstanceMultiMapAccessor.java │ │ │ ├── EntitySectionMixin.java │ │ │ └── package-info.java │ │ ├── entity_tracker │ │ │ ├── ChunkMap$TrackedEntityMixin.java │ │ │ └── package-info.java │ │ ├── enum_values │ │ │ ├── package-info.java │ │ │ ├── piston_block │ │ │ │ ├── PistonBaseBlockMixin.java │ │ │ │ └── package-info.java │ │ │ ├── piston_handler │ │ │ │ ├── PistonStructureResolverMixin.java │ │ │ │ └── package-info.java │ │ │ └── redstone_wire │ │ │ │ ├── RedStoneWireBlockMixin.java │ │ │ │ └── package-info.java │ │ ├── explosion_behavior │ │ │ ├── EntityBasedExplosionDamageCalculatorMixin.java │ │ │ └── package-info.java │ │ ├── nbt │ │ │ ├── CompoundTagMixin.java │ │ │ └── package-info.java │ │ └── package-info.java │ │ ├── block │ │ ├── flatten_states │ │ │ ├── FluidStateMixin.java │ │ │ └── package-info.java │ │ ├── fluid │ │ │ ├── flow │ │ │ │ ├── FlowingFluidMixin.java │ │ │ │ └── package-info.java │ │ │ └── package-info.java │ │ ├── hopper │ │ │ ├── AbstractChestBoatMixin.java │ │ │ ├── AbstractContainerMenuMixin.java │ │ │ ├── BlockBehaviourMixin.java │ │ │ ├── ChiseledBookShelfBlockEntityMixin.java │ │ │ ├── ClassInstanceMultiMapMixin.java │ │ │ ├── ComposterMixin.java │ │ │ ├── CompoundContainerAccessor.java │ │ │ ├── ContainerMixin.java │ │ │ ├── EntityAccessor.java │ │ │ ├── EntityDataAccessorMixin.java │ │ │ ├── EntitySectionAccessor.java │ │ │ ├── HopperBlockEntityMixin.java │ │ │ ├── HopperBlockMixin.java │ │ │ ├── InventoryAccessors.java │ │ │ ├── NonNullListAccessor.java │ │ │ ├── OldMinecartBehaviorMixin.java │ │ │ ├── README.md │ │ │ └── package-info.java │ │ ├── moving_block_shapes │ │ │ ├── PistonMovingBlockEntityMixin.java │ │ │ ├── VoxelShapeMixin.java │ │ │ └── package-info.java │ │ ├── package-info.java │ │ └── redstone_wire │ │ │ ├── DefaultRedstoneWireEvaluatorMixin.java │ │ │ ├── RedStoneWireBlockMixin.java │ │ │ ├── RedstoneWireEvaluatorMixin.java │ │ │ └── package-info.java │ │ ├── block_pattern_matching │ │ ├── BlockPatternMixin.java │ │ ├── EndDragonFightMixin.java │ │ └── package-info.java │ │ ├── cached_hashcode │ │ ├── FlowingFluid$BlockStatePairKeyMixin.java │ │ └── package-info.java │ │ ├── chunk │ │ ├── entity_class_groups │ │ │ ├── ClassInstanceMultiMapMixin.java │ │ │ ├── ClientLevelMixin.java │ │ │ └── package-info.java │ │ ├── no_locking │ │ │ ├── LevelChunkSectionMixin.java │ │ │ ├── PalettedContainerMixin.java │ │ │ └── package-info.java │ │ ├── no_validation │ │ │ ├── SimpleBitStorageMixin.java │ │ │ ├── ZeroBitStorageMixin.java │ │ │ └── package-info.java │ │ ├── package-info.java │ │ ├── palette │ │ │ ├── PalettedContainer$StrategyMixin.java │ │ │ └── package-info.java │ │ └── serialization │ │ │ ├── PalettedContainerMixin.java │ │ │ ├── SimpleBitStorageMixin.java │ │ │ └── package-info.java │ │ ├── collections │ │ ├── attributes │ │ │ ├── AttributeMapMixin.java │ │ │ └── package-info.java │ │ ├── block_entity_tickers │ │ │ ├── LevelChunkMixin.java │ │ │ └── package-info.java │ │ ├── brain │ │ │ ├── BrainMixin.java │ │ │ └── package-info.java │ │ ├── chunk_tickets │ │ │ ├── SortedArraySetMixin.java │ │ │ └── package-info.java │ │ ├── entity_by_type │ │ │ ├── ClassInstanceMultiMapMixin.java │ │ │ └── package-info.java │ │ ├── entity_filtering │ │ │ ├── ClassInstanceMultiMapMixin.java │ │ │ └── package-info.java │ │ ├── entity_ticking │ │ │ ├── EntityTickListMixin.java │ │ │ └── package-info.java │ │ ├── fluid_submersion │ │ │ ├── EntityMixin.java │ │ │ └── package-info.java │ │ ├── gamerules │ │ │ ├── GameRulesMixin.java │ │ │ └── package-info.java │ │ ├── mob_spawning │ │ │ ├── MobSpawnSettingsMixin.java │ │ │ ├── WeightedListMixin.java │ │ │ └── package-info.java │ │ └── package-info.java │ │ ├── debug │ │ ├── package-info.java │ │ └── palette │ │ │ ├── ClientBoundLevelChunkPacketDataAccessor.java │ │ │ ├── ClientPacketListenerMixin.java │ │ │ ├── PalettedContainerMixin.java │ │ │ └── package-info.java │ │ ├── entity │ │ ├── collisions │ │ │ ├── intersection │ │ │ │ ├── EntityGetterMixin.java │ │ │ │ ├── LevelMixin.java │ │ │ │ └── package-info.java │ │ │ ├── movement │ │ │ │ ├── EntityMixin.java │ │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ └── unpushable_cramming │ │ │ │ ├── AbstractBoatMixin.java │ │ │ │ ├── EntityMixin.java │ │ │ │ ├── EntitySectionMixin.java │ │ │ │ ├── EntitySelectorMixin.java │ │ │ │ ├── LevelMixin.java │ │ │ │ ├── LivingEntityMixin.java │ │ │ │ ├── OldMinecartBehaviorMixin.java │ │ │ │ ├── README.md │ │ │ │ └── package-info.java │ │ ├── equipment_tracking │ │ │ ├── EntityEquipmentMixin.java │ │ │ ├── enchantment_ticking │ │ │ │ ├── LivingEntityMixin.java │ │ │ │ └── package-info.java │ │ │ ├── equipment_changes │ │ │ │ ├── LivingEntityMixin.java │ │ │ │ └── package-info.java │ │ │ └── package-info.java │ │ ├── fast_elytra_check │ │ │ ├── LivingEntityMixin.java │ │ │ └── package-info.java │ │ ├── fast_hand_swing │ │ │ ├── LivingEntityMixin.java │ │ │ └── package-info.java │ │ ├── fast_powder_snow_check │ │ │ ├── LivingEntityMixin.java │ │ │ └── package-info.java │ │ ├── fast_retrieval │ │ │ ├── EntitySectionStorageMixin.java │ │ │ └── package-info.java │ │ ├── inactive_navigations │ │ │ ├── DrownedEntityLeaveWaterGoalMixin.java │ │ │ ├── DrownedMixin.java │ │ │ ├── LivingEntityMixin.java │ │ │ ├── MobMixin.java │ │ │ ├── PathNavigationMixin.java │ │ │ ├── ServerLevel$EntityCallbacksMixin.java │ │ │ ├── ServerLevelMixin.java │ │ │ └── package-info.java │ │ ├── package-info.java │ │ ├── replace_entitytype_predicates │ │ │ ├── ArmorStandMixin.java │ │ │ ├── GolemRandomStrollInVillageGoalMixin.java │ │ │ ├── HangingEntityMixin.java │ │ │ ├── ItemFrameMixin.java │ │ │ ├── LlamaFollowCaravanGoalMixin.java │ │ │ ├── OldMinecartBehaviorMixin.java │ │ │ └── package-info.java │ │ └── sprinting_particles │ │ │ ├── EntityMixin.java │ │ │ └── package-info.java │ │ ├── experimental │ │ ├── client_tick │ │ │ ├── entity │ │ │ │ ├── base_tick │ │ │ │ │ ├── package-info.java │ │ │ │ │ ├── unused_ambient_sound │ │ │ │ │ │ ├── MobMixin.java │ │ │ │ │ │ └── package-info.java │ │ │ │ │ └── unused_water_supply │ │ │ │ │ │ ├── AgeableWaterCreatureMixin.java │ │ │ │ │ │ └── package-info.java │ │ │ │ ├── package-info.java │ │ │ │ └── unused_brain │ │ │ │ │ ├── BrainMixin.java │ │ │ │ │ ├── LivingEntityMixin.java │ │ │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ └── particle │ │ │ │ ├── biome_particles │ │ │ │ ├── AmbientParticleSettingsMixin.java │ │ │ │ ├── ClientLevelMixin.java │ │ │ │ └── package-info.java │ │ │ │ └── package-info.java │ │ ├── entity │ │ │ ├── block_caching │ │ │ │ ├── EntityMixin.java │ │ │ │ ├── block_support │ │ │ │ │ ├── EntityMixin.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── package-info.java │ │ │ │ └── suffocation │ │ │ │ │ ├── EntityMixin.java │ │ │ │ │ └── package-info.java │ │ │ ├── item_entity_merging │ │ │ │ ├── ItemEntityMixin.java │ │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ └── projectile_projectile_collisions │ │ │ │ ├── ProjectileUtilMixin.java │ │ │ │ └── package-info.java │ │ └── package-info.java │ │ ├── gen │ │ ├── cached_generator_settings │ │ │ ├── NoiseBasedChunkGeneratorMixin.java │ │ │ └── package-info.java │ │ └── package-info.java │ │ ├── math │ │ ├── fast_blockpos │ │ │ ├── BlockPosMixin.java │ │ │ ├── DirectionMixin.java │ │ │ └── package-info.java │ │ ├── fast_util │ │ │ ├── AABBMixin.java │ │ │ ├── AxisCycleDirectionMixin.java │ │ │ ├── DirectionMixin.java │ │ │ └── package-info.java │ │ ├── package-info.java │ │ └── sine_lut │ │ │ ├── MthMixin.java │ │ │ └── package-info.java │ │ ├── minimal_nonvanilla │ │ ├── ai │ │ │ ├── package-info.java │ │ │ └── sensor │ │ │ │ ├── frog_attackables │ │ │ │ ├── FrogAttackablesSensorMixin.java │ │ │ │ └── package-info.java │ │ │ │ └── package-info.java │ │ ├── collisions │ │ │ └── empty_space │ │ │ │ ├── ArrayVoxelShapeInvoker.java │ │ │ │ ├── BitSetDiscreteVoxelShapeAccessor.java │ │ │ │ ├── LevelMixin.java │ │ │ │ └── package-info.java │ │ ├── package-info.java │ │ ├── spawning │ │ │ ├── EntitySectionAccessor.java │ │ │ ├── EntitySectionStorageMixin.java │ │ │ ├── PersistentEntitySectionManagerAccessor.java │ │ │ ├── ServerChunkCacheMixin.java │ │ │ ├── ServerLevelAccessor.java │ │ │ └── package-info.java │ │ └── world │ │ │ └── block_entity_ticking │ │ │ └── support_cache │ │ │ ├── BlockEntityMixin.java │ │ │ ├── DirectBlockEntityTickInvokerMixin.java │ │ │ ├── LevelChunkMixin.java │ │ │ └── package-info.java │ │ ├── shapes │ │ ├── blockstate_cache │ │ │ ├── BlockMixin.java │ │ │ └── package-info.java │ │ ├── lazy_shape_context │ │ │ ├── EntityCollisionContextMixin.java │ │ │ └── package-info.java │ │ ├── optimized_matching │ │ │ ├── ShapesMixin.java │ │ │ └── package-info.java │ │ ├── package-info.java │ │ ├── precompute_shape_arrays │ │ │ ├── CubePointRangeMixin.java │ │ │ ├── CubeVoxelShapeMixin.java │ │ │ └── package-info.java │ │ ├── shape_merging │ │ │ ├── ShapesMixin.java │ │ │ └── package-info.java │ │ └── specialized_shapes │ │ │ ├── ShapesMixin.java │ │ │ ├── VoxelShapeMixin.java │ │ │ └── package-info.java │ │ ├── util │ │ ├── accessors │ │ │ ├── EntitySectionAccessor.java │ │ │ ├── ItemEntityAccessor.java │ │ │ ├── ItemStackAccessor.java │ │ │ ├── LevelAccessor.java │ │ │ ├── PersistentEntitySectionManagerAccessor.java │ │ │ ├── ServerLevelAccessor.java │ │ │ ├── TransientEntitySectionManagerAccessor.java │ │ │ └── package-info.java │ │ ├── block_entity_retrieval │ │ │ ├── LevelMixin.java │ │ │ └── package-info.java │ │ ├── block_tracking │ │ │ ├── BlockStateBaseMixin.java │ │ │ ├── LevelChunkSectionMixin.java │ │ │ └── package-info.java │ │ ├── chunk_access │ │ │ ├── LevelReaderMixin.java │ │ │ ├── PathNavigationRegionMixin.java │ │ │ └── package-info.java │ │ ├── chunk_status_tracking │ │ │ ├── ChunkHolderMixin.java │ │ │ ├── LevelChunkMixin.java │ │ │ └── package-info.java │ │ ├── data_storage │ │ │ ├── LevelMixin.java │ │ │ └── package-info.java │ │ ├── entity_collection_replacement │ │ │ ├── ClassInstanceMultiMapMixin.java │ │ │ └── package-info.java │ │ ├── entity_movement_tracking │ │ │ ├── EntitySectionMixin.java │ │ │ ├── PersistentEntitySectionManagerAccessor.java │ │ │ ├── ServerEntityManagerListenerMixin.java │ │ │ ├── ServerLevelAccessor.java │ │ │ └── package-info.java │ │ ├── entity_section_position │ │ │ ├── EntitySectionMixin.java │ │ │ ├── EntitySectionStorageMixin.java │ │ │ └── package-info.java │ │ ├── initialization │ │ │ └── package-info.java │ │ ├── inventory_change_listening │ │ │ ├── BaseContainerBlockEntityMixin.java │ │ │ ├── BlockEntityMixin.java │ │ │ ├── StackListReplacementTracking.java │ │ │ └── package-info.java │ │ ├── inventory_comparator_tracking │ │ │ ├── BlockEntityMixin.java │ │ │ ├── DiodeBlockMixin.java │ │ │ └── package-info.java │ │ ├── item_component_and_count_tracking │ │ │ ├── ItemEntityMixin.java │ │ │ ├── ItemStackMixin.java │ │ │ ├── PatchedDataComponentMapMixin.java │ │ │ └── package-info.java │ │ ├── package-info.java │ │ └── world_border_listener │ │ │ ├── WorldBorderMixin.java │ │ │ └── package-info.java │ │ └── world │ │ ├── block_entity_ticking │ │ ├── chunk_tickable │ │ │ ├── LevelMixin.java │ │ │ └── package-info.java │ │ ├── package-info.java │ │ ├── sleeping │ │ │ ├── BlockEntityMixin.java │ │ │ ├── LevelChunkMixin.java │ │ │ ├── LevelMixin.java │ │ │ ├── ServerLevelMixin.java │ │ │ ├── WrappedBlockEntityTickInvokerAccessor.java │ │ │ ├── brewing_stand │ │ │ │ ├── BrewingStandBlockEntityMixin.java │ │ │ │ └── package-info.java │ │ │ ├── campfire │ │ │ │ ├── CampfireBlockEntityMixin.java │ │ │ │ ├── lit │ │ │ │ │ ├── CampfireBlockEntityMixin.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── package-info.java │ │ │ │ └── unlit │ │ │ │ │ ├── CampfireBlockEntityMixin.java │ │ │ │ │ └── package-info.java │ │ │ ├── chest_animation │ │ │ │ ├── ChestBlockEntityMixin.java │ │ │ │ ├── EnderChestBlockEntityMixin.java │ │ │ │ └── package-info.java │ │ │ ├── crafter │ │ │ │ ├── CrafterBlockEntityMixin.java │ │ │ │ └── package-info.java │ │ │ ├── furnace │ │ │ │ ├── AbstractFurnaceBlockEntityMixin.java │ │ │ │ └── package-info.java │ │ │ ├── hopper │ │ │ │ ├── HopperBlockEntityMixin.java │ │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ └── shulker_box │ │ │ │ ├── ShulkerBoxBlockEntityMixin.java │ │ │ │ └── package-info.java │ │ └── world_border │ │ │ ├── DirectBlockEntityTickInvokerMixin.java │ │ │ └── package-info.java │ │ ├── chunk_access │ │ ├── ChunkHolderMixin.java │ │ ├── GenerationChunkHolderAccessor.java │ │ ├── LevelMixin.java │ │ ├── ServerChunkCacheMixin.java │ │ └── package-info.java │ │ ├── chunk_ticking │ │ ├── package-info.java │ │ └── spread_ice │ │ │ ├── BiomeMixin.java │ │ │ └── package-info.java │ │ ├── combined_heightmap_update │ │ ├── HeightmapAccessor.java │ │ ├── LevelChunkMixin.java │ │ └── package-info.java │ │ ├── explosions │ │ ├── block_raycast │ │ │ ├── ServerExplosionMixin.java │ │ │ └── package-info.java │ │ ├── entity_raycast │ │ │ ├── ClipContextMixin.java │ │ │ ├── ServerExplosionMixin.java │ │ │ └── package-info.java │ │ └── package-info.java │ │ ├── game_events │ │ ├── dispatch │ │ │ ├── GameEventDispatcherMixin.java │ │ │ ├── LevelChunkMixin.java │ │ │ └── package-info.java │ │ └── package-info.java │ │ ├── inline_block_access │ │ ├── LevelChunkMixin.java │ │ ├── LevelMixin.java │ │ └── package-info.java │ │ ├── inline_height │ │ ├── LevelChunkMixin.java │ │ ├── LevelMixin.java │ │ └── package-info.java │ │ ├── package-info.java │ │ ├── raycast │ │ ├── BlockGetterMixin.java │ │ ├── ClipContextAccessor.java │ │ └── package-info.java │ │ ├── temperature_cache │ │ ├── BiomeMixin.java │ │ └── package-info.java │ │ └── tick_scheduler │ │ ├── LevelChunkTicksMixin.java │ │ └── package-info.java │ └── resources │ ├── assets │ └── lithium │ │ └── lithium-icon.png │ ├── lithium.accesswidener │ └── lithium.mixins.json ├── components └── mixin-config-plugin │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties │ ├── settings.gradle │ └── src │ └── main │ └── java │ └── net │ └── caffeinemc │ └── gradle │ ├── CreateMixinConfigTask.java │ ├── DefaultConfigCreator.java │ ├── GradleMixinConfigPlugin.java │ ├── MixinConfigDependency.java │ └── MixinConfigOption.java ├── fabric ├── build.gradle.kts └── src │ ├── gametest │ ├── java │ │ └── net │ │ │ └── caffeinemc │ │ │ └── mods │ │ │ └── lithium │ │ │ └── fabric │ │ │ └── gametest │ │ │ └── LithiumFabricGameTest.java │ └── resources │ │ └── fabric.mod.json │ └── main │ ├── java │ └── net │ │ └── caffeinemc │ │ └── mods │ │ └── lithium │ │ └── fabric │ │ ├── FabricEntityAccess.java │ │ ├── FabricMappingInformation.java │ │ ├── FabricMixinOverrides.java │ │ ├── FabricModCompat.java │ │ ├── FabricRuntimeInformation.java │ │ ├── LithiumFabricMod.java │ │ └── mixin │ │ ├── block │ │ └── hopper │ │ │ └── LevelMixin.java │ │ ├── collections │ │ └── poi_types │ │ │ ├── PoiTypesMixin.java │ │ │ └── package-info.java │ │ ├── compat │ │ └── worldedit │ │ │ ├── LevelChunkMixin.java │ │ │ └── package-info.java │ │ ├── entity │ │ └── collisions │ │ │ └── fluid │ │ │ ├── EntityMixin.java │ │ │ └── package-info.java │ │ ├── experimental │ │ └── entity │ │ │ └── block_caching │ │ │ └── fluid_pushing │ │ │ ├── EntityMixin.java │ │ │ └── package-info.java │ │ └── util │ │ ├── initialization │ │ └── FuelValuesMixin.java │ │ └── inventory_change_listening │ │ ├── BlockEntityMixin.java │ │ └── ChestBlockEntityMixin.java │ └── resources │ ├── META-INF │ └── services │ │ ├── net.caffeinemc.mods.lithium.common.services.PlatformEntityAccess │ │ ├── net.caffeinemc.mods.lithium.common.services.PlatformMappingInformation │ │ ├── net.caffeinemc.mods.lithium.common.services.PlatformMixinOverrides │ │ ├── net.caffeinemc.mods.lithium.common.services.PlatformModCompat │ │ └── net.caffeinemc.mods.lithium.common.services.PlatformRuntimeInformation │ ├── fabric.mod.json │ └── lithium-fabric.mixins.json ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── idea └── inspections.xml ├── lithium-fabric-mixin-config.md ├── lithium-mixin-config.md ├── lithium-neoforge-mixin-config.md ├── neoforge ├── build.gradle.kts └── src │ ├── gametest │ └── java │ │ └── net │ │ └── caffeinemc │ │ └── mods │ │ └── lithium │ │ └── neoforge │ │ └── test │ │ └── LithiumNeoforgeGameTest.java │ └── main │ ├── java │ └── net │ │ └── caffeinemc │ │ └── mods │ │ └── lithium │ │ └── neoforge │ │ ├── LithiumNeoForgeMod.java │ │ ├── NeoForgeEntityAccess.java │ │ ├── NeoForgeMappingInformation.java │ │ ├── NeoForgeMixinOverrides.java │ │ ├── NeoForgeModCompat.java │ │ ├── NeoForgeRuntimeInformation.java │ │ └── mixin │ │ ├── block │ │ └── hopper │ │ │ ├── HopperBlockEntityMixin.java │ │ │ └── LevelMixin.java │ │ ├── startup │ │ ├── MinecraftMixin.java │ │ └── package-info.java │ │ └── util │ │ ├── initialization │ │ └── DataMapHooksMixin.java │ │ └── inventory_change_listening │ │ └── ChestBlockEntityMixin.java │ └── resources │ ├── META-INF │ ├── accesstransformer.cfg │ ├── neoforge.mods.toml │ └── services │ │ ├── net.caffeinemc.mods.lithium.common.services.PlatformEntityAccess │ │ ├── net.caffeinemc.mods.lithium.common.services.PlatformMappingInformation │ │ ├── net.caffeinemc.mods.lithium.common.services.PlatformMixinOverrides │ │ ├── net.caffeinemc.mods.lithium.common.services.PlatformModCompat │ │ └── net.caffeinemc.mods.lithium.common.services.PlatformRuntimeInformation │ └── lithium-neoforge.mixins.json └── settings.gradle.kts /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE/new_feature.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug fix 3 | about: Use this template if you're creating a pull request which adds a feature or other enhancement 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | ### Preface 11 | 12 | Please read our [Contributor Guidelines](https://github.com/CaffeineMC/lithium-fabric/blob/1.17.x/dev/CONTRIBUTING.md) 13 | before submitting any pull requests to this repository. 14 | 15 | By submitting a pull request, you are indicating that you agree to 16 | the [Contributor License Agreement](https://github.com/CaffeineMC/lithium-fabric/blob/1.17.x/dev/CONTRIBUTING.md#contributor-license-agreement-cla) 17 | and that your code will be licensed irrecoverably under the GNU LGPLv3. If you do not agree to these terms, do not open 18 | a pull request. 19 | 20 | Please remove this section before submitting your pull request. Doing so indicates that you have read and acknowledged 21 | it. 22 | 23 | ### Proposed Changes 24 | Provide a detailed description of what your pull request changes. 25 | -------------------------------------------------------------------------------- /.github/workflows/pull_request.yml: -------------------------------------------------------------------------------- 1 | name: PR CI 2 | 3 | on: [ pull_request ] 4 | 5 | jobs: 6 | Build: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - name: Checkout Repository 11 | uses: actions/checkout@v4 12 | 13 | - name: Setup JDK 21 14 | uses: actions/setup-java@v4 15 | with: 16 | distribution: adopt 17 | java-version: 21 18 | 19 | - name: Setup Gradle 20 | uses: gradle/actions/setup-gradle@v4 21 | 22 | - name: Grant execute permission for gradlew 23 | run: chmod +x gradlew 24 | 25 | - name: Build with Gradle 26 | run: ./gradlew build 27 | 28 | - name: Run Test Servers 29 | timeout-minutes: 5 30 | run: | 31 | ./gradlew fabric:runGametestServer & 32 | ./gradlew neoforge:runGametestServer & 33 | wait -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # gradle 2 | 3 | .gradle/ 4 | build/ 5 | out/ 6 | classes/ 7 | 8 | # idea 9 | 10 | .idea/ 11 | *.iml 12 | *.ipr 13 | *.iws 14 | 15 | # vscode 16 | 17 | .settings/ 18 | .vscode/ 19 | bin/ 20 | .classpath 21 | .project 22 | 23 | # fabric + neoforge 24 | 25 | /run/ 26 | /common/run/ 27 | /fabric/run/ 28 | /neoforge/run/ 29 | /neoforge/runs/ 30 | 31 | # macOS 32 | 33 | .DS_Store 34 | .AppleDouble 35 | .LSOverride 36 | 37 | # lithium 38 | 39 | fabric/testserver/* 40 | /src/main/resources/assets/lithium/lithium-mixin-config-default.properties 41 | /src/main/resources/assets/lithium/lithium-mixin-config-dependencies.properties 42 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | _ReleaseTag_ is automatically replaced with the release tag, e.g. mc1.21.4-0.14.5 2 | _MCVersion_ is automatically replaced with the minecraft version, e.g. 1.21.4 3 | _LithiumVersion_ is automatically replaced with the lithium version, e.g. 0.14.5 4 | Everything above the line is ignored and not included in the changelog. Everything below will be in the 5 | changelog on GitHub, Modrinth and CurseForge. 6 | ---------- 7 | Lithium _LithiumVersion_ for Minecraft _MCVersion_ fixes a few issues with experimental settings. 8 | 9 | Make sure to take a backup of your world before using the mod and please report any bugs and mod compatibility issues at the [issue tracker](https://github.com/CaffeineMC/lithium-fabric/issues). You can check the [description of each optimization](https://github.com/CaffeineMC/lithium/blob/_ReleaseTag_/lithium-mixin-config.md) and how to disable it when encountering a problem. 10 | 11 | ## Fixes 12 | - Fix various issues and mod compatibility problems with experimental client brain optimization 13 | 14 | ## Additions 15 | - Experimental client biome particle spawning optimization 16 | - Experimental client entity ticking optimizations 17 | -------------------------------------------------------------------------------- /common/src/.gitignore: -------------------------------------------------------------------------------- 1 | jmh -------------------------------------------------------------------------------- /common/src/api/java/net/caffeinemc/mods/lithium/api/inventory/LithiumDefaultedList.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.api.inventory; 2 | 3 | import net.minecraft.world.item.ItemStack; 4 | import net.minecraft.core.Direction; 5 | 6 | public interface LithiumDefaultedList { 7 | /** 8 | * Call this method when the behavior of 9 | * {@link net.minecraft.world.Container#canPlaceItem(int, ItemStack)} 10 | * {@link net.minecraft.world.WorldlyContainer#canPlaceItemThroughFace(int, ItemStack, Direction)} 11 | * {@link net.minecraft.world.WorldlyContainer#canTakeItemThroughFace(int, ItemStack, Direction)} 12 | * or similar functionality changed. 13 | * This method will not need to be called if this change in behavior is triggered by a change of the stack list contents. 14 | */ 15 | void changedInteractionConditions(); 16 | } 17 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/structure: -------------------------------------------------------------------------------- 1 | gametest/structure -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_environment/lithium_default_environment.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:all_of", 3 | "definitions" : [ 4 | { 5 | "type" : "minecraft:game_rules", 6 | "bool_rules" : [ 7 | { 8 | "rule" : "doMobSpawning", 9 | "value" : false 10 | } 11 | ], 12 | "int_rules" : [ 13 | { 14 | "rule" : "randomTickSpeed", 15 | "value" : 3 16 | } 17 | ] 18 | }, 19 | { 20 | "type" : "minecraft:time_of_day", 21 | "time" : 12000 22 | }, 23 | { 24 | "type" : "minecraft:weather", 25 | "weather" : "clear" 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/ai_baby_pig_follow_parent.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:ai_baby_pig_follow_parent", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/ai_johnny_witch_throw_regeneration.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:ai_johnny_witch_throw_regeneration", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/ai_villager_hide_in_home.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:ai_villager_hide_in_home", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/armorstand_pushed_by_water.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:armorstand_pushed_by_water", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/cart_signalstrength.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:cart_signalstrength", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/comparator_update_collection.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:comparator_update_collection", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/creeper_flee_from_cat.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:creeper_flee_from_cat", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/frog_jump.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:frog_jump", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/goat_jump.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:goat_jump", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/hopper_dc_interaction_change.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:hopper_dc_interaction_change", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/hopper_interaction_change.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:hopper_interaction_change", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/hopper_interaction_change_v2.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:hopper_interaction_change_v2", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/hopper_item_datacommand.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:hopper_item_datacommand", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/hopper_storagecart_interaction.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:hopper_storagecart_interaction", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/hopper_transfer_speed.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:hopper_transfer_speed", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/item_sorter.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:item_sorter", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/itempickup.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:itempickup", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/lava_push_speed.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:lava_push_speed", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/llama_pathfinding.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:llama_pathfinding", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/moving_block_collision.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:moving_block_collision", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/pathfinding_avoid_lava.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:pathfinding_avoid_lava", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/pathfinding_prefer_water_over_lava.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:pathfinding_prefer_water_over_lava", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/pig_dispensed_onto_pressure_plate.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:pig_dispensed_onto_pressure_plate", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/spawn_almost_all_entities.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:spawn_almost_all_entities", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/tnt_above_world.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:tnt_above_world", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/tnt_below_world.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:tnt_below_world", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/tnt_block_shield_entity.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:tnt_block_shield_entity", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/tnt_knockback_entity.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:tnt_knockback_entity", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/gametest/resources/data/lithium-gametest/test_instance/tnt_minecart_rail_shielding.json: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "minecraft:block_based", 3 | "environment" : "lithium-gametest:lithium_default_environment", 4 | "structure" : "lithium-gametest:tnt_minecart_rail_shielding", 5 | "max_ticks" : 400, 6 | "setup_ticks" : 10, 7 | "required" : true, 8 | "rotation" : "none", 9 | "manual_only" : false, 10 | "max_attempts" : 1, 11 | "required_successes" : 1, 12 | "sky_access" : false 13 | } 14 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/LithiumMod.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | public class LithiumMod { 7 | private static final Logger LOGGER = LoggerFactory.getLogger("Lithium"); 8 | 9 | private static String MOD_VERSION; 10 | 11 | public static void onInitialization(String version) { 12 | MOD_VERSION = version; 13 | } 14 | 15 | public static Logger logger() { 16 | if (LOGGER == null) { 17 | throw new IllegalStateException("Logger not yet available"); 18 | } 19 | 20 | return LOGGER; 21 | } 22 | 23 | public static String getVersion() { 24 | if (MOD_VERSION == null) { 25 | throw new NullPointerException("Mod version hasn't been populated yet"); 26 | } 27 | 28 | return MOD_VERSION; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/ai/MemoryModificationCounter.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.ai; 2 | 3 | public interface MemoryModificationCounter { 4 | 5 | long lithium$getModCount(); 6 | } 7 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/ai/pathing/BlockStatePathingCache.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.ai.pathing; 2 | 3 | import net.minecraft.world.level.pathfinder.PathType; 4 | 5 | public interface BlockStatePathingCache { 6 | PathType lithium$getPathNodeType(); 7 | 8 | PathType lithium$getNeighborPathNodeType(); 9 | 10 | void lithium$initializePathNodeTypeCache(); 11 | } 12 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/block/BlockCountingSection.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.block; 2 | 3 | import net.minecraft.world.level.block.state.BlockState; 4 | 5 | public interface BlockCountingSection { 6 | boolean lithium$mayContainAny(TrackedBlockStatePredicate trackedBlockStatePredicate); 7 | 8 | void lithium$trackBlockStateChange(BlockState newState, BlockState oldState); 9 | } 10 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/block/BlockListeningSection.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.block; 2 | 3 | import net.caffeinemc.mods.lithium.common.tracking.block.SectionedBlockChangeTracker; 4 | import net.minecraft.world.level.Level; 5 | 6 | public interface BlockListeningSection { 7 | 8 | void lithium$addToCallback(SectionedBlockChangeTracker tracker, long sectionPos, Level world); 9 | 10 | void lithium$removeFromCallback(SectionedBlockChangeTracker tracker); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/block/BlockStateFlagHolder.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.block; 2 | 3 | public interface BlockStateFlagHolder { 4 | int lithium$getAllFlags(); 5 | 6 | void lithium$initializeFlags(); 7 | } 8 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/block/entity/SetBlockStateHandlingBlockEntity.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.block.entity; 2 | 3 | public interface SetBlockStateHandlingBlockEntity { 4 | default void lithium$handleSetBlockState() { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/block/entity/SetChangedHandlingBlockEntity.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.block.entity; 2 | 3 | public interface SetChangedHandlingBlockEntity { 4 | default void lithium$handleSetChanged() { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/block/entity/ShapeUpdateHandlingBlockBehaviour.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.block.entity; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.world.level.LevelReader; 5 | import net.minecraft.world.level.block.state.BlockState; 6 | 7 | public interface ShapeUpdateHandlingBlockBehaviour { 8 | 9 | default void lithium$handleShapeUpdate(LevelReader world, BlockState myBlockState, BlockPos myPos, BlockPos posFrom, BlockState newState) { 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/block/entity/inventory_change_tracking/InventoryChangeListener.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.block.entity.inventory_change_tracking; 2 | 3 | import net.minecraft.world.Container; 4 | 5 | public interface InventoryChangeListener { 6 | default void handleStackListReplaced(Container inventory) { 7 | this.lithium$handleInventoryRemoved(inventory); 8 | } 9 | 10 | void lithium$handleInventoryContentModified(Container inventory); 11 | 12 | void lithium$handleInventoryRemoved(Container inventory); 13 | 14 | boolean lithium$handleComparatorAdded(Container inventory); 15 | } 16 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/block/entity/inventory_change_tracking/InventoryChangeTracker.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.block.entity.inventory_change_tracking; 2 | 3 | import net.caffeinemc.mods.lithium.common.hopper.LithiumStackList; 4 | 5 | public interface InventoryChangeTracker extends InventoryChangeEmitter { 6 | default void listenForContentChangesOnce(LithiumStackList stackList, InventoryChangeListener inventoryChangeListener) { 7 | this.lithium$forwardContentChangeOnce(inventoryChangeListener, stackList, this); 8 | } 9 | 10 | default void listenForMajorInventoryChanges(InventoryChangeListener inventoryChangeListener) { 11 | this.lithium$forwardMajorInventoryChanges(inventoryChangeListener); 12 | } 13 | 14 | default void stopListenForMajorInventoryChanges(InventoryChangeListener inventoryChangeListener) { 15 | this.lithium$stopForwardingMajorInventoryChanges(inventoryChangeListener); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/block/entity/inventory_comparator_tracking/ComparatorTracker.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.block.entity.inventory_comparator_tracking; 2 | 3 | import net.minecraft.core.Direction; 4 | 5 | public interface ComparatorTracker { 6 | void lithium$onComparatorAdded(Direction direction, int offset); 7 | 8 | boolean lithium$hasAnyComparatorNearby(); 9 | } 10 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/client/ClientWorldAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.client; 2 | 3 | import net.minecraft.world.entity.Entity; 4 | import net.minecraft.world.level.entity.TransientEntitySectionManager; 5 | 6 | public interface ClientWorldAccessor { 7 | TransientEntitySectionManager lithium$getEntityManager(); 8 | } 9 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/client/SharedFields.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.client; 2 | 3 | import com.google.common.collect.ImmutableList; 4 | import net.caffeinemc.mods.lithium.common.util.collections.DummyList; 5 | import net.minecraft.world.entity.ai.Brain; 6 | import org.spongepowered.asm.mixin.Unique; 7 | 8 | import java.util.List; 9 | import java.util.concurrent.atomic.AtomicInteger; 10 | 11 | public class SharedFields { 12 | public static final AtomicInteger MAXIMUM_BIOME_PARTICLE_CHANCE = new AtomicInteger(Float.floatToIntBits(0.0F)); //Using atomic integer as replacement for atomic float 13 | @Unique 14 | public static final Brain DUMMY_BRAIN = new Brain<>(new DummyList<>(), List.of(), ImmutableList.of(), () -> { 15 | throw new IllegalStateException("Trying to serialize client side brain! If you really want this, disable lithium's client side brain optimization!"); 16 | }); 17 | } 18 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/entity/EquipmentInfo.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.entity; 2 | 3 | public interface EquipmentInfo { 4 | boolean lithium$shouldTickEnchantments(); 5 | 6 | boolean lithium$hasUnsentEquipmentChanges(); 7 | 8 | void lithium$onEquipmentChangesSent(); 9 | } 10 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/entity/FluidCachingEntity.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.entity; 2 | 3 | public interface FluidCachingEntity { 4 | } 5 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/entity/NavigatingEntity.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.entity; 2 | 3 | import net.minecraft.world.entity.ai.navigation.PathNavigation; 4 | 5 | public interface NavigatingEntity { 6 | boolean lithium$isRegisteredToWorld(); 7 | 8 | void lithium$setRegisteredToWorld(PathNavigation navigation); 9 | 10 | PathNavigation lithium$getRegisteredNavigation(); 11 | 12 | void lithium$updateNavigationRegistration(); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/entity/PositionedEntityTrackingSection.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.entity; 2 | 3 | public interface PositionedEntityTrackingSection { 4 | void lithium$setPos(long chunkSectionPos); 5 | 6 | long lithium$getPos(); 7 | } 8 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/entity/TypeFilterableListInternalAccess.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.entity; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.function.Function; 6 | 7 | public interface TypeFilterableListInternalAccess { 8 | List lithium$getOrCreateAllOfTypeRaw(Class type); 9 | 10 | List lithium$replaceCollectionAndGet(Class type, Function, List> listCtor); 11 | List lithium$replaceCollectionAndGet(Class type, ArrayList list); 12 | } 13 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/entity/pushable/EntityPushablePredicate.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.entity.pushable; 2 | 3 | import java.util.function.Predicate; 4 | 5 | public abstract class EntityPushablePredicate implements Predicate { 6 | 7 | public static Predicate and(Predicate first, Predicate second) { 8 | return new EntityPushablePredicate() { 9 | @Override 10 | public boolean test(T t) { 11 | return first.test(t) && second.test(t); 12 | } 13 | }; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/entity/pushable/FeetBlockCachingEntity.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.entity.pushable; 2 | 3 | import net.minecraft.world.level.block.state.BlockState; 4 | 5 | public interface FeetBlockCachingEntity { 6 | 7 | default void lithium$OnFeetBlockCacheDeleted() { 8 | 9 | } 10 | 11 | default void lithium$OnFeetBlockCacheSet(BlockState newState) { 12 | 13 | } 14 | 15 | default void lithium$SetClimbingMobCachingSectionUpdateBehavior(boolean listening) { 16 | throw new UnsupportedOperationException(); 17 | } 18 | 19 | BlockState lithium$getCachedFeetBlockState(); 20 | } -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/hopper/BlockStateOnlyInventory.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.hopper; 2 | 3 | public interface BlockStateOnlyInventory { 4 | } 5 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/hopper/HopperCachingState.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.hopper; 2 | 3 | public class HopperCachingState { 4 | 5 | public enum BlockInventory { 6 | UNKNOWN, // No information cached 7 | BLOCK_STATE, // Known to be Composter-like inventory (inventory from block, but not block entity, only depends on block state) 8 | BLOCK_ENTITY, // Known to be BlockEntity inventory without removal tracking capability 9 | REMOVAL_TRACKING_BLOCK_ENTITY, // Known to be BlockEntity inventory with removal tracking capability 10 | NO_BLOCK_INVENTORY // Known to be a block without hopper interaction (-> interact with entities instead) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/hopper/UpdateReceiver.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.hopper; 2 | 3 | import net.minecraft.core.Direction; 4 | 5 | public interface UpdateReceiver { 6 | void lithium$invalidateCacheOnNeighborUpdate(boolean above); 7 | 8 | void lithium$invalidateCacheOnUndirectedNeighborUpdate(); 9 | 10 | void lithium$invalidateCacheOnNeighborUpdate(Direction fromDirection); 11 | } 12 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/services/PlatformEntityAccess.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.services; 2 | 3 | import net.minecraft.world.entity.Entity; 4 | import net.minecraft.world.level.Level; 5 | import net.minecraft.world.phys.AABB; 6 | 7 | import java.util.ArrayList; 8 | import java.util.function.Predicate; 9 | 10 | public interface PlatformEntityAccess { 11 | PlatformEntityAccess INSTANCE = Services.load(PlatformEntityAccess.class); 12 | 13 | void addEnderDragonParts(Level level, Entity excludedEntity, AABB box, Predicate entityFilter, ArrayList entities); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/services/PlatformMappingInformation.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.services; 2 | 3 | public interface PlatformMappingInformation { 4 | PlatformMappingInformation INSTANCE = Services.load(PlatformMappingInformation.class); 5 | 6 | String mapMethodName(String fromMappings, String clazz, String method, String argsDescriptor, String mojmap); 7 | } 8 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/services/PlatformMixinOverrides.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.services; 2 | 3 | import net.caffeinemc.mods.lithium.common.config.Option; 4 | 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | public interface PlatformMixinOverrides { 9 | PlatformMixinOverrides INSTANCE = Services.load(PlatformMixinOverrides.class); 10 | 11 | static PlatformMixinOverrides getInstance() { 12 | return INSTANCE; 13 | } 14 | 15 | void applyLithiumCompat(Map options); 16 | 17 | List applyModOverrides(); 18 | 19 | record MixinOverride(String modId, String option, boolean enabled) { 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/services/PlatformModCompat.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.services; 2 | 3 | import net.minecraft.world.level.block.entity.HopperBlockEntity; 4 | import net.minecraft.world.level.block.state.BlockState; 5 | 6 | public interface PlatformModCompat { 7 | PlatformModCompat INSTANCE = Services.load(PlatformModCompat.class); 8 | 9 | boolean canHopperInteractWithApiBlockInventory(HopperBlockEntity hopperBlockEntity, BlockState hopperState, boolean extracting); 10 | } 11 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/services/Services.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.services; 2 | 3 | import net.caffeinemc.mods.lithium.common.LithiumMod; 4 | 5 | import java.util.ServiceLoader; 6 | 7 | public class Services { 8 | // This code is used to load a service for the current environment. Your implementation of the service must be defined 9 | // manually by including a text file in META-INF/services named with the fully qualified class name of the service. 10 | // Inside the file you should write the fully qualified class name of the implementation to load for the platform. 11 | public static T load(Class clazz) { 12 | final T loadedService = ServiceLoader.load(clazz) 13 | .findFirst() 14 | .orElseThrow(() -> new NullPointerException("Failed to load service for " + clazz.getName())); 15 | LithiumMod.logger().debug("Loaded {} for service {}", loadedService, clazz); 16 | return loadedService; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/shapes/OffsetVoxelShapeCache.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.shapes; 2 | 3 | import net.minecraft.core.Direction; 4 | import net.minecraft.world.phys.shapes.VoxelShape; 5 | 6 | public interface OffsetVoxelShapeCache { 7 | VoxelShape lithium$getOffsetSimplifiedShape(float offset, Direction direction); 8 | 9 | void lithium$setShape(float offset, Direction direction, VoxelShape offsetShape); 10 | } -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/shapes/VoxelShapeCaster.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.shapes; 2 | 3 | import net.minecraft.world.phys.AABB; 4 | import net.minecraft.world.phys.shapes.BooleanOp; 5 | import net.minecraft.world.phys.shapes.VoxelShape; 6 | 7 | /** 8 | * Provides a simple interface for directly querying intersections against a shape. This can be used instead of the 9 | * expensive {@link net.minecraft.world.phys.shapes.Shapes#joinIsNotEmpty(VoxelShape, VoxelShape, BooleanOp)} 10 | * in collision detection and resolution. 11 | */ 12 | public interface VoxelShapeCaster { 13 | /** 14 | * Checks whether an entity's bounding box collides with this shape translated to the given coordinates. 15 | * 16 | * @param box The entity's bounding box 17 | * @param blockX The x-coordinate of this shape 18 | * @param blockY The y-coordinate of this shape 19 | * @param blockZ The z-coordinate of this shape 20 | * @return True if the box intersects with this shape, otherwise false 21 | */ 22 | boolean intersects(AABB box, double blockX, double blockY, double blockZ); 23 | } 24 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/shapes/lists/OffsetFractionalDoubleList.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.shapes.lists; 2 | 3 | import it.unimi.dsi.fastutil.doubles.AbstractDoubleList; 4 | 5 | public class OffsetFractionalDoubleList extends AbstractDoubleList { 6 | //this class must not extend FractionalDoubleList, due to VoxelShapes.createListPair using instanceof 7 | private final int numSections; 8 | private final double offset; 9 | 10 | public OffsetFractionalDoubleList(int numSections, double offset) { 11 | this.numSections = numSections; 12 | this.offset = offset; 13 | } 14 | 15 | public double getDouble(int position) { 16 | return this.offset + (double) position / (double) this.numSections; 17 | } 18 | 19 | public int size() { 20 | return this.numSections + 1; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/tracking/VicinityCacheProvider.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.tracking; 2 | 3 | import net.minecraft.world.entity.Entity; 4 | 5 | public interface VicinityCacheProvider { 6 | VicinityCache lithium$getVicinityCache(); 7 | 8 | default VicinityCache getUpdatedVicinityCache(Entity entity) { 9 | VicinityCache bc = this.lithium$getVicinityCache(); 10 | bc.updateCache(entity); 11 | return bc; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/tracking/entity/EntityMovementTrackerSection.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.tracking.entity; 2 | 3 | import net.minecraft.world.level.entity.EntityAccess; 4 | import net.minecraft.world.level.entity.EntitySectionStorage; 5 | 6 | public interface EntityMovementTrackerSection { 7 | void lithium$addListener(SectionedEntityMovementTracker listener); 8 | 9 | void lithium$removeListener(EntitySectionStorage sectionedEntityCache, SectionedEntityMovementTracker listener); 10 | 11 | void lithium$trackEntityMovement(int notificationMask, long time); 12 | 13 | long lithium$getChangeTime(int trackedClass); 14 | 15 | void lithium$listenToMovementOnce(SectionedEntityMovementTracker listener, int trackedClass); 16 | 17 | void lithium$removeListenToMovementOnce(SectionedEntityMovementTracker listener, int trackedClass); 18 | } 19 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/tracking/entity/SectionedEntityMovementListener.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.tracking.entity; 2 | 3 | public interface SectionedEntityMovementListener { 4 | 5 | void lithium$handleEntityMovement(Object category); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/tracking/entity/ToggleableMovementTracker.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.tracking.entity; 2 | 3 | public interface ToggleableMovementTracker { 4 | 5 | int lithium$setNotificationMask(int notificationMask); 6 | } 7 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/util/ArrayConstants.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.util; 2 | 3 | /** 4 | * Pre-initialized constants to avoid unnecessary allocations. 5 | */ 6 | public final class ArrayConstants { 7 | private ArrayConstants() {} 8 | 9 | public static final int[] EMPTY = new int[0]; 10 | public static final int[] ZERO = new int[]{0}; 11 | } 12 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/util/ChunkConstants.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.util; 2 | 3 | import sun.misc.Unsafe; 4 | 5 | import java.lang.reflect.Field; 6 | import net.minecraft.world.level.chunk.EmptyLevelChunk; 7 | import net.minecraft.world.level.chunk.LevelChunk; 8 | 9 | public class ChunkConstants { 10 | public static final LevelChunk DUMMY_CHUNK; 11 | 12 | static { 13 | try { 14 | Field f = Unsafe.class.getDeclaredField("theUnsafe"); 15 | f.setAccessible(true); 16 | Unsafe unsafe = (Unsafe) f.get(null); 17 | DUMMY_CHUNK = (LevelChunk) unsafe.allocateInstance(EmptyLevelChunk.class); 18 | } catch (Exception e) { 19 | throw new RuntimeException(e); 20 | } 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/util/DirectionConstants.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.util; 2 | 3 | import net.minecraft.core.Direction; 4 | 5 | /** 6 | * Pre-initialized constants to avoid unnecessary allocations. 7 | */ 8 | public final class DirectionConstants { 9 | private DirectionConstants() {} 10 | 11 | public static final Direction[] ALL = Direction.values(); 12 | public static final Direction[] VERTICAL = {Direction.DOWN, Direction.UP}; 13 | public static final Direction[] HORIZONTAL = {Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH}; 14 | public static final byte[] HORIZONTAL_OPPOSITE_INDICES = {1, 0, 3, 2}; 15 | } 16 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/util/POIRegistryEntries.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.util; 2 | 3 | import net.minecraft.core.Holder; 4 | import net.minecraft.world.entity.ai.village.poi.PoiType; 5 | import net.minecraft.world.entity.ai.village.poi.PoiTypes; 6 | import net.minecraft.world.level.block.BedBlock; 7 | import net.minecraft.world.level.block.Blocks; 8 | import net.minecraft.world.level.block.state.properties.BedPart; 9 | 10 | public class POIRegistryEntries { 11 | //Using a separate class, so the registry lookup happens after the registry is initialized 12 | public static final Holder NETHER_PORTAL_ENTRY = PoiTypes.forState(Blocks.NETHER_PORTAL.defaultBlockState()).orElseThrow(() -> new IllegalStateException("Nether portal poi type not found")); 13 | public static final Holder HOME_ENTRY = PoiTypes.forState(Blocks.RED_BED.defaultBlockState().setValue(BedBlock.PART, BedPart.HEAD)).orElseThrow(() -> new IllegalStateException("Home poi type not found")); 14 | } 15 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/util/change_tracking/ChangePublisher.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.util.change_tracking; 2 | 3 | import net.minecraft.world.item.ItemStack; 4 | 5 | public interface ChangePublisher { 6 | void lithium$subscribe(ChangeSubscriber subscriber, int subscriberData); 7 | 8 | int lithium$unsubscribe(ChangeSubscriber subscriber); 9 | 10 | default void lithium$unsubscribeWithData(ChangeSubscriber subscriber, int index) { 11 | throw new UnsupportedOperationException("Only implemented for ItemStacks"); 12 | } 13 | 14 | default boolean lithium$isSubscribedWithData(ChangeSubscriber subscriber, int subscriberData) { 15 | throw new UnsupportedOperationException("Only implemented for ItemStacks"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/util/collections/DummyList.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.util.collections; 2 | 3 | import java.util.AbstractList; 4 | 5 | public class DummyList extends AbstractList { 6 | @Override 7 | public T get(int index) { 8 | throw new IndexOutOfBoundsException(index); 9 | } 10 | 11 | @Override 12 | public int size() { 13 | return 0; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/util/deduplication/LithiumInterner.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.util.deduplication; 2 | 3 | import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; 4 | 5 | public class LithiumInterner { 6 | private final ObjectOpenHashSet canonicalStorage = new ObjectOpenHashSet<>(); 7 | 8 | public S getCanonical(S value) { 9 | //noinspection unchecked 10 | return (S) this.canonicalStorage.addOrGet(value); 11 | } 12 | 13 | public void deleteCanonical(T value) { 14 | this.canonicalStorage.remove(value); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/util/lock/NullLock.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.util.lock; 2 | 3 | import java.util.concurrent.TimeUnit; 4 | import java.util.concurrent.locks.Condition; 5 | import java.util.concurrent.locks.Lock; 6 | 7 | /** 8 | * A Lock which doesn't do anything. 9 | */ 10 | public class NullLock implements Lock { 11 | @Override 12 | public void lock() { 13 | 14 | } 15 | 16 | @Override 17 | public void lockInterruptibly() { 18 | 19 | } 20 | 21 | @Override 22 | public boolean tryLock() { 23 | return true; 24 | } 25 | 26 | @Override 27 | public boolean tryLock(long time, TimeUnit unit) { 28 | return true; 29 | } 30 | 31 | @Override 32 | public void unlock() { 33 | 34 | } 35 | 36 | @Override 37 | public Condition newCondition() { 38 | throw new UnsupportedOperationException(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/util/lock/NullReadWriteLock.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.util.lock; 2 | 3 | import java.util.concurrent.locks.Lock; 4 | import java.util.concurrent.locks.ReadWriteLock; 5 | 6 | /** 7 | * A ReadWriteLock which doesn't do anything. 8 | */ 9 | public class NullReadWriteLock implements ReadWriteLock { 10 | private final NullLock lock = new NullLock(); 11 | 12 | @Override 13 | public Lock readLock() { 14 | return this.lock; 15 | } 16 | 17 | @Override 18 | public Lock writeLock() { 19 | return this.lock; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/util/math/MutableVec3d.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.util.math; 2 | 3 | import net.minecraft.world.phys.Vec3; 4 | 5 | public class MutableVec3d { 6 | private double x, y, z; 7 | 8 | public double getX() { 9 | return this.x; 10 | } 11 | 12 | public double getY() { 13 | return this.y; 14 | } 15 | 16 | public double getZ() { 17 | return this.z; 18 | } 19 | 20 | public void add(Vec3 vec) { 21 | this.x += vec.x; 22 | this.y += vec.y; 23 | this.z += vec.z; 24 | } 25 | 26 | public Vec3 toImmutable() { 27 | return new Vec3(this.x, this.y, this.z); 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/util/tuples/Range6Int.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.util.tuples; 2 | 3 | public record Range6Int(int negativeX, int negativeY, int negativeZ, int positiveX, int positiveY, int positiveZ) { 4 | } 5 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/util/tuples/RefIntPair.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.util.tuples; 2 | 3 | import java.util.Objects; 4 | 5 | public record RefIntPair(A left, int right) { 6 | 7 | @Override 8 | public boolean equals(Object obj) { 9 | if (obj == this) { 10 | return true; 11 | } 12 | if (obj == null || obj.getClass() != this.getClass()) { 13 | return false; 14 | } 15 | var that = (RefIntPair) obj; 16 | return this.left == that.left && 17 | this.right == that.right; 18 | } 19 | 20 | @Override 21 | public int hashCode() { 22 | return Objects.hash(System.identityHashCode(this.left), right); 23 | } 24 | 25 | @Override 26 | public String toString() { 27 | return "RefIntPair[" + 28 | "left=" + left + ", " + 29 | "right=" + right + ']'; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/util/tuples/SortedPointOfInterest.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.util.tuples; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.world.entity.ai.village.poi.PoiRecord; 5 | 6 | public record SortedPointOfInterest(PoiRecord poi, double distanceSq) { 7 | 8 | public SortedPointOfInterest(PoiRecord poi, BlockPos origin) { 9 | this(poi, poi.getPos().distSqr(origin)); 10 | } 11 | 12 | public BlockPos getPos() { 13 | return this.poi.getPos(); 14 | } 15 | 16 | public int getX() { 17 | return this.getPos().getX(); 18 | } 19 | 20 | public int getY() { 21 | return this.getPos().getY(); 22 | } 23 | 24 | public int getZ() { 25 | return this.getPos().getZ(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/world/ChunkAwareEntityIterable.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.world; 2 | 3 | import net.minecraft.world.level.entity.EntityAccess; 4 | 5 | public interface ChunkAwareEntityIterable { 6 | Iterable lithium$IterateEntitiesInTrackedSections(); 7 | } 8 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/world/ChunkRandomSource.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.world; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.world.level.Level; 5 | 6 | public interface ChunkRandomSource { 7 | /** 8 | * Alternative implementation of {@link Level#getBlockRandomPos(int, int, int, int)} which does not allocate 9 | * a new {@link BlockPos}. 10 | */ 11 | void lithium$getRandomPosInChunk(int x, int y, int z, int mask, BlockPos.MutableBlockPos out); 12 | } 13 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/world/ChunkView.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.world; 2 | 3 | import net.minecraft.world.level.chunk.ChunkAccess; 4 | import org.jetbrains.annotations.Nullable; 5 | 6 | public interface ChunkView { 7 | 8 | @Nullable 9 | ChunkAccess lithium$getLoadedChunk(int chunkX, int chunkZ); 10 | } 11 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/world/ClimbingMobCachingSection.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.world; 2 | 3 | import net.caffeinemc.mods.lithium.common.entity.pushable.EntityPushablePredicate; 4 | import net.caffeinemc.mods.lithium.common.entity.pushable.FeetBlockCachingEntity; 5 | import net.minecraft.util.AbortableIterationConsumer; 6 | import net.minecraft.world.entity.Entity; 7 | import net.minecraft.world.level.Level; 8 | import net.minecraft.world.level.block.state.BlockState; 9 | import net.minecraft.world.phys.AABB; 10 | 11 | import java.util.ArrayList; 12 | 13 | public interface ClimbingMobCachingSection { 14 | 15 | AbortableIterationConsumer.Continuation lithium$collectPushableEntities(Level world, Entity except, AABB box, EntityPushablePredicate entityPushablePredicate, ArrayList entities); 16 | 17 | void lithium$onEntityModifiedCachedBlock(FeetBlockCachingEntity entity, BlockState newBlockState); 18 | } 19 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/world/ServerWorldExtended.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.world; 2 | 3 | import net.minecraft.world.entity.Mob; 4 | 5 | public interface ServerWorldExtended { 6 | void lithium$setNavigationActive(Mob mobEntity); 7 | 8 | void lithium$setNavigationInactive(Mob mobEntity); 9 | } 10 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/world/block_pattern_matching/BlockPatternExtended.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.world.block_pattern_matching; 2 | 3 | import net.minecraft.world.level.block.Block; 4 | 5 | public interface BlockPatternExtended { 6 | 7 | void lithium$setRequiredBlock(Block block, int count); 8 | } 9 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/world/blockentity/BlockEntityGetter.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.world.blockentity; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.world.level.block.entity.BlockEntity; 5 | 6 | public interface BlockEntityGetter { 7 | BlockEntity lithium$getLoadedExistingBlockEntity(BlockPos pos); 8 | } 9 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/world/blockentity/SupportCache.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.world.blockentity; 2 | 3 | public interface SupportCache { 4 | boolean lithium$isSupported(); 5 | } 6 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/world/chunk/ChunkHolderExtended.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.world.chunk; 2 | 3 | public interface ChunkHolderExtended { 4 | /** 5 | * Updates the last accessed timestamp for this chunk. This is used to determine if a ticket was recently 6 | * created for it. 7 | * 8 | * @param time The current time 9 | * @return True if the chunk needs a new ticket to be created in order to retain it, otherwise false 10 | */ 11 | boolean lithium$updateLastAccessTime(long time); 12 | } 13 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/world/chunk/ClassGroupFilterableList.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.world.chunk; 2 | 3 | import net.caffeinemc.mods.lithium.common.entity.EntityClassGroup; 4 | 5 | import java.util.Collection; 6 | 7 | public interface ClassGroupFilterableList { 8 | Collection lithium$getAllOfGroupType(EntityClassGroup type); 9 | 10 | } -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/world/chunk/CompactingPackedIntegerArray.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.world.chunk; 2 | 3 | import net.minecraft.world.level.chunk.Palette; 4 | 5 | public interface CompactingPackedIntegerArray { 6 | /** 7 | * Copies the data out of this array into a new non-packed array. The returned array contains a copy of this array 8 | * re-mapped using {@param destPalette}. 9 | */ 10 | void lithium$compact(Palette srcPalette, Palette dstPalette, short[] out); 11 | } 12 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/world/explosions/ClipContextAccess.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.world.explosions; 2 | 3 | import net.minecraft.world.phys.Vec3; 4 | import net.minecraft.world.phys.shapes.CollisionContext; 5 | 6 | public interface ClipContextAccess { 7 | 8 | void lithium$setFrom(Vec3 from); 9 | 10 | CollisionContext lithium$getCollisionContext(); 11 | } 12 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/world/interests/PointOfInterestSetExtended.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.world.interests; 2 | 3 | import java.util.function.Consumer; 4 | import java.util.function.Predicate; 5 | import net.minecraft.core.Holder; 6 | import net.minecraft.world.entity.ai.village.poi.PoiManager; 7 | import net.minecraft.world.entity.ai.village.poi.PoiRecord; 8 | import net.minecraft.world.entity.ai.village.poi.PoiType; 9 | 10 | public interface PointOfInterestSetExtended { 11 | void lithium$collectMatchingPoints(Predicate> type, PoiManager.Occupancy status, 12 | Consumer consumer); 13 | } -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/world/interests/RegionBasedStorageSectionExtended.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.world.interests; 2 | 3 | import java.util.stream.Stream; 4 | 5 | public interface RegionBasedStorageSectionExtended { 6 | /** 7 | * Fast-path for retrieving all items in a chunk column. This avoids needing to retrieve items for each sub-chunk 8 | * individually. 9 | * 10 | * @param chunkX The x-coordinate of the chunk column 11 | * @param chunkZ The z-coordinate of the chunk column 12 | */ 13 | Stream lithium$getWithinChunkColumn(int chunkX, int chunkZ); 14 | 15 | /** 16 | * Fast-path for collecting all items in a chunk column. This avoids needing to retrieve items for each sub-chunk 17 | * individually. 18 | * 19 | * @param chunkX The x-coordinate of the chunk column 20 | * @param chunkZ The z-coordinate of the chunk column 21 | */ 22 | Iterable lithium$getInChunkColumn(int chunkX, int chunkZ); 23 | } 24 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/common/world/interests/iterator/SinglePointOfInterestTypeFilter.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.common.world.interests.iterator; 2 | 3 | import java.util.function.Predicate; 4 | import net.minecraft.core.Holder; 5 | import net.minecraft.world.entity.ai.village.poi.PoiType; 6 | 7 | public record SinglePointOfInterestTypeFilter( 8 | Holder type) implements Predicate> { 9 | 10 | @Override 11 | public boolean test(Holder other) { 12 | return this.type == other; 13 | } 14 | 15 | public Holder getType() { 16 | return this.type; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This package includes patches that are meant to reduce the performance impact of Mob AI. 3 | */ 4 | @MixinConfigOption(description = "Mob AI optimizations") 5 | package net.caffeinemc.mods.lithium.mixin.ai; 6 | 7 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/pathing/PathfindingContextAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.ai.pathing; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.world.level.pathfinder.PathfindingContext; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | @Mixin(PathfindingContext.class) 9 | public interface PathfindingContextAccessor { 10 | 11 | @Accessor("mutablePos") 12 | BlockPos.MutableBlockPos getLastNodePos(); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/pathing/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = """ 3 | A faster code path is used for determining what kind of path-finding node type is associated with a 4 | given block. Additionally, a faster chunk cache will be used for accessing blocks while evaluating 5 | paths.""", 6 | depends = { 7 | @MixinConfigDependency(dependencyPath = "mixin.util.chunk_access"), 8 | @MixinConfigDependency(dependencyPath = "mixin.util.initialization") 9 | } 10 | ) 11 | package net.caffeinemc.mods.lithium.mixin.ai.pathing; 12 | 13 | import net.caffeinemc.gradle.MixinConfigDependency; 14 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/poi/fast_portals/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Portal search uses the faster POI search and optimized loaded state caching") 2 | package net.caffeinemc.mods.lithium.mixin.ai.poi.fast_portals; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/poi/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Implements a faster POI search") 2 | package net.caffeinemc.mods.lithium.mixin.ai.poi; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/poi/tasks/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Mob Tasks which search for POIs use the optimized POI search") 2 | package net.caffeinemc.mods.lithium.mixin.ai.poi.tasks; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/raid/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Avoids unnecessary raid bar updates and optimizes expensive leader banner operations", 3 | depends = @MixinConfigDependency(dependencyPath = "mixin.util.data_storage") 4 | ) 5 | package net.caffeinemc.mods.lithium.mixin.ai.raid; 6 | 7 | import net.caffeinemc.gradle.MixinConfigDependency; 8 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/sensor/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Brain sensor optimizations") 2 | package net.caffeinemc.mods.lithium.mixin.ai.sensor; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/sensor/replace_streams/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Replace Stream code of AI sensors with more traditional iteration") 2 | package net.caffeinemc.mods.lithium.mixin.ai.sensor.replace_streams; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/sensor/replace_streams/tempting/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Replace Stream code of tempting sensor player search with more traditional iteration") 2 | package net.caffeinemc.mods.lithium.mixin.ai.sensor.replace_streams.tempting; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/sensor/secondary_poi/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Avoid unnecessary secondary POI searches of non-farmer villagers") 2 | package net.caffeinemc.mods.lithium.mixin.ai.sensor.secondary_poi; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/task/launch/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Keep track of running and runnable tasks to speed up task launching checks") 2 | package net.caffeinemc.mods.lithium.mixin.ai.task.launch; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/task/memory_change_counting/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Keep track of AI memory changes to skip checking AI task memory prerequisites") 2 | package net.caffeinemc.mods.lithium.mixin.ai.task.memory_change_counting; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/task/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Various AI task optimizations") 2 | package net.caffeinemc.mods.lithium.mixin.ai.task; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/task/replace_streams/ShufflingListMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.ai.task.replace_streams; 2 | 3 | import net.caffeinemc.mods.lithium.common.ai.WeightedListIterable; 4 | import net.minecraft.world.entity.ai.behavior.ShufflingList; 5 | import org.spongepowered.asm.mixin.Final; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.Shadow; 8 | 9 | import java.util.Iterator; 10 | import java.util.List; 11 | 12 | @Mixin(ShufflingList.class) 13 | public class ShufflingListMixin implements WeightedListIterable { 14 | @Shadow 15 | @Final 16 | protected List> entries; 17 | 18 | @Override 19 | public Iterator iterator() { 20 | return new ListIterator<>(this.entries.iterator()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/task/replace_streams/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Replace Stream code of AI tasks with more traditional iteration.") 2 | package net.caffeinemc.mods.lithium.mixin.ai.task.replace_streams; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/task/run/long_jump_weighted_choice/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Speed up the weighted random choice of long jump target positions.") 2 | package net.caffeinemc.mods.lithium.mixin.ai.task.run.long_jump_weighted_choice; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/task/run/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Various optimizations inside AI tasks") 2 | package net.caffeinemc.mods.lithium.mixin.ai.task.run; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/useless_sensors/BrainAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.ai.useless_sensors; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.gen.Accessor; 5 | 6 | import java.util.Map; 7 | import net.minecraft.world.entity.LivingEntity; 8 | import net.minecraft.world.entity.ai.Brain; 9 | import net.minecraft.world.entity.ai.sensing.Sensor; 10 | import net.minecraft.world.entity.ai.sensing.SensorType; 11 | 12 | @Mixin(Brain.class) 13 | public interface BrainAccessor { 14 | 15 | @Accessor("sensors") 16 | Map>, Sensor> getSensors(); 17 | } 18 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/useless_sensors/SensorAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.ai.useless_sensors; 2 | 3 | import net.minecraft.world.entity.ai.sensing.Sensor; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | @Mixin(Sensor.class) 8 | public interface SensorAccessor { 9 | 10 | @Accessor("timeToTick") 11 | long getLastSenseTime(); 12 | 13 | @Accessor("scanRate") 14 | int getSenseInterval(); 15 | 16 | @Accessor("timeToTick") 17 | void setLastSenseTime(long lastSenseTime); 18 | } 19 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/useless_sensors/goat_item_sensor/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Disable the goat item sensor whose memories are never used.") 2 | package net.caffeinemc.mods.lithium.mixin.ai.useless_sensors.goat_item_sensor; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/useless_sensors/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Disabling useless brain sensors to avoid useless sensing calculations.") 2 | package net.caffeinemc.mods.lithium.mixin.ai.useless_sensors; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/useless_sensors/parent_animal_sensor/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Disable the parent animal sensor when an animal is not a baby." + 2 | " Would differ from vanilla in the case where an adult animal turns back into a baby animal, as the sensor information is refreshed," + 3 | " leading to a less-outdated value in the first second of turning back into a baby animal. However, there is no way to turn an animal" + 4 | " back into a baby without reinitializing the brain, creating entirely new sensors." 5 | ) 6 | package net.caffeinemc.mods.lithium.mixin.ai.useless_sensors.parent_animal_sensor; 7 | 8 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/alloc/chunk_random/LevelMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.alloc.chunk_random; 2 | 3 | import net.caffeinemc.mods.lithium.common.world.ChunkRandomSource; 4 | import net.minecraft.core.BlockPos; 5 | import net.minecraft.world.level.Level; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.Shadow; 8 | 9 | @Mixin(Level.class) 10 | public class LevelMixin implements ChunkRandomSource { 11 | @Shadow 12 | protected int randValue; 13 | 14 | /** 15 | * {@inheritDoc} 16 | */ 17 | @Override 18 | public void lithium$getRandomPosInChunk(int x, int y, int z, int mask, BlockPos.MutableBlockPos out) { 19 | this.randValue = this.randValue * 3 + 1013904223; 20 | int rand = this.randValue >> 2; 21 | out.set(x + (rand & 15), y + (rand >> 16 & mask), z + (rand >> 8 & 15)); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/alloc/chunk_random/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This package includes a patch that reduces the memory usage of random position selection when ticking chunks by 3 | * replacing the repeated BlockPos allocations with a single BlockPos.Mutable that is defensively copied only when 4 | * passed to unknown code. 5 | */ 6 | @MixinConfigOption(description = "Random block ticking uses fewer block position allocations, thereby reducing the object allocation rate.") 7 | package net.caffeinemc.mods.lithium.mixin.alloc.chunk_random; 8 | 9 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/alloc/composter/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This package includes a patch that reduces the memory usage and performance impact of Composter usages. The repeated 3 | * array allocations are replaced by the came copy that is stored in a static final field. 4 | */ 5 | @MixinConfigOption(description = "Composters will reuse the available slot arrays that are requested by hoppers") 6 | package net.caffeinemc.mods.lithium.mixin.alloc.composter; 7 | 8 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/alloc/deep_passengers/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This package includes a patch that reduces the memory usage and performance impact of querying the passengers of an 3 | * entity by replacing Java Stream code with ArrayList operations where possible. 4 | */ 5 | @MixinConfigOption(description = "Reduce stream code usage when getting the passengers of an entity") 6 | package net.caffeinemc.mods.lithium.mixin.alloc.deep_passengers; 7 | 8 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/alloc/entity_iteration/ClassInstanceMultiMapAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.alloc.entity_iteration; 2 | 3 | import net.minecraft.util.ClassInstanceMultiMap; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | import java.util.List; 8 | 9 | @Mixin(ClassInstanceMultiMap.class) 10 | public interface ClassInstanceMultiMapAccessor { 11 | 12 | @Accessor("allInstances") 13 | List getAllInstances(); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/alloc/entity_iteration/EntitySectionMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.alloc.entity_iteration; 2 | 3 | import net.minecraft.util.ClassInstanceMultiMap; 4 | import net.minecraft.world.level.entity.EntitySection; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Redirect; 8 | 9 | import java.util.Iterator; 10 | 11 | @Mixin(EntitySection.class) 12 | public class EntitySectionMixin { 13 | 14 | @Redirect( 15 | method = "getEntities(Lnet/minecraft/world/phys/AABB;Lnet/minecraft/util/AbortableIterationConsumer;)Lnet/minecraft/util/AbortableIterationConsumer$Continuation;", 16 | at = @At(value = "INVOKE", target = "Lnet/minecraft/util/ClassInstanceMultiMap;iterator()Ljava/util/Iterator;") 17 | ) 18 | private Iterator directIterator(ClassInstanceMultiMap instance) { 19 | return ((ClassInstanceMultiMapAccessor) instance).getAllInstances().iterator(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/alloc/entity_iteration/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Avoid unnecessary indirection when iterating entities of an entity section.") 2 | package net.caffeinemc.mods.lithium.mixin.alloc.entity_iteration; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/alloc/entity_tracker/ChunkMap$TrackedEntityMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.alloc.entity_tracker; 2 | 3 | import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet; 4 | import net.minecraft.server.level.ChunkMap; 5 | import net.minecraft.server.network.ServerPlayerConnection; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Redirect; 9 | 10 | import java.util.Set; 11 | 12 | @Mixin(ChunkMap.TrackedEntity.class) 13 | public class ChunkMap$TrackedEntityMixin { 14 | 15 | /** 16 | * Uses less memory, and will cache the returned iterator. 17 | */ 18 | @Redirect( 19 | method = "", 20 | require = 0, 21 | at = @At( 22 | value = "INVOKE", 23 | target = "Lcom/google/common/collect/Sets;newIdentityHashSet()Ljava/util/Set;", 24 | remap = false 25 | ) 26 | ) 27 | private Set useFasterCollection() { 28 | return new ReferenceOpenHashSet<>(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/alloc/entity_tracker/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This package includes a patch that reduces the memory usage and performance impact of Entity trackers by replacing the 3 | * IdentityHashSet with a hashset from the fastutil library. 4 | */ 5 | @MixinConfigOption(description = "Entity trackers use a fastutil set for storing players instead of an IdentityHashSet") 6 | package net.caffeinemc.mods.lithium.mixin.alloc.entity_tracker; 7 | 8 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/alloc/enum_values/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This package includes patches that reduce the memory usage and performance impact of Enum usages. The defensive copy 3 | * in Enum values() function is avoided by reusing the came copy that is stored in a static final field. 4 | */ 5 | @MixinConfigOption(description = "Avoid `Enum#values()` array copy in frequently called code") 6 | package net.caffeinemc.mods.lithium.mixin.alloc.enum_values; 7 | 8 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/alloc/enum_values/piston_block/PistonBaseBlockMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.alloc.enum_values.piston_block; 2 | 3 | import net.caffeinemc.mods.lithium.common.util.DirectionConstants; 4 | import net.minecraft.core.Direction; 5 | import net.minecraft.world.level.block.piston.PistonBaseBlock; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Redirect; 9 | 10 | @Mixin(PistonBaseBlock.class) 11 | public class PistonBaseBlockMixin { 12 | 13 | @Redirect( 14 | method = "getNeighborSignal", 15 | at = @At( 16 | value = "INVOKE", 17 | target = "Lnet/minecraft/core/Direction;values()[Lnet/minecraft/core/Direction;" 18 | ) 19 | ) 20 | private Direction[] removeAllocation() { 21 | return DirectionConstants.ALL; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/alloc/enum_values/piston_block/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Avoid `Enum#values()` array copy in frequently called code") 2 | package net.caffeinemc.mods.lithium.mixin.alloc.enum_values.piston_block; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/alloc/enum_values/piston_handler/PistonStructureResolverMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.alloc.enum_values.piston_handler; 2 | 3 | import net.caffeinemc.mods.lithium.common.util.DirectionConstants; 4 | import net.minecraft.core.Direction; 5 | import net.minecraft.world.level.block.piston.PistonStructureResolver; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Redirect; 9 | 10 | @Mixin(PistonStructureResolver.class) 11 | public class PistonStructureResolverMixin { 12 | 13 | @Redirect( 14 | method = "addBranchingBlocks(Lnet/minecraft/core/BlockPos;)Z", 15 | at = @At( 16 | value = "INVOKE", 17 | target = "Lnet/minecraft/core/Direction;values()[Lnet/minecraft/core/Direction;" 18 | ) 19 | ) 20 | private Direction[] removeAllocation() { 21 | return DirectionConstants.ALL; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/alloc/enum_values/piston_handler/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Avoid `Enum#values()` array copy in frequently called code") 2 | package net.caffeinemc.mods.lithium.mixin.alloc.enum_values.piston_handler; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/alloc/enum_values/redstone_wire/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Avoid `Enum#values()` array copy in frequently called code") 2 | package net.caffeinemc.mods.lithium.mixin.alloc.enum_values.redstone_wire; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/alloc/explosion_behavior/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This package includes a patch that reduces the memory usage and performance impact of explosions by avoiding a lambda 3 | * allocation in the very often called block blast resistance calculation function 4 | * {@link net.minecraft.world.explosion.EntityExplosionBehavior#getBlastResistance(net.minecraft.world.explosion.Explosion, net.minecraft.world.BlockView, net.minecraft.util.math.BlockPos, net.minecraft.block.BlockState, net.minecraft.fluid.FluidState)}. 5 | */ 6 | @MixinConfigOption(description = "Remove lambda allocation in frequently called block blast resistance calculation in explosion code") 7 | package net.caffeinemc.mods.lithium.mixin.alloc.explosion_behavior; 8 | 9 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/alloc/nbt/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This package includes a patch that reduces the memory usage and performance impact of NBT tags by replacing the 3 | * HashMap with a hashmap from the fastutil library. 4 | */ 5 | @MixinConfigOption(description = "NBT tags use a fastutil hashmap instead of a standard HashMap") 6 | package net.caffeinemc.mods.lithium.mixin.alloc.nbt; 7 | 8 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/alloc/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This package includes patches that are meant to reduce the memory usage of minecraft. 3 | */ 4 | @MixinConfigOption(description = "Patches that reduce memory allocations") 5 | package net.caffeinemc.mods.lithium.mixin.alloc; 6 | 7 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/block/flatten_states/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This package includes a patch that stores information about fluid states directly in the FluidState object to improve 3 | * the performance of accessing whether the FluidState is empty. 4 | */ 5 | @MixinConfigOption(description = "FluidStates store directly whether they are empty") 6 | package net.caffeinemc.mods.lithium.mixin.block.flatten_states; 7 | 8 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/block/fluid/flow/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Fluid flow optimization") 2 | package net.caffeinemc.mods.lithium.mixin.block.fluid.flow; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/block/fluid/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Fluid optimizations") 2 | package net.caffeinemc.mods.lithium.mixin.block.fluid; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/block/hopper/ChiseledBookShelfBlockEntityMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.block.hopper; 2 | 3 | import net.caffeinemc.mods.lithium.api.inventory.LithiumTransferConditionInventory; 4 | import net.minecraft.world.level.block.entity.ChiseledBookShelfBlockEntity; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | 7 | @Mixin(ChiseledBookShelfBlockEntity.class) 8 | public class ChiseledBookShelfBlockEntityMixin implements LithiumTransferConditionInventory { 9 | 10 | @Override 11 | public boolean lithium$itemInsertionTestRequiresStackSize1() { 12 | return true; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/block/hopper/ClassInstanceMultiMapMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.block.hopper; 2 | 3 | import net.minecraft.util.ClassInstanceMultiMap; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.injection.At; 6 | import org.spongepowered.asm.mixin.injection.Redirect; 7 | 8 | @Mixin(value = ClassInstanceMultiMap.class, priority = 1010) 9 | public class ClassInstanceMultiMapMixin { 10 | //require = 0 due to the overwrite in the other TypeFilterableListMixin 11 | @Redirect( 12 | method = "find(Ljava/lang/Class;)Ljava/util/Collection;", 13 | at = @At(value = "INVOKE", target = "Ljava/lang/Class;isAssignableFrom(Ljava/lang/Class;)Z", remap = false), require = 0, expect = 0) 14 | private boolean isAlwaysAssignable(Class aClass, Class cls) { 15 | return true; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/block/hopper/CompoundContainerAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.block.hopper; 2 | 3 | import net.minecraft.world.CompoundContainer; 4 | import net.minecraft.world.Container; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | @Mixin(CompoundContainer.class) 9 | public interface CompoundContainerAccessor { 10 | 11 | @Accessor("container1") 12 | Container getFirst(); 13 | 14 | @Accessor("container2") 15 | Container getSecond(); 16 | } 17 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/block/hopper/ContainerMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.block.hopper; 2 | 3 | import net.caffeinemc.mods.lithium.api.inventory.LithiumCooldownReceivingInventory; 4 | import net.caffeinemc.mods.lithium.api.inventory.LithiumTransferConditionInventory; 5 | import net.minecraft.world.Container; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | 8 | @Mixin(Container.class) 9 | public interface ContainerMixin extends LithiumCooldownReceivingInventory, LithiumTransferConditionInventory { 10 | } 11 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/block/hopper/EntityAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.block.hopper; 2 | 3 | import net.minecraft.world.entity.Entity; 4 | import net.minecraft.world.level.entity.EntityInLevelCallback; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | @Mixin(Entity.class) 9 | public interface EntityAccessor { 10 | 11 | @Accessor("levelCallback") 12 | EntityInLevelCallback getChangeListener(); 13 | } 14 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/block/hopper/EntitySectionAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.block.hopper; 2 | 3 | import net.minecraft.util.ClassInstanceMultiMap; 4 | import net.minecraft.world.level.entity.EntitySection; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | @Mixin(EntitySection.class) 9 | public interface EntitySectionAccessor { 10 | @Accessor("storage") 11 | ClassInstanceMultiMap getCollection(); 12 | } 13 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/block/hopper/NonNullListAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.block.hopper; 2 | 3 | import net.minecraft.core.NonNullList; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | import java.util.List; 8 | 9 | @Mixin(NonNullList.class) 10 | public interface NonNullListAccessor { 11 | @Accessor("list") 12 | List getDelegate(); 13 | } 14 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/block/moving_block_shapes/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This package includes a patch that uses memoization to store offset collision shapes that are otherwise repeatedly 3 | * created when accessing the collision shape of moving blocks and moving pistons. 4 | */ 5 | @MixinConfigOption(description = "Moving blocks and retracting pistons avoid calculating their VoxelShapes by reusing previously created VoxelShapes.") 6 | package net.caffeinemc.mods.lithium.mixin.block.moving_block_shapes; 7 | 8 | import net.caffeinemc.gradle.MixinConfigOption; 9 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/block/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Optimizations related to blocks") 2 | package net.caffeinemc.mods.lithium.mixin.block; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/block/redstone_wire/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This package includes a patch that optimizes the redstone wire power level calculation by avoiding duplicate accesses 3 | * of the blocks around the redstone wire. 4 | */ 5 | @MixinConfigOption(description = "Redstone wire power calculations avoid duplicate block accesses") 6 | package net.caffeinemc.mods.lithium.mixin.block.redstone_wire; 7 | 8 | import net.caffeinemc.gradle.MixinConfigOption; 9 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/block_pattern_matching/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Fast-path exit end portal search by counting nearby bedrock blocks. Reduces lag when placing the last end crystal when respawning the ender dragon.") 2 | package net.caffeinemc.mods.lithium.mixin.block_pattern_matching; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/cached_hashcode/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This package includes a patch that stores the hashcode to avoid recalculating it. 3 | */ 4 | @MixinConfigOption(description = "BlockNeighborGroups used in fluid code cache their hashcode") 5 | package net.caffeinemc.mods.lithium.mixin.cached_hashcode; 6 | 7 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/chunk/entity_class_groups/ClientLevelMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.chunk.entity_class_groups; 2 | 3 | import net.caffeinemc.mods.lithium.common.client.ClientWorldAccessor; 4 | import net.minecraft.client.multiplayer.ClientLevel; 5 | import net.minecraft.world.entity.Entity; 6 | import net.minecraft.world.level.entity.TransientEntitySectionManager; 7 | import org.spongepowered.asm.mixin.Final; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.Shadow; 10 | 11 | @Mixin(ClientLevel.class) 12 | public class ClientLevelMixin implements ClientWorldAccessor { 13 | @Shadow 14 | @Final 15 | private TransientEntitySectionManager entityStorage; 16 | 17 | @Override 18 | public TransientEntitySectionManager lithium$getEntityManager() { 19 | return this.entityStorage; 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/chunk/entity_class_groups/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Allow grouping entity classes for faster entity access, e.g. boats and shulkers", 2 | depends = @MixinConfigDependency(dependencyPath = "mixin.util.accessors")) 3 | package net.caffeinemc.mods.lithium.mixin.chunk.entity_class_groups; 4 | 5 | import net.caffeinemc.gradle.MixinConfigDependency; 6 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/chunk/no_locking/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Remove debug checks in block access code") 2 | package net.caffeinemc.mods.lithium.mixin.chunk.no_locking; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/chunk/no_validation/SimpleBitStorageMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.chunk.no_validation; 2 | 3 | import net.minecraft.util.SimpleBitStorage; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.injection.At; 6 | import org.spongepowered.asm.mixin.injection.Redirect; 7 | 8 | @Mixin(SimpleBitStorage.class) 9 | public class SimpleBitStorageMixin { 10 | @Redirect( 11 | method = {"getAndSet(II)I", "set(II)V", "get(I)I"}, 12 | at = @At(value = "INVOKE", target = "Lorg/apache/commons/lang3/Validate;inclusiveBetween(JJJ)V", remap = false) 13 | 14 | ) 15 | public void skipValidation(long start, long end, long value) { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/chunk/no_validation/ZeroBitStorageMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.chunk.no_validation; 2 | 3 | import net.minecraft.util.ZeroBitStorage; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.injection.At; 6 | import org.spongepowered.asm.mixin.injection.Redirect; 7 | 8 | @Mixin(ZeroBitStorage.class) 9 | public class ZeroBitStorageMixin { 10 | @Redirect( 11 | method = {"getAndSet(II)I", "set(II)V", "get(I)I"}, 12 | at = @At(value = "INVOKE", target = "Lorg/apache/commons/lang3/Validate;inclusiveBetween(JJJ)V", remap = false) 13 | 14 | ) 15 | public void skipValidation(long start, long end, long value) { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/chunk/no_validation/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Skip bounds validation when accessing blocks") 2 | package net.caffeinemc.mods.lithium.mixin.chunk.no_validation; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/chunk/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This package includes various world chunk related optimizations. 3 | */ 4 | @MixinConfigOption(description = "Various world chunk optimizations") 5 | package net.caffeinemc.mods.lithium.mixin.chunk; 6 | 7 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/chunk/palette/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Replaces the vanilla hash palette with an optimized variant") 2 | package net.caffeinemc.mods.lithium.mixin.chunk.palette; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/chunk/serialization/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Optimizes chunk palette compaction when serializing chunks") 2 | package net.caffeinemc.mods.lithium.mixin.chunk.serialization; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/collections/attributes/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Uses fastutil hashmaps for entity attributes") 2 | package net.caffeinemc.mods.lithium.mixin.collections.attributes; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/collections/block_entity_tickers/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Uses fastutil hashmaps for BlockEntity tickers") 2 | package net.caffeinemc.mods.lithium.mixin.collections.block_entity_tickers; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/collections/brain/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Uses fastutil hashmaps for AI memories and sensors") 2 | package net.caffeinemc.mods.lithium.mixin.collections.brain; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/collections/chunk_tickets/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Improves the chunk ticket sets by speeding up the removal of chunk tickets") 2 | package net.caffeinemc.mods.lithium.mixin.collections.chunk_tickets; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/collections/entity_by_type/ClassInstanceMultiMapMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.collections.entity_by_type; 2 | 3 | import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap; 4 | import net.minecraft.util.ClassInstanceMultiMap; 5 | import org.spongepowered.asm.mixin.Final; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.Mutable; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 12 | 13 | import java.util.List; 14 | import java.util.Map; 15 | 16 | @Mixin(ClassInstanceMultiMap.class) 17 | public class ClassInstanceMultiMapMixin { 18 | 19 | @Mutable 20 | @Shadow 21 | @Final 22 | private Map, List> byClass; 23 | 24 | @Inject(method = "", at = @At("RETURN")) 25 | private void init(Class elementType, CallbackInfo ci) { 26 | this.byClass = new Reference2ReferenceOpenHashMap<>(this.byClass); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/collections/entity_by_type/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Uses fastutil hashmaps for type specific entity lists") 2 | package net.caffeinemc.mods.lithium.mixin.collections.entity_by_type; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/collections/entity_filtering/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "The expensive check to see if a TypeFilterableList can be filtered by a specific class is only made when a new list for that type needs to be created") 2 | package net.caffeinemc.mods.lithium.mixin.collections.entity_filtering; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/collections/entity_ticking/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Copy entity hashmap instead of duplicating the list using iteration") 2 | package net.caffeinemc.mods.lithium.mixin.collections.entity_ticking; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/collections/fluid_submersion/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Use ReferenceArraySet instead of HashSet to store the fluids the entity is currently submerged in.") 2 | package net.caffeinemc.mods.lithium.mixin.collections.fluid_submersion; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/collections/gamerules/GameRulesMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.collections.gamerules; 2 | 3 | import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; 4 | import net.minecraft.world.level.GameRules; 5 | import org.spongepowered.asm.mixin.Final; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.Mutable; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 12 | 13 | import java.util.Map; 14 | 15 | @Mixin(GameRules.class) 16 | public class GameRulesMixin { 17 | @Mutable 18 | @Shadow 19 | @Final 20 | private Map, GameRules.Value> rules; 21 | 22 | @Inject( 23 | method = "(Ljava/util/Map;Lnet/minecraft/world/flag/FeatureFlagSet;)V", 24 | at = @At("RETURN") 25 | ) 26 | private void reinitializeMap(CallbackInfo ci) { 27 | this.rules = new Object2ObjectOpenHashMap<>(this.rules); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/collections/gamerules/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Uses fastutil hashmaps for gamerules") 2 | package net.caffeinemc.mods.lithium.mixin.collections.gamerules; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/collections/mob_spawning/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Uses custom hashset/list combination for faster mob spawn checks") 2 | package net.caffeinemc.mods.lithium.mixin.collections.mob_spawning; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/collections/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Various collection optimizations") 2 | package net.caffeinemc.mods.lithium.mixin.collections; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/debug/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Debug features", enabled = false) 2 | package net.caffeinemc.mods.lithium.mixin.debug; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/debug/palette/ClientBoundLevelChunkPacketDataAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.debug.palette; 2 | 3 | import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | @Mixin(ClientboundLevelChunkPacketData.class) 8 | public interface ClientBoundLevelChunkPacketDataAccessor { 9 | 10 | @Accessor("buffer") 11 | byte[] getBuffer(); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/debug/palette/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Clients check the chunk section data when receiving a chunk data packet.") 2 | package net.caffeinemc.mods.lithium.mixin.debug.palette; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/entity/collisions/intersection/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Uses faster block access for block collisions and delayed entity access with grouped boat/shulker for entity collisions when available", 3 | depends = { 4 | @MixinConfigDependency(dependencyPath = "mixin.util.chunk_access") 5 | } 6 | ) 7 | package net.caffeinemc.mods.lithium.mixin.entity.collisions.intersection; 8 | 9 | import net.caffeinemc.gradle.MixinConfigDependency; 10 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/entity/collisions/movement/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Entity movement uses optimized block access and optimized and delayed entity access." + 3 | " Additionally, the supporting block of entities that only move downwards is checked first. This can" + 4 | " profit from mixin.experimental.entity.block_caching.block_support, but it is not required.", 5 | depends = @MixinConfigDependency(dependencyPath = "mixin.util.chunk_access") 6 | ) 7 | package net.caffeinemc.mods.lithium.mixin.entity.collisions.movement; 8 | 9 | import net.caffeinemc.gradle.MixinConfigDependency; 10 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/entity/collisions/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Various entity collision optimizations") 2 | package net.caffeinemc.mods.lithium.mixin.entity.collisions; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/entity/collisions/unpushable_cramming/EntitySelectorMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.entity.collisions.unpushable_cramming; 2 | 3 | import net.caffeinemc.mods.lithium.common.entity.pushable.EntityPushablePredicate; 4 | import net.minecraft.world.entity.EntitySelector; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Redirect; 8 | 9 | import java.util.function.Predicate; 10 | 11 | @Mixin(EntitySelector.class) 12 | public class EntitySelectorMixin { 13 | 14 | @Redirect( 15 | method = "pushableBy(Lnet/minecraft/world/entity/Entity;)Ljava/util/function/Predicate;", 16 | at = @At( 17 | value = "INVOKE", 18 | target = "Ljava/util/function/Predicate;and(Ljava/util/function/Predicate;)Ljava/util/function/Predicate;" 19 | ) 20 | ) 21 | private static Predicate getEntityPushablePredicate(Predicate first, Predicate second) { 22 | return EntityPushablePredicate.and(first, second); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/entity/collisions/unpushable_cramming/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "In chunks with many mobs in ladders a separate list of pushable entities for cramming tests is used", 3 | depends = { 4 | @MixinConfigDependency(dependencyPath = "mixin.chunk.entity_class_groups") 5 | } 6 | ) 7 | package net.caffeinemc.mods.lithium.mixin.entity.collisions.unpushable_cramming; 8 | 9 | import net.caffeinemc.gradle.MixinConfigDependency; 10 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/entity/equipment_tracking/enchantment_ticking/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Use equipment tracking to skip ticking enchantments (Soul speed) when no such enchantments are present on the equipment of a living entity.") 2 | package net.caffeinemc.mods.lithium.mixin.entity.equipment_tracking.enchantment_ticking; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/entity/equipment_tracking/equipment_changes/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Skips repeated checks whether the equipment of an entity changed.") 2 | package net.caffeinemc.mods.lithium.mixin.entity.equipment_tracking.equipment_changes; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/entity/equipment_tracking/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Skips repeated checks whether the equipment of an entity changed. " + 3 | "Equipment updates are detected instead.", 4 | depends = @MixinConfigDependency(dependencyPath = "mixin.util.item_component_and_count_tracking") 5 | ) 6 | package net.caffeinemc.mods.lithium.mixin.entity.equipment_tracking; 7 | 8 | import net.caffeinemc.gradle.MixinConfigDependency; 9 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/entity/fast_elytra_check/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Skip repeatedly writing to the data tracker that an entity is not flying") 2 | package net.caffeinemc.mods.lithium.mixin.entity.fast_elytra_check; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/entity/fast_hand_swing/LivingEntityMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.entity.fast_hand_swing; 2 | 3 | import net.minecraft.world.entity.LivingEntity; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.Shadow; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(LivingEntity.class) 11 | public abstract class LivingEntityMixin { 12 | @Shadow 13 | public boolean swinging; 14 | 15 | @Shadow 16 | public int swingTime; 17 | 18 | @Inject( 19 | method = "updateSwingTime()V", 20 | at = @At("HEAD"), 21 | cancellable = true 22 | ) 23 | private void skipGetDuration(CallbackInfo ci) { 24 | if (!this.swinging && this.swingTime == 0) { 25 | ci.cancel(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/entity/fast_hand_swing/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Skip hand swinging speed and animation calculations when the hand of an entity is not swinging") 2 | package net.caffeinemc.mods.lithium.mixin.entity.fast_hand_swing; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/entity/fast_powder_snow_check/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Skip checking whether an entity is inside powder snow for movement speed slowdown when it is not freezing") 2 | package net.caffeinemc.mods.lithium.mixin.entity.fast_powder_snow_check; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/entity/fast_retrieval/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Access entities faster when accessing a relatively small number of entity sections") 2 | package net.caffeinemc.mods.lithium.mixin.entity.fast_retrieval; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/entity/inactive_navigations/DrownedEntityLeaveWaterGoalMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.entity.inactive_navigations; 2 | 3 | import net.caffeinemc.mods.lithium.common.entity.NavigatingEntity; 4 | import net.minecraft.world.entity.monster.Drowned; 5 | import org.spongepowered.asm.mixin.Final; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.Shadow; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | @Mixin(targets = "net/minecraft/world/entity/monster/Drowned$DrownedGoToBeachGoal") 13 | public class DrownedEntityLeaveWaterGoalMixin { 14 | @Shadow 15 | @Final 16 | private Drowned drowned; 17 | 18 | @Inject(method = "start()V", at = @At(value = "RETURN")) 19 | private void updateInactivityState(CallbackInfo ci) { 20 | ((NavigatingEntity) this.drowned).lithium$updateNavigationRegistration(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/entity/inactive_navigations/DrownedMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.entity.inactive_navigations; 2 | 3 | import net.caffeinemc.mods.lithium.common.entity.NavigatingEntity; 4 | import net.minecraft.world.entity.monster.Drowned; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(Drowned.class) 11 | public class DrownedMixin { 12 | @Inject(method = "updateSwimming()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/monster/Drowned;setSwimming(Z)V")) 13 | private void updateInactivityState(CallbackInfo ci) { 14 | ((NavigatingEntity) this).lithium$updateNavigationRegistration(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/entity/inactive_navigations/LivingEntityMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.entity.inactive_navigations; 2 | 3 | import net.caffeinemc.mods.lithium.common.entity.NavigatingEntity; 4 | import net.minecraft.world.entity.LivingEntity; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(LivingEntity.class) 11 | public class LivingEntityMixin { 12 | 13 | @Inject(method = "stopRiding", at = @At("RETURN")) 14 | public void handleStopRiding(CallbackInfo ci) { 15 | if (this instanceof NavigatingEntity navigatingEntity) { 16 | navigatingEntity.lithium$updateNavigationRegistration(); 17 | } 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/entity/inactive_navigations/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Block updates skip notifying mobs that won't react to the block update anyways", 3 | depends = @MixinConfigDependency(dependencyPath = "mixin.util.data_storage") 4 | ) 5 | package net.caffeinemc.mods.lithium.mixin.entity.inactive_navigations; 6 | 7 | import net.caffeinemc.gradle.MixinConfigDependency; 8 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/entity/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Various entity optimizations") 2 | package net.caffeinemc.mods.lithium.mixin.entity; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/entity/replace_entitytype_predicates/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Accesses entities of the correct type directly instead of accessing all nearby entities and filtering them afterwards") 2 | package net.caffeinemc.mods.lithium.mixin.entity.replace_entitytype_predicates; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/entity/sprinting_particles/EntityMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.entity.sprinting_particles; 2 | 3 | import net.minecraft.world.entity.Entity; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.injection.At; 6 | import org.spongepowered.asm.mixin.injection.Redirect; 7 | 8 | @Mixin(Entity.class) 9 | public abstract class EntityMixin { 10 | 11 | @Redirect( 12 | method = "baseTick", 13 | at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;canSpawnSprintParticle()Z") 14 | ) 15 | private boolean skipParticlesOnServerSide(Entity instance) { 16 | if (instance.level().isClientSide()) { 17 | return instance.canSpawnSprintParticle(); 18 | } 19 | return false; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/entity/sprinting_particles/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Skips trying to create sprinting particles for all entities on the server side.") 2 | package net.caffeinemc.mods.lithium.mixin.entity.sprinting_particles; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/experimental/client_tick/entity/base_tick/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Client-side entity base tick optimizations" 3 | ) 4 | package net.caffeinemc.mods.lithium.mixin.experimental.client_tick.entity.base_tick; 5 | 6 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/experimental/client_tick/entity/base_tick/unused_ambient_sound/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Skip client-side server-only entity ambient sound play attempts" 3 | ) 4 | package net.caffeinemc.mods.lithium.mixin.experimental.client_tick.entity.base_tick.unused_ambient_sound; 5 | 6 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/experimental/client_tick/entity/base_tick/unused_water_supply/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Skip client-side breathing tick of water creatures" 3 | ) 4 | package net.caffeinemc.mods.lithium.mixin.experimental.client_tick.entity.base_tick.unused_water_supply; 5 | 6 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/experimental/client_tick/entity/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Client-side only entity optimizations" 3 | ) 4 | package net.caffeinemc.mods.lithium.mixin.experimental.client_tick.entity; 5 | 6 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/experimental/client_tick/entity/unused_brain/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Skip creating brains for living entities on the client" 3 | ) 4 | package net.caffeinemc.mods.lithium.mixin.experimental.client_tick.entity.unused_brain; 5 | 6 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/experimental/client_tick/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Client-side only optimizations" 3 | ) 4 | package net.caffeinemc.mods.lithium.mixin.experimental.client_tick; 5 | 6 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/experimental/client_tick/particle/biome_particles/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Optimized client-side only biome particle spawning by checking the random chance before getting the biome" 3 | ) 4 | package net.caffeinemc.mods.lithium.mixin.experimental.client_tick.particle.biome_particles; 5 | 6 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/experimental/client_tick/particle/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Client-side only particle optimizations" 3 | ) 4 | package net.caffeinemc.mods.lithium.mixin.experimental.client_tick.particle; 5 | 6 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/experimental/entity/block_caching/block_support/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Use the block listening system to skip supporting block search (used for honey block pushing, velocity modifiers like soulsand, etc)", 2 | depends = @MixinConfigDependency(dependencyPath = "mixin.util.block_tracking")) 3 | package net.caffeinemc.mods.lithium.mixin.experimental.entity.block_caching.block_support; 4 | 5 | import net.caffeinemc.gradle.MixinConfigDependency; 6 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/experimental/entity/block_caching/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Use block listening system to allow skipping stuff in entity code", 2 | depends = @MixinConfigDependency(dependencyPath = "mixin.util.block_tracking")) 3 | package net.caffeinemc.mods.lithium.mixin.experimental.entity.block_caching; 4 | 5 | import net.caffeinemc.gradle.MixinConfigDependency; 6 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/experimental/entity/block_caching/suffocation/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Use the block listening system to cache the entity suffocation check.", 2 | depends = @MixinConfigDependency(dependencyPath = "mixin.util.block_tracking")) 3 | package net.caffeinemc.mods.lithium.mixin.experimental.entity.block_caching.suffocation; 4 | 5 | import net.caffeinemc.gradle.MixinConfigDependency; 6 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/experimental/entity/item_entity_merging/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Optimize item entity merging by categorizing item entities by item type and only attempting to" + 3 | " merge with the same type. Categorizing by stack size allows skipping merge attempts of full item" + 4 | " entities or two more than half full item entities.", 5 | depends = { 6 | @MixinConfigDependency(dependencyPath = "mixin.util.accessors"), 7 | @MixinConfigDependency(dependencyPath = "mixin.util.entity_collection_replacement"), 8 | @MixinConfigDependency(dependencyPath = "mixin.util.item_component_and_count_tracking") 9 | } 10 | ) 11 | package net.caffeinemc.mods.lithium.mixin.experimental.entity.item_entity_merging; 12 | 13 | import net.caffeinemc.gradle.MixinConfigDependency; 14 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/experimental/entity/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Experimental entity optimizations") 2 | package net.caffeinemc.mods.lithium.mixin.experimental.entity; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/experimental/entity/projectile_projectile_collisions/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Optimize huge stacks of projectiles (e.g. 1000+ ender pearls in a single statis chamber) by " + 3 | "skipping projectile-projectile collision checks for projectile types that are unable to collide with " + 4 | "each other, e.g. ender pearls never collide with ender pearls.", 5 | depends = @MixinConfigDependency(dependencyPath = "mixin.chunk.entity_class_groups") 6 | ) 7 | package net.caffeinemc.mods.lithium.mixin.experimental.entity.projectile_projectile_collisions; 8 | 9 | import net.caffeinemc.gradle.MixinConfigDependency; 10 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/experimental/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Various experimental optimizations", enabled = false) 2 | package net.caffeinemc.mods.lithium.mixin.experimental; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/gen/cached_generator_settings/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "World generator settings cache the sea level. Disabled by default due to startup crash.", enabled = false) 3 | package net.caffeinemc.mods.lithium.mixin.gen.cached_generator_settings; 4 | 5 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/gen/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Various world generation optimizations") 2 | package net.caffeinemc.mods.lithium.mixin.gen; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/math/fast_blockpos/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Avoids indirection and inlines several functions") 2 | package net.caffeinemc.mods.lithium.mixin.math.fast_blockpos; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/math/fast_util/DirectionMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.math.fast_util; 2 | 3 | import net.minecraft.core.Direction; 4 | import net.minecraft.util.RandomSource; 5 | import org.spongepowered.asm.mixin.Final; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.Overwrite; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | 10 | @Mixin(Direction.class) 11 | public class DirectionMixin { 12 | @Shadow 13 | @Final 14 | private static Direction[] VALUES; 15 | 16 | @Shadow 17 | @Final 18 | private int oppositeIndex; 19 | 20 | /** 21 | * @reason Avoid the modulo/abs operations 22 | * @author JellySquid 23 | */ 24 | @Overwrite 25 | public Direction getOpposite() { 26 | return VALUES[this.oppositeIndex]; 27 | } 28 | 29 | /** 30 | * @reason Do not allocate an excessive number of Direction arrays 31 | * @author JellySquid 32 | */ 33 | @Overwrite 34 | public static Direction getRandom(RandomSource rand) { 35 | return VALUES[rand.nextInt(VALUES.length)]; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/math/fast_util/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Avoid indirection and inline several functions in Direction, Axis and Box code") 2 | package net.caffeinemc.mods.lithium.mixin.math.fast_util; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/math/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Various math optimizations") 2 | package net.caffeinemc.mods.lithium.mixin.math; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/math/sine_lut/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Reduces the sine table size to reduce memory usage and increase access speed") 2 | package net.caffeinemc.mods.lithium.mixin.math.sine_lut; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/minimal_nonvanilla/ai/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Mob AI optimizations") 2 | package net.caffeinemc.mods.lithium.mixin.minimal_nonvanilla.ai; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/minimal_nonvanilla/ai/sensor/frog_attackables/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Speed up frog attackable sensor by checking entity type before visibility test." + 3 | " This is slightly non-vanilla because the visibility information is cached for up to a second." + 4 | " If this sensor does not compute the visibility test, a later access might compute the visibility instead." + 5 | " That can cause a different result, since the later computation leads to a more updated result." 6 | ) 7 | package net.caffeinemc.mods.lithium.mixin.minimal_nonvanilla.ai.sensor.frog_attackables; 8 | 9 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/minimal_nonvanilla/ai/sensor/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Brain sensor optimizations") 2 | package net.caffeinemc.mods.lithium.mixin.minimal_nonvanilla.ai.sensor; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/minimal_nonvanilla/collisions/empty_space/ArrayVoxelShapeInvoker.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.minimal_nonvanilla.collisions.empty_space; 2 | 3 | import it.unimi.dsi.fastutil.doubles.DoubleList; 4 | import net.minecraft.world.phys.shapes.ArrayVoxelShape; 5 | import net.minecraft.world.phys.shapes.DiscreteVoxelShape; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.gen.Invoker; 8 | 9 | @Mixin(ArrayVoxelShape.class) 10 | public interface ArrayVoxelShapeInvoker { 11 | @Invoker(value = "") 12 | static ArrayVoxelShape init(DiscreteVoxelShape shape, DoubleList xPoints, DoubleList yPoints, DoubleList zPoints) { 13 | throw new AssertionError(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/minimal_nonvanilla/collisions/empty_space/BitSetDiscreteVoxelShapeAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.minimal_nonvanilla.collisions.empty_space; 2 | 3 | import net.minecraft.world.phys.shapes.BitSetDiscreteVoxelShape; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | import java.util.BitSet; 8 | 9 | @Mixin(BitSetDiscreteVoxelShape.class) 10 | public interface BitSetDiscreteVoxelShapeAccessor { 11 | 12 | @Accessor 13 | BitSet getStorage(); 14 | } 15 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/minimal_nonvanilla/collisions/empty_space/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Speed up finding empty spaces mobs fit into. This speeds up entity pose checks and nether portal" + 3 | " positioning for colliding mobs (This code is vanilla's nether portal horse suffocation fix)." + 4 | " If certain block collision surfaces have coordinates that are different but within 1e-7 of each other," + 5 | " this optimization may cause entities coming from nether portals or changing pose to be placed in a" + 6 | " different position or pose than vanilla. This effect only occurs when the decision whether the entity" + 7 | " fits into a space depends on a difference in the magnitude of 1e-7 blocks." 8 | ) 9 | package net.caffeinemc.mods.lithium.mixin.minimal_nonvanilla.collisions.empty_space; 10 | 11 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/minimal_nonvanilla/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Optimizations that technically deviate from vanilla behavior, but must not affect " + 2 | "gameplay or contraptions. Each optimization includes a description of the differences to vanilla behavior. " + 3 | "In case any of these optimizations breaks any of your contraptions or affects your gameplay, " + 4 | "please report it to our issue tracker as we consider this to be a bug.") 5 | package net.caffeinemc.mods.lithium.mixin.minimal_nonvanilla; 6 | 7 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/minimal_nonvanilla/spawning/EntitySectionAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.minimal_nonvanilla.spawning; 2 | 3 | import net.minecraft.util.ClassInstanceMultiMap; 4 | import net.minecraft.world.level.entity.EntitySection; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | @Mixin(EntitySection.class) 9 | public interface EntitySectionAccessor { 10 | @Accessor("storage") 11 | ClassInstanceMultiMap getCollection(); 12 | } 13 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/minimal_nonvanilla/spawning/PersistentEntitySectionManagerAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.minimal_nonvanilla.spawning; 2 | 3 | import net.minecraft.world.level.entity.EntityAccess; 4 | import net.minecraft.world.level.entity.EntitySectionStorage; 5 | import net.minecraft.world.level.entity.PersistentEntitySectionManager; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.gen.Accessor; 8 | 9 | @Mixin(PersistentEntitySectionManager.class) 10 | public interface PersistentEntitySectionManagerAccessor { 11 | @Accessor("sectionStorage") 12 | EntitySectionStorage getCache(); 13 | } 14 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/minimal_nonvanilla/spawning/ServerLevelAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.minimal_nonvanilla.spawning; 2 | 3 | import net.minecraft.server.level.ServerLevel; 4 | import net.minecraft.world.entity.Entity; 5 | import net.minecraft.world.level.entity.PersistentEntitySectionManager; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.gen.Accessor; 8 | 9 | @Mixin(ServerLevel.class) 10 | public interface ServerLevelAccessor { 11 | @Accessor("entityManager") 12 | PersistentEntitySectionManager getEntityManager(); 13 | } 14 | 15 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/minimal_nonvanilla/spawning/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Optimizations to spawning conditions. Reorders the iteration over entities to match the chunks " + 3 | "and chunk sections, reducing the number of cache misses. Might differ slightly from vanilla due to " + 4 | "floating point associativity differences when summing the spawning potential of density controlled " + 5 | "spawns, e.g. skeleton, ghast, enderman and strider spawns in certain nether biomes.") 6 | package net.caffeinemc.mods.lithium.mixin.minimal_nonvanilla.spawning; 7 | 8 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/minimal_nonvanilla/world/block_entity_ticking/support_cache/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "BlockEntity ticking caches whether the BlockEntity can exist in the BlockState at the same location." + 3 | " This deviates from vanilla in the case of placing a hopper in a powered location, immediately updating the" + 4 | " cached BlockState (which is incorrect in vanilla). This most likely does not affect your gameplay, as this" + 5 | " deviation only affects hoppers, and in vanilla, hoppers never use the cached state information anyway.", 6 | depends = @MixinConfigDependency(dependencyPath = "mixin.world.block_entity_ticking") 7 | ) 8 | package net.caffeinemc.mods.lithium.mixin.minimal_nonvanilla.world.block_entity_ticking.support_cache; 9 | 10 | import net.caffeinemc.gradle.MixinConfigDependency; 11 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/shapes/blockstate_cache/BlockMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.shapes.blockstate_cache; 2 | 3 | import net.caffeinemc.mods.lithium.common.util.collections.Object2BooleanCacheTable; 4 | import net.minecraft.world.level.block.Block; 5 | import net.minecraft.world.phys.shapes.BooleanOp; 6 | import net.minecraft.world.phys.shapes.Shapes; 7 | import net.minecraft.world.phys.shapes.VoxelShape; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.Overwrite; 10 | 11 | @Mixin(Block.class) 12 | public class BlockMixin { 13 | private static final Object2BooleanCacheTable FULL_CUBE_CACHE = new Object2BooleanCacheTable<>( 14 | 512, 15 | shape -> !Shapes.joinIsNotEmpty(Shapes.block(), shape, BooleanOp.NOT_SAME) 16 | ); 17 | 18 | /** 19 | * @reason Use a faster cache implementation 20 | * @author gegy1000 21 | */ 22 | @Overwrite 23 | public static boolean isShapeFullBlock(VoxelShape shape) { 24 | return FULL_CUBE_CACHE.get(shape); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/shapes/blockstate_cache/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Use a faster collection for the full cube test cache") 2 | package net.caffeinemc.mods.lithium.mixin.shapes.blockstate_cache; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/shapes/lazy_shape_context/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Entity shape contexts initialize rarely used fields only on first use" 2 | ) 3 | package net.caffeinemc.mods.lithium.mixin.shapes.lazy_shape_context; 4 | 5 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/shapes/optimized_matching/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "VoxelShape collisions use a faster intersection test for cuboid shapes") 2 | package net.caffeinemc.mods.lithium.mixin.shapes.optimized_matching; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/shapes/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Various VoxelShape optimizations") 2 | package net.caffeinemc.mods.lithium.mixin.shapes; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/shapes/precompute_shape_arrays/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "VoxelShapes store position arrays for their shape instead of recalculating the positions") 2 | package net.caffeinemc.mods.lithium.mixin.shapes.precompute_shape_arrays; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/shapes/shape_merging/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Merging and intersecting VoxelShapes is optimized using faster position list merging") 2 | package net.caffeinemc.mods.lithium.mixin.shapes.shape_merging; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/shapes/specialized_shapes/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Specialized VoxelShape implementations are used for cuboid and empty shapes. Collisions" + 2 | " with those shapes are optimized using a cuboid specific implementation") 3 | package net.caffeinemc.mods.lithium.mixin.shapes.specialized_shapes; 4 | 5 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/accessors/EntitySectionAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.util.accessors; 2 | 3 | import net.minecraft.util.ClassInstanceMultiMap; 4 | import net.minecraft.world.level.entity.EntitySection; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | @Mixin(EntitySection.class) 9 | public interface EntitySectionAccessor { 10 | @Accessor("storage") 11 | ClassInstanceMultiMap getCollection(); 12 | } 13 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/accessors/ItemEntityAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.util.accessors; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.gen.Accessor; 5 | 6 | import java.util.UUID; 7 | import net.minecraft.world.entity.item.ItemEntity; 8 | 9 | @Mixin(ItemEntity.class) 10 | public interface ItemEntityAccessor { 11 | @Accessor("target") 12 | UUID lithium$getOwner(); 13 | } 14 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/accessors/ItemStackAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.util.accessors; 2 | 3 | import net.minecraft.world.item.Item; 4 | import net.minecraft.world.item.ItemStack; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | @Mixin(ItemStack.class) 9 | public interface ItemStackAccessor { 10 | 11 | @Accessor("item") 12 | Item lithium$getItem(); 13 | } 14 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/accessors/LevelAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.util.accessors; 2 | 3 | import net.minecraft.world.level.Level; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | @Mixin(Level.class) 8 | public interface LevelAccessor { 9 | 10 | @Accessor 11 | Thread getThread(); 12 | } 13 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/accessors/PersistentEntitySectionManagerAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.util.accessors; 2 | 3 | import net.minecraft.world.level.entity.EntityAccess; 4 | import net.minecraft.world.level.entity.EntitySectionStorage; 5 | import net.minecraft.world.level.entity.PersistentEntitySectionManager; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.gen.Accessor; 8 | 9 | @Mixin(PersistentEntitySectionManager.class) 10 | public interface PersistentEntitySectionManagerAccessor { 11 | @Accessor("sectionStorage") 12 | EntitySectionStorage getCache(); 13 | } 14 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/accessors/ServerLevelAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.util.accessors; 2 | 3 | import net.minecraft.server.level.ServerLevel; 4 | import net.minecraft.world.entity.Entity; 5 | import net.minecraft.world.level.entity.PersistentEntitySectionManager; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.gen.Accessor; 8 | 9 | @Mixin(ServerLevel.class) 10 | public interface ServerLevelAccessor { 11 | @Accessor("entityManager") 12 | PersistentEntitySectionManager getEntityManager(); 13 | } 14 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/accessors/TransientEntitySectionManagerAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.util.accessors; 2 | 3 | import net.minecraft.world.level.entity.EntityAccess; 4 | import net.minecraft.world.level.entity.EntitySectionStorage; 5 | import net.minecraft.world.level.entity.TransientEntitySectionManager; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.gen.Accessor; 8 | 9 | @Mixin(TransientEntitySectionManager.class) 10 | public interface TransientEntitySectionManagerAccessor { 11 | @Accessor("sectionStorage") 12 | EntitySectionStorage getCache(); 13 | } 14 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/accessors/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Allow accessing certain fields and functions that are normally inaccessible") 2 | package net.caffeinemc.mods.lithium.mixin.util.accessors; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/block_entity_retrieval/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Allows access to existing BlockEntities without creating new ones") 2 | package net.caffeinemc.mods.lithium.mixin.util.block_entity_retrieval; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/block_tracking/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Chunk sections count certain blocks inside them and provide a method to quickly check whether a" + 3 | " chunk contains any of these blocks. Furthermore, chunk sections can notify registered listeners about" + 4 | " certain blocks being placed or broken.", 5 | depends = { 6 | @MixinConfigDependency(dependencyPath = "mixin.util.data_storage"), 7 | @MixinConfigDependency(dependencyPath = "mixin.util.chunk_status_tracking"), 8 | @MixinConfigDependency(dependencyPath = "mixin.util.initialization") 9 | } 10 | ) 11 | package net.caffeinemc.mods.lithium.mixin.util.block_tracking; 12 | 13 | import net.caffeinemc.gradle.MixinConfigDependency; 14 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/chunk_access/LevelReaderMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.util.chunk_access; 2 | 3 | import net.caffeinemc.mods.lithium.common.world.ChunkView; 4 | import net.minecraft.world.level.LevelReader; 5 | import net.minecraft.world.level.chunk.ChunkAccess; 6 | import net.minecraft.world.level.chunk.status.ChunkStatus; 7 | import org.jetbrains.annotations.Nullable; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.Shadow; 10 | 11 | @Mixin(LevelReader.class) 12 | public interface LevelReaderMixin extends ChunkView { 13 | 14 | @Shadow 15 | @Nullable ChunkAccess getChunk(int var1, int var2, ChunkStatus var3, boolean var4); 16 | 17 | @Override 18 | default @Nullable ChunkAccess lithium$getLoadedChunk(int chunkX, int chunkZ) { 19 | return this.getChunk(chunkX, chunkZ, ChunkStatus.FULL, false); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/chunk_access/PathNavigationRegionMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.util.chunk_access; 2 | 3 | import net.caffeinemc.mods.lithium.common.world.ChunkView; 4 | import net.minecraft.world.level.PathNavigationRegion; 5 | import net.minecraft.world.level.chunk.ChunkAccess; 6 | import org.jetbrains.annotations.Nullable; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | 10 | @Mixin(PathNavigationRegion.class) 11 | public abstract class PathNavigationRegionMixin implements ChunkView { 12 | 13 | @Shadow 14 | protected abstract ChunkAccess getChunk(int chunkX, int chunkZ); 15 | 16 | @Override 17 | public @Nullable ChunkAccess lithium$getLoadedChunk(int chunkX, int chunkZ) { 18 | return this.getChunk(chunkX, chunkZ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/chunk_access/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Access chunks of worlds, chunk caches and chunk regions directly." 3 | ) 4 | package net.caffeinemc.mods.lithium.mixin.util.chunk_access; 5 | 6 | import net.caffeinemc.gradle.MixinConfigOption; 7 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/chunk_status_tracking/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Allows reacting to changes of the load status of chunks.", 3 | depends = @MixinConfigDependency(dependencyPath = "mixin.util.accessors") 4 | 5 | ) 6 | package net.caffeinemc.mods.lithium.mixin.util.chunk_status_tracking; 7 | 8 | import net.caffeinemc.gradle.MixinConfigDependency; 9 | import net.caffeinemc.gradle.MixinConfigOption; 10 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/data_storage/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Stores lithium's extra data used for various optimizations on a per-world basis." + 3 | " The data is not saved, but allows optimizations to quickly store and access data." 4 | ) 5 | package net.caffeinemc.mods.lithium.mixin.util.data_storage; 6 | 7 | import net.caffeinemc.gradle.MixinConfigOption; 8 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/entity_collection_replacement/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Allow replacing entity collections with custom collection types." 3 | ) 4 | package net.caffeinemc.mods.lithium.mixin.util.entity_collection_replacement; 5 | 6 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/entity_movement_tracking/PersistentEntitySectionManagerAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.util.entity_movement_tracking; 2 | 3 | import net.minecraft.world.level.entity.EntityAccess; 4 | import net.minecraft.world.level.entity.EntitySectionStorage; 5 | import net.minecraft.world.level.entity.PersistentEntitySectionManager; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.gen.Accessor; 8 | 9 | @Mixin(PersistentEntitySectionManager.class) 10 | public interface PersistentEntitySectionManagerAccessor { 11 | @Accessor("sectionStorage") 12 | EntitySectionStorage getCache(); 13 | } 14 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/entity_movement_tracking/ServerLevelAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.util.entity_movement_tracking; 2 | 3 | import net.minecraft.server.level.ServerLevel; 4 | import net.minecraft.world.entity.Entity; 5 | import net.minecraft.world.level.entity.PersistentEntitySectionManager; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.gen.Accessor; 8 | 9 | @Mixin(ServerLevel.class) 10 | public interface ServerLevelAccessor { 11 | @Accessor("entityManager") 12 | PersistentEntitySectionManager getEntityManager(); 13 | } 14 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/entity_movement_tracking/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "System to notify subscribers of certain entity sections about position changes of certain entity types.", 3 | depends = { 4 | @MixinConfigDependency(dependencyPath = "mixin.util.entity_section_position"), 5 | @MixinConfigDependency(dependencyPath = "mixin.util.data_storage") 6 | } 7 | ) 8 | package net.caffeinemc.mods.lithium.mixin.util.entity_movement_tracking; 9 | 10 | import net.caffeinemc.gradle.MixinConfigDependency; 11 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/entity_section_position/EntitySectionMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.util.entity_section_position; 2 | 3 | import net.caffeinemc.mods.lithium.common.entity.PositionedEntityTrackingSection; 4 | import net.minecraft.world.level.entity.EntitySection; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | 7 | @Mixin(EntitySection.class) 8 | public class EntitySectionMixin implements PositionedEntityTrackingSection { 9 | private long pos; 10 | 11 | @Override 12 | public void lithium$setPos(long chunkSectionPos) { 13 | this.pos = chunkSectionPos; 14 | } 15 | 16 | @Override 17 | public long lithium$getPos() { 18 | return this.pos; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/entity_section_position/EntitySectionStorageMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.util.entity_section_position; 2 | 3 | import net.caffeinemc.mods.lithium.common.entity.PositionedEntityTrackingSection; 4 | import net.minecraft.world.level.entity.EntityAccess; 5 | import net.minecraft.world.level.entity.EntitySection; 6 | import net.minecraft.world.level.entity.EntitySectionStorage; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 11 | 12 | @Mixin(EntitySectionStorage.class) 13 | public class EntitySectionStorageMixin { 14 | @Inject(method = "createSection(J)Lnet/minecraft/world/level/entity/EntitySection;", at = @At("RETURN")) 15 | private void rememberPos(long sectionPos, CallbackInfoReturnable> cir) { 16 | ((PositionedEntityTrackingSection) cir.getReturnValue()).lithium$setPos(sectionPos); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/entity_section_position/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Entity sections store their position") 2 | package net.caffeinemc.mods.lithium.mixin.util.entity_section_position; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/initialization/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Platform dependent initialization hooks.") 2 | package net.caffeinemc.mods.lithium.mixin.util.initialization; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/inventory_change_listening/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Certain BlockEntity Inventories emit updates to their listeners when their stack list is changed or the inventory becomes invalid" 2 | ) 3 | package net.caffeinemc.mods.lithium.mixin.util.inventory_change_listening; 4 | 5 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/inventory_comparator_tracking/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "BlockEntity Inventories update their listeners when a comparator is placed near them", 3 | depends = { 4 | @MixinConfigDependency(dependencyPath = "mixin.util.block_entity_retrieval") 5 | } 6 | ) 7 | package net.caffeinemc.mods.lithium.mixin.util.inventory_comparator_tracking; 8 | 9 | import net.caffeinemc.gradle.MixinConfigDependency; 10 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/item_component_and_count_tracking/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Implements a subscription / publishing system for changes of item stack components and item entity item type." 3 | ) 4 | package net.caffeinemc.mods.lithium.mixin.util.item_component_and_count_tracking; 5 | 6 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Various utilities for other mixins") 2 | package net.caffeinemc.mods.lithium.mixin.util; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/world_border_listener/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "World border changes are sent to listeners such as BlockEntities") 2 | package net.caffeinemc.mods.lithium.mixin.util.world_border_listener; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/block_entity_ticking/chunk_tickable/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Speed up checking whether a chunk ticks block entities during block entity ticking.") 2 | package net.caffeinemc.mods.lithium.mixin.world.block_entity_ticking.chunk_tickable; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/block_entity_ticking/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Various BlockEntity ticking optimizations") 2 | package net.caffeinemc.mods.lithium.mixin.world.block_entity_ticking; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/block_entity_ticking/sleeping/BlockEntityMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.world.block_entity_ticking.sleeping; 2 | 3 | import net.caffeinemc.mods.lithium.common.block.entity.SetChangedHandlingBlockEntity; 4 | import net.minecraft.world.level.block.entity.BlockEntity; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(BlockEntity.class) 11 | public class BlockEntityMixin implements SetChangedHandlingBlockEntity { 12 | 13 | @Inject(method = "setChanged()V", at = @At("RETURN")) 14 | private void handleSetChanged(CallbackInfo ci) { 15 | this.lithium$handleSetChanged(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/block_entity_ticking/sleeping/LevelMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.world.block_entity_ticking.sleeping; 2 | 3 | import com.llamalad7.mixinextras.injector.wrapoperation.Operation; 4 | import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; 5 | import net.minecraft.core.BlockPos; 6 | import net.minecraft.world.level.Level; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | 10 | @Mixin(Level.class) 11 | public class LevelMixin { 12 | 13 | @WrapOperation( 14 | method = "tickBlockEntities", 15 | at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;shouldTickBlocksAt(Lnet/minecraft/core/BlockPos;)Z"), 16 | require = 0 17 | ) 18 | private boolean shouldTickBlockPosFilterNull(Level instance, BlockPos pos, Operation original) { 19 | if (pos == null) { 20 | return false; 21 | } 22 | return original.call(instance, pos); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/block_entity_ticking/sleeping/ServerLevelMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.world.block_entity_ticking.sleeping; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.server.level.ServerLevel; 5 | import net.minecraft.world.level.block.entity.TickingBlockEntity; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Redirect; 9 | 10 | @Mixin(ServerLevel.class) 11 | public class ServerLevelMixin { 12 | 13 | @Redirect( 14 | method = "dumpBlockEntityTickers", 15 | at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/entity/TickingBlockEntity;getPos()Lnet/minecraft/core/BlockPos;") 16 | ) 17 | private BlockPos getPosOrOrigin(TickingBlockEntity instance) { 18 | BlockPos pos = instance.getPos(); 19 | if (pos == null) { 20 | return BlockPos.ZERO; 21 | } 22 | return pos; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/block_entity_ticking/sleeping/WrappedBlockEntityTickInvokerAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.world.block_entity_ticking.sleeping; 2 | 3 | import net.minecraft.world.level.block.entity.TickingBlockEntity; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | import org.spongepowered.asm.mixin.gen.Invoker; 7 | 8 | @Mixin(targets = "net/minecraft/world/level/chunk/LevelChunk$RebindableTickingBlockEntityWrapper" ) 9 | public interface WrappedBlockEntityTickInvokerAccessor { 10 | @Invoker("rebind") 11 | void callSetWrapped(TickingBlockEntity wrapped); 12 | 13 | @Accessor("ticker") 14 | TickingBlockEntity getWrapped(); 15 | } 16 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/block_entity_ticking/sleeping/brewing_stand/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "BlockEntity sleeping for inactive brewing stands" 2 | ) 3 | package net.caffeinemc.mods.lithium.mixin.world.block_entity_ticking.sleeping.brewing_stand; 4 | 5 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/block_entity_ticking/sleeping/campfire/lit/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "BlockEntity sleeping for inactive lit campfires") 2 | package net.caffeinemc.mods.lithium.mixin.world.block_entity_ticking.sleeping.campfire.lit; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/block_entity_ticking/sleeping/campfire/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "BlockEntity sleeping for inactive campfires") 2 | package net.caffeinemc.mods.lithium.mixin.world.block_entity_ticking.sleeping.campfire; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/block_entity_ticking/sleeping/campfire/unlit/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "BlockEntity sleeping for inactive unlit campfires") 2 | package net.caffeinemc.mods.lithium.mixin.world.block_entity_ticking.sleeping.campfire.unlit; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/block_entity_ticking/sleeping/chest_animation/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "BlockEntity sleeping for inactive chest lid animation, which is only performed client side.") 2 | package net.caffeinemc.mods.lithium.mixin.world.block_entity_ticking.sleeping.chest_animation; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/block_entity_ticking/sleeping/crafter/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "BlockEntity sleeping for inactive crafters" 2 | ) 3 | package net.caffeinemc.mods.lithium.mixin.world.block_entity_ticking.sleeping.crafter; 4 | 5 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/block_entity_ticking/sleeping/furnace/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "BlockEntity sleeping for inactive furnaces" 2 | ) 3 | package net.caffeinemc.mods.lithium.mixin.world.block_entity_ticking.sleeping.furnace; 4 | 5 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/block_entity_ticking/sleeping/hopper/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "BlockEntity sleeping for locked hoppers") 2 | package net.caffeinemc.mods.lithium.mixin.world.block_entity_ticking.sleeping.hopper; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/block_entity_ticking/sleeping/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Allows BlockEntities to sleep, meaning they are no longer ticked until woken up, e.g. by updates to their inventory or block state") 2 | package net.caffeinemc.mods.lithium.mixin.world.block_entity_ticking.sleeping; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/block_entity_ticking/sleeping/shulker_box/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "BlockEntity sleeping for closed shulker boxes") 2 | package net.caffeinemc.mods.lithium.mixin.world.block_entity_ticking.sleeping.shulker_box; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/block_entity_ticking/world_border/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Avoids repeatedly testing whether the BlockEntity is inside the world border by caching the test result and listening for world border changes", 3 | depends = { 4 | @MixinConfigDependency(dependencyPath = "mixin.util.world_border_listener") 5 | } 6 | ) 7 | package net.caffeinemc.mods.lithium.mixin.world.block_entity_ticking.world_border; 8 | 9 | import net.caffeinemc.gradle.MixinConfigDependency; 10 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/chunk_access/ChunkHolderMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.world.chunk_access; 2 | 3 | import net.caffeinemc.mods.lithium.common.world.chunk.ChunkHolderExtended; 4 | import net.minecraft.server.level.ChunkHolder; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Unique; 7 | 8 | @Mixin(ChunkHolder.class) 9 | public class ChunkHolderMixin implements ChunkHolderExtended { 10 | 11 | @Unique 12 | private long lastRequestTime; 13 | 14 | @Override 15 | public boolean lithium$updateLastAccessTime(long time) { 16 | long prev = this.lastRequestTime; 17 | this.lastRequestTime = time; 18 | 19 | return prev != time; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/chunk_access/GenerationChunkHolderAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.world.chunk_access; 2 | 3 | import net.minecraft.server.level.ChunkResult; 4 | import net.minecraft.server.level.GenerationChunkHolder; 5 | import net.minecraft.world.level.chunk.ChunkAccess; 6 | import net.minecraft.world.level.chunk.status.ChunkStatus; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.gen.Accessor; 9 | import org.spongepowered.asm.mixin.gen.Invoker; 10 | 11 | import java.util.concurrent.CompletableFuture; 12 | import java.util.concurrent.atomic.AtomicReferenceArray; 13 | 14 | @Mixin(GenerationChunkHolder.class) 15 | public interface GenerationChunkHolderAccessor { 16 | 17 | @Accessor("futures") 18 | AtomicReferenceArray>> lithium$getChunkFuturesByStatus(); 19 | 20 | @Invoker("isStatusDisallowed") 21 | boolean invokeCannotBeLoaded(ChunkStatus status); 22 | } 23 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/chunk_access/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Several changes to the chunk manager to speed up chunk access") 2 | package net.caffeinemc.mods.lithium.mixin.world.chunk_access; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/chunk_ticking/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Various optimizations to chunk ticking") 2 | package net.caffeinemc.mods.lithium.mixin.world.chunk_ticking; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/chunk_ticking/spread_ice/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Access FluidState through already known BlockState instead of accessing the world again.") 2 | package net.caffeinemc.mods.lithium.mixin.world.chunk_ticking.spread_ice; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/combined_heightmap_update/HeightmapAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.world.combined_heightmap_update; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.gen.Accessor; 5 | import org.spongepowered.asm.mixin.gen.Invoker; 6 | 7 | import java.util.function.Predicate; 8 | import net.minecraft.world.level.block.state.BlockState; 9 | import net.minecraft.world.level.levelgen.Heightmap; 10 | 11 | @Mixin(Heightmap.class) 12 | public interface HeightmapAccessor { 13 | @Invoker("setHeight") 14 | void callSet(int x, int z, int height); 15 | @Accessor("isOpaque") 16 | Predicate getBlockPredicate(); 17 | } 18 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/combined_heightmap_update/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "The four vanilla heightmaps are updated using a combined block search instead of searching blocks separately.") 2 | package net.caffeinemc.mods.lithium.mixin.world.combined_heightmap_update; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/explosions/block_raycast/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Various improvements to explosion block damage, e.g. not accessing blocks along an explosion ray multiple times") 2 | package net.caffeinemc.mods.lithium.mixin.world.explosions.block_raycast; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/explosions/entity_raycast/ClipContextMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.world.explosions.entity_raycast; 2 | 3 | import net.caffeinemc.mods.lithium.common.world.explosions.ClipContextAccess; 4 | import net.minecraft.world.level.ClipContext; 5 | import net.minecraft.world.phys.Vec3; 6 | import net.minecraft.world.phys.shapes.CollisionContext; 7 | import org.spongepowered.asm.mixin.Final; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.Mutable; 10 | import org.spongepowered.asm.mixin.Shadow; 11 | 12 | @Mixin(ClipContext.class) 13 | public class ClipContextMixin implements ClipContextAccess { 14 | @Mutable 15 | @Shadow 16 | @Final 17 | private Vec3 from; 18 | 19 | @Shadow 20 | @Final 21 | private CollisionContext collisionContext; 22 | 23 | @Override 24 | public void lithium$setFrom(Vec3 from) { 25 | this.from = from; 26 | } 27 | 28 | @Override 29 | public CollisionContext lithium$getCollisionContext() { 30 | return this.collisionContext; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/explosions/entity_raycast/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Various improvements to explosion entity damage, e.g. simplifying the raycasts.") 2 | package net.caffeinemc.mods.lithium.mixin.world.explosions.entity_raycast; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/explosions/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Various improvements to explosions.") 2 | package net.caffeinemc.mods.lithium.mixin.world.explosions; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/game_events/dispatch/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Create game event dispatchers for chunk sections only when needed, i.e. when a" + 3 | " listener is added to a section. This reduces memory usage for chunks that do not have any listeners." + 4 | " The dispatchers are accessed more directly instead of indirectly through chunks." + 5 | " In total this speeds up attempting to dispatch events especially when there are no nearby listeners.", 6 | depends = { 7 | @MixinConfigDependency(dependencyPath = "mixin.util.data_storage"), 8 | @MixinConfigDependency(dependencyPath = "mixin.util.chunk_status_tracking") 9 | } 10 | ) 11 | package net.caffeinemc.mods.lithium.mixin.world.game_events.dispatch; 12 | 13 | import net.caffeinemc.gradle.MixinConfigDependency; 14 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/game_events/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Various improvements to game events (vibrations) that are detected by allays, wardens and several sculk blocks.") 2 | package net.caffeinemc.mods.lithium.mixin.world.game_events; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/inline_block_access/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Faster block and fluid access due to inlining and reduced method size") 2 | package net.caffeinemc.mods.lithium.mixin.world.inline_block_access; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/inline_height/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Reduces indirection by inlining world height access methods", 3 | enabled = false //TODO find out why this crashes the render thread 4 | ) 5 | package net.caffeinemc.mods.lithium.mixin.world.inline_height; 6 | 7 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Various world related optimizations") 2 | package net.caffeinemc.mods.lithium.mixin.world; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/raycast/ClipContextAccessor.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.world.raycast; 2 | 3 | import net.minecraft.world.level.ClipContext; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | @Mixin(ClipContext.class) 8 | public interface ClipContextAccessor { 9 | 10 | @Accessor("fluid") 11 | ClipContext.Fluid getFluidHandling(); 12 | } 13 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/raycast/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Speeds up raycasts with faster block accesses and more efficient fluid handling.") 2 | package net.caffeinemc.mods.lithium.mixin.world.raycast; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/temperature_cache/BiomeMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.mixin.world.temperature_cache; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.world.level.biome.Biome; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Overwrite; 7 | import org.spongepowered.asm.mixin.Shadow; 8 | 9 | @Mixin(Biome.class) 10 | public abstract class BiomeMixin { 11 | 12 | @Shadow 13 | protected abstract float getHeightAdjustedTemperature(BlockPos pos, int i); 14 | 15 | /** 16 | * @author 2No2Name 17 | * @reason Remove caching 18 | */ 19 | @Deprecated 20 | @Overwrite 21 | public float getTemperature(BlockPos blockPos, int i) { 22 | return this.getHeightAdjustedTemperature(blockPos, i); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/temperature_cache/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Removes the 1024 entry biome temperature cache hash map because the cache seems to be slow and rarely hit." 3 | ) 4 | package net.caffeinemc.mods.lithium.mixin.world.temperature_cache; 5 | 6 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/java/net/caffeinemc/mods/lithium/mixin/world/tick_scheduler/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Use faster tick collections and pack scheduled ticks into integers for easier tick comparisons") 2 | package net.caffeinemc.mods.lithium.mixin.world.tick_scheduler; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /common/src/main/resources/assets/lithium/lithium-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CaffeineMC/lithium/0873ffe15cd68dcdc1341bd402175fd326d7a3f9/common/src/main/resources/assets/lithium/lithium-icon.png -------------------------------------------------------------------------------- /components/mixin-config-plugin/build.gradle: -------------------------------------------------------------------------------- 1 | 2 | apply plugin: "java" 3 | apply plugin: "java-gradle-plugin" 4 | 5 | base { 6 | archivesName = 'mixin-config-plugin' 7 | } 8 | version = '1.0-SNAPSHOT' 9 | group = 'net.caffeinemc' 10 | 11 | repositories { 12 | mavenCentral() 13 | } 14 | 15 | dependencies { 16 | } 17 | 18 | gradlePlugin { 19 | // Define the plugin 20 | plugins { 21 | compiler { 22 | id = 'net.caffeinemc.mixin-config-plugin' 23 | implementationClass = 'net.caffeinemc.gradle.GradleMixinConfigPlugin' 24 | } 25 | } 26 | } 27 | 28 | java { 29 | sourceCompatibility = JavaVersion.VERSION_21 30 | targetCompatibility = JavaVersion.VERSION_21 31 | } 32 | // ensure that the encoding is set to UTF-8, no matter what the system default is 33 | // this fixes some edge cases with special characters not displaying correctly 34 | // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html 35 | tasks.withType(JavaCompile) { 36 | options.encoding = "UTF-8" 37 | } 38 | 39 | jar { 40 | from "${rootProject.projectDir}/LICENSE.md" 41 | } -------------------------------------------------------------------------------- /components/mixin-config-plugin/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx3G 2 | -------------------------------------------------------------------------------- /components/mixin-config-plugin/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /components/mixin-config-plugin/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | gradlePluginPortal() 4 | } 5 | } 6 | rootProject.name = "mixin-config-plugin" -------------------------------------------------------------------------------- /components/mixin-config-plugin/src/main/java/net/caffeinemc/gradle/GradleMixinConfigPlugin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.gradle; 2 | 3 | import org.apache.log4j.LogManager; 4 | import org.apache.log4j.Logger; 5 | import org.gradle.api.Plugin; 6 | import org.gradle.api.Project; 7 | 8 | public class GradleMixinConfigPlugin implements Plugin { 9 | 10 | static final Logger LOGGER = LogManager.getLogger("CaffeineMc-MixinConfig"); 11 | 12 | @Override 13 | public void apply(Project project) { 14 | project.getTasks().register(project.getName() + "CreateMixinConfig", CreateMixinConfigTask.class); 15 | } 16 | } -------------------------------------------------------------------------------- /components/mixin-config-plugin/src/main/java/net/caffeinemc/gradle/MixinConfigDependency.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.gradle; 2 | 3 | public @interface MixinConfigDependency { 4 | String dependencyPath(); 5 | 6 | boolean enabled() default true; 7 | } 8 | -------------------------------------------------------------------------------- /components/mixin-config-plugin/src/main/java/net/caffeinemc/gradle/MixinConfigOption.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.gradle; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | //RUNTIME is required due to the current method of accessing the annotation by loading the class 10 | @Target(ElementType.PACKAGE) 11 | public @interface MixinConfigOption { 12 | boolean enabled() default true; 13 | 14 | MixinConfigDependency[] depends() default {}; 15 | 16 | String description(); 17 | } 18 | -------------------------------------------------------------------------------- /fabric/src/gametest/java/net/caffeinemc/mods/lithium/fabric/gametest/LithiumFabricGameTest.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.fabric.gametest; 2 | 3 | 4 | import java.nio.file.Paths; 5 | 6 | import net.minecraft.gametest.framework.StructureUtils; 7 | 8 | public class LithiumFabricGameTest { 9 | 10 | public static final String LITHIUM_GAMETEST_SNBT_PATH = System.getenv("LITHIUM_GAMETEST_RESOURCES"); 11 | 12 | static { 13 | StructureUtils.testStructuresDir = Paths.get(LITHIUM_GAMETEST_SNBT_PATH); 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /fabric/src/gametest/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "lithium-gametest", 4 | "name": "Lithium Gametest", 5 | "version": "1.0.0", 6 | "environment": "*", 7 | "entrypoints": { 8 | "fabric-gametest" : [ 9 | "net.caffeinemc.mods.lithium.fabric.gametest.LithiumFabricGameTest" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /fabric/src/main/java/net/caffeinemc/mods/lithium/fabric/FabricMappingInformation.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.fabric; 2 | 3 | import net.caffeinemc.mods.lithium.common.services.PlatformMappingInformation; 4 | import net.fabricmc.loader.api.FabricLoader; 5 | 6 | public class FabricMappingInformation implements PlatformMappingInformation { 7 | 8 | @Override 9 | public String mapMethodName(String fromMappings, String clazz, String method, String argsDescriptor, String mojmap) { 10 | return FabricLoader.getInstance().getMappingResolver().mapMethodName(fromMappings, clazz, method, argsDescriptor); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /fabric/src/main/java/net/caffeinemc/mods/lithium/fabric/LithiumFabricMod.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.fabric; 2 | 3 | import net.caffeinemc.mods.lithium.common.LithiumMod; 4 | import net.fabricmc.api.ModInitializer; 5 | import net.fabricmc.loader.api.FabricLoader; 6 | import net.fabricmc.loader.api.ModContainer; 7 | 8 | public class LithiumFabricMod implements ModInitializer { 9 | 10 | @Override 11 | public void onInitialize() { 12 | ModContainer mod = FabricLoader.getInstance() 13 | .getModContainer("lithium") 14 | .orElseThrow(NullPointerException::new); 15 | 16 | LithiumMod.onInitialization(mod.getMetadata().getVersion().getFriendlyString()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /fabric/src/main/java/net/caffeinemc/mods/lithium/fabric/mixin/collections/poi_types/PoiTypesMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.fabric.mixin.collections.poi_types; 2 | 3 | import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap; 4 | import net.minecraft.world.entity.ai.village.poi.PoiType; 5 | import net.minecraft.world.entity.ai.village.poi.PoiTypes; 6 | import net.minecraft.world.level.block.state.BlockState; 7 | import org.spongepowered.asm.mixin.Final; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.Mutable; 10 | import org.spongepowered.asm.mixin.Shadow; 11 | 12 | import java.util.Map; 13 | 14 | /** 15 | * Replaces the backing map type with a faster collection type which uses reference equality. 16 | */ 17 | @Mixin(PoiTypes.class) 18 | public class PoiTypesMixin { 19 | @Mutable 20 | @Shadow 21 | @Final 22 | private static Map TYPE_BY_STATE; 23 | 24 | static { 25 | TYPE_BY_STATE = new Reference2ReferenceOpenHashMap<>(TYPE_BY_STATE); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /fabric/src/main/java/net/caffeinemc/mods/lithium/fabric/mixin/collections/poi_types/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Uses fastutil hashmap for POI Types") 2 | package net.caffeinemc.mods.lithium.fabric.mixin.collections.poi_types; 3 | 4 | import net.caffeinemc.gradle.MixinConfigOption; 5 | //Not on NeoForge, as it also replaces the map -------------------------------------------------------------------------------- /fabric/src/main/java/net/caffeinemc/mods/lithium/fabric/mixin/compat/worldedit/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Send updates to hoppers when adding inventory block entities to chunks when world edit is loaded. " + 3 | "Fixes the issue of hoppers not noticing when inventories are placed using worldedit without any block updates. Enabled automatically when worldedit is present.", 4 | depends = @MixinConfigDependency(dependencyPath = "mixin.util.block_entity_retrieval"), 5 | enabled = false // Enabled automatically when worldedit is present 6 | ) 7 | package net.caffeinemc.mods.lithium.fabric.mixin.compat.worldedit; 8 | 9 | import net.caffeinemc.gradle.MixinConfigDependency; 10 | import net.caffeinemc.gradle.MixinConfigOption; 11 | 12 | -------------------------------------------------------------------------------- /fabric/src/main/java/net/caffeinemc/mods/lithium/fabric/mixin/entity/collisions/fluid/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "Skips being pushed by fluids when the nearby chunk sections do not contain this fluid", 3 | depends = { 4 | @MixinConfigDependency(dependencyPath = "mixin.util.block_tracking"), 5 | @MixinConfigDependency(dependencyPath = "mixin.experimental.entity.block_caching.fluid_pushing", enabled = false) 6 | } 7 | ) 8 | package net.caffeinemc.mods.lithium.fabric.mixin.entity.collisions.fluid; 9 | 10 | import net.caffeinemc.gradle.MixinConfigDependency; 11 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /fabric/src/main/java/net/caffeinemc/mods/lithium/fabric/mixin/experimental/entity/block_caching/fluid_pushing/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption(description = "Use the block listening system to cache entity fluid interaction when not touching fluid currents.", 2 | depends = @MixinConfigDependency(dependencyPath = "mixin.util.block_tracking")) 3 | package net.caffeinemc.mods.lithium.fabric.mixin.experimental.entity.block_caching.fluid_pushing; 4 | 5 | import net.caffeinemc.gradle.MixinConfigDependency; 6 | import net.caffeinemc.gradle.MixinConfigOption; -------------------------------------------------------------------------------- /fabric/src/main/java/net/caffeinemc/mods/lithium/fabric/mixin/util/inventory_change_listening/BlockEntityMixin.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.fabric.mixin.util.inventory_change_listening; 2 | 3 | import net.caffeinemc.mods.lithium.common.block.entity.SetBlockStateHandlingBlockEntity; 4 | import net.minecraft.world.level.block.entity.BlockEntity; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(BlockEntity.class) 11 | public class BlockEntityMixin implements SetBlockStateHandlingBlockEntity { 12 | 13 | @Inject(method = "setBlockState(Lnet/minecraft/world/level/block/state/BlockState;)V", at = @At("RETURN")) 14 | private void emitRemovedOnSetCachedState(CallbackInfo ci) { 15 | this.lithium$handleSetBlockState(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /fabric/src/main/resources/META-INF/services/net.caffeinemc.mods.lithium.common.services.PlatformEntityAccess: -------------------------------------------------------------------------------- 1 | net.caffeinemc.mods.lithium.fabric.FabricEntityAccess -------------------------------------------------------------------------------- /fabric/src/main/resources/META-INF/services/net.caffeinemc.mods.lithium.common.services.PlatformMappingInformation: -------------------------------------------------------------------------------- 1 | net.caffeinemc.mods.lithium.fabric.FabricMappingInformation -------------------------------------------------------------------------------- /fabric/src/main/resources/META-INF/services/net.caffeinemc.mods.lithium.common.services.PlatformMixinOverrides: -------------------------------------------------------------------------------- 1 | net.caffeinemc.mods.lithium.fabric.FabricMixinOverrides -------------------------------------------------------------------------------- /fabric/src/main/resources/META-INF/services/net.caffeinemc.mods.lithium.common.services.PlatformModCompat: -------------------------------------------------------------------------------- 1 | net.caffeinemc.mods.lithium.fabric.FabricModCompat -------------------------------------------------------------------------------- /fabric/src/main/resources/META-INF/services/net.caffeinemc.mods.lithium.common.services.PlatformRuntimeInformation: -------------------------------------------------------------------------------- 1 | net.caffeinemc.mods.lithium.fabric.FabricRuntimeInformation -------------------------------------------------------------------------------- /fabric/src/main/resources/lithium-fabric.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "package" : "net.caffeinemc.mods.lithium.fabric.mixin", 3 | "required" : true, 4 | "compatibilityLevel" : "JAVA_21", 5 | "plugin" : "net.caffeinemc.mods.lithium.mixin.LithiumMixinPlugin", 6 | "injectors" : { 7 | "defaultRequire" : 1 8 | }, 9 | "overwrites" : { 10 | "conformVisibility" : true 11 | }, 12 | "mixins" : [ 13 | "block.hopper.LevelMixin", 14 | "collections.poi_types.PoiTypesMixin", 15 | "compat.worldedit.LevelChunkMixin", 16 | "entity.collisions.fluid.EntityMixin", 17 | "experimental.entity.block_caching.fluid_pushing.EntityMixin", 18 | "util.initialization.FuelValuesMixin", 19 | "util.inventory_change_listening.BlockEntityMixin", 20 | "util.inventory_change_listening.ChestBlockEntityMixin" 21 | ], 22 | "client" : [ 23 | ] 24 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Done to increase the memory available to gradle. 2 | org.gradle.jvmargs=-Xmx3G 3 | 4 | org.gradle.caching=true 5 | org.gradle.parallel=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CaffeineMC/lithium/0873ffe15cd68dcdc1341bd402175fd326d7a3f9/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /neoforge/src/gametest/java/net/caffeinemc/mods/lithium/neoforge/test/LithiumNeoforgeGameTest.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.neoforge.test; 2 | 3 | 4 | import java.nio.file.Paths; 5 | 6 | import net.minecraft.gametest.framework.StructureUtils; 7 | 8 | //TODO this does nothing, neoforge has no tests atm 9 | public class LithiumNeoforgeGameTest { 10 | 11 | public static final String LITHIUM_GAMETEST_SNBT_PATH = System.getenv("LITHIUM_GAMETEST_RESOURCES"); 12 | 13 | static { 14 | StructureUtils.testStructuresDir = Paths.get(LITHIUM_GAMETEST_SNBT_PATH); 15 | } 16 | } -------------------------------------------------------------------------------- /neoforge/src/main/java/net/caffeinemc/mods/lithium/neoforge/LithiumNeoForgeMod.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.neoforge; 2 | 3 | import net.neoforged.bus.api.IEventBus; 4 | import net.neoforged.fml.ModContainer; 5 | import net.neoforged.fml.common.Mod; 6 | 7 | @Mod(value = "lithium") 8 | public class LithiumNeoForgeMod { 9 | public LithiumNeoForgeMod(IEventBus bus, ModContainer modContainer) { 10 | 11 | } 12 | } -------------------------------------------------------------------------------- /neoforge/src/main/java/net/caffeinemc/mods/lithium/neoforge/NeoForgeMappingInformation.java: -------------------------------------------------------------------------------- 1 | package net.caffeinemc.mods.lithium.neoforge; 2 | 3 | import net.caffeinemc.mods.lithium.common.services.PlatformMappingInformation; 4 | 5 | public class NeoForgeMappingInformation implements PlatformMappingInformation { 6 | 7 | @Override 8 | public String mapMethodName(String fromMappings, String clazz, String method, String argsDescriptor, String mojmap) { 9 | return mojmap; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /neoforge/src/main/java/net/caffeinemc/mods/lithium/neoforge/mixin/startup/package-info.java: -------------------------------------------------------------------------------- 1 | @MixinConfigOption( 2 | description = "NeoForge startup hook. Must stay enabled." 3 | ) 4 | package net.caffeinemc.mods.lithium.neoforge.mixin.startup; 5 | 6 | import net.caffeinemc.gradle.MixinConfigOption; 7 | 8 | -------------------------------------------------------------------------------- /neoforge/src/main/resources/META-INF/neoforge.mods.toml: -------------------------------------------------------------------------------- 1 | modLoader = "javafml" 2 | loaderVersion = "*" 3 | license = "LGPL-3.0-only" 4 | 5 | [[mods]] 6 | modId = "lithium" 7 | 8 | version = "${version}" 9 | displayName = "Lithium" 10 | 11 | logoFile = "assets/lithium/lithium-icon.png" 12 | 13 | authors = "2No2Name, JellySquid" 14 | 15 | credits = "" 16 | 17 | description = ''' 18 | Lithium is a free and open-source optimization mod for Minecraft which makes a wide range of performance improvements to the game. 19 | ''' 20 | 21 | [modproperties.lithium] 22 | 23 | [[dependencies.lithium]] 24 | modId = "minecraft" 25 | type = "required" 26 | versionRange = "1.21.5" 27 | ordering = "NONE" 28 | side = "BOTH" 29 | 30 | [[mixins]] 31 | config = "lithium.mixins.json" 32 | 33 | [[mixins]] 34 | config = "lithium-neoforge.mixins.json" -------------------------------------------------------------------------------- /neoforge/src/main/resources/META-INF/services/net.caffeinemc.mods.lithium.common.services.PlatformEntityAccess: -------------------------------------------------------------------------------- 1 | net.caffeinemc.mods.lithium.neoforge.NeoForgeEntityAccess -------------------------------------------------------------------------------- /neoforge/src/main/resources/META-INF/services/net.caffeinemc.mods.lithium.common.services.PlatformMappingInformation: -------------------------------------------------------------------------------- 1 | net.caffeinemc.mods.lithium.neoforge.NeoForgeMappingInformation -------------------------------------------------------------------------------- /neoforge/src/main/resources/META-INF/services/net.caffeinemc.mods.lithium.common.services.PlatformMixinOverrides: -------------------------------------------------------------------------------- 1 | net.caffeinemc.mods.lithium.neoforge.NeoForgeMixinOverrides -------------------------------------------------------------------------------- /neoforge/src/main/resources/META-INF/services/net.caffeinemc.mods.lithium.common.services.PlatformModCompat: -------------------------------------------------------------------------------- 1 | net.caffeinemc.mods.lithium.neoforge.NeoForgeModCompat -------------------------------------------------------------------------------- /neoforge/src/main/resources/META-INF/services/net.caffeinemc.mods.lithium.common.services.PlatformRuntimeInformation: -------------------------------------------------------------------------------- 1 | net.caffeinemc.mods.lithium.neoforge.NeoForgeRuntimeInformation -------------------------------------------------------------------------------- /neoforge/src/main/resources/lithium-neoforge.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "package" : "net.caffeinemc.mods.lithium.neoforge.mixin", 3 | "required" : true, 4 | "compatibilityLevel" : "JAVA_21", 5 | "plugin" : "net.caffeinemc.mods.lithium.mixin.LithiumMixinPlugin", 6 | "injectors" : { 7 | "defaultRequire" : 1 8 | }, 9 | "overwrites" : { 10 | "conformVisibility" : true 11 | }, 12 | "mixins" : [ 13 | "block.hopper.HopperBlockEntityMixin", 14 | "block.hopper.LevelMixin", 15 | "util.initialization.DataMapHooksMixin", 16 | "util.inventory_change_listening.ChestBlockEntityMixin" 17 | ], 18 | "client" : [ 19 | "startup.MinecraftMixin" 20 | ] 21 | } -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "lithium" 2 | 3 | pluginManagement { 4 | repositories { 5 | maven { url = uri("https://maven.fabricmc.net/") } 6 | maven { url = uri("https://maven.neoforged.net/releases/") } 7 | gradlePluginPortal() 8 | } 9 | } 10 | includeBuild("components/mixin-config-plugin") 11 | 12 | include("common") 13 | //Comment out fabric or neoforge to disable the respective platform 14 | include("fabric") 15 | //include("neoforge") //TODO enable when neoforge is ready 16 | --------------------------------------------------------------------------------