Update to BCLib 0.3.0

This commit is contained in:
paulevsGitch 2021-07-20 00:39:58 +03:00
parent 1a52251af0
commit b2431153dc
294 changed files with 7484 additions and 1440 deletions

View file

@ -16,6 +16,7 @@ import java.util.List;
public class ItemStackMixin {
@Inject(method = "getTooltipLines", at = @At("RETURN"))
private void be_getTooltip(Player entity, TooltipFlag tooltipContext, CallbackInfoReturnable<List<Component>> info) {
ItemTooltipCallback.EVENT.invoker().getTooltip(entity, ItemStack.class.cast(this), tooltipContext, info.getReturnValue());
ItemTooltipCallback.EVENT.invoker()
.getTooltip(entity, ItemStack.class.cast(this), tooltipContext, info.getReturnValue());
}
}

View file

@ -11,7 +11,6 @@ import com.mojang.blaze3d.vertex.VertexFormat;
import com.mojang.math.Matrix4f;
import com.mojang.math.Quaternion;
import com.mojang.math.Vector3f;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.DimensionSpecialEffects;
@ -21,7 +20,6 @@ import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.client.renderer.RenderBuffers;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.resources.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@ -101,7 +99,10 @@ public class LevelRendererMixin {
FogRenderer.levelFogColor();
RenderSystem.enableTexture();
RenderSystem.enableBlend();
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
RenderSystem.blendFunc(
GlStateManager.SourceFactor.SRC_ALPHA,
GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA
);
float blindA = 1F - BackgroundInfo.blindness;
blind02 = blindA * 0.2F;
@ -111,26 +112,62 @@ public class LevelRendererMixin {
matrices.pushPose();
matrices.mulPose(new Quaternion(0, time, 0, false));
RenderSystem.setShaderTexture(0, HORIZON);
be_renderBuffer(matrices, matrix4f, horizon, DefaultVertexFormat.POSITION_TEX, 0.77F, 0.31F, 0.73F, 0.7F * blindA);
be_renderBuffer(
matrices,
matrix4f,
horizon,
DefaultVertexFormat.POSITION_TEX,
0.77F,
0.31F,
0.73F,
0.7F * blindA
);
matrices.popPose();
matrices.pushPose();
matrices.mulPose(new Quaternion(0, -time, 0, false));
RenderSystem.setShaderTexture(0, NEBULA_1);
be_renderBuffer(matrices, matrix4f, nebulas1, DefaultVertexFormat.POSITION_TEX, 0.77F, 0.31F, 0.73F, blind02);
be_renderBuffer(
matrices,
matrix4f,
nebulas1,
DefaultVertexFormat.POSITION_TEX,
0.77F,
0.31F,
0.73F,
blind02
);
matrices.popPose();
matrices.pushPose();
matrices.mulPose(new Quaternion(0, time2, 0, false));
RenderSystem.setShaderTexture(0, NEBULA_2);
be_renderBuffer(matrices, matrix4f, nebulas2, DefaultVertexFormat.POSITION_TEX, 0.77F, 0.31F, 0.73F, blind02);
be_renderBuffer(
matrices,
matrix4f,
nebulas2,
DefaultVertexFormat.POSITION_TEX,
0.77F,
0.31F,
0.73F,
blind02
);
matrices.popPose();
RenderSystem.setShaderTexture(0, STARS);
matrices.pushPose();
matrices.mulPose(axis3.rotation(time));
be_renderBuffer(matrices, matrix4f, stars3, DefaultVertexFormat.POSITION_TEX, 0.77F, 0.31F, 0.73F, blind06);
be_renderBuffer(
matrices,
matrix4f,
stars3,
DefaultVertexFormat.POSITION_TEX,
0.77F,
0.31F,
0.73F,
blind06
);
matrices.popPose();
matrices.pushPose();
@ -143,7 +180,16 @@ public class LevelRendererMixin {
if (a > 0) {
if (a > 1) a = 1;
RenderSystem.setShaderTexture(0, FOG);
be_renderBuffer(matrices, matrix4f, fog, DefaultVertexFormat.POSITION_TEX, BackgroundInfo.fogColorRed, BackgroundInfo.fogColorGreen, BackgroundInfo.fogColorBlue, a);
be_renderBuffer(
matrices,
matrix4f,
fog,
DefaultVertexFormat.POSITION_TEX,
BackgroundInfo.fogColorRed,
BackgroundInfo.fogColorGreen,
BackgroundInfo.fogColorBlue,
a
);
}
RenderSystem.disableTexture();

View file

@ -33,7 +33,10 @@ public abstract class LocalPlayerMixin extends AbstractClientPlayer {
public void be_aiStep(CallbackInfo info) {
ItemStack itemStack = getItemBySlot(EquipmentSlot.CHEST);
if (itemStack.getItem() instanceof FallFlyingItem && ElytraItem.isFlyEnabled(itemStack) && tryToStartFallFlying()) {
connection.send(new ServerboundPlayerCommandPacket(LocalPlayer.class.cast(this), ServerboundPlayerCommandPacket.Action.START_FALL_FLYING));
connection.send(new ServerboundPlayerCommandPacket(
LocalPlayer.class.cast(this),
ServerboundPlayerCommandPacket.Action.START_FALL_FLYING
));
}
}
}

View file

@ -36,11 +36,17 @@ public class MinecraftClientMixin {
private void be_getEndMusic(CallbackInfoReturnable<Music> info) {
if (!(this.screen instanceof WinScreen) && this.player != null) {
if (this.player.level.dimension() == Level.END) {
if (this.gui.getBossOverlay().shouldPlayMusic() && MHelper.lengthSqr(this.player.getX(), this.player.getZ()) < 250000) {
if (this.gui.getBossOverlay().shouldPlayMusic() && MHelper.lengthSqr(
this.player.getX(),
this.player.getZ()
) < 250000) {
info.setReturnValue(Musics.END_BOSS);
}
else {
Music sound = this.level.getBiomeManager().getNoiseBiomeAtPosition(this.player.blockPosition()).getBackgroundMusic().orElse(Musics.END);
Music sound = this.level.getBiomeManager()
.getNoiseBiomeAtPosition(this.player.blockPosition())
.getBackgroundMusic()
.orElse(Musics.END);
info.setReturnValue(sound);
}
info.cancel();

View file

@ -12,7 +12,11 @@ public abstract class ModelLoaderMixin {
@ModifyVariable(method = "loadModel", ordinal = 2, at = @At(value = "INVOKE"))
public ResourceLocation be_switchModel(ResourceLocation id) {
if (GeneratorOptions.changeChorusPlant() && id.getNamespace().equals("minecraft") && id.getPath().startsWith("blockstates/") && id.getPath().contains("chorus") && !id.getPath().contains("custom_")) {
if (GeneratorOptions.changeChorusPlant() && id.getNamespace().equals("minecraft") && id.getPath()
.startsWith(
"blockstates/") && id
.getPath()
.contains("chorus") && !id.getPath().contains("custom_")) {
id = new ResourceLocation(id.getPath().replace("chorus", "custom_chorus"));
}
return id;

View file

@ -1,13 +1,11 @@
package ru.betterend.mixin.client;
import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.resources.sounds.AbstractSoundInstance;
import net.minecraft.client.resources.sounds.SoundInstance;
import net.minecraft.client.sounds.MusicManager;
import net.minecraft.sounds.Music;
import net.minecraft.util.Mth;
import net.minecraft.world.level.Level;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@ -52,7 +50,8 @@ public abstract class MusicTrackerMixin {
if (currentMusic instanceof AbstractSoundInstance) {
((AbstractSoundInstanceAccessor) currentMusic).setVolume(volume);
}
minecraft.getSoundManager().updateSourceVolume(currentMusic.getSource(), currentMusic.getVolume() * volume);
minecraft.getSoundManager()
.updateSourceVolume(currentMusic.getSource(), currentMusic.getVolume() * volume);
long t = System.currentTimeMillis();
if (volume == 1 && time == 0) {
time = t;
@ -91,7 +90,9 @@ public abstract class MusicTrackerMixin {
}
private boolean be_shouldChangeSound(Music musicSound) {
return currentMusic != null && !musicSound.getEvent().getLocation().equals(this.currentMusic.getLocation()) && musicSound.replaceCurrentMusic();
return currentMusic != null && !musicSound.getEvent()
.getLocation()
.equals(this.currentMusic.getLocation()) && musicSound.replaceCurrentMusic();
}
private boolean be_checkNullSound(Music musicSound) {