Skip to content

Commit

Permalink
Add 1.20.2
Browse files Browse the repository at this point in the history
  • Loading branch information
R0bbyYT committed Sep 28, 2023
1 parent 0cf3203 commit 7dc6758
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 21 deletions.
13 changes: 12 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,18 @@ labyMod {
}

minecraft {
registerVersions("1.8.9", "1.12.2", "1.16.5", "1.17.1", "1.18.2", "1.19.2", "1.19.3", "1.19.4", "1.20.1") { version, provider ->
registerVersions(
"1.8.9",
"1.12.2",
"1.16.5",
"1.17.1",
"1.18.2",
"1.19.2",
"1.19.3",
"1.19.4",
"1.20.1",
"1.20.2"
) { version, provider ->
configureRun(provider, version)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2022 BurgerbudeORG & Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package org.burgerbude.labymod.addons.fullbright.core.configuration;
/*
* Copyright (C) 2022 BurgerbudeORG & Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package org.burgerbude.labymod.addons.fullbright.core.configuration;

import net.labymod.api.addon.AddonConfig;
import net.labymod.api.client.gui.screen.widget.widgets.input.SwitchWidget.SwitchSetting;
Expand All @@ -26,7 +26,7 @@
@ConfigName("settings")
public class FullBrightConfiguration extends AddonConfig implements ConfigAccessor {

@SwitchSetting
@SwitchSetting(hotkey = true)
private final ConfigProperty<Boolean> enabled = new ConfigProperty<>(false);

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package java.org.burgerbude.labymod.addons.fullbright.v1_16_5.mixins;
package org.burgerbude.labymod.addons.fullbright.v1_16_5.mixins;

import com.mojang.blaze3d.platform.NativeImage;
import net.labymod.api.Laby;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* Copyright (C) 2022 BurgerbudeORG & Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package org.burgerbude.labymod.addons.fullbright.v1_20_2.mixins;

import com.mojang.blaze3d.platform.NativeImage;
import net.labymod.api.Laby;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.texture.DynamicTexture;
import org.burgerbude.labymod.addons.fullbright.core.event.UpdateLightmapTextureEvent;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(LightTexture.class)
public class MixinLightTexture {

@Shadow
@Final
private NativeImage lightPixels;

@Shadow
@Final
private DynamicTexture lightTexture;
@Shadow
private boolean updateLightTexture;
private boolean fullbright$updated = false;

@Inject(method = "updateLightTexture", at = @At("HEAD"), cancellable = true)
private void fullbright$updateLightTexture(float v, CallbackInfo ci) {
final var event = Laby.fireEvent(new UpdateLightmapTextureEvent());
if (event.isCancelled()) {
if (!this.fullbright$updated) {
this.fullbright$writeWhiteTexture();
}
this.fullbright$updated = true;
this.lightTexture.upload();
ci.cancel();
return;
}

// Is need for the singleplayer, if the user is in a screen,
// the tick method is not called and therefore the light level is not updated
if (this.fullbright$updated) {
this.updateLightTexture = true;
}

this.fullbright$updated = false;
}

private void fullbright$writeWhiteTexture() {
for (int x = 0; x < 16; x++) {
for (int y = 0; y < 16; y++) {
this.lightPixels.setPixelRGBA(x, y, 0xFFFFFFFF);
}
}
}

}

0 comments on commit 7dc6758

Please sign in to comment.