This commit is contained in:
paulevsGitch 2021-11-20 19:01:43 +03:00
parent 8ea432bc19
commit c0b7ccca72
3 changed files with 22 additions and 27 deletions

View file

@ -12,29 +12,24 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(LayerLightSectionStorage.class) @Mixin(LayerLightSectionStorage.class)
public class LayerLightSectionStorageMixin { public class LayerLightSectionStorageMixin {
@Shadow
protected DataLayer getDataLayer(long sectionPos, boolean cached) {
return null;
}
@Shadow @Inject(method = "getStoredLevel", at = @At(value = "HEAD"), cancellable = true)
protected DataLayer getDataLayer(long sectionPos, boolean cached) { private void bclib_lightFix(long blockPos, CallbackInfoReturnable<Integer> info) {
return null; try {
} long pos = SectionPos.blockToSection(blockPos);
DataLayer dataLayer = this.getDataLayer(pos, true);
@Inject(method = "getStoredLevel", at = @At(value = "HEAD"), cancellable = true) info.setReturnValue(dataLayer.get(
private void lightFix(long blockPos, CallbackInfoReturnable<Integer> info) { SectionPos.sectionRelative(BlockPos.getX(blockPos)),
try { SectionPos.sectionRelative(BlockPos.getY(blockPos)),
long m = SectionPos.blockToSection(blockPos); SectionPos.sectionRelative(BlockPos.getZ(blockPos))
DataLayer dataLayer = this.getDataLayer(m, true); ));
info.setReturnValue( }
dataLayer.get( catch (Exception e) {
SectionPos.sectionRelative(BlockPos.getX(blockPos)), info.setReturnValue(0);
SectionPos.sectionRelative(BlockPos.getY(blockPos)), }
SectionPos.sectionRelative(BlockPos.getZ(blockPos)) }
)
);
info.cancel();
} catch (Exception e) {
info.setReturnValue(0);
info.cancel();
}
}
} }

View file

@ -26,7 +26,7 @@ public class SimpleReloadableResourceManagerMixin {
}; };
@Inject(method = "hasResource", at = @At("HEAD"), cancellable = true) @Inject(method = "hasResource", at = @At("HEAD"), cancellable = true)
private void hasResource(ResourceLocation resourceLocation, CallbackInfoReturnable<Boolean> info) { private void bclib_hasResource(ResourceLocation resourceLocation, CallbackInfoReturnable<Boolean> info) {
if (resourceLocation.getNamespace().equals("minecraft")) { if (resourceLocation.getNamespace().equals("minecraft")) {
for (String key: BCLIB_MISSING_RESOURCES) { for (String key: BCLIB_MISSING_RESOURCES) {
if (resourceLocation.getPath().equals(key)) { if (resourceLocation.getPath().equals(key)) {

View file

@ -6,6 +6,7 @@
"mixins": [ "mixins": [
"SimpleReloadableResourceManagerMixin", "SimpleReloadableResourceManagerMixin",
"shears.DiggingEnchantmentMixin", "shears.DiggingEnchantmentMixin",
"LayerLightSectionStorageMixin",
"shears.TripWireBlockMixin", "shears.TripWireBlockMixin",
"ChunkBiomeContainerMixin", "ChunkBiomeContainerMixin",
"shears.BeehiveBlockMixin", "shears.BeehiveBlockMixin",
@ -20,7 +21,6 @@
"MinecraftServerMixin", "MinecraftServerMixin",
"PistonBaseBlockMixin", "PistonBaseBlockMixin",
"WorldGenRegionMixin", "WorldGenRegionMixin",
"LayerLightSectionStorageMixin",
"DimensionTypeMixin", "DimensionTypeMixin",
"RecipeManagerMixin", "RecipeManagerMixin",
"CraftingMenuMixin", "CraftingMenuMixin",