Fixed mixins conflicts and recipes console spam
This commit is contained in:
parent
d45c37c370
commit
89e327240d
32 changed files with 84 additions and 85 deletions
|
@ -0,0 +1,3 @@
|
|||
package ru.betterend.interfaces;
|
||||
|
||||
public interface BetterEndRecipe {}
|
|
@ -41,7 +41,7 @@ public class AnvilScreenMixin extends ForgingScreen<AnvilScreenHandler> {
|
|||
}
|
||||
|
||||
@Inject(method = "setup", at = @At("TAIL"))
|
||||
protected void setup(CallbackInfo info) {
|
||||
protected void be_setup(CallbackInfo info) {
|
||||
this.be_buttons.clear();
|
||||
int x = (width - backgroundWidth) / 2;
|
||||
int y = (height - backgroundHeight) / 2;
|
||||
|
@ -51,14 +51,14 @@ public class AnvilScreenMixin extends ForgingScreen<AnvilScreenHandler> {
|
|||
}
|
||||
|
||||
@Inject(method = "renderForeground", at = @At("TAIL"))
|
||||
protected void renderForeground(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo info) {
|
||||
protected void be_renderForeground(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo info) {
|
||||
if (anvilHandler.be_getRecipes().size() > 1) {
|
||||
this.be_buttons.forEach(button -> button.render(matrices, mouseX, mouseY, delta));
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "onSlotUpdate", at = @At("HEAD"), cancellable = true)
|
||||
public void onSlotUpdate(ScreenHandler handler, int slotId, ItemStack stack, CallbackInfo info) {
|
||||
public void be_onSlotUpdate(ScreenHandler handler, int slotId, ItemStack stack, CallbackInfo info) {
|
||||
AnvilScreenHandlerExtended anvilHandler = AnvilScreenHandlerExtended.class.cast(handler);
|
||||
if (anvilHandler.be_getCurrentRecipe() != null) {
|
||||
this.nameField.setText("");
|
||||
|
|
|
@ -42,7 +42,7 @@ public class BackgroundRendererMixin {
|
|||
private static float blue;
|
||||
|
||||
@Inject(method = "render", at = @At("RETURN"))
|
||||
private static void onRender(Camera camera, float tickDelta, ClientWorld world, int i, float f, CallbackInfo info) {
|
||||
private static void be_onRender(Camera camera, float tickDelta, ClientWorld world, int i, float f, CallbackInfo info) {
|
||||
long l = Util.getMeasuringTimeMs() - time;
|
||||
time += l;
|
||||
lerp += l * 0.001F;
|
||||
|
@ -69,7 +69,7 @@ public class BackgroundRendererMixin {
|
|||
}
|
||||
|
||||
@Inject(method = "applyFog", at = @At("HEAD"), cancellable = true)
|
||||
private static void fogDensity(Camera camera, BackgroundRenderer.FogType fogType, float viewDistance, boolean thickFog, CallbackInfo info) {
|
||||
private static void be_fogDensity(Camera camera, BackgroundRenderer.FogType fogType, float viewDistance, boolean thickFog, CallbackInfo info) {
|
||||
Entity entity = camera.getFocusedEntity();
|
||||
Biome biome = entity.world.getBiome(entity.getBlockPos());
|
||||
FluidState fluidState = camera.getSubmergedFluidState();
|
||||
|
|
|
@ -20,7 +20,7 @@ public class BiomeColorsMixin {
|
|||
private static final int STREAM_COLOR = MHelper.color(105, 213, 244);
|
||||
|
||||
@Inject(method = "getWaterColor", at = @At("RETURN"), cancellable = true)
|
||||
private static void beGetWaterColor(BlockRenderView world, BlockPos pos, CallbackInfoReturnable<Integer> info) {
|
||||
private static void be_getWaterColor(BlockRenderView world, BlockPos pos, CallbackInfoReturnable<Integer> info) {
|
||||
int color = info.getReturnValue();
|
||||
|
||||
boolean scanDeep = true;
|
||||
|
|
|
@ -29,7 +29,7 @@ public class ClientPlayNetworkHandlerMixin
|
|||
private ClientWorld world;
|
||||
|
||||
@Inject(method = "onSignEditorOpen", at = @At(value = "HEAD"), cancellable = true)
|
||||
public void openSignEditor(SignEditorOpenS2CPacket packet, CallbackInfo info) {
|
||||
public void be_openSignEditor(SignEditorOpenS2CPacket packet, CallbackInfo info) {
|
||||
NetworkThreadUtils.forceMainThread(packet, (ClientPlayNetworkHandler) (Object) this,
|
||||
(ThreadExecutor<?>) client);
|
||||
BlockEntity blockEntity = this.world.getBlockEntity(packet.getPos());
|
||||
|
@ -41,7 +41,7 @@ public class ClientPlayNetworkHandlerMixin
|
|||
}
|
||||
|
||||
@Inject(method = "onBlockEntityUpdate", at = @At(value = "HEAD"), cancellable = true)
|
||||
public void onEntityUpdate(BlockEntityUpdateS2CPacket packet, CallbackInfo info) {
|
||||
public void be_onEntityUpdate(BlockEntityUpdateS2CPacket packet, CallbackInfo info) {
|
||||
NetworkThreadUtils.forceMainThread(packet, (ClientPlayNetworkHandler) (Object) this,
|
||||
(ThreadExecutor<?>) client);
|
||||
BlockPos blockPos = packet.getPos();
|
||||
|
|
|
@ -8,15 +8,17 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
import net.minecraft.client.recipebook.ClientRecipeBook;
|
||||
import net.minecraft.client.recipebook.RecipeBookGroup;
|
||||
import net.minecraft.recipe.Recipe;
|
||||
import ru.betterend.interfaces.BetterEndRecipe;
|
||||
import ru.betterend.recipe.builders.AlloyingRecipe;
|
||||
|
||||
@Mixin(ClientRecipeBook.class)
|
||||
public abstract class ClientRecipeBookMixin {
|
||||
@Inject(method = "getGroupForRecipe", at = @At("HEAD"), cancellable = true)
|
||||
private static void getGroupForRecipe(Recipe<?> recipe, CallbackInfoReturnable<RecipeBookGroup> cinfo) {
|
||||
private static void be_getGroupForRecipe(Recipe<?> recipe, CallbackInfoReturnable<RecipeBookGroup> cinfo) {
|
||||
if (recipe instanceof AlloyingRecipe) {
|
||||
cinfo.setReturnValue(RecipeBookGroup.BLAST_FURNACE_MISC);
|
||||
cinfo.cancel();
|
||||
} else if (recipe instanceof BetterEndRecipe) {
|
||||
cinfo.setReturnValue(RecipeBookGroup.UNKNOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public abstract class EnchantingTableBlockMixin extends Block {
|
|||
}
|
||||
|
||||
@Inject(method = "randomDisplayTick", at = @At(value = "TAIL"))
|
||||
private void beOnRandomDisplayTick(BlockState state, World world, BlockPos pos, Random random, CallbackInfo info) {
|
||||
private void be_onRandomDisplayTick(BlockState state, World world, BlockPos pos, Random random, CallbackInfo info) {
|
||||
for (int px = -2; px <= 2; ++px) {
|
||||
for (int pz = -2; pz <= 2; ++pz) {
|
||||
if (px > -2 && px < 2 && pz == -1) {
|
||||
|
|
|
@ -48,7 +48,7 @@ public class MinecraftClientMixin {
|
|||
private ItemColors itemColors;
|
||||
|
||||
@Inject(method = "<init>*", at = @At("TAIL"))
|
||||
private void onInit(RunArgs args, CallbackInfo info) {
|
||||
private void be_onInit(RunArgs args, CallbackInfo info) {
|
||||
Registry.BLOCK.forEach(block -> {
|
||||
if (block instanceof IColorProvider) {
|
||||
IColorProvider provider = (IColorProvider) block;
|
||||
|
@ -59,7 +59,7 @@ public class MinecraftClientMixin {
|
|||
}
|
||||
|
||||
@Inject(method = "getMusicType", at = @At("HEAD"), cancellable = true)
|
||||
private void getEndMusic(CallbackInfoReturnable<MusicSound> info) {
|
||||
private void be_getEndMusic(CallbackInfoReturnable<MusicSound> info) {
|
||||
if (!(this.currentScreen instanceof CreditsScreen) && this.player != null) {
|
||||
if (this.player.world.getRegistryKey() == World.END) {
|
||||
if (this.inGameHud.getBossBarHud().shouldPlayDragonMusic() && MHelper.lengthSqr(this.player.getX(), this.player.getZ()) < 250000) {
|
||||
|
|
|
@ -32,7 +32,7 @@ public class ModelLoaderMixin {
|
|||
private ResourceManager resourceManager;
|
||||
|
||||
@Inject(method = "loadModelFromJson", at = @At("HEAD"), cancellable = true)
|
||||
private void loadModelPattern(Identifier id, CallbackInfoReturnable<JsonUnbakedModel> info) {
|
||||
private void be_loadModelPattern(Identifier id, CallbackInfoReturnable<JsonUnbakedModel> info) {
|
||||
if (id.getNamespace().equals(BetterEnd.MOD_ID)) {
|
||||
Identifier modelId = new Identifier(id.getNamespace(), "models/" + id.getPath() + ".json");
|
||||
JsonUnbakedModel model;
|
||||
|
|
|
@ -20,7 +20,7 @@ import ru.betterend.patterns.BlockPatterned;
|
|||
public abstract class ModelVariantMapMixin {
|
||||
|
||||
@Inject(method = "deserialize", at = @At("HEAD"), cancellable = true)
|
||||
private static void deserializeBlockState(ModelVariantMap.DeserializationContext context, Reader reader, CallbackInfoReturnable<ModelVariantMap> info) {
|
||||
private static void be_deserializeBlockState(ModelVariantMap.DeserializationContext context, Reader reader, CallbackInfoReturnable<ModelVariantMap> info) {
|
||||
Block block = context.getStateFactory().getDefaultState().getBlock();
|
||||
if (block instanceof BlockPatterned) {
|
||||
String pattern = ((BlockPatterned) block).getStatesPattern(reader);
|
||||
|
|
|
@ -39,7 +39,7 @@ public class MusicTrackerMixin {
|
|||
private static long time;
|
||||
|
||||
@Inject(method = "tick", at = @At("HEAD"), cancellable = true)
|
||||
public void beOnTick(CallbackInfo info) {
|
||||
public void be_onTick(CallbackInfo info) {
|
||||
if (ClientOptions.blendBiomeMusic()) {
|
||||
MusicSound musicSound = client.getMusicType();
|
||||
if (volume > 0 && beIsInEnd() && beShouldChangeSound(musicSound)) {
|
||||
|
|
|
@ -30,7 +30,7 @@ public abstract class NamespaceResourceManagerMixin {
|
|||
value = "NEW",
|
||||
target = "java/io/FileNotFoundException",
|
||||
shift = Shift.BEFORE))
|
||||
public void getStatesPattern(Identifier id, CallbackInfoReturnable<List<Resource>> info) {
|
||||
public void be_getStatesPattern(Identifier id, CallbackInfoReturnable<List<Resource>> info) {
|
||||
if (id.getNamespace().equals(BetterEnd.MOD_ID)) {
|
||||
String[] data = id.getPath().split("/");
|
||||
if (data.length > 1) {
|
||||
|
|
|
@ -76,8 +76,8 @@ public class WorldRendererMixin {
|
|||
private int ticks;
|
||||
|
||||
@Inject(method = "<init>*", at = @At("TAIL"))
|
||||
private void onInit(MinecraftClient client, BufferBuilderStorage bufferBuilders, CallbackInfo info) {
|
||||
initStars();
|
||||
private void be_onInit(MinecraftClient client, BufferBuilderStorage bufferBuilders, CallbackInfo info) {
|
||||
be_initStars();
|
||||
Random random = new Random(131);
|
||||
axis1 = new Vector3f(random.nextFloat(), random.nextFloat(), random.nextFloat());
|
||||
axis2 = new Vector3f(random.nextFloat(), random.nextFloat(), random.nextFloat());
|
||||
|
@ -92,7 +92,7 @@ public class WorldRendererMixin {
|
|||
}
|
||||
|
||||
@Inject(method = "renderSky", at = @At("HEAD"), cancellable = true)
|
||||
private void renderBetterEndSky(MatrixStack matrices, float tickDelta, CallbackInfo info) {
|
||||
private void be_renderBetterEndSky(MatrixStack matrices, float tickDelta, CallbackInfo info) {
|
||||
if (ClientOptions.isCustomSky() && client.world.getSkyProperties().getSkyType() == SkyProperties.SkyType.END) {
|
||||
time = (ticks % 360000) * 0.000017453292F;
|
||||
time2 = time * 2;
|
||||
|
@ -121,31 +121,31 @@ public class WorldRendererMixin {
|
|||
matrices.push();
|
||||
matrices.multiply(new Quaternion(0, time, 0, false));
|
||||
textureManager.bindTexture(HORIZON);
|
||||
renderBuffer(matrices, horizon, VertexFormats.POSITION_TEXTURE, 0.77F, 0.31F, 0.73F, 0.7F * blindA);
|
||||
be_renderBuffer(matrices, horizon, VertexFormats.POSITION_TEXTURE, 0.77F, 0.31F, 0.73F, 0.7F * blindA);
|
||||
matrices.pop();
|
||||
|
||||
matrices.push();
|
||||
matrices.multiply(new Quaternion(0, -time, 0, false));
|
||||
textureManager.bindTexture(NEBULA_1);
|
||||
renderBuffer(matrices, nebulas1, VertexFormats.POSITION_TEXTURE, 0.77F, 0.31F, 0.73F, blind02);
|
||||
be_renderBuffer(matrices, nebulas1, VertexFormats.POSITION_TEXTURE, 0.77F, 0.31F, 0.73F, blind02);
|
||||
matrices.pop();
|
||||
|
||||
matrices.push();
|
||||
matrices.multiply(new Quaternion(0, time2, 0, false));
|
||||
textureManager.bindTexture(NEBULA_2);
|
||||
renderBuffer(matrices, nebulas2, VertexFormats.POSITION_TEXTURE, 0.77F, 0.31F, 0.73F, blind02);
|
||||
be_renderBuffer(matrices, nebulas2, VertexFormats.POSITION_TEXTURE, 0.77F, 0.31F, 0.73F, blind02);
|
||||
matrices.pop();
|
||||
|
||||
textureManager.bindTexture(STARS);
|
||||
|
||||
matrices.push();
|
||||
matrices.multiply(axis3.getRadialQuaternion(time));
|
||||
renderBuffer(matrices, stars3, VertexFormats.POSITION_TEXTURE, 0.77F, 0.31F, 0.73F, blind06);
|
||||
be_renderBuffer(matrices, stars3, VertexFormats.POSITION_TEXTURE, 0.77F, 0.31F, 0.73F, blind06);
|
||||
matrices.pop();
|
||||
|
||||
matrices.push();
|
||||
matrices.multiply(axis4.getRadialQuaternion(time2));
|
||||
renderBuffer(matrices, stars4, VertexFormats.POSITION_TEXTURE, 1F, 1F, 1F, blind06);
|
||||
be_renderBuffer(matrices, stars4, VertexFormats.POSITION_TEXTURE, 1F, 1F, 1F, blind06);
|
||||
matrices.pop();
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ public class WorldRendererMixin {
|
|||
if (a > 0) {
|
||||
if (a > 1) a = 1;
|
||||
textureManager.bindTexture(FOG);
|
||||
renderBuffer(matrices, fog, VertexFormats.POSITION_TEXTURE, BackgroundInfo.red, BackgroundInfo.green, BackgroundInfo.blue, a);
|
||||
be_renderBuffer(matrices, fog, VertexFormats.POSITION_TEXTURE, BackgroundInfo.red, BackgroundInfo.green, BackgroundInfo.blue, a);
|
||||
}
|
||||
|
||||
RenderSystem.disableTexture();
|
||||
|
@ -161,12 +161,12 @@ public class WorldRendererMixin {
|
|||
if (blindA > 0) {
|
||||
matrices.push();
|
||||
matrices.multiply(axis1.getRadialQuaternion(time3));
|
||||
renderBuffer(matrices, stars1, VertexFormats.POSITION, 1, 1, 1, blind06);
|
||||
be_renderBuffer(matrices, stars1, VertexFormats.POSITION, 1, 1, 1, blind06);
|
||||
matrices.pop();
|
||||
|
||||
matrices.push();
|
||||
matrices.multiply(axis2.getRadialQuaternion(time2));
|
||||
renderBuffer(matrices, stars2, VertexFormats.POSITION, 0.95F, 0.64F, 0.93F, blind06);
|
||||
be_renderBuffer(matrices, stars2, VertexFormats.POSITION, 0.95F, 0.64F, 0.93F, blind06);
|
||||
matrices.pop();
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ public class WorldRendererMixin {
|
|||
}
|
||||
}
|
||||
|
||||
private void renderBuffer(MatrixStack matrices, VertexBuffer buffer, VertexFormat format, float r, float g, float b, float a) {
|
||||
private void be_renderBuffer(MatrixStack matrices, VertexBuffer buffer, VertexFormat format, float r, float g, float b, float a) {
|
||||
RenderSystem.color4f(r, g, b, a);
|
||||
buffer.bind();
|
||||
format.startDrawing(0L);
|
||||
|
@ -186,84 +186,84 @@ public class WorldRendererMixin {
|
|||
format.endDrawing();
|
||||
}
|
||||
|
||||
private void initStars() {
|
||||
private void be_initStars() {
|
||||
BufferBuilder buffer = Tessellator.getInstance().getBuffer();
|
||||
stars1 = buildBufferStars(buffer, stars1, 0.1, 0.30, 3500, 41315);
|
||||
stars2 = buildBufferStars(buffer, stars2, 0.1, 0.35, 2000, 35151);
|
||||
stars3 = buildBufferUVStars(buffer, stars3, 0.4, 1.2, 1000, 61354);
|
||||
stars4 = buildBufferUVStars(buffer, stars4, 0.4, 1.2, 1000, 61355);
|
||||
nebulas1 = buildBufferFarFog(buffer, nebulas1, 40, 60, 30, 11515);
|
||||
nebulas2 = buildBufferFarFog(buffer, nebulas2, 40, 60, 10, 14151);
|
||||
horizon = buildBufferHorizon(buffer, horizon);
|
||||
fog = buildBufferFog(buffer, fog);
|
||||
stars1 = be_buildBufferStars(buffer, stars1, 0.1, 0.30, 3500, 41315);
|
||||
stars2 = be_buildBufferStars(buffer, stars2, 0.1, 0.35, 2000, 35151);
|
||||
stars3 = be_buildBufferUVStars(buffer, stars3, 0.4, 1.2, 1000, 61354);
|
||||
stars4 = be_buildBufferUVStars(buffer, stars4, 0.4, 1.2, 1000, 61355);
|
||||
nebulas1 = be_buildBufferFarFog(buffer, nebulas1, 40, 60, 30, 11515);
|
||||
nebulas2 = be_buildBufferFarFog(buffer, nebulas2, 40, 60, 10, 14151);
|
||||
horizon = be_buildBufferHorizon(buffer, horizon);
|
||||
fog = be_buildBufferFog(buffer, fog);
|
||||
}
|
||||
|
||||
private VertexBuffer buildBufferStars(BufferBuilder bufferBuilder, VertexBuffer buffer, double minSize, double maxSize, int count, long seed) {
|
||||
private VertexBuffer be_buildBufferStars(BufferBuilder bufferBuilder, VertexBuffer buffer, double minSize, double maxSize, int count, long seed) {
|
||||
if (buffer != null) {
|
||||
buffer.close();
|
||||
}
|
||||
|
||||
buffer = new VertexBuffer(VertexFormats.POSITION);
|
||||
makeStars(bufferBuilder, minSize, maxSize, count, seed);
|
||||
be_makeStars(bufferBuilder, minSize, maxSize, count, seed);
|
||||
bufferBuilder.end();
|
||||
buffer.upload(bufferBuilder);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
private VertexBuffer buildBufferUVStars(BufferBuilder bufferBuilder, VertexBuffer buffer, double minSize, double maxSize, int count, long seed) {
|
||||
private VertexBuffer be_buildBufferUVStars(BufferBuilder bufferBuilder, VertexBuffer buffer, double minSize, double maxSize, int count, long seed) {
|
||||
if (buffer != null) {
|
||||
buffer.close();
|
||||
}
|
||||
|
||||
buffer = new VertexBuffer(VertexFormats.POSITION_TEXTURE);
|
||||
makeUVStars(bufferBuilder, minSize, maxSize, count, seed);
|
||||
be_makeUVStars(bufferBuilder, minSize, maxSize, count, seed);
|
||||
bufferBuilder.end();
|
||||
buffer.upload(bufferBuilder);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
private VertexBuffer buildBufferFarFog(BufferBuilder bufferBuilder, VertexBuffer buffer, double minSize, double maxSize, int count, long seed) {
|
||||
private VertexBuffer be_buildBufferFarFog(BufferBuilder bufferBuilder, VertexBuffer buffer, double minSize, double maxSize, int count, long seed) {
|
||||
if (buffer != null) {
|
||||
buffer.close();
|
||||
}
|
||||
|
||||
buffer = new VertexBuffer(VertexFormats.POSITION_TEXTURE);
|
||||
makeFarFog(bufferBuilder, minSize, maxSize, count, seed);
|
||||
be_makeFarFog(bufferBuilder, minSize, maxSize, count, seed);
|
||||
bufferBuilder.end();
|
||||
buffer.upload(bufferBuilder);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
private VertexBuffer buildBufferHorizon(BufferBuilder bufferBuilder, VertexBuffer buffer) {
|
||||
private VertexBuffer be_buildBufferHorizon(BufferBuilder bufferBuilder, VertexBuffer buffer) {
|
||||
if (buffer != null) {
|
||||
buffer.close();
|
||||
}
|
||||
|
||||
buffer = new VertexBuffer(VertexFormats.POSITION_TEXTURE);
|
||||
makeCylinder(bufferBuilder, 16, 50, 100);
|
||||
be_makeCylinder(bufferBuilder, 16, 50, 100);
|
||||
bufferBuilder.end();
|
||||
buffer.upload(bufferBuilder);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
private VertexBuffer buildBufferFog(BufferBuilder bufferBuilder, VertexBuffer buffer) {
|
||||
private VertexBuffer be_buildBufferFog(BufferBuilder bufferBuilder, VertexBuffer buffer) {
|
||||
if (buffer != null) {
|
||||
buffer.close();
|
||||
}
|
||||
|
||||
buffer = new VertexBuffer(VertexFormats.POSITION_TEXTURE);
|
||||
makeCylinder(bufferBuilder, 16, 50, 70);
|
||||
be_makeCylinder(bufferBuilder, 16, 50, 70);
|
||||
bufferBuilder.end();
|
||||
buffer.upload(bufferBuilder);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
private void makeStars(BufferBuilder buffer, double minSize, double maxSize, int count, long seed) {
|
||||
private void be_makeStars(BufferBuilder buffer, double minSize, double maxSize, int count, long seed) {
|
||||
Random random = new Random(seed);
|
||||
buffer.begin(7, VertexFormats.POSITION);
|
||||
|
||||
|
@ -306,7 +306,7 @@ public class WorldRendererMixin {
|
|||
}
|
||||
}
|
||||
|
||||
private void makeUVStars(BufferBuilder buffer, double minSize, double maxSize, int count, long seed) {
|
||||
private void be_makeUVStars(BufferBuilder buffer, double minSize, double maxSize, int count, long seed) {
|
||||
Random random = new Random(seed);
|
||||
buffer.begin(7, VertexFormats.POSITION_TEXTURE);
|
||||
|
||||
|
@ -354,7 +354,7 @@ public class WorldRendererMixin {
|
|||
}
|
||||
}
|
||||
|
||||
private void makeFarFog(BufferBuilder buffer, double minSize, double maxSize, int count, long seed) {
|
||||
private void be_makeFarFog(BufferBuilder buffer, double minSize, double maxSize, int count, long seed) {
|
||||
Random random = new Random(seed);
|
||||
buffer.begin(7, VertexFormats.POSITION_TEXTURE);
|
||||
|
||||
|
@ -405,7 +405,7 @@ public class WorldRendererMixin {
|
|||
}
|
||||
}
|
||||
|
||||
private void makeCylinder(BufferBuilder buffer, int segments, double height, double radius) {
|
||||
private void be_makeCylinder(BufferBuilder buffer, int segments, double height, double radius) {
|
||||
buffer.begin(7, VertexFormats.POSITION_TEXTURE);
|
||||
for (int i = 0; i < segments; i ++) {
|
||||
double a1 = (double) i * Math.PI * 2.0 / (double) segments;
|
||||
|
|
|
@ -26,7 +26,7 @@ import ru.betterend.util.MHelper;
|
|||
public abstract class AbstractBlockMixin {
|
||||
|
||||
@Inject(method = "getDroppedStacks", at = @At("HEAD"), cancellable = true)
|
||||
public void getDroppedStacks(BlockState state, LootContext.Builder builder, CallbackInfoReturnable<List<ItemStack>> info) {
|
||||
public void be_getDroppedStacks(BlockState state, LootContext.Builder builder, CallbackInfoReturnable<List<ItemStack>> info) {
|
||||
if (state.isOf(Blocks.GLOWSTONE)) {
|
||||
ItemStack tool = builder.get(LootContextParameters.TOOL);
|
||||
if (tool != null && tool.getItem() instanceof EndHammerItem) {
|
||||
|
@ -39,12 +39,10 @@ public abstract class AbstractBlockMixin {
|
|||
min = MathHelper.clamp(min + fortune, min, max);
|
||||
if (min == max) {
|
||||
info.setReturnValue(Lists.newArrayList(new ItemStack(Items.GLOWSTONE_DUST, max)));
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
count = MHelper.randRange(min, max, MHelper.RANDOM);
|
||||
info.setReturnValue(Lists.newArrayList(new ItemStack(Items.GLOWSTONE_DUST, count)));
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public abstract class AnvilScreenHandlerMixin extends ForgingScreenHandler imple
|
|||
public abstract void updateResult();
|
||||
|
||||
@Inject(method = "canTakeOutput", at = @At("HEAD"), cancellable = true)
|
||||
protected void canTakeOutput(PlayerEntity player, boolean present, CallbackInfoReturnable<Boolean> info) {
|
||||
protected void be_canTakeOutput(PlayerEntity player, boolean present, CallbackInfoReturnable<Boolean> info) {
|
||||
if (be_currentRecipe != null) {
|
||||
ItemStack output = this.be_currentRecipe.craft(input, player);
|
||||
if (!output.isEmpty()) {
|
||||
|
@ -50,7 +50,7 @@ public abstract class AnvilScreenHandlerMixin extends ForgingScreenHandler imple
|
|||
}
|
||||
|
||||
@Inject(method = "onTakeOutput", at = @At("HEAD"), cancellable = true)
|
||||
protected void onTakeOutput(PlayerEntity player, ItemStack stack, CallbackInfoReturnable<ItemStack> info) {
|
||||
protected void be_onTakeOutput(PlayerEntity player, ItemStack stack, CallbackInfoReturnable<ItemStack> info) {
|
||||
if (be_currentRecipe != null) {
|
||||
this.input.getStack(0).decrement(1);
|
||||
this.onContentChanged(input);
|
||||
|
@ -74,7 +74,7 @@ public abstract class AnvilScreenHandlerMixin extends ForgingScreenHandler imple
|
|||
}
|
||||
|
||||
@Inject(method = "updateResult", at = @At("HEAD"), cancellable = true)
|
||||
public void updateOutput(CallbackInfo info) {
|
||||
public void be_updateOutput(CallbackInfo info) {
|
||||
RecipeManager recipeManager = this.player.world.getRecipeManager();
|
||||
this.be_recipes = recipeManager.getAllMatches(AnvilRecipe.TYPE, input, player.world);
|
||||
if (be_recipes.size() > 0) {
|
||||
|
@ -85,7 +85,7 @@ public abstract class AnvilScreenHandlerMixin extends ForgingScreenHandler imple
|
|||
}
|
||||
|
||||
@Inject(method = "setNewItemName", at = @At("HEAD"), cancellable = true)
|
||||
public void setNewItemName(String string, CallbackInfo info) {
|
||||
public void be_setNewItemName(String string, CallbackInfo info) {
|
||||
if (be_currentRecipe != null) {
|
||||
info.cancel();
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public class BoneMealItemMixin {
|
|||
private static final Mutable POS = new Mutable();
|
||||
|
||||
@Inject(method = "useOnBlock", at = @At("HEAD"), cancellable = true)
|
||||
private void beOnUse(ItemUsageContext context, CallbackInfoReturnable<ActionResult> info) {
|
||||
private void be_onUse(ItemUsageContext context, CallbackInfoReturnable<ActionResult> info) {
|
||||
World world = context.getWorld();
|
||||
BlockPos blockPos = context.getBlockPos();
|
||||
if (!world.isClient) {
|
||||
|
|
|
@ -23,7 +23,7 @@ import ru.betterend.util.MHelper;
|
|||
@Mixin(ChorusPlantFeature.class)
|
||||
public class ChorusPlantFeatureMixin {
|
||||
@Inject(method = "generate", at = @At("HEAD"), cancellable = true)
|
||||
private void onGenerate(StructureWorldAccess structureWorldAccess, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos, DefaultFeatureConfig defaultFeatureConfig, CallbackInfoReturnable<Boolean> info) {
|
||||
private void be_onGenerate(StructureWorldAccess structureWorldAccess, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos, DefaultFeatureConfig defaultFeatureConfig, CallbackInfoReturnable<Boolean> info) {
|
||||
if (structureWorldAccess.isAir(blockPos) && structureWorldAccess.getBlockState(blockPos.down()).isOf(EndBlocks.CHORUS_NYLIUM)) {
|
||||
ChorusFlowerBlock.generate(structureWorldAccess, blockPos, random, MHelper.randRange(8, 16, random));
|
||||
BlockState bottom = structureWorldAccess.getBlockState(blockPos);
|
||||
|
@ -31,7 +31,6 @@ public class ChorusPlantFeatureMixin {
|
|||
BlocksHelper.setWithoutUpdate(structureWorldAccess, blockPos, bottom.with(BlocksHelper.ROOTS, true).with(ConnectingBlock.DOWN, true));
|
||||
}
|
||||
info.setReturnValue(true);
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public abstract class CraftingScreenHandlerMixin
|
|||
private ScreenHandlerContext context;
|
||||
|
||||
@Inject(method = "canUse", at = @At("HEAD"), cancellable = true)
|
||||
private void canUse(PlayerEntity player, CallbackInfoReturnable<Boolean> info) {
|
||||
private void be_canUse(PlayerEntity player, CallbackInfoReturnable<Boolean> info) {
|
||||
if (context.run((world, pos) -> {
|
||||
return world.getBlockState(pos).getBlock() instanceof CraftingTableBlock;
|
||||
}, true)) {
|
||||
|
|
|
@ -20,7 +20,6 @@ public class EndPortalFeatureMixin {
|
|||
private void bePortalGenerate(StructureWorldAccess structureWorldAccess, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos, DefaultFeatureConfig defaultFeatureConfig, CallbackInfoReturnable<Boolean> info) {
|
||||
if (!GeneratorOptions.hasPortal()) {
|
||||
info.setReturnValue(false);
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ public class EndSpikeFeatureMixin {
|
|||
private void beSpikeGenerate(StructureWorldAccess structureWorldAccess, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos, EndSpikeFeatureConfig endSpikeFeatureConfig, CallbackInfoReturnable<Boolean> info) {
|
||||
if (!GeneratorOptions.hasPillars()) {
|
||||
info.setReturnValue(false);
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,11 +16,10 @@ import ru.betterend.effects.EndStatusEffects;
|
|||
public abstract class EndermanEntityMixin {
|
||||
|
||||
@Inject(method = "isPlayerStaring", at = @At("HEAD"), cancellable = true)
|
||||
private void isPlayerStaring(PlayerEntity player, CallbackInfoReturnable<Boolean> info) {
|
||||
private void be_isPlayerStaring(PlayerEntity player, CallbackInfoReturnable<Boolean> info) {
|
||||
if (player.isCreative() || player.hasStatusEffect(EndStatusEffects.END_VEIL) ||
|
||||
EnchantmentHelper.getLevel(EndEnchantments.END_VEIL, player.getEquippedStack(EquipmentSlot.HEAD)) > 0) {
|
||||
info.setReturnValue(false);
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public abstract class EntityMixin implements TeleportingEntity {
|
|||
protected abstract TeleportTarget getTeleportTarget(ServerWorld destination);
|
||||
|
||||
@Inject(method = "moveToWorld", at = @At("HEAD"), cancellable = true)
|
||||
public void moveToWorld(ServerWorld destination, CallbackInfoReturnable<Entity> info) {
|
||||
public void be_moveToWorld(ServerWorld destination, CallbackInfoReturnable<Entity> info) {
|
||||
if (!removed && beExitPos != null && world instanceof ServerWorld) {
|
||||
this.detach();
|
||||
this.world.getProfiler().push("changeDimension");
|
||||
|
@ -75,21 +75,19 @@ public abstract class EntityMixin implements TeleportingEntity {
|
|||
this.world.getProfiler().pop();
|
||||
this.beExitPos = null;
|
||||
info.setReturnValue(entity);
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getTeleportTarget", at = @At("HEAD"), cancellable = true)
|
||||
protected void getTeleportTarget(ServerWorld destination, CallbackInfoReturnable<TeleportTarget> info) {
|
||||
protected void be_getTeleportTarget(ServerWorld destination, CallbackInfoReturnable<TeleportTarget> info) {
|
||||
if (beExitPos != null) {
|
||||
info.setReturnValue(new TeleportTarget(new Vec3d(beExitPos.getX() + 0.5D, beExitPos.getY(), beExitPos.getZ() + 0.5D), getVelocity(), yaw, pitch));
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "baseTick", at = @At("TAIL"))
|
||||
public void baseTick(CallbackInfo info) {
|
||||
public void be_baseTick(CallbackInfo info) {
|
||||
if (hasCooldown()) {
|
||||
this.beCooldown--;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraft.world.ServerWorldAccess;
|
|||
@Mixin(HostileEntity.class)
|
||||
public class HostileEntityMixin {
|
||||
@Inject(method = "canSpawnInDark", at = @At(value = "RETURN"), cancellable = true)
|
||||
private static void endermenCheck(EntityType<? extends HostileEntity> type, ServerWorldAccess serverWorldAccess, SpawnReason spawnReason, BlockPos pos, Random random, CallbackInfoReturnable<Boolean> info) {
|
||||
private static void be_endermenCheck(EntityType<? extends HostileEntity> type, ServerWorldAccess serverWorldAccess, SpawnReason spawnReason, BlockPos pos, Random random, CallbackInfoReturnable<Boolean> info) {
|
||||
boolean canSpawn = info.getReturnValue();
|
||||
if (canSpawn && spawnReason == SpawnReason.NATURAL && type == EntityType.ENDERMAN) {
|
||||
Box box = new Box(pos).expand(16);
|
||||
|
|
|
@ -24,6 +24,5 @@ public class LandPathNodeMakerMixin {
|
|||
|
||||
private static void beCactusDamage(CallbackInfoReturnable<PathNodeType> info) {
|
||||
info.setReturnValue(PathNodeType.DAMAGE_CACTUS);
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,20 +22,20 @@ public abstract class LivingEntityMixin {
|
|||
private Entity lastAttacker;
|
||||
|
||||
@Inject(method = "damage", at = @At("HEAD"))
|
||||
public void damage(DamageSource source, float amount, CallbackInfoReturnable<Boolean> info) {
|
||||
public void be_damage(DamageSource source, float amount, CallbackInfoReturnable<Boolean> info) {
|
||||
this.lastAttacker = source.getAttacker();
|
||||
}
|
||||
|
||||
@ModifyArg(method = "damage", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;takeKnockback(FDD)V"))
|
||||
private float increaseKnockback(float value, double x, double z) {
|
||||
private float be_increaseKnockback(float value, double x, double z) {
|
||||
if (lastAttacker != null && lastAttacker instanceof LivingEntity) {
|
||||
LivingEntity attacker = (LivingEntity) lastAttacker;
|
||||
value += this.getKnockback(attacker.getMainHandStack().getItem());
|
||||
value += this.be_getKnockback(attacker.getMainHandStack().getItem());
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private double getKnockback(Item tool) {
|
||||
private double be_getKnockback(Item tool) {
|
||||
if (tool == null) return 0.0D;
|
||||
Collection<EntityAttributeModifier> modifiers = tool.getAttributeModifiers(EquipmentSlot.MAINHAND)
|
||||
.get(EntityAttributes.GENERIC_ATTACK_KNOCKBACK);
|
||||
|
|
|
@ -24,7 +24,7 @@ public abstract class PlayerEntityMixin {
|
|||
private static Direction[] HORIZONTAL;
|
||||
|
||||
@Inject(method = "findRespawnPosition", at = @At(value = "HEAD"), cancellable = true)
|
||||
private static void statueRespawn(ServerWorld world, BlockPos pos, float f, boolean bl, boolean bl2, CallbackInfoReturnable<Optional<Vec3d>> info) {
|
||||
private static void be_statueRespawn(ServerWorld world, BlockPos pos, float f, boolean bl, boolean bl2, CallbackInfoReturnable<Optional<Vec3d>> info) {
|
||||
BlockState blockState = world.getBlockState(pos);
|
||||
if (blockState.isOf(EndBlocks.RESPAWN_OBELISK)) {
|
||||
info.setReturnValue(beObeliskRespawnPosition(world, pos, blockState));
|
||||
|
|
|
@ -29,7 +29,7 @@ public class ServerPlayNetworkHandlerMixin {
|
|||
public ServerPlayerEntity player;
|
||||
|
||||
@Inject(method = "onSignUpdate", at = @At(value = "HEAD"), cancellable = true)
|
||||
private void signUpdate(UpdateSignC2SPacket packet, CallbackInfo info) {
|
||||
private void be_signUpdate(UpdateSignC2SPacket packet, CallbackInfo info) {
|
||||
NetworkThreadUtils.forceMainThread(packet, (ServerPlayNetworkHandler) (Object) this, (ServerWorld) this.player.getServerWorld());
|
||||
this.player.updateLastActionTime();
|
||||
ServerWorld serverWorld = this.player.getServerWorld();
|
||||
|
|
|
@ -15,7 +15,7 @@ public abstract class ServerPlayerEntityMixin implements TeleportingEntity {
|
|||
private long beCooldown;
|
||||
|
||||
@Inject(method = "tick", at = @At("TAIL"))
|
||||
public void baseTick(CallbackInfo info) {
|
||||
public void be_baseTick(CallbackInfo info) {
|
||||
if (hasCooldown()) {
|
||||
this.beCooldown--;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public class TagGroupLoaderMixin {
|
|||
private String entryType;
|
||||
|
||||
@Inject(method = "prepareReload", at = @At("RETURN"), cancellable = true)
|
||||
public void prepareReload(ResourceManager manager, Executor prepareExecutor, CallbackInfoReturnable<CompletableFuture<Map<Identifier, Tag.Builder>>> info) {
|
||||
public void be_prepareReload(ResourceManager manager, Executor prepareExecutor, CallbackInfoReturnable<CompletableFuture<Map<Identifier, Tag.Builder>>> info) {
|
||||
CompletableFuture<Map<Identifier, Tag.Builder>> future = info.getReturnValue();
|
||||
info.setReturnValue(CompletableFuture.supplyAsync(() -> {
|
||||
Map<Identifier, Tag.Builder> map = future.join();
|
||||
|
|
|
@ -21,12 +21,13 @@ import net.minecraft.util.collection.DefaultedList;
|
|||
import net.minecraft.world.World;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.config.Configs;
|
||||
import ru.betterend.interfaces.BetterEndRecipe;
|
||||
import ru.betterend.recipe.EndRecipeManager;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.util.ItemUtil;
|
||||
import ru.betterend.util.RecipeHelper;
|
||||
|
||||
public class AlloyingRecipe implements Recipe<Inventory> {
|
||||
public class AlloyingRecipe implements Recipe<Inventory>, BetterEndRecipe {
|
||||
|
||||
public final static String GROUP = "alloying";
|
||||
public final static RecipeType<AlloyingRecipe> TYPE = EndRecipeManager.registerType(GROUP);
|
||||
|
|
|
@ -22,12 +22,13 @@ import net.minecraft.util.collection.DefaultedList;
|
|||
import net.minecraft.world.World;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.config.Configs;
|
||||
import ru.betterend.interfaces.BetterEndRecipe;
|
||||
import ru.betterend.recipe.EndRecipeManager;
|
||||
import ru.betterend.registry.EndTags;
|
||||
import ru.betterend.util.ItemUtil;
|
||||
import ru.betterend.util.RecipeHelper;
|
||||
|
||||
public class AnvilRecipe implements Recipe<Inventory> {
|
||||
public class AnvilRecipe implements Recipe<Inventory>, BetterEndRecipe {
|
||||
|
||||
public final static String GROUP = "smithing";
|
||||
public final static RecipeType<AnvilRecipe> TYPE = EndRecipeManager.registerType(GROUP);
|
||||
|
|
|
@ -20,11 +20,12 @@ import net.minecraft.world.World;
|
|||
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.config.Configs;
|
||||
import ru.betterend.interfaces.BetterEndRecipe;
|
||||
import ru.betterend.recipe.EndRecipeManager;
|
||||
import ru.betterend.rituals.InfusionRitual;
|
||||
import ru.betterend.util.ItemUtil;
|
||||
|
||||
public class InfusionRecipe implements Recipe<InfusionRitual> {
|
||||
public class InfusionRecipe implements Recipe<InfusionRitual>, BetterEndRecipe {
|
||||
|
||||
public final static String GROUP = "infusion";
|
||||
public final static RecipeType<InfusionRecipe> TYPE = EndRecipeManager.registerType(GROUP);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue