将其改为可调试
修整了格式
This commit is contained in:
parent
a9aaa20bb6
commit
49ff4ee7f0
|
|
@ -161,9 +161,9 @@ repositories {
|
|||
// ForgeGradle automatically adds the Forge maven and Maven Central for you
|
||||
|
||||
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so:
|
||||
// flatDir {
|
||||
// dir 'libs'
|
||||
// }
|
||||
flatDir {
|
||||
dir 'libs'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
@ -173,7 +173,7 @@ dependencies {
|
|||
minecraft 'net.minecraftforge:forge:1.18.2-40.1.54'
|
||||
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
|
||||
implementation group: 'net.md-5', name: 'SpecialSource', version: '1.11.0'
|
||||
compileOnly files("lib/modernlife.jar")
|
||||
implementation fg.deobf("blank:modernlife-1.18.2:1.54")
|
||||
// implementation fg.deobf(files("lib/modernlife.jar"))
|
||||
// Real mod deobf dependency examples - these get remapped to your current mappings
|
||||
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency
|
||||
|
|
|
|||
|
|
@ -6,4 +6,4 @@ org.gradle.daemon=false
|
|||
mod.id = modernlifepatch
|
||||
mod.group = com.r3944realms.modernlifepatch
|
||||
mod.author = r3944Realms
|
||||
mod.version = 1.18.2-1.4.2
|
||||
mod.version = 1.18.2-1.4.3
|
||||
Binary file not shown.
95506
lib/output.srg
95506
lib/output.srg
File diff suppressed because it is too large
Load Diff
BIN
lib/target.jar
BIN
lib/target.jar
Binary file not shown.
|
|
@ -1,6 +1,7 @@
|
|||
package com.r3944realms.modernlifepatch;
|
||||
|
||||
import com.dairymoose.modernlife.core.CustomBlocks;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.r3944realms.modernlifepatch.client.event.CreativeScreenEvents;
|
||||
import com.r3944realms.modernlifepatch.client.renderer.blockentity.MirrorBlockEntityRenderer;
|
||||
import com.r3944realms.modernlifepatch.content.blocks.ModBlocks;
|
||||
|
|
@ -10,6 +11,9 @@ import net.minecraft.client.renderer.RenderType;
|
|||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.EntityRenderersEvent;
|
||||
import net.minecraftforge.client.gui.ForgeIngameGui;
|
||||
import net.minecraftforge.client.gui.IIngameOverlay;
|
||||
import net.minecraftforge.client.gui.OverlayRegistry;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
|
|
@ -25,6 +29,7 @@ public abstract class ClientEventHandler {
|
|||
@OnlyIn(Dist.CLIENT)
|
||||
public static void onClientSetup(FMLClientSetupEvent event) {
|
||||
event.enqueueWork(() -> {
|
||||
|
||||
ItemBlockRenderTypes.setRenderLayer(ModBlocks.MASSIVE_MIRROR.get(), RenderType.cutout());
|
||||
ItemBlockRenderTypes.setRenderLayer(ModBlocks.LARGE_MIRROR.get(), RenderType.cutout());
|
||||
ItemBlockRenderTypes.setRenderLayer(CustomBlocks.BLOCK_ACACIA_CHAIR.get(), RenderType.cutout());
|
||||
|
|
@ -37,8 +42,9 @@ public abstract class ClientEventHandler {
|
|||
ItemBlockRenderTypes.setRenderLayer(CustomBlocks.BLOCK_WARPED_CHAIR.get(), RenderType.cutout());
|
||||
ItemBlockRenderTypes.setRenderLayer(CustomBlocks.BLOCK_POWER_RECEIVER.get(), RenderType.translucent());
|
||||
});
|
||||
MinecraftForge.EVENT_BUS.register(new CreativeScreenEvents());
|
||||
if(ModernLifePatch.isModernLifeLoaded) MinecraftForge.EVENT_BUS.register(new CreativeScreenEvents());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRegisterRenderer (EntityRenderersEvent.RegisterRenderers event) {
|
||||
event.registerBlockEntityRenderer(ModBlockEntityType.MIRROR.get(), MirrorBlockEntityRenderer::new);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.r3944realms.modernlifepatch;
|
|||
|
||||
import net.minecraft.server.packs.repository.Pack;
|
||||
import net.minecraft.server.packs.repository.PackSource;
|
||||
import net.minecraftforge.client.model.obj.OBJLoader;
|
||||
import net.minecraftforge.event.AddPackFindersEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ public class CreativeScreenEvents {
|
|||
|
||||
@SubscribeEvent
|
||||
public void onScreenInit(ScreenEvent.InitScreenEvent.Post event) {
|
||||
if(!ModernLifePatch.isModernLifeLoaded) return;
|
||||
if(event.getScreen() instanceof CreativeModeInventoryScreen creativeScreen) {
|
||||
if(this.filters == null) {
|
||||
//初始化过滤器
|
||||
|
|
@ -118,7 +117,6 @@ public class CreativeScreenEvents {
|
|||
}
|
||||
@SubscribeEvent
|
||||
public void onScreenClick(ScreenEvent.MouseClickedEvent.Pre event) {
|
||||
if(!ModernLifePatch.isModernLifeLoaded) return;
|
||||
if(event.getButton() != GLFW.GLFW_MOUSE_BUTTON_LEFT)
|
||||
return;
|
||||
|
||||
|
|
@ -138,7 +136,6 @@ public class CreativeScreenEvents {
|
|||
}
|
||||
@SubscribeEvent
|
||||
public void onScreenDrawPre(ScreenEvent.DrawScreenEvent.Pre event) {
|
||||
if(!ModernLifePatch.isModernLifeLoaded) return;
|
||||
if(event.getScreen() instanceof CreativeModeInventoryScreen creativeModeInventoryScreen) {
|
||||
if(creativeModeInventoryScreen.getSelectedTab() == ModernLifePatch.MLP_CREATIVE_TAB.getId()) {
|
||||
if(!this.viewThisCreativeTab) {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
package com.r3944realms.modernlifepatch.mixin.item;
|
||||
|
||||
import com.dairymoose.modernlife.items.CameraItem;
|
||||
import com.dairymoose.modernlife.util.CanvasData;
|
||||
import com.mojang.blaze3d.platform.NativeImage;
|
||||
import com.r3944realms.modernlifepatch.ModernLifePatch;
|
||||
import com.r3944realms.modernlifepatch.datagen.lang.ModLangKeyValue;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
|
|
@ -14,74 +11,15 @@ import net.minecraft.world.item.ItemStack;
|
|||
import net.minecraft.world.item.TooltipFlag;
|
||||
import net.minecraft.world.level.Level;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
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 java.util.List;
|
||||
|
||||
@Mixin(CameraItem.class)
|
||||
public abstract class MixinCamera {
|
||||
|
||||
@Unique
|
||||
private static int modernLifePatch$toInternalRgbFormat(int nativeRgb) {
|
||||
int r = nativeRgb & 255;
|
||||
int g = (nativeRgb & '\uff00') >> 8;
|
||||
int b = (nativeRgb & 16711680) >> 16;
|
||||
return r << 16 | g << 8 | b;
|
||||
}
|
||||
@Inject(method = {"getAverageRgbAt"}, at = @At("HEAD"), remap = false, cancellable = true)
|
||||
private static void getAverageRgbAt(NativeImage img, int x, int y, float pixelSampleWidth, float pixelSampleHeight, CallbackInfoReturnable<Integer> cir) {
|
||||
try {
|
||||
int destX = (int) ((float) x * pixelSampleWidth);
|
||||
int destY = (int) ((float) y * pixelSampleHeight);
|
||||
int rSum = 0;
|
||||
int gSum = 0;
|
||||
int bSum = 0;
|
||||
int iterations = 0;
|
||||
int hStart = (int) (-pixelSampleHeight / 2.0F);
|
||||
int hEnd = (int) (pixelSampleHeight / 2.0F);
|
||||
int wStart = (int) (-pixelSampleWidth / 2.0F);
|
||||
int wEnd = (int) (pixelSampleWidth / 2.0F);
|
||||
ModernLifePatch.logger.info("[ModernLifePatch.MixinCamera] pixelSampleHeight: {} , pixelSampleWidth: {}", pixelSampleHeight, pixelSampleWidth);
|
||||
if (hStart == hEnd) {
|
||||
hStart = 0;
|
||||
hEnd = 1;
|
||||
wStart = 0;
|
||||
wEnd = 1;
|
||||
}
|
||||
|
||||
int h;
|
||||
int w;
|
||||
int finalX;
|
||||
ModernLifePatch.logger.info("[ModernLifePatch.MixinCamera] hEnd: {} , wEnd: {}", hEnd, wEnd);
|
||||
for (h = hStart; h < hEnd; ++h) {
|
||||
for (w = wStart; w < wEnd; ++w) {
|
||||
finalX = destX + w;
|
||||
int finalY = destY + h;
|
||||
finalX = Math.max(finalX, 0);
|
||||
finalY = Math.max(finalY, 0);
|
||||
finalX = Math.min(finalX, img.getWidth() - 1);
|
||||
finalY = Math.min(finalY, img.getHeight() - 1);
|
||||
int rgb = modernLifePatch$toInternalRgbFormat(img.getPixelRGBA(finalX, finalY));
|
||||
rSum += CanvasData.getRValue(rgb);
|
||||
gSum += CanvasData.getGValue(rgb);
|
||||
bSum += CanvasData.getBValue(rgb);
|
||||
++iterations;
|
||||
}
|
||||
}
|
||||
ModernLifePatch.logger.info("[ModernLifePatch.MixinCamera] rSum: {} , gSum: {}, bSum: {}", rSum, gSum, bSum);
|
||||
ModernLifePatch.logger.info("[ModernLifePatch.MixinCamera] iterations: {} ", iterations);
|
||||
h = rSum / iterations;
|
||||
w = gSum / iterations;
|
||||
finalX = bSum / iterations;
|
||||
cir.setReturnValue(h << 16 | w << 8 | finalX);
|
||||
} catch(ArrayIndexOutOfBoundsException e) {
|
||||
cir.setReturnValue(0xffffffff);
|
||||
}
|
||||
}
|
||||
@Inject(method = {"appendHoverText"}, at= @At("HEAD"), cancellable = true)
|
||||
public void appendHoverText(ItemStack itemStack, Level world, List<Component> text, TooltipFlag flag, CallbackInfo ci) {
|
||||
int photoCount = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user