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
@Shadow protected DataLayer getDataLayer(long sectionPos, boolean cached) {
protected DataLayer getDataLayer(long sectionPos, boolean cached) { return null;
return null; }
}
@Inject(method = "getStoredLevel", at = @At(value = "HEAD"), cancellable = true)
@Inject(method = "getStoredLevel", at = @At(value = "HEAD"), cancellable = true) private void bclib_lightFix(long blockPos, CallbackInfoReturnable<Integer> info) {
private void lightFix(long blockPos, CallbackInfoReturnable<Integer> info) { try {
try { long pos = SectionPos.blockToSection(blockPos);
long m = SectionPos.blockToSection(blockPos); DataLayer dataLayer = this.getDataLayer(pos, true);
DataLayer dataLayer = this.getDataLayer(m, true); info.setReturnValue(dataLayer.get(
info.setReturnValue( SectionPos.sectionRelative(BlockPos.getX(blockPos)),
dataLayer.get( SectionPos.sectionRelative(BlockPos.getY(blockPos)),
SectionPos.sectionRelative(BlockPos.getX(blockPos)), SectionPos.sectionRelative(BlockPos.getZ(blockPos))
SectionPos.sectionRelative(BlockPos.getY(blockPos)), ));
SectionPos.sectionRelative(BlockPos.getZ(blockPos)) }
) catch (Exception e) {
); info.setReturnValue(0);
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",