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()));
|
||||
|
|
|
@ -31,11 +31,11 @@ public abstract class AnvilMenuMixin extends ItemCombinerMenu implements AnvilSc
|
|||
private List<AnvilRecipe> be_recipes = Collections.emptyList();
|
||||
private AnvilRecipe be_currentRecipe;
|
||||
private DataSlot anvilLevel;
|
||||
|
||||
|
||||
public AnvilMenuMixin(int syncId, Inventory playerInventory) {
|
||||
super(MenuType.ANVIL, syncId, playerInventory, ContainerLevelAccess.NULL);
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "<init>(ILnet/minecraft/world/entity/player/Inventory;Lnet/minecraft/world/inventory/ContainerLevelAccess;)V", at = @At("TAIL"))
|
||||
public void be_initAnvilLevel(int syncId, Inventory inventory, ContainerLevelAccess context, CallbackInfo info) {
|
||||
this.anvilLevel = addDataSlot(DataSlot.standalone());
|
||||
|
@ -53,17 +53,17 @@ public abstract class AnvilMenuMixin extends ItemCombinerMenu implements AnvilSc
|
|||
anvilLevel.set(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
public abstract void createResult();
|
||||
|
||||
|
||||
@Inject(method = "mayPickup", at = @At("HEAD"), cancellable = true)
|
||||
protected void be_canTakeOutput(Player player, boolean present, CallbackInfoReturnable<Boolean> info) {
|
||||
if (be_currentRecipe != null) {
|
||||
info.setReturnValue(be_currentRecipe.checkHammerDurability(inputSlots, player));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "onTake", at = @At("HEAD"), cancellable = true)
|
||||
protected void be_onTakeOutput(Player player, ItemStack stack, CallbackInfo info) {
|
||||
if (be_currentRecipe != null) {
|
||||
|
@ -90,15 +90,14 @@ public abstract class AnvilMenuMixin extends ItemCombinerMenu implements AnvilSc
|
|||
info.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "createResult", at = @At("HEAD"), cancellable = true)
|
||||
public void be_updateOutput(CallbackInfo info) {
|
||||
RecipeManager recipeManager = this.player.level.getRecipeManager();
|
||||
be_recipes = recipeManager.getRecipesFor(AnvilRecipe.TYPE, inputSlots, player.level);
|
||||
if (be_recipes.size() > 0) {
|
||||
int anvilLevel = this.anvilLevel.get();
|
||||
be_recipes = be_recipes.stream().filter(recipe ->
|
||||
anvilLevel >= recipe.getAnvilLevel()).collect(Collectors.toList());
|
||||
be_recipes = be_recipes.stream().filter(recipe -> anvilLevel >= recipe.getAnvilLevel()).collect(Collectors.toList());
|
||||
if (be_recipes.size() > 0) {
|
||||
if (be_currentRecipe == null || !be_recipes.contains(be_currentRecipe)) {
|
||||
be_currentRecipe = be_recipes.get(0);
|
||||
|
@ -111,14 +110,14 @@ public abstract class AnvilMenuMixin extends ItemCombinerMenu implements AnvilSc
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "setItemName", at = @At("HEAD"), cancellable = true)
|
||||
public void be_setNewItemName(String string, CallbackInfo info) {
|
||||
if (be_currentRecipe != null) {
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean clickMenuButton(Player player, int id) {
|
||||
if (id == 0) {
|
||||
|
@ -131,24 +130,24 @@ public abstract class AnvilMenuMixin extends ItemCombinerMenu implements AnvilSc
|
|||
}
|
||||
return super.clickMenuButton(player, id);
|
||||
}
|
||||
|
||||
|
||||
private void be_updateResult() {
|
||||
if (be_currentRecipe == null) return;
|
||||
resultSlots.setItem(0, be_currentRecipe.assemble(inputSlots));
|
||||
broadcastChanges();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void be_updateCurrentRecipe(AnvilRecipe recipe) {
|
||||
this.be_currentRecipe = recipe;
|
||||
be_updateResult();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AnvilRecipe be_getCurrentRecipe() {
|
||||
return be_currentRecipe;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<AnvilRecipe> be_getRecipes() {
|
||||
return be_recipes;
|
||||
|
|
|
@ -13,13 +13,13 @@ import java.util.function.Supplier;
|
|||
public interface BiomeGenerationSettingsAccessor {
|
||||
@Accessor("features")
|
||||
List<List<Supplier<ConfiguredFeature<?, ?>>>> be_getFeatures();
|
||||
|
||||
|
||||
@Accessor("features")
|
||||
void be_setFeatures(List<List<Supplier<ConfiguredFeature<?, ?>>>> features);
|
||||
|
||||
|
||||
@Accessor("structureStarts")
|
||||
List<Supplier<ConfiguredStructureFeature<?, ?>>> be_getStructures();
|
||||
|
||||
|
||||
@Accessor("structureStarts")
|
||||
void be_setStructures(List<Supplier<ConfiguredStructureFeature<?, ?>>> structures);
|
||||
}
|
||||
|
|
|
@ -35,15 +35,15 @@ import java.util.Random;
|
|||
public abstract class ChorusFlowerBlockMixin extends Block {
|
||||
private static final VoxelShape SHAPE_FULL = Block.box(0, 0, 0, 16, 16, 16);
|
||||
private static final VoxelShape SHAPE_HALF = Block.box(0, 0, 0, 16, 4, 16);
|
||||
|
||||
|
||||
public ChorusFlowerBlockMixin(Properties settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
private ChorusPlantBlock plant;
|
||||
|
||||
|
||||
@Inject(method = "canSurvive", at = @At("HEAD"), cancellable = true)
|
||||
private void be_canSurvive(BlockState state, LevelReader world, BlockPos pos, CallbackInfoReturnable<Boolean> info) {
|
||||
if (world.getBlockState(pos.below()).is(EndBlocks.CHORUS_NYLIUM)) {
|
||||
|
@ -51,7 +51,7 @@ public abstract class ChorusFlowerBlockMixin extends Block {
|
|||
info.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "randomTick", at = @At("HEAD"), cancellable = true)
|
||||
private void be_randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random, CallbackInfo info) {
|
||||
if (world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) {
|
||||
|
@ -71,7 +71,7 @@ public abstract class ChorusFlowerBlockMixin extends Block {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "generatePlant", at = @At("RETURN"), cancellable = true)
|
||||
private static void be_generatePlant(LevelAccessor world, BlockPos pos, Random random, int size, CallbackInfo info) {
|
||||
BlockState state = world.getBlockState(pos);
|
||||
|
@ -79,20 +79,20 @@ public abstract class ChorusFlowerBlockMixin extends Block {
|
|||
BlocksHelper.setWithoutUpdate(world, pos, state.setValue(VanillaBlockProperties.ROOTS, true));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
private static boolean allNeighborsEmpty(LevelReader world, BlockPos pos, @Nullable Direction exceptDirection) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
private void placeGrownFlower(Level world, BlockPos pos, int age) {
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
private void placeDeadFlower(Level world, BlockPos pos) {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
|
||||
if (GeneratorOptions.changeChorusPlant()) {
|
||||
|
@ -102,7 +102,7 @@ public abstract class ChorusFlowerBlockMixin extends Block {
|
|||
return super.getShape(state, world, pos, context);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "placeDeadFlower", at = @At("HEAD"), cancellable = true)
|
||||
private void be_placeDeadFlower(Level world, BlockPos pos, CallbackInfo info) {
|
||||
BlockState down = world.getBlockState(pos.below());
|
||||
|
|
|
@ -29,14 +29,14 @@ public abstract class ChorusPlantBlockMixin extends Block {
|
|||
public ChorusPlantBlockMixin(Properties settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "<init>*", at = @At("TAIL"))
|
||||
private void beOnInit(BlockBehaviour.Properties settings, CallbackInfo info) {
|
||||
if (GeneratorOptions.changeChorusPlant()) {
|
||||
this.registerDefaultState(this.defaultBlockState().setValue(VanillaBlockProperties.ROOTS, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "createBlockStateDefinition", at = @At("TAIL"))
|
||||
private void be_createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder, CallbackInfo info) {
|
||||
GeneratorOptions.init();
|
||||
|
@ -44,7 +44,7 @@ public abstract class ChorusPlantBlockMixin extends Block {
|
|||
builder.add(VanillaBlockProperties.ROOTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "getStateForPlacement(Lnet/minecraft/world/item/context/BlockPlaceContext;)Lnet/minecraft/world/level/block/state/BlockState;", at = @At("RETURN"), cancellable = true)
|
||||
private void be_getStateForPlacement(BlockPlaceContext ctx, CallbackInfoReturnable<BlockState> info) {
|
||||
BlockPos pos = ctx.getClickedPos();
|
||||
|
@ -60,11 +60,8 @@ public abstract class ChorusPlantBlockMixin extends Block {
|
|||
info.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "Lnet/minecraft/world/level/block/ChorusPlantBlock;getStateForPlacement" +
|
||||
"(Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;)" +
|
||||
"Lnet/minecraft/world/level/block/state/BlockState;",
|
||||
at = @At("RETURN"), cancellable = true)
|
||||
|
||||
@Inject(method = "Lnet/minecraft/world/level/block/ChorusPlantBlock;getStateForPlacement" + "(Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;)" + "Lnet/minecraft/world/level/block/state/BlockState;", at = @At("RETURN"), cancellable = true)
|
||||
private void be_getStateForPlacement(BlockGetter blockGetter, BlockPos blockPos, CallbackInfoReturnable<BlockState> info) {
|
||||
BlockState plant = info.getReturnValue();
|
||||
if (plant.is(Blocks.CHORUS_PLANT)) {
|
||||
|
@ -85,7 +82,7 @@ public abstract class ChorusPlantBlockMixin extends Block {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "canSurvive", at = @At("HEAD"), cancellable = true)
|
||||
private void be_canSurvive(BlockState state, LevelReader world, BlockPos pos, CallbackInfoReturnable<Boolean> info) {
|
||||
BlockState down = world.getBlockState(pos.below());
|
||||
|
@ -94,7 +91,7 @@ public abstract class ChorusPlantBlockMixin extends Block {
|
|||
info.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "updateShape", at = @At("RETURN"), cancellable = true)
|
||||
private void be_updateShape(BlockState state, Direction direction, BlockState newState, LevelAccessor world, BlockPos pos, BlockPos posFrom, CallbackInfoReturnable<BlockState> info) {
|
||||
BlockState plant = info.getReturnValue();
|
||||
|
|
|
@ -19,22 +19,22 @@ public class ChunkBiomeContainerMixin implements IBiomeArray {
|
|||
@Final
|
||||
@Shadow
|
||||
private Biome[] biomes;
|
||||
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
private static int WIDTH_BITS;
|
||||
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
private static int HORIZONTAL_MASK;
|
||||
|
||||
|
||||
@Override
|
||||
public void be_setBiome(Biome biome, BlockPos pos) {
|
||||
int biomeX = pos.getX() >> 2;
|
||||
int biomeY = pos.getY() >> 2;
|
||||
int biomeZ = pos.getZ() >> 2;
|
||||
int index = be_getArrayIndex(biomeX, biomeY, biomeZ);
|
||||
|
||||
|
||||
if (Integrations.hasHydrogen()) {
|
||||
try {
|
||||
ChunkBiomeContainer self = (ChunkBiomeContainer) (Object) this;
|
||||
|
@ -69,38 +69,38 @@ public class ChunkBiomeContainerMixin implements IBiomeArray {
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
biomes[index] = biome;
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private int quartMinY;
|
||||
@Shadow
|
||||
@Final
|
||||
private int quartHeight;
|
||||
|
||||
|
||||
private int be_getArrayIndex(int biomeX, int biomeY, int biomeZ) {
|
||||
int i = biomeX & HORIZONTAL_MASK;
|
||||
int j = Mth.clamp(biomeY - this.quartMinY, 0, this.quartHeight);
|
||||
int k = biomeZ & HORIZONTAL_MASK;
|
||||
return j << WIDTH_BITS + WIDTH_BITS | k << WIDTH_BITS | i;
|
||||
}
|
||||
|
||||
|
||||
private Field be_getField(String name) throws Exception {
|
||||
Field field = ChunkBiomeContainer.class.getDeclaredField(name);
|
||||
field.setAccessible(true);
|
||||
return field;
|
||||
}
|
||||
|
||||
|
||||
private BitStorage be_getHydrogenStorage(ChunkBiomeContainer container) throws Exception {
|
||||
return (BitStorage) be_getField("intArray").get(container);
|
||||
}
|
||||
|
||||
|
||||
private Biome[] be_getHydrogenPalette(ChunkBiomeContainer container) throws Exception {
|
||||
return (Biome[]) be_getField("palette").get(container);
|
||||
}
|
||||
|
||||
|
||||
private int be_getHydrogenPaletteIndex(Biome biome, Biome[] palette) {
|
||||
int index = -1;
|
||||
for (int i = 0; i < palette.length; i++) {
|
||||
|
@ -111,11 +111,11 @@ public class ChunkBiomeContainerMixin implements IBiomeArray {
|
|||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
private void be_setHydrogenPalette(ChunkBiomeContainer container, Biome[] palette) throws Exception {
|
||||
be_getField("palette").set(container, palette);
|
||||
}
|
||||
|
||||
|
||||
private void be_setHydrogenStorage(ChunkBiomeContainer container, BitStorage storage) throws Exception {
|
||||
be_getField("intArray").set(container, storage);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ public abstract class CraftingMenuMixin {
|
|||
@Final
|
||||
@Shadow
|
||||
private ContainerLevelAccess access;
|
||||
|
||||
|
||||
@Inject(method = "stillValid", at = @At("HEAD"), cancellable = true)
|
||||
private void be_stillValid(Player player, CallbackInfoReturnable<Boolean> info) {
|
||||
if (access.evaluate((world, pos) -> {
|
||||
|
|
|
@ -17,10 +17,9 @@ import ru.betterend.world.generator.GeneratorOptions;
|
|||
public class DimensionTypeMixin {
|
||||
@Inject(method = "defaultEndGenerator", at = @At("HEAD"), cancellable = true)
|
||||
private static void be_replaceGenerator(Registry<Biome> biomeRegistry, Registry<NoiseGeneratorSettings> chunkGeneratorSettingsRegistry, long seed, CallbackInfoReturnable<ChunkGenerator> info) {
|
||||
info.setReturnValue(new NoiseBasedChunkGenerator(new BetterEndBiomeSource(biomeRegistry, seed), seed,
|
||||
() -> chunkGeneratorSettingsRegistry.getOrThrow(NoiseGeneratorSettings.END)));
|
||||
info.setReturnValue(new NoiseBasedChunkGenerator(new BetterEndBiomeSource(biomeRegistry, seed), seed, () -> chunkGeneratorSettingsRegistry.getOrThrow(NoiseGeneratorSettings.END)));
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "createDragonFight", at = @At("HEAD"), cancellable = true)
|
||||
private void be_hasEnderDragonFight(CallbackInfoReturnable<Boolean> info) {
|
||||
if (!GeneratorOptions.hasDragonFights()) {
|
||||
|
|
|
@ -26,35 +26,35 @@ public abstract class EnchantmentMenuMixin extends AbstractContainerMenu {
|
|||
@Final
|
||||
@Shadow
|
||||
private Container enchantSlots;
|
||||
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
private ContainerLevelAccess access;
|
||||
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
private Random random;
|
||||
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
private DataSlot enchantmentSeed;
|
||||
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
public int[] costs;
|
||||
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
public int[] enchantClue;
|
||||
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
public int[] levelClue;
|
||||
|
||||
|
||||
protected EnchantmentMenuMixin(MenuType<?> type, int syncId) {
|
||||
super(type, syncId);
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "slotsChanged", at = @At("HEAD"), cancellable = true)
|
||||
private void be_slotsChanged(Container inventory, CallbackInfo info) {
|
||||
if (inventory == this.enchantSlots) {
|
||||
|
@ -62,7 +62,7 @@ public abstract class EnchantmentMenuMixin extends AbstractContainerMenu {
|
|||
if (!itemStack.isEmpty() && itemStack.isEnchantable()) {
|
||||
this.access.execute((world, blockPos) -> {
|
||||
int i = 0;
|
||||
|
||||
|
||||
int j;
|
||||
for (j = -1; j <= 1; ++j) {
|
||||
for (int k = -1; k <= 1; ++k) {
|
||||
|
@ -70,24 +70,24 @@ public abstract class EnchantmentMenuMixin extends AbstractContainerMenu {
|
|||
if (world.getBlockState(blockPos.offset(k * 2, 0, j * 2)).is(TagAPI.BOOKSHELVES)) {
|
||||
++i;
|
||||
}
|
||||
|
||||
|
||||
if (world.getBlockState(blockPos.offset(k * 2, 1, j * 2)).is(TagAPI.BOOKSHELVES)) {
|
||||
++i;
|
||||
}
|
||||
|
||||
|
||||
if (k != 0 && j != 0) {
|
||||
if (world.getBlockState(blockPos.offset(k * 2, 0, j)).is(TagAPI.BOOKSHELVES)) {
|
||||
++i;
|
||||
}
|
||||
|
||||
|
||||
if (world.getBlockState(blockPos.offset(k * 2, 1, j)).is(TagAPI.BOOKSHELVES)) {
|
||||
++i;
|
||||
}
|
||||
|
||||
|
||||
if (world.getBlockState(blockPos.offset(k, 0, j * 2)).is(TagAPI.BOOKSHELVES)) {
|
||||
++i;
|
||||
}
|
||||
|
||||
|
||||
if (world.getBlockState(blockPos.offset(k, 1, j * 2)).is(TagAPI.BOOKSHELVES)) {
|
||||
++i;
|
||||
}
|
||||
|
@ -95,9 +95,9 @@ public abstract class EnchantmentMenuMixin extends AbstractContainerMenu {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
random.setSeed(enchantmentSeed.get());
|
||||
|
||||
|
||||
for (j = 0; j < 3; ++j) {
|
||||
costs[j] = EnchantmentHelper.getEnchantmentCost(this.random, j, i, itemStack);
|
||||
enchantClue[j] = -1;
|
||||
|
@ -106,7 +106,7 @@ public abstract class EnchantmentMenuMixin extends AbstractContainerMenu {
|
|||
costs[j] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (j = 0; j < 3; ++j) {
|
||||
if (this.costs[j] > 0) {
|
||||
List<EnchantmentInstance> list = this.getEnchantmentList(itemStack, j, this.costs[j]);
|
||||
|
@ -117,7 +117,7 @@ public abstract class EnchantmentMenuMixin extends AbstractContainerMenu {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
broadcastChanges();
|
||||
});
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ public abstract class EnchantmentMenuMixin extends AbstractContainerMenu {
|
|||
info.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
private List<EnchantmentInstance> getEnchantmentList(ItemStack stack, int slot, int level) {
|
||||
return null;
|
||||
|
|
|
@ -35,7 +35,7 @@ public class EndCityFeatureMixin {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
private static int getYPositionForFeature(ChunkPos pos, ChunkGenerator chunkGenerator, LevelHeightAccessor levelHeightAccessor) {
|
||||
return 0;
|
||||
|
|
|
@ -36,20 +36,20 @@ public class EndDragonFightMixin {
|
|||
@Final
|
||||
@Shadow
|
||||
private ServerLevel level;
|
||||
|
||||
|
||||
@Shadow
|
||||
private BlockPattern.BlockPatternMatch findExitPortal() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
private void spawnExitPortal(boolean bl) {
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
private void respawnDragon(List<EndCrystal> list) {
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "tryRespawn", at = @At("HEAD"), cancellable = true)
|
||||
private void be_tryRespawnDragon(CallbackInfo info) {
|
||||
if (GeneratorOptions.replacePortal() && GeneratorOptions.hasDragonFights() && this.dragonKilled && this.respawnStage == null) {
|
||||
|
@ -64,16 +64,16 @@ public class EndDragonFightMixin {
|
|||
else {
|
||||
LOGGER.debug("Found the exit portal & temporarily using it.");
|
||||
}
|
||||
|
||||
|
||||
blockPos = portalLocation;
|
||||
}
|
||||
|
||||
|
||||
List<EndCrystal> crystals = Lists.newArrayList();
|
||||
BlockPos center = GeneratorOptions.getPortalPos().above(5);
|
||||
for (Direction dir : BlocksHelper.HORIZONTAL) {
|
||||
BlockPos central = center.relative(dir, 4);
|
||||
List<EndCrystal> crystalList = level.getEntitiesOfClass(EndCrystal.class, new AABB(central.below(255).south().west(), central.above(255).north().east()));
|
||||
|
||||
|
||||
int count = crystalList.size();
|
||||
for (int n = 0; n < count; n++) {
|
||||
EndCrystal crystal = crystalList.get(n);
|
||||
|
@ -83,15 +83,15 @@ public class EndDragonFightMixin {
|
|||
n--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (crystalList.isEmpty()) {
|
||||
info.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
crystals.addAll(crystalList);
|
||||
}
|
||||
|
||||
|
||||
LOGGER.debug("Found all crystals, respawning dragon.");
|
||||
respawnDragon(crystals);
|
||||
info.cancel();
|
||||
|
|
|
@ -30,7 +30,7 @@ public class EndPodiumFeatureMixin {
|
|||
@Final
|
||||
@Shadow
|
||||
private boolean active;
|
||||
|
||||
|
||||
@Inject(method = "place", at = @At("HEAD"), cancellable = true)
|
||||
private void be_place(FeaturePlaceContext<NoneFeatureConfiguration> featurePlaceContext, CallbackInfoReturnable<Boolean> info) {
|
||||
if (!GeneratorOptions.hasPortal()) {
|
||||
|
@ -49,14 +49,14 @@ public class EndPodiumFeatureMixin {
|
|||
info.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ModifyVariable(method = "place", ordinal = 0, at = @At("HEAD"))
|
||||
private FeaturePlaceContext<NoneFeatureConfiguration> be_setPosOnGround(FeaturePlaceContext<NoneFeatureConfiguration> featurePlaceContext) {
|
||||
WorldGenLevel world = featurePlaceContext.level();
|
||||
BlockPos pos = be_updatePos(featurePlaceContext.origin(), world);
|
||||
return new FeaturePlaceContext<NoneFeatureConfiguration>(world, featurePlaceContext.chunkGenerator(), featurePlaceContext.random(), pos, featurePlaceContext.config());
|
||||
}
|
||||
|
||||
|
||||
private BlockPos be_updatePos(BlockPos blockPos, WorldGenLevel world) {
|
||||
if (GeneratorOptions.useNewGenerator()) {
|
||||
BlockPos pos = GeneratorOptions.getPortalPos();
|
||||
|
|
|
@ -17,7 +17,7 @@ public class EndSpikeMixin {
|
|||
@Final
|
||||
@Shadow
|
||||
private int height;
|
||||
|
||||
|
||||
@Inject(method = "getHeight", at = @At("HEAD"), cancellable = true)
|
||||
private void be_getSpikeHeight(CallbackInfoReturnable<Integer> info) {
|
||||
if (!GeneratorOptions.isDirectSpikeHeight()) {
|
||||
|
@ -30,12 +30,12 @@ public class EndSpikeMixin {
|
|||
info.setReturnValue(maxY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
public int getCenterX() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
public int getCenterZ() {
|
||||
return 0;
|
||||
|
|
|
@ -15,8 +15,7 @@ import ru.betterend.effects.EndStatusEffects;
|
|||
public abstract class EnderManMixin {
|
||||
@Inject(method = "isLookingAtMe", at = @At("HEAD"), cancellable = true)
|
||||
private void be_isLookingAtMe(Player player, CallbackInfoReturnable<Boolean> info) {
|
||||
if (player.isCreative() || player.hasEffect(EndStatusEffects.END_VEIL) ||
|
||||
EnchantmentHelper.getItemEnchantmentLevel(EndEnchantments.END_VEIL, player.getItemBySlot(EquipmentSlot.HEAD)) > 0) {
|
||||
if (player.isCreative() || player.hasEffect(EndStatusEffects.END_VEIL) || EnchantmentHelper.getItemEnchantmentLevel(EndEnchantments.END_VEIL, player.getItemBySlot(EquipmentSlot.HEAD)) > 0) {
|
||||
info.setReturnValue(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,31 +21,31 @@ public abstract class EntityMixin implements TeleportingEntity {
|
|||
private float yRot;
|
||||
@Shadow
|
||||
private float xRot;
|
||||
|
||||
|
||||
@Shadow
|
||||
public Level level;
|
||||
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
public abstract void unRide();
|
||||
|
||||
|
||||
@Shadow
|
||||
public abstract Vec3 getDeltaMovement();
|
||||
|
||||
|
||||
@Shadow
|
||||
public abstract EntityType<?> getType();
|
||||
|
||||
|
||||
@Shadow
|
||||
protected abstract PortalInfo findDimensionEntryPoint(ServerLevel destination);
|
||||
|
||||
|
||||
@Shadow
|
||||
protected abstract void removeAfterChangingDimensions();
|
||||
|
||||
|
||||
@Shadow
|
||||
public abstract boolean isRemoved();
|
||||
|
||||
|
||||
private BlockPos exitPos;
|
||||
|
||||
|
||||
@Inject(method = "changeDimension", at = @At("HEAD"), cancellable = true)
|
||||
public void be_changeDimension(ServerLevel destination, CallbackInfoReturnable<Entity> info) {
|
||||
if (!isRemoved() && be_canTeleport() && level instanceof ServerLevel) {
|
||||
|
@ -61,10 +61,10 @@ public abstract class EntityMixin implements TeleportingEntity {
|
|||
entity.moveTo(teleportTarget.pos.x, teleportTarget.pos.y, teleportTarget.pos.z, teleportTarget.yRot, entity.getXRot());
|
||||
entity.setDeltaMovement(teleportTarget.speed);
|
||||
//TODO: check if this works as intended in 1.17
|
||||
|
||||
|
||||
destination.addDuringTeleport(entity);
|
||||
}
|
||||
|
||||
|
||||
this.removeAfterChangingDimensions();
|
||||
level.getProfiler().pop();
|
||||
((ServerLevel) level).resetEmptyTime();
|
||||
|
@ -75,24 +75,24 @@ public abstract class EntityMixin implements TeleportingEntity {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "findDimensionEntryPoint", at = @At("HEAD"), cancellable = true)
|
||||
protected void be_findDimensionEntryPoint(ServerLevel destination, CallbackInfoReturnable<PortalInfo> info) {
|
||||
if (be_canTeleport()) {
|
||||
info.setReturnValue(new PortalInfo(new Vec3(exitPos.getX() + 0.5, exitPos.getY(), exitPos.getZ() + 0.5), getDeltaMovement(), yRot, xRot));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void be_setExitPos(BlockPos pos) {
|
||||
this.exitPos = pos.immutable();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void be_resetExitPos() {
|
||||
this.exitPos = null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean be_canTeleport() {
|
||||
return this.exitPos != null;
|
||||
|
|
|
@ -39,39 +39,39 @@ import java.util.Collection;
|
|||
|
||||
@Mixin(LivingEntity.class)
|
||||
public abstract class LivingEntityMixin extends Entity {
|
||||
|
||||
|
||||
public LivingEntityMixin(EntityType<?> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
protected int fallFlyTicks;
|
||||
|
||||
|
||||
@Shadow
|
||||
public abstract boolean hasEffect(MobEffect mobEffect);
|
||||
|
||||
|
||||
@Shadow
|
||||
public abstract ItemStack getItemBySlot(EquipmentSlot equipmentSlot);
|
||||
|
||||
|
||||
@Shadow
|
||||
public abstract void calculateEntityAnimation(LivingEntity livingEntity, boolean b);
|
||||
|
||||
|
||||
@Shadow
|
||||
protected abstract SoundEvent getFallDamageSound(int i);
|
||||
|
||||
|
||||
@Shadow
|
||||
public abstract boolean isFallFlying();
|
||||
|
||||
|
||||
@Shadow
|
||||
public abstract AttributeMap getAttributes();
|
||||
|
||||
|
||||
private Entity lastAttacker;
|
||||
|
||||
|
||||
@Inject(method = "createLivingAttributes", at = @At("RETURN"), cancellable = true)
|
||||
private static void be_addLivingAttributes(CallbackInfoReturnable<AttributeSupplier.Builder> info) {
|
||||
EndAttributes.addLivingEntityAttributes(info.getReturnValue());
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "tickEffects", at = @At("HEAD"))
|
||||
protected void be_applyEffects(CallbackInfo info) {
|
||||
if (!level.isClientSide()) {
|
||||
|
@ -86,7 +86,7 @@ public abstract class LivingEntityMixin extends Entity {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "canBeAffected", at = @At("HEAD"), cancellable = true)
|
||||
public void be_canBeAffected(MobEffectInstance mobEffectInstance, CallbackInfoReturnable<Boolean> info) {
|
||||
try {
|
||||
|
@ -98,12 +98,12 @@ public abstract class LivingEntityMixin extends Entity {
|
|||
BetterEnd.LOGGER.warning("Blindness resistance attribute haven't been registered.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "hurt", at = @At("HEAD"))
|
||||
public void be_hurt(DamageSource source, float amount, CallbackInfoReturnable<Boolean> info) {
|
||||
this.lastAttacker = source.getEntity();
|
||||
}
|
||||
|
||||
|
||||
@ModifyArg(method = "hurt", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;knockback(DDD)V"), index = 0)
|
||||
private double be_increaseKnockback(double value, double x, double z) {
|
||||
if (lastAttacker != null && lastAttacker instanceof LivingEntity) {
|
||||
|
@ -112,7 +112,7 @@ public abstract class LivingEntityMixin extends Entity {
|
|||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "updateFallFlying", at = @At("HEAD"), cancellable = true)
|
||||
private void be_updateFallFlying(CallbackInfo info) {
|
||||
ItemStack itemStack = getItemBySlot(EquipmentSlot.CHEST);
|
||||
|
@ -121,8 +121,7 @@ public abstract class LivingEntityMixin extends Entity {
|
|||
if (isFlying && !onGround && !isPassenger() && !hasEffect(MobEffects.LEVITATION)) {
|
||||
if (ElytraItem.isFlyEnabled(itemStack)) {
|
||||
if ((fallFlyTicks + 1) % 20 == 0) {
|
||||
itemStack.hurtAndBreak(1, LivingEntity.class.cast(this),
|
||||
livingEntity -> livingEntity.broadcastBreakEvent(EquipmentSlot.CHEST));
|
||||
itemStack.hurtAndBreak(1, LivingEntity.class.cast(this), livingEntity -> livingEntity.broadcastBreakEvent(EquipmentSlot.CHEST));
|
||||
}
|
||||
isFlying = true;
|
||||
}
|
||||
|
@ -137,10 +136,8 @@ public abstract class LivingEntityMixin extends Entity {
|
|||
info.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "travel", at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/entity/LivingEntity;isFallFlying()Z",
|
||||
shift = Shift.AFTER), cancellable = true)
|
||||
|
||||
@Inject(method = "travel", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;isFallFlying()Z", shift = Shift.AFTER), cancellable = true)
|
||||
public void be_travel(Vec3 vec3, CallbackInfo info) {
|
||||
ItemStack itemStack = getItemBySlot(EquipmentSlot.CHEST);
|
||||
if (isFallFlying() && itemStack.getItem() instanceof FallFlyingItem) {
|
||||
|
@ -148,7 +145,7 @@ public abstract class LivingEntityMixin extends Entity {
|
|||
if (moveDelta.y > -0.5D) {
|
||||
fallDistance = 1.0F;
|
||||
}
|
||||
|
||||
|
||||
Vec3 lookAngle = getLookAngle();
|
||||
double d = 0.08D;
|
||||
float rotX = getXRot() * 0.017453292F;
|
||||
|
@ -163,12 +160,12 @@ public abstract class LivingEntityMixin extends Entity {
|
|||
coef = moveDelta.y * -0.1D * (double) n;
|
||||
moveDelta = moveDelta.add(lookAngle.x * coef / k, coef, lookAngle.z * coef / k);
|
||||
}
|
||||
|
||||
|
||||
if (rotX < 0.0F && k > 0.0D) {
|
||||
coef = l * (double) (-Mth.sin(rotX)) * 0.04D;
|
||||
moveDelta = moveDelta.add(-lookAngle.x * coef / k, coef * 3.2D, -lookAngle.z * coef / k);
|
||||
}
|
||||
|
||||
|
||||
if (k > 0.0D) {
|
||||
moveDelta = moveDelta.add((lookAngle.x / k * l - moveDelta.x) * 0.1D, 0.0D, (lookAngle.z / k * l - moveDelta.z) * 0.1D);
|
||||
}
|
||||
|
@ -191,12 +188,12 @@ public abstract class LivingEntityMixin extends Entity {
|
|||
setSharedFlag(7, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
calculateEntityAnimation(LivingEntity.class.cast(this), this instanceof FlyingAnimal);
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private double be_getKnockback(Item tool) {
|
||||
if (tool == null) return 0.0D;
|
||||
Collection<AttributeModifier> modifiers = tool.getDefaultAttributeModifiers(EquipmentSlot.MAINHAND).get(Attributes.ATTACK_KNOCKBACK);
|
||||
|
|
|
@ -24,15 +24,15 @@ import java.util.Map;
|
|||
public abstract class MinecraftServerMixin {
|
||||
@Shadow
|
||||
private ServerResources resources;
|
||||
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
private Map<ResourceKey<Level>, ServerLevel> levels;
|
||||
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
protected WorldData worldData;
|
||||
|
||||
|
||||
@Inject(method = "overworld", at = @At(value = "HEAD"), cancellable = true)
|
||||
private void be_overworld(CallbackInfoReturnable<ServerLevel> info) {
|
||||
if (GeneratorOptions.swapOverworldToEnd()) {
|
||||
|
@ -44,7 +44,7 @@ public abstract class MinecraftServerMixin {
|
|||
info.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "createLevels", at = @At(value = "TAIL"))
|
||||
private void be_createLevels(ChunkProgressListener worldGenerationProgressListener, CallbackInfo info) {
|
||||
if (GeneratorOptions.swapOverworldToEnd()) {
|
||||
|
@ -59,21 +59,21 @@ public abstract class MinecraftServerMixin {
|
|||
setInitialSpawn(world, serverWorldProperties, generatorOptions.generateBonusChest(), bl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
private static void setInitialSpawn(ServerLevel serverLevel, ServerLevelData serverLevelData, boolean bl, boolean bl2) {
|
||||
}
|
||||
|
||||
|
||||
;
|
||||
|
||||
|
||||
@Inject(method = "setInitialSpawn", at = @At(value = "HEAD"), cancellable = true)
|
||||
private static void be_setInitialSpawn(ServerLevel world, ServerLevelData serverWorldProperties, boolean bonusChest, boolean debugWorld, CallbackInfo info) {
|
||||
if (GeneratorOptions.swapOverworldToEnd() && world.dimension() == Level.OVERWORLD) {
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Shadow
|
||||
public PlayerList getPlayerList() {
|
||||
return null;
|
||||
|
|
|
@ -21,16 +21,16 @@ public abstract class NoiseBasedChunkGeneratorMixin extends ChunkGenerator {
|
|||
@Final
|
||||
@Shadow
|
||||
protected Supplier<NoiseGeneratorSettings> settings;
|
||||
|
||||
|
||||
public NoiseBasedChunkGeneratorMixin(BiomeSource populationSource, BiomeSource biomeSource, StructureSettings structuresConfig, long worldSeed) {
|
||||
super(populationSource, biomeSource, structuresConfig, worldSeed);
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "<init>(Lnet/minecraft/world/level/biome/BiomeSource;Lnet/minecraft/world/level/biome/BiomeSource;JLjava/util/function/Supplier;)V", at = @At("TAIL"))
|
||||
private void beOnInit(BiomeSource populationSource, BiomeSource biomeSource, long seed, Supplier<NoiseGeneratorSettings> settings, CallbackInfo info) {
|
||||
TerrainGenerator.initNoise(seed);
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "fillNoiseColumn([DIIII)V", at = @At("HEAD"), cancellable = true, allow = 2)
|
||||
private void be_fillNoiseColumn(double[] buffer, int x, int z, int k, int l, CallbackInfo info) {
|
||||
if (GeneratorOptions.useNewGenerator() && settings.get().stable(NoiseGeneratorSettings.END)) {
|
||||
|
|
|
@ -15,11 +15,8 @@ import ru.betterend.events.PlayerAdvancementsCallback;
|
|||
public abstract class PlayerAdvancementsMixin {
|
||||
@Shadow
|
||||
private ServerPlayer player;
|
||||
|
||||
@Inject(method = "award", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/advancements/AdvancementRewards;grant(Lnet/minecraft/server/level/ServerPlayer;)V",
|
||||
shift = Shift.AFTER))
|
||||
|
||||
@Inject(method = "award", at = @At(value = "INVOKE", target = "Lnet/minecraft/advancements/AdvancementRewards;grant(Lnet/minecraft/server/level/ServerPlayer;)V", shift = Shift.AFTER))
|
||||
public void be_award(Advancement advancement, String criterionName, CallbackInfoReturnable<Boolean> info) {
|
||||
PlayerAdvancementsCallback.PLAYER_ADVANCEMENT_COMPLETE.invoker().onAdvancementComplete(player, advancement, criterionName);
|
||||
}
|
||||
|
|
|
@ -62,26 +62,26 @@ public class PlayerListMixin {
|
|||
@Final
|
||||
@Shadow
|
||||
private static Logger LOGGER;
|
||||
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
private MinecraftServer server;
|
||||
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
private RegistryAccess.RegistryHolder registryHolder;
|
||||
|
||||
|
||||
@Shadow
|
||||
private int viewDistance;
|
||||
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
private List<ServerPlayer> players;
|
||||
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
private Map<UUID, ServerPlayer> playersByUUID;
|
||||
|
||||
|
||||
@Inject(method = "placeNewPlayer", at = @At(value = "HEAD"), cancellable = true)
|
||||
public void be_placeNewPlayer(Connection connection, ServerPlayer serverPlayer, CallbackInfo info) {
|
||||
if (GeneratorOptions.swapOverworldToEnd()) {
|
||||
|
@ -101,7 +101,7 @@ public class PlayerListMixin {
|
|||
else {
|
||||
var23 = Level.END;
|
||||
}
|
||||
|
||||
|
||||
ResourceKey<Level> registryKey = var23;
|
||||
ServerLevel serverLevel = this.server.getLevel(registryKey);
|
||||
ServerLevel serverLevel3;
|
||||
|
@ -112,39 +112,29 @@ public class PlayerListMixin {
|
|||
else {
|
||||
serverLevel3 = serverLevel;
|
||||
}
|
||||
|
||||
|
||||
serverPlayer.setLevel(serverLevel3);
|
||||
//serverPlayer.gameMode.setLevel((ServerLevel) serverPlayer.level);
|
||||
String string2 = "local";
|
||||
if (connection.getRemoteAddress() != null) {
|
||||
string2 = connection.getRemoteAddress().toString();
|
||||
}
|
||||
|
||||
LOGGER.info("{}[{}] logged in with entity id {} at ({}, {}, {})", serverPlayer.getName().getString(), string2,
|
||||
serverPlayer.getId(), serverPlayer.getX(), serverPlayer.getY(), serverPlayer.getZ());
|
||||
|
||||
LOGGER.info("{}[{}] logged in with entity id {} at ({}, {}, {})", serverPlayer.getName().getString(), string2, serverPlayer.getId(), serverPlayer.getX(), serverPlayer.getY(), serverPlayer.getZ());
|
||||
LevelData worldProperties = serverLevel3.getLevelData();
|
||||
serverPlayer.loadGameTypes(compoundTag);
|
||||
//this.updatePlayerGameMode(serverPlayer, (ServerPlayer) null, serverLevel3);
|
||||
ServerGamePacketListenerImpl serverPlayNetworkHandler = new ServerGamePacketListenerImpl(this.server,
|
||||
connection, serverPlayer);
|
||||
ServerGamePacketListenerImpl serverPlayNetworkHandler = new ServerGamePacketListenerImpl(this.server, connection, serverPlayer);
|
||||
GameRules gameRules = serverLevel3.getGameRules();
|
||||
boolean bl = gameRules.getBoolean(GameRules.RULE_DO_IMMEDIATE_RESPAWN);
|
||||
boolean bl2 = gameRules.getBoolean(GameRules.RULE_REDUCEDDEBUGINFO);
|
||||
serverPlayNetworkHandler.send(new ClientboundLoginPacket(serverPlayer.getId(),
|
||||
serverPlayer.gameMode.getGameModeForPlayer(), serverPlayer.gameMode.getPreviousGameModeForPlayer(),
|
||||
BiomeManager.obfuscateSeed(serverLevel3.getSeed()), worldProperties.isHardcore(),
|
||||
this.server.levelKeys(), this.registryHolder, serverLevel3.dimensionType(), serverLevel3.dimension(),
|
||||
this.getMaxPlayers(), this.viewDistance, bl2, !bl, serverLevel3.isDebug(), serverLevel3.isFlat()));
|
||||
serverPlayNetworkHandler.send(new ClientboundCustomPayloadPacket(ClientboundCustomPayloadPacket.BRAND,
|
||||
(new FriendlyByteBuf(Unpooled.buffer())).writeUtf(this.getServer().getServerModName())));
|
||||
serverPlayNetworkHandler
|
||||
.send(new ClientboundChangeDifficultyPacket(worldProperties.getDifficulty(), worldProperties.isDifficultyLocked()));
|
||||
serverPlayNetworkHandler.send(new ClientboundLoginPacket(serverPlayer.getId(), serverPlayer.gameMode.getGameModeForPlayer(), serverPlayer.gameMode.getPreviousGameModeForPlayer(), BiomeManager.obfuscateSeed(serverLevel3.getSeed()), worldProperties.isHardcore(), this.server.levelKeys(), this.registryHolder, serverLevel3.dimensionType(), serverLevel3.dimension(), this.getMaxPlayers(), this.viewDistance, bl2, !bl, serverLevel3.isDebug(), serverLevel3.isFlat()));
|
||||
serverPlayNetworkHandler.send(new ClientboundCustomPayloadPacket(ClientboundCustomPayloadPacket.BRAND, (new FriendlyByteBuf(Unpooled.buffer())).writeUtf(this.getServer().getServerModName())));
|
||||
serverPlayNetworkHandler.send(new ClientboundChangeDifficultyPacket(worldProperties.getDifficulty(), worldProperties.isDifficultyLocked()));
|
||||
serverPlayNetworkHandler.send(new ClientboundPlayerAbilitiesPacket(serverPlayer.getAbilities()));
|
||||
serverPlayNetworkHandler.send(new ClientboundSetCarriedItemPacket(serverPlayer.getInventory().selected));
|
||||
serverPlayNetworkHandler
|
||||
.send(new ClientboundUpdateRecipesPacket(this.server.getRecipeManager().getRecipes()));
|
||||
serverPlayNetworkHandler
|
||||
.send(new ClientboundUpdateTagsPacket(this.server.getTags().serializeToNetwork(this.registryHolder)));
|
||||
serverPlayNetworkHandler.send(new ClientboundUpdateRecipesPacket(this.server.getRecipeManager().getRecipes()));
|
||||
serverPlayNetworkHandler.send(new ClientboundUpdateTagsPacket(this.server.getTags().serializeToNetwork(this.registryHolder)));
|
||||
this.sendPlayerPermissionLevel(serverPlayer);
|
||||
serverPlayer.getStats().markAllDirty();
|
||||
serverPlayer.getRecipeBook().sendInitialRecipeBook(serverPlayer);
|
||||
|
@ -152,46 +142,38 @@ public class PlayerListMixin {
|
|||
this.server.invalidateStatus();
|
||||
TranslatableComponent mutableText2;
|
||||
if (serverPlayer.getGameProfile().getName().equalsIgnoreCase(string)) {
|
||||
mutableText2 = new TranslatableComponent("multiplayer.player.joined",
|
||||
new Object[]{serverPlayer.getDisplayName()});
|
||||
mutableText2 = new TranslatableComponent("multiplayer.player.joined", new Object[]{serverPlayer.getDisplayName()});
|
||||
}
|
||||
else {
|
||||
mutableText2 = new TranslatableComponent("multiplayer.player.joined.renamed",
|
||||
new Object[]{serverPlayer.getDisplayName(), string});
|
||||
mutableText2 = new TranslatableComponent("multiplayer.player.joined.renamed", new Object[]{serverPlayer.getDisplayName(), string});
|
||||
}
|
||||
|
||||
|
||||
this.broadcastMessage(mutableText2.withStyle(ChatFormatting.YELLOW), ChatType.SYSTEM, Util.NIL_UUID);
|
||||
serverPlayNetworkHandler.teleport(serverPlayer.getX(), serverPlayer.getY(), serverPlayer.getZ(),
|
||||
serverPlayer.getYRot(), serverPlayer.getXRot());
|
||||
serverPlayNetworkHandler.teleport(serverPlayer.getX(), serverPlayer.getY(), serverPlayer.getZ(), serverPlayer.getYRot(), serverPlayer.getXRot());
|
||||
this.players.add(serverPlayer);
|
||||
this.playersByUUID.put(serverPlayer.getUUID(), serverPlayer);
|
||||
this.broadcastAll(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER,
|
||||
new ServerPlayer[]{serverPlayer}));
|
||||
|
||||
this.broadcastAll(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, new ServerPlayer[]{serverPlayer}));
|
||||
|
||||
for (ServerPlayer player : this.players) {
|
||||
serverPlayer.connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER,
|
||||
new ServerPlayer[]{(ServerPlayer) player}));
|
||||
serverPlayer.connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, new ServerPlayer[]{(ServerPlayer) player}));
|
||||
}
|
||||
|
||||
|
||||
serverLevel3.addNewPlayer(serverPlayer);
|
||||
this.server.getCustomBossEvents().onPlayerConnect(serverPlayer);
|
||||
this.sendLevelInfo(serverPlayer, serverLevel3);
|
||||
if (!this.server.getResourcePack().isEmpty()) {
|
||||
serverPlayer.sendTexturePack(this.server.getResourcePack(), this.server.getResourcePackHash(),
|
||||
this.server.isResourcePackRequired(), this.server.getResourcePackPrompt());
|
||||
serverPlayer.sendTexturePack(this.server.getResourcePack(), this.server.getResourcePackHash(), this.server.isResourcePackRequired(), this.server.getResourcePackPrompt());
|
||||
}
|
||||
|
||||
|
||||
for (MobEffectInstance statusEffectInstance : serverPlayer.getActiveEffects()) {
|
||||
serverPlayNetworkHandler
|
||||
.send(new ClientboundUpdateMobEffectPacket(serverPlayer.getId(), statusEffectInstance));
|
||||
serverPlayNetworkHandler.send(new ClientboundUpdateMobEffectPacket(serverPlayer.getId(), statusEffectInstance));
|
||||
}
|
||||
|
||||
|
||||
if (compoundTag != null && compoundTag.contains("RootVehicle", 10)) {
|
||||
CompoundTag compoundTag2 = compoundTag.getCompound("RootVehicle");
|
||||
Entity entity = EntityType.loadEntityRecursive(compoundTag2.getCompound("Entity"), serverLevel3,
|
||||
(vehicle) -> {
|
||||
return !serverLevel3.addWithUUID(vehicle) ? null : vehicle;
|
||||
});
|
||||
Entity entity = EntityType.loadEntityRecursive(compoundTag2.getCompound("Entity"), serverLevel3, (vehicle) -> {
|
||||
return !serverLevel3.addWithUUID(vehicle) ? null : vehicle;
|
||||
});
|
||||
if (entity != null) {
|
||||
UUID uUID2;
|
||||
if (compoundTag2.hasUUID("Attach")) {
|
||||
|
@ -200,7 +182,7 @@ public class PlayerListMixin {
|
|||
else {
|
||||
uUID2 = null;
|
||||
}
|
||||
|
||||
|
||||
Iterator<?> var21;
|
||||
Entity entity3;
|
||||
if (entity.getUUID().equals(uUID2)) {
|
||||
|
@ -208,7 +190,7 @@ public class PlayerListMixin {
|
|||
}
|
||||
else {
|
||||
var21 = entity.getIndirectPassengers().iterator();
|
||||
|
||||
|
||||
while (var21.hasNext()) {
|
||||
entity3 = (Entity) var21.next();
|
||||
if (entity3.getUUID().equals(uUID2)) {
|
||||
|
@ -217,12 +199,12 @@ public class PlayerListMixin {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!serverPlayer.isPassenger()) {
|
||||
LOGGER.warn("Couldn't reattach entity to player");
|
||||
entity.discard();
|
||||
var21 = entity.getIndirectPassengers().iterator();
|
||||
|
||||
|
||||
while (var21.hasNext()) {
|
||||
entity3 = (Entity) var21.next();
|
||||
entity3.discard();
|
||||
|
@ -230,51 +212,51 @@ public class PlayerListMixin {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
serverPlayer.initInventoryMenu();
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
public CompoundTag load(ServerPlayer player) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// @Shadow
|
||||
// private void updatePlayerGameMode(ServerPlayer player, @Nullable ServerPlayer oldPlayer, ServerLevel world) {}
|
||||
|
||||
|
||||
@Shadow
|
||||
public void sendPlayerPermissionLevel(ServerPlayer player) {
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
public int getPlayerCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
public int getMaxPlayers() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
public MinecraftServer getServer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
protected void updateEntireScoreboard(ServerScoreboard scoreboard, ServerPlayer player) {
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
public void broadcastMessage(Component message, ChatType type, UUID senderUuid) {
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
public void broadcastAll(Packet<?> packet) {
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
public void sendLevelInfo(ServerPlayer player, ServerLevel world) {
|
||||
}
|
||||
|
|
|
@ -28,13 +28,13 @@ import java.util.Optional;
|
|||
|
||||
@Mixin(Player.class)
|
||||
public abstract class PlayerMixin extends LivingEntity {
|
||||
|
||||
|
||||
protected PlayerMixin(EntityType<? extends LivingEntity> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
}
|
||||
|
||||
|
||||
private static Direction[] horizontal;
|
||||
|
||||
|
||||
@Inject(method = "findRespawnPositionAndUseSpawnBlock", at = @At(value = "HEAD"), cancellable = true)
|
||||
private static void be_findRespawnPositionAndUseSpawnBlock(ServerLevel world, BlockPos pos, float f, boolean bl, boolean bl2, CallbackInfoReturnable<Optional<Vec3>> info) {
|
||||
BlockState blockState = world.getBlockState(pos);
|
||||
|
@ -43,7 +43,7 @@ public abstract class PlayerMixin extends LivingEntity {
|
|||
info.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "tryToStartFallFlying", at = @At("HEAD"), cancellable = true)
|
||||
public void be_tryToStartFlying(CallbackInfoReturnable<Boolean> info) {
|
||||
if (!onGround && !isFallFlying() && !isInWater() && !hasEffect(MobEffects.LEVITATION)) {
|
||||
|
@ -54,7 +54,7 @@ public abstract class PlayerMixin extends LivingEntity {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static Optional<Vec3> be_obeliskRespawnPosition(ServerLevel world, BlockPos pos, BlockState state) {
|
||||
if (state.getValue(BlockProperties.TRIPLE_SHAPE) == TripleShape.TOP) {
|
||||
pos = pos.below(2);
|
||||
|
|
|
@ -35,22 +35,22 @@ import java.util.function.Supplier;
|
|||
@Mixin(ServerLevel.class)
|
||||
public abstract class ServerLevelMixin extends Level {
|
||||
private static String be_lastWorld = null;
|
||||
|
||||
|
||||
protected ServerLevelMixin(WritableLevelData writableLevelData, ResourceKey<Level> resourceKey, DimensionType dimensionType, Supplier<ProfilerFiller> supplier, boolean bl, boolean bl2, long l) {
|
||||
super(writableLevelData, resourceKey, dimensionType, supplier, bl, bl2, l);
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "<init>*", at = @At("TAIL"))
|
||||
private void be_onServerWorldInit(MinecraftServer server, Executor workerExecutor, LevelStorageSource.LevelStorageAccess session, ServerLevelData properties, ResourceKey<Level> registryKey, DimensionType dimensionType, ChunkProgressListener worldGenerationProgressListener, ChunkGenerator chunkGenerator, boolean debugWorld, long l, List<CustomSpawner> list, boolean bl, CallbackInfo info) {
|
||||
if (be_lastWorld != null && be_lastWorld.equals(session.getLevelId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
be_lastWorld = session.getLevelId();
|
||||
ServerLevel world = ServerLevel.class.cast(this);
|
||||
EndBiomes.onWorldLoad(world.getSeed());
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "getSharedSpawnPos", at = @At("HEAD"), cancellable = true)
|
||||
private void be_getSharedSpawnPos(CallbackInfoReturnable<BlockPos> info) {
|
||||
if (GeneratorOptions.changeSpawn()) {
|
||||
|
@ -60,14 +60,8 @@ public abstract class ServerLevelMixin extends Level {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ModifyArg(
|
||||
method = "tickChunk",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/level/ServerLevel;setBlockAndUpdate(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)Z"
|
||||
)
|
||||
)
|
||||
|
||||
@ModifyArg(method = "tickChunk", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerLevel;setBlockAndUpdate(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)Z"))
|
||||
private BlockState be_modifyTickState(BlockPos pos, BlockState state) {
|
||||
if (state.is(Blocks.ICE)) {
|
||||
ResourceLocation biome = BiomeAPI.getBiomeID(getBiome(pos));
|
||||
|
|
|
@ -49,28 +49,28 @@ public abstract class ServerPlayerMixin extends Player implements TeleportingEnt
|
|||
private int lastSentFood;
|
||||
@Shadow
|
||||
private int lastSentExp;
|
||||
|
||||
|
||||
private BlockPos exitPos;
|
||||
private int be_teleportDelay = 0;
|
||||
|
||||
|
||||
public ServerPlayerMixin(Level world, BlockPos pos, float yaw, GameProfile profile) {
|
||||
super(world, pos, yaw, profile);
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "createEndPlatform", at = @At("HEAD"), cancellable = true)
|
||||
private void be_createEndSpawnPlatform(ServerLevel world, BlockPos centerPos, CallbackInfo info) {
|
||||
if (!GeneratorOptions.generateObsidianPlatform()) {
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "findDimensionEntryPoint", at = @At("HEAD"), cancellable = true)
|
||||
protected void be_getTeleportTarget(ServerLevel destination, CallbackInfoReturnable<PortalInfo> info) {
|
||||
if (be_canTeleport()) {
|
||||
info.setReturnValue(new PortalInfo(new Vec3(exitPos.getX() + 0.5, exitPos.getY(), exitPos.getZ() + 0.5), getDeltaMovement(), getYRot(), getXRot()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "changeDimension", at = @At("HEAD"), cancellable = true)
|
||||
public void be_changeDimension(ServerLevel destination, CallbackInfoReturnable<Entity> info) {
|
||||
if (be_canTeleport() && level instanceof ServerLevel) {
|
||||
|
@ -78,8 +78,7 @@ public abstract class ServerPlayerMixin extends Player implements TeleportingEnt
|
|||
ServerLevel serverWorld = getLevel();
|
||||
LevelData worldProperties = destination.getLevelData();
|
||||
ServerPlayer player = ServerPlayer.class.cast(this);
|
||||
connection.send(new ClientboundRespawnPacket(destination.dimensionType(), destination.dimension(), BiomeManager.obfuscateSeed(destination.getSeed()),
|
||||
gameMode.getGameModeForPlayer(), gameMode.getPreviousGameModeForPlayer(), destination.isDebug(), destination.isFlat(), true));
|
||||
connection.send(new ClientboundRespawnPacket(destination.dimensionType(), destination.dimension(), BiomeManager.obfuscateSeed(destination.getSeed()), gameMode.getGameModeForPlayer(), gameMode.getPreviousGameModeForPlayer(), destination.isDebug(), destination.isFlat(), true));
|
||||
connection.send(new ClientboundChangeDifficultyPacket(worldProperties.getDifficulty(), worldProperties.isDifficultyLocked()));
|
||||
PlayerList playerManager = server.getPlayerList();
|
||||
playerManager.sendPlayerPermissionLevel(player);
|
||||
|
@ -100,11 +99,11 @@ public abstract class ServerPlayerMixin extends Player implements TeleportingEnt
|
|||
connection.send(new ClientboundPlayerAbilitiesPacket(getAbilities()));
|
||||
playerManager.sendLevelInfo(player, destination);
|
||||
playerManager.sendAllPlayerInfo(player);
|
||||
|
||||
|
||||
for (MobEffectInstance statusEffectInstance : getActiveEffects()) {
|
||||
connection.send(new ClientboundUpdateMobEffectPacket(getId(), statusEffectInstance));
|
||||
}
|
||||
|
||||
|
||||
connection.send(new ClientboundLevelEventPacket(1032, BlockPos.ZERO, 0, false));
|
||||
lastSentExp = -1;
|
||||
lastSentHealth = -1.0F;
|
||||
|
@ -115,12 +114,12 @@ public abstract class ServerPlayerMixin extends Player implements TeleportingEnt
|
|||
info.setReturnValue(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "tick", at = @At("TAIL"))
|
||||
public void be_decreaseCooldawn(CallbackInfo info) {
|
||||
if (be_teleportDelay > 0) be_teleportDelay--;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getDimensionChangingDelay() {
|
||||
if (be_teleportDelay > 0) {
|
||||
|
@ -128,27 +127,27 @@ public abstract class ServerPlayerMixin extends Player implements TeleportingEnt
|
|||
}
|
||||
return super.getDimensionChangingDelay();
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
public abstract ServerLevel getLevel();
|
||||
|
||||
|
||||
@Shadow
|
||||
abstract void triggerDimensionChangeTriggers(ServerLevel origin);
|
||||
|
||||
|
||||
@Shadow
|
||||
@Override
|
||||
protected abstract PortalInfo findDimensionEntryPoint(ServerLevel destination);
|
||||
|
||||
|
||||
@Override
|
||||
public void be_setExitPos(BlockPos pos) {
|
||||
this.exitPos = pos.immutable();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void be_resetExitPos() {
|
||||
this.exitPos = null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean be_canTeleport() {
|
||||
return this.exitPos != null;
|
||||
|
|
|
@ -13,14 +13,14 @@ public abstract class ShuffelingListMixin<U> implements ShuffelingListExtended<U
|
|||
@Shadow
|
||||
@Final
|
||||
protected List<ShufflingList.WeightedEntry<U>> entries;
|
||||
|
||||
|
||||
public boolean isEmpty() {
|
||||
return this.entries.isEmpty();
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
public abstract ShufflingList<U> shuffle();
|
||||
|
||||
|
||||
public U getOne() {
|
||||
return this.shuffle().stream().findFirst().orElseThrow(RuntimeException::new);
|
||||
}
|
||||
|
|
|
@ -13,16 +13,16 @@ public abstract class SlimeMixin extends Entity implements ISlime {
|
|||
public SlimeMixin(EntityType<? extends Slime> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
protected void setSize(int size, boolean heal) {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void be_setSlimeSize(int size, boolean heal) {
|
||||
setSize(size, heal);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void entityRemove(Entity.RemovalReason removalReason) {
|
||||
super.remove(removalReason);
|
||||
|
|
|
@ -38,14 +38,14 @@ public class SpikeFeatureMixin {
|
|||
info.setReturnValue(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "placeSpike", at = @At("HEAD"), cancellable = true)
|
||||
private void be_placeSpike(ServerLevelAccessor world, Random random, SpikeConfiguration config, SpikeFeature.EndSpike spike, CallbackInfo info) {
|
||||
int x = spike.getCenterX();
|
||||
int z = spike.getCenterZ();
|
||||
int radius = spike.getRadius();
|
||||
int minY = 0;
|
||||
|
||||
|
||||
long lx = (long) x;
|
||||
long lz = (long) z;
|
||||
if (lx * lx + lz * lz < 10000) {
|
||||
|
@ -61,10 +61,10 @@ public class SpikeFeatureMixin {
|
|||
else {
|
||||
minY = world.getChunk(x >> 4, z >> 4).getHeight(Types.WORLD_SURFACE, x & 15, z);
|
||||
}
|
||||
|
||||
|
||||
GeneratorOptions.setDirectSpikeHeight();
|
||||
int maxY = minY + spike.getHeight() - 64;
|
||||
|
||||
|
||||
if (GeneratorOptions.replacePillars() && be_radiusInRange(radius)) {
|
||||
radius--;
|
||||
StructureTemplate base = StructureHelper.readStructure(BetterEnd.makeID("pillars/pillar_base_" + radius));
|
||||
|
@ -75,11 +75,11 @@ public class SpikeFeatureMixin {
|
|||
side = top.getSize();
|
||||
BlockPos pos2 = new BlockPos(x - (side.getX() >> 1), maxY, z - (side.getZ() >> 1));
|
||||
maxY = pos2.getY();
|
||||
|
||||
|
||||
StructurePlaceSettings data = new StructurePlaceSettings();
|
||||
base.placeInWorld(world, pos1, pos1, data, random, 2);
|
||||
top.placeInWorld(world, pos2, pos2, data, random, 2);
|
||||
|
||||
|
||||
int r2 = radius * radius + 1;
|
||||
MutableBlockPos mut = new MutableBlockPos();
|
||||
for (int px = -radius; px <= radius; px++) {
|
||||
|
@ -128,13 +128,13 @@ public class SpikeFeatureMixin {
|
|||
mut.setZ(z);
|
||||
mut.setY(maxY);
|
||||
BlocksHelper.setWithoutUpdate(world, mut, Blocks.BEDROCK);
|
||||
|
||||
|
||||
EndCrystal crystal = EntityType.END_CRYSTAL.create(world.getLevel());
|
||||
crystal.setBeamTarget(config.getCrystalBeamTarget());
|
||||
crystal.setInvulnerable(config.isCrystalInvulnerable());
|
||||
crystal.moveTo(x + 0.5D, maxY + 1, z + 0.5D, random.nextFloat() * 360.0F, 0.0F);
|
||||
world.addFreshEntity(crystal);
|
||||
|
||||
|
||||
if (spike.isGuarded()) {
|
||||
for (int px = -2; px <= 2; ++px) {
|
||||
boolean bl = Mth.abs(px) == 2;
|
||||
|
@ -153,10 +153,10 @@ public class SpikeFeatureMixin {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
info.cancel();
|
||||
}
|
||||
|
||||
|
||||
private boolean be_radiusInRange(int radius) {
|
||||
return radius > 1 && radius < 6;
|
||||
}
|
||||
|
|
|
@ -17,19 +17,19 @@ import java.util.List;
|
|||
@Mixin(value = WeightedBiomePicker.class, remap = false)
|
||||
public class WeightedBiomePickerMixin implements IBiomeList {
|
||||
private final List<ResourceKey<Biome>> biomes = Lists.newArrayList();
|
||||
|
||||
|
||||
@Inject(method = "addBiome", at = @At("TAIL"))
|
||||
private void be_addBiome(final ResourceKey<Biome> biome, final double weight, CallbackInfo info) {
|
||||
if (be_isCorrectPicker(WeightedBiomePicker.class.cast(this))) {
|
||||
biomes.add(biome);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ResourceKey<Biome>> getBiomes() {
|
||||
return biomes;
|
||||
}
|
||||
|
||||
|
||||
private boolean be_isCorrectPicker(WeightedBiomePicker picker) {
|
||||
return picker == InternalBiomeData.getEndBiomesMap().get(Biomes.SMALL_END_ISLANDS) || picker == InternalBiomeData.getEndBarrensMap().get(Biomes.END_BARRENS);
|
||||
}
|
||||
|
|
|
@ -1,25 +1,21 @@
|
|||
package ru.betterend.mixin.common;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.SectionPos;
|
||||
import net.minecraft.server.level.WorldGenRegion;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.levelgen.feature.SpikeFeature;
|
||||
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;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import ru.bclib.util.MHelper;
|
||||
|
||||
@Mixin(WorldGenRegion.class)
|
||||
public class WorldGenRegionMixin {
|
||||
@Final
|
||||
@Shadow
|
||||
private ChunkPos center;
|
||||
|
||||
|
||||
@Inject(method = "ensureCanWrite", at = @At("HEAD"), cancellable = true)
|
||||
private void be_alterBlockCheck(BlockPos blockPos, CallbackInfoReturnable<Boolean> info) {
|
||||
int x = blockPos.getX() >> 4;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue