generated from JamCoreModding/multi-loader-template-mod
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f325fb
commit 1232053
Showing
26 changed files
with
189 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
- (fix) game will no longer crash when `player.accessoriesCapability()` returns null (#59) | ||
Update to 1.21.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
.../client/java/io/github/jamalam360/utility_belt/client/compat/LambDynamicLightsCompat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package io.github.jamalam360.utility_belt.client.compat; | ||
|
||
import dev.lambdaurora.lambdynlights.api.DynamicLightsContext; | ||
import dev.lambdaurora.lambdynlights.api.DynamicLightsInitializer; | ||
import dev.lambdaurora.lambdynlights.api.entity.luminance.EntityLuminance; | ||
import dev.lambdaurora.lambdynlights.api.item.ItemLightSourceManager; | ||
import io.github.jamalam360.utility_belt.UtilityBelt; | ||
import io.github.jamalam360.utility_belt.UtilityBeltInventory; | ||
import io.github.jamalam360.utility_belt.UtilityBeltItem; | ||
import io.github.jamalam360.utility_belt.state.StateManager; | ||
import net.minecraft.world.entity.Entity; | ||
import net.minecraft.world.entity.EntityType; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.item.ItemStack; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Range; | ||
|
||
public class LambDynamicLightsCompat implements DynamicLightsInitializer { | ||
|
||
@Override | ||
public void onInitializeDynamicLights(DynamicLightsContext ctx) { | ||
UtilityBelt.LOGGER.info("Initializing LambDynamicLights compat for Utility Belt."); | ||
ctx.entityLightSourceManager().onRegisterEvent().register((registerContext) -> { | ||
registerContext.register(EntityType.PLAYER, UtilityBeltEntityLuminance.INSTANCE); | ||
}); | ||
} | ||
|
||
private static class UtilityBeltEntityLuminance implements EntityLuminance { | ||
|
||
public static final UtilityBeltEntityLuminance INSTANCE = new UtilityBeltEntityLuminance(); | ||
|
||
public static final EntityLuminance.Type TYPE = EntityLuminance.Type.registerSimple( | ||
UtilityBelt.id("belt_luminance"), | ||
INSTANCE | ||
); | ||
|
||
private UtilityBeltEntityLuminance() {} | ||
|
||
@Override | ||
public @NotNull Type type() { | ||
return TYPE; | ||
} | ||
|
||
@Override | ||
public @Range(from = 0L, to = 15L) int getLuminance(@NotNull ItemLightSourceManager itemLightSourceManager, @NotNull Entity entity) { | ||
if (!(entity instanceof Player player)) { | ||
return 0; | ||
} | ||
|
||
int luminance = 0; | ||
StateManager stateManager = StateManager.getStateManager(player); | ||
if (stateManager.hasBelt(player)) { | ||
UtilityBeltInventory inv = stateManager.getInventory(player); | ||
|
||
for (ItemStack stack : inv.items()) { | ||
luminance = Math.max(luminance, itemLightSourceManager.getLuminance(stack)); | ||
} | ||
} | ||
|
||
return luminance; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
common/src/generated/resources/assets/utility_belt/items/utility_belt.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"model": { | ||
"type": "minecraft:model", | ||
"model": "utility_belt:item/utility_belt" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.