Removed color provider
This commit is contained in:
parent
2c8862a37b
commit
4040597a6d
475 changed files with 5411 additions and 7521 deletions
|
@ -25,17 +25,16 @@ import java.util.List;
|
|||
|
||||
@Mixin(AnvilScreen.class)
|
||||
public class AnvilScreenMixin extends ItemCombinerScreen<AnvilMenu> {
|
||||
|
||||
|
||||
@Shadow
|
||||
private EditBox name;
|
||||
|
||||
|
||||
private final List<AbstractWidget> be_buttons = Lists.newArrayList();
|
||||
|
||||
public AnvilScreenMixin(AnvilMenu handler, Inventory playerInventory, Component title,
|
||||
ResourceLocation texture) {
|
||||
|
||||
public AnvilScreenMixin(AnvilMenu handler, Inventory playerInventory, Component title, ResourceLocation texture) {
|
||||
super(handler, playerInventory, title, texture);
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "subInit", at = @At("TAIL"))
|
||||
protected void be_subInit(CallbackInfo info) {
|
||||
int x = (width - imageWidth) / 2;
|
||||
|
@ -44,14 +43,14 @@ public class AnvilScreenMixin extends ItemCombinerScreen<AnvilMenu> {
|
|||
be_buttons.add(new Button(x + 8, y + 45, 15, 20, new TextComponent("<"), b -> be_previousRecipe()));
|
||||
be_buttons.add(new Button(x + 154, y + 45, 15, 20, new TextComponent(">"), b -> be_nextRecipe()));
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "renderFg", at = @At("TAIL"))
|
||||
protected void be_renderForeground(PoseStack matrices, int mouseX, int mouseY, float delta, CallbackInfo info) {
|
||||
be_buttons.forEach(button -> {
|
||||
button.render(matrices, mouseX, mouseY, delta);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "slotChanged", at = @At("HEAD"), cancellable = true)
|
||||
public void be_onSlotUpdate(AbstractContainerMenu handler, int slotId, ItemStack stack, CallbackInfo info) {
|
||||
AnvilScreenHandlerExtended anvilHandler = (AnvilScreenHandlerExtended) handler;
|
||||
|
@ -69,15 +68,15 @@ public class AnvilScreenMixin extends ItemCombinerScreen<AnvilMenu> {
|
|||
be_buttons.forEach(button -> button.visible = false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void be_nextRecipe() {
|
||||
((AnvilScreenHandlerExtended) menu).be_nextRecipe();
|
||||
}
|
||||
|
||||
|
||||
private void be_previousRecipe() {
|
||||
((AnvilScreenHandlerExtended) menu).be_previousRecipe();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
||||
if (minecraft != null) {
|
||||
|
|
|
@ -13,11 +13,11 @@ import ru.betterend.client.render.ArmoredElytraLayer;
|
|||
|
||||
@Mixin(ArmorStandRenderer.class)
|
||||
public abstract class ArmorStandRendererMixin extends LivingEntityRenderer<ArmorStand, ArmorStandArmorModel> {
|
||||
|
||||
|
||||
public ArmorStandRendererMixin(EntityRendererProvider.Context context, ArmorStandArmorModel entityModel, float f) {
|
||||
super(context, entityModel, f);
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "<init>*", at = @At("TAIL"))
|
||||
public void be_addCustomLayer(EntityRendererProvider.Context context, CallbackInfo ci) {
|
||||
addLayer(new ArmoredElytraLayer<>(this, context.getModelSet()));
|
||||
|
|
|
@ -5,13 +5,11 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.client.renderer.BiomeColors;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.ColorUtil;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.client.ClientOptions;
|
||||
|
@ -27,7 +25,7 @@ public class BiomeColorsMixin {
|
|||
private static final int STREAM_COLOR = ColorUtil.color(105, 213, 244);
|
||||
private static final Point[] OFFSETS;
|
||||
private static final boolean HAS_SODIUM;
|
||||
|
||||
|
||||
@Inject(method = "getAverageWaterColor", at = @At("RETURN"), cancellable = true)
|
||||
private static void be_getWaterColor(BlockAndTintGetter world, BlockPos pos, CallbackInfoReturnable<Integer> info) {
|
||||
if (ClientOptions.useSulfurWaterColor()) {
|
||||
|
@ -44,10 +42,10 @@ public class BiomeColorsMixin {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
HAS_SODIUM = FabricLoader.getInstance().isModLoaded("sodium");
|
||||
|
||||
|
||||
int index = 0;
|
||||
OFFSETS = new Point[20];
|
||||
for (int x = -2; x < 3; x++) {
|
||||
|
|
|
@ -14,7 +14,7 @@ import ru.betterend.item.ArmoredElytra;
|
|||
|
||||
@Mixin(CapeLayer.class)
|
||||
public class CapeLayerMixin {
|
||||
|
||||
|
||||
@Inject(method = "render", at = @At("HEAD"), cancellable = true)
|
||||
public void be_checkCustomElytra(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, AbstractClientPlayer abstractClientPlayer, float f, float g, float h, float j, float k, float l, CallbackInfo info) {
|
||||
ItemStack itemStack = abstractClientPlayer.getItemBySlot(EquipmentSlot.CHEST);
|
||||
|
|
|
@ -20,10 +20,10 @@ public class ClientPlayNetworkHandlerMixin {
|
|||
@Final
|
||||
@Shadow
|
||||
private Minecraft minecraft;
|
||||
|
||||
|
||||
@Shadow
|
||||
private ClientLevel level;
|
||||
|
||||
|
||||
@Inject(method = "handleOpenSignEditor", at = @At(value = "HEAD"), cancellable = true)
|
||||
public void be_openSignEditor(ClientboundOpenSignEditorPacket packet, CallbackInfo info) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, ClientPacketListener.class.cast(this), minecraft);
|
||||
|
|
|
@ -13,11 +13,11 @@ import ru.betterend.client.render.ArmoredElytraLayer;
|
|||
|
||||
@Mixin(HumanoidMobRenderer.class)
|
||||
public abstract class HumanoidMobRendererMixin<T extends Mob, M extends HumanoidModel<T>> extends MobRenderer<T, M> {
|
||||
|
||||
|
||||
public HumanoidMobRendererMixin(EntityRendererProvider.Context context, M entityModel, float f) {
|
||||
super(context, entityModel, f);
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "<init>(Lnet/minecraft/client/renderer/entity/EntityRendererProvider$Context;Lnet/minecraft/client/model/HumanoidModel;FFFF)V", at = @At("TAIL"))
|
||||
public void be_addCustomLayer(EntityRendererProvider.Context context, M humanoidModel, float f, float g, float h, float i, CallbackInfo ci) {
|
||||
addLayer(new ArmoredElytraLayer<>(this, context.getModelSet()));
|
||||
|
|
|
@ -42,7 +42,7 @@ public class LevelRendererMixin {
|
|||
private static final ResourceLocation HORIZON = BetterEnd.makeID("textures/sky/nebula_1.png");
|
||||
private static final ResourceLocation STARS = BetterEnd.makeID("textures/sky/stars.png");
|
||||
private static final ResourceLocation FOG = BetterEnd.makeID("textures/sky/fog.png");
|
||||
|
||||
|
||||
private static VertexBuffer stars1;
|
||||
private static VertexBuffer stars2;
|
||||
private static VertexBuffer stars3;
|
||||
|
@ -61,21 +61,21 @@ public class LevelRendererMixin {
|
|||
private static float blind02;
|
||||
private static float blind06;
|
||||
private static boolean directOpenGL = false;
|
||||
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private Minecraft minecraft;
|
||||
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private TextureManager textureManager;
|
||||
|
||||
|
||||
@Shadow
|
||||
private ClientLevel level;
|
||||
|
||||
|
||||
@Shadow
|
||||
private int ticks;
|
||||
|
||||
|
||||
@Inject(method = "<init>*", at = @At("TAIL"))
|
||||
private void be_onInit(Minecraft client, RenderBuffers bufferBuilders, CallbackInfo info) {
|
||||
be_initStars();
|
||||
|
@ -88,22 +88,22 @@ public class LevelRendererMixin {
|
|||
axis2.normalize();
|
||||
axis3.normalize();
|
||||
axis4.normalize();
|
||||
|
||||
|
||||
directOpenGL = FabricLoader.getInstance().isModLoaded("optifabric") || FabricLoader.getInstance().isModLoaded("immersive_portals");
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "renderSky", at = @At("HEAD"), cancellable = true)
|
||||
private void be_renderBetterEndSky(PoseStack matrices, Matrix4f matrix4f, float tickDelta, Runnable runnable, CallbackInfo info) {
|
||||
if (ClientOptions.isCustomSky() && minecraft.level.effects().skyType() == DimensionSpecialEffects.SkyType.END) {
|
||||
runnable.run();
|
||||
|
||||
|
||||
time = (ticks % 360000) * 0.000017453292F;
|
||||
time2 = time * 2;
|
||||
time3 = time * 3;
|
||||
|
||||
|
||||
FogRenderer.levelFogColor();
|
||||
RenderSystem.enableTexture();
|
||||
|
||||
|
||||
if (directOpenGL) {
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glAlphaFunc(516, 0.0F);
|
||||
|
@ -114,73 +114,73 @@ public class LevelRendererMixin {
|
|||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
|
||||
float blindA = 1F - BackgroundInfo.blindness;
|
||||
blind02 = blindA * 0.2F;
|
||||
blind06 = blindA * 0.6F;
|
||||
|
||||
|
||||
if (blindA > 0) {
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
matrices.popPose();
|
||||
|
||||
|
||||
matrices.pushPose();
|
||||
matrices.mulPose(axis4.rotation(time2));
|
||||
be_renderBuffer(matrices, matrix4f, stars4, DefaultVertexFormat.POSITION_TEX, 1F, 1F, 1F, blind06);
|
||||
matrices.popPose();
|
||||
}
|
||||
|
||||
|
||||
float a = (BackgroundInfo.fogDensity - 1F);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
RenderSystem.disableTexture();
|
||||
|
||||
|
||||
if (blindA > 0) {
|
||||
matrices.pushPose();
|
||||
matrices.mulPose(axis1.rotation(time3));
|
||||
be_renderBuffer(matrices, matrix4f, stars1, DefaultVertexFormat.POSITION, 1, 1, 1, blind06);
|
||||
matrices.popPose();
|
||||
|
||||
|
||||
matrices.pushPose();
|
||||
matrices.mulPose(axis2.rotation(time2));
|
||||
be_renderBuffer(matrices, matrix4f, stars2, DefaultVertexFormat.POSITION, 0.95F, 0.64F, 0.93F, blind06);
|
||||
matrices.popPose();
|
||||
}
|
||||
|
||||
|
||||
RenderSystem.enableTexture();
|
||||
RenderSystem.depthMask(true);
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.disableBlend();
|
||||
|
||||
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void be_renderBuffer(PoseStack matrices, Matrix4f matrix4f, VertexBuffer buffer, VertexFormat format, float r, float g, float b, float a) {
|
||||
RenderSystem.setShaderColor(r, g, b, a);
|
||||
if (format == DefaultVertexFormat.POSITION) {
|
||||
|
@ -190,7 +190,7 @@ public class LevelRendererMixin {
|
|||
buffer.drawWithShader(matrices.last().pose(), matrix4f, GameRenderer.getPositionTexShader());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void be_initStars() {
|
||||
BufferBuilder buffer = Tesselator.getInstance().getBuilder();
|
||||
stars1 = be_buildBufferStars(buffer, stars1, 0.1, 0.30, 3500, 41315);
|
||||
|
@ -202,12 +202,12 @@ public class LevelRendererMixin {
|
|||
horizon = be_buildBufferHorizon(buffer, horizon);
|
||||
fog = be_buildBufferFog(buffer, fog);
|
||||
}
|
||||
|
||||
|
||||
private VertexBuffer be_buildBufferStars(BufferBuilder bufferBuilder, VertexBuffer buffer, double minSize, double maxSize, int count, long seed) {
|
||||
if (buffer != null) {
|
||||
buffer.close();
|
||||
}
|
||||
|
||||
|
||||
//TODO: Test if this is working correct
|
||||
//Format is set in the DrawState
|
||||
//buffer = new VertexBuffer(DefaultVertexFormat.POSITION);
|
||||
|
@ -215,70 +215,70 @@ public class LevelRendererMixin {
|
|||
be_makeStars(bufferBuilder, minSize, maxSize, count, seed);
|
||||
bufferBuilder.end();
|
||||
buffer.upload(bufferBuilder);
|
||||
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
private VertexBuffer be_buildBufferUVStars(BufferBuilder bufferBuilder, VertexBuffer buffer, double minSize, double maxSize, int count, long seed) {
|
||||
if (buffer != null) {
|
||||
buffer.close();
|
||||
}
|
||||
|
||||
|
||||
// buffer = new VertexBuffer(DefaultVertexFormat.POSITION_TEX);
|
||||
buffer = new VertexBuffer();
|
||||
be_makeUVStars(bufferBuilder, minSize, maxSize, count, seed);
|
||||
bufferBuilder.end();
|
||||
buffer.upload(bufferBuilder);
|
||||
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
private VertexBuffer be_buildBufferFarFog(BufferBuilder bufferBuilder, VertexBuffer buffer, double minSize, double maxSize, int count, long seed) {
|
||||
if (buffer != null) {
|
||||
buffer.close();
|
||||
}
|
||||
|
||||
|
||||
// buffer = new VertexBuffer(DefaultVertexFormat.POSITION_TEX);
|
||||
buffer = new VertexBuffer();
|
||||
be_makeFarFog(bufferBuilder, minSize, maxSize, count, seed);
|
||||
bufferBuilder.end();
|
||||
buffer.upload(bufferBuilder);
|
||||
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
private VertexBuffer be_buildBufferHorizon(BufferBuilder bufferBuilder, VertexBuffer buffer) {
|
||||
if (buffer != null) {
|
||||
buffer.close();
|
||||
}
|
||||
|
||||
|
||||
// buffer = new VertexBuffer(DefaultVertexFormat.POSITION_TEX);
|
||||
buffer = new VertexBuffer();
|
||||
be_makeCylinder(bufferBuilder, 16, 50, 100);
|
||||
bufferBuilder.end();
|
||||
buffer.upload(bufferBuilder);
|
||||
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
private VertexBuffer be_buildBufferFog(BufferBuilder bufferBuilder, VertexBuffer buffer) {
|
||||
if (buffer != null) {
|
||||
buffer.close();
|
||||
}
|
||||
|
||||
|
||||
// buffer = new VertexBuffer(DefaultVertexFormat.POSITION_TEX);
|
||||
buffer = new VertexBuffer();
|
||||
be_makeCylinder(bufferBuilder, 16, 50, 70);
|
||||
bufferBuilder.end();
|
||||
buffer.upload(bufferBuilder);
|
||||
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
private void be_makeStars(BufferBuilder buffer, double minSize, double maxSize, int count, long seed) {
|
||||
Random random = new Random(seed);
|
||||
buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION);
|
||||
|
||||
|
||||
for (int i = 0; i < count; ++i) {
|
||||
double posX = random.nextDouble() * 2.0 - 1.0;
|
||||
double posY = random.nextDouble() * 2.0 - 1.0;
|
||||
|
@ -302,7 +302,7 @@ public class LevelRendererMixin {
|
|||
double s = random.nextDouble() * Math.PI * 2.0;
|
||||
double t = Math.sin(s);
|
||||
double u = Math.cos(s);
|
||||
|
||||
|
||||
for (int v = 0; v < 4; ++v) {
|
||||
double x = (double) ((v & 2) - 1) * size;
|
||||
double y = (double) ((v + 1 & 2) - 1) * size;
|
||||
|
@ -317,11 +317,11 @@ public class LevelRendererMixin {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void be_makeUVStars(BufferBuilder buffer, double minSize, double maxSize, int count, long seed) {
|
||||
Random random = new Random(seed);
|
||||
buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX);
|
||||
|
||||
|
||||
for (int i = 0; i < count; ++i) {
|
||||
double posX = random.nextDouble() * 2.0 - 1.0;
|
||||
double posY = random.nextDouble() * 2.0 - 1.0;
|
||||
|
@ -345,7 +345,7 @@ public class LevelRendererMixin {
|
|||
double s = random.nextDouble() * Math.PI * 2.0;
|
||||
double t = Math.sin(s);
|
||||
double u = Math.cos(s);
|
||||
|
||||
|
||||
int pos = 0;
|
||||
float minV = random.nextInt(4) / 4F;
|
||||
for (int v = 0; v < 4; ++v) {
|
||||
|
@ -365,11 +365,11 @@ public class LevelRendererMixin {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void be_makeFarFog(BufferBuilder buffer, double minSize, double maxSize, int count, long seed) {
|
||||
Random random = new Random(seed);
|
||||
buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX);
|
||||
|
||||
|
||||
for (int i = 0; i < count; ++i) {
|
||||
double posX = random.nextDouble() * 2.0 - 1.0;
|
||||
double posY = random.nextDouble() - 0.5;
|
||||
|
@ -397,7 +397,7 @@ public class LevelRendererMixin {
|
|||
double s = random.nextDouble() * Math.PI * 2.0;
|
||||
double t = Math.sin(s);
|
||||
double u = Math.cos(s);
|
||||
|
||||
|
||||
int pos = 0;
|
||||
for (int v = 0; v < 4; ++v) {
|
||||
double x = (double) ((v & 2) - 1) * size;
|
||||
|
@ -416,7 +416,7 @@ public class LevelRendererMixin {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void be_makeCylinder(BufferBuilder buffer, int segments, double height, double radius) {
|
||||
buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX);
|
||||
for (int i = 0; i < segments; i++) {
|
||||
|
@ -426,10 +426,10 @@ public class LevelRendererMixin {
|
|||
double pz1 = Math.cos(a1) * radius;
|
||||
double px2 = Math.sin(a2) * radius;
|
||||
double pz2 = Math.cos(a2) * radius;
|
||||
|
||||
|
||||
float u0 = (float) i / (float) segments;
|
||||
float u1 = (float) (i + 1) / (float) segments;
|
||||
|
||||
|
||||
buffer.vertex(px1, -height, pz1).uv(u0, 0).endVertex();
|
||||
buffer.vertex(px1, height, pz1).uv(u0, 1).endVertex();
|
||||
buffer.vertex(px2, height, pz2).uv(u1, 1).endVertex();
|
||||
|
|
|
@ -20,18 +20,16 @@ import ru.betterend.interfaces.FallFlyingItem;
|
|||
|
||||
@Mixin(LocalPlayer.class)
|
||||
public abstract class LocalPlayerMixin extends AbstractClientPlayer {
|
||||
|
||||
|
||||
public LocalPlayerMixin(ClientLevel clientLevel, GameProfile gameProfile) {
|
||||
super(clientLevel, gameProfile);
|
||||
}
|
||||
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
public ClientPacketListener connection;
|
||||
|
||||
@Inject(method = "aiStep", at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/player/LocalPlayer;getItemBySlot(Lnet/minecraft/world/entity/EquipmentSlot;)Lnet/minecraft/world/item/ItemStack;",
|
||||
shift = Shift.AFTER))
|
||||
|
||||
@Inject(method = "aiStep", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;getItemBySlot(Lnet/minecraft/world/entity/EquipmentSlot;)Lnet/minecraft/world/item/ItemStack;", shift = Shift.AFTER))
|
||||
public void be_aiStep(CallbackInfo info) {
|
||||
ItemStack itemStack = getItemBySlot(EquipmentSlot.CHEST);
|
||||
if (itemStack.getItem() instanceof FallFlyingItem && ElytraItem.isFlyEnabled(itemStack) && tryToStartFallFlying()) {
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
package ru.betterend.mixin.client;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.color.block.BlockColors;
|
||||
import net.minecraft.client.color.item.ItemColors;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.gui.screens.WinScreen;
|
||||
import net.minecraft.client.main.GameConfig;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.sounds.Music;
|
||||
import net.minecraft.sounds.Musics;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
@ -18,45 +14,24 @@ 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;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import ru.bclib.interfaces.IColorProvider;
|
||||
import ru.bclib.util.MHelper;
|
||||
|
||||
@Mixin(Minecraft.class)
|
||||
public class MinecraftClientMixin {
|
||||
@Shadow
|
||||
public LocalPlayer player;
|
||||
|
||||
|
||||
@Shadow
|
||||
public Screen screen;
|
||||
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
public Gui gui;
|
||||
|
||||
|
||||
@Shadow
|
||||
public ClientLevel level;
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
private BlockColors blockColors;
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
private ItemColors itemColors;
|
||||
|
||||
@Inject(method = "<init>*", at = @At("TAIL"))
|
||||
private void be_onInit(GameConfig args, CallbackInfo info) {
|
||||
Registry.BLOCK.forEach(block -> {
|
||||
if (block instanceof IColorProvider) {
|
||||
IColorProvider provider = (IColorProvider) block;
|
||||
blockColors.register(provider.getProvider(), block);
|
||||
itemColors.register(provider.getItemProvider(), block.asItem());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "getSituationalMusic", at = @At("HEAD"), cancellable = true)
|
||||
private void be_getEndMusic(CallbackInfoReturnable<Music> info) {
|
||||
if (!(this.screen instanceof WinScreen) && this.player != null) {
|
||||
|
@ -65,7 +40,7 @@ public class MinecraftClientMixin {
|
|||
info.setReturnValue(Musics.END_BOSS);
|
||||
}
|
||||
else {
|
||||
Music sound = (Music) 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();
|
||||
|
|
|
@ -9,12 +9,10 @@ import ru.betterend.world.generator.GeneratorOptions;
|
|||
|
||||
@Mixin(ModelBakery.class)
|
||||
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;
|
||||
|
|
|
@ -22,21 +22,21 @@ public abstract class MusicTrackerMixin {
|
|||
@Final
|
||||
@Shadow
|
||||
private Minecraft minecraft;
|
||||
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
private Random random;
|
||||
|
||||
|
||||
@Shadow
|
||||
private SoundInstance currentMusic;
|
||||
|
||||
|
||||
@Shadow
|
||||
private int nextSongDelay;
|
||||
|
||||
|
||||
private static float volume = 1;
|
||||
private static float srcVolume = 0;
|
||||
private static long time;
|
||||
|
||||
|
||||
@Inject(method = "tick", at = @At("HEAD"), cancellable = true)
|
||||
public void be_onTick(CallbackInfo info) {
|
||||
if (ClientOptions.blendBiomeMusic()) {
|
||||
|
@ -79,19 +79,19 @@ public abstract class MusicTrackerMixin {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean be_isInEnd() {
|
||||
return minecraft.level != null && minecraft.level.dimension().equals(Level.END);
|
||||
}
|
||||
|
||||
|
||||
private boolean be_shouldChangeSound(Music musicSound) {
|
||||
return currentMusic != null && !musicSound.getEvent().getLocation().equals(this.currentMusic.getLocation()) && musicSound.replaceCurrentMusic();
|
||||
}
|
||||
|
||||
|
||||
private boolean be_checkNullSound(Music musicSound) {
|
||||
return musicSound != null && musicSound.getEvent() != null;
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
public abstract void startPlaying(Music type);
|
||||
}
|
||||
|
|
|
@ -13,11 +13,11 @@ import ru.betterend.client.render.ArmoredElytraLayer;
|
|||
|
||||
@Mixin(PlayerRenderer.class)
|
||||
public abstract class PlayerRendererMixin extends LivingEntityRenderer<AbstractClientPlayer, PlayerModel<AbstractClientPlayer>> {
|
||||
|
||||
|
||||
public PlayerRendererMixin(EntityRendererProvider.Context context, PlayerModel<AbstractClientPlayer> entityModel, float f) {
|
||||
super(context, entityModel, f);
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "<init>*", at = @At("TAIL"))
|
||||
public void be_addCustomLayer(EntityRendererProvider.Context context, boolean bl, CallbackInfo ci) {
|
||||
addLayer(new ArmoredElytraLayer<>(this, context.getModelSet()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue