code cleanup
This commit is contained in:
parent
08b2a41043
commit
69eb806228
|
|
@ -38,6 +38,7 @@ public class ArchitecturyCompat {
|
|||
private static Method PLACE_BLOCK;
|
||||
private static Method IS_FALSE;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static void setup( ) {
|
||||
try {
|
||||
Class BlockEvent = Class.forName("dev.architectury.event.events.common.BlockEvent");
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@ package tschipp.carryon.config.fabric;
|
|||
import com.google.gson.*;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import tschipp.carryon.Constants;
|
||||
import tschipp.carryon.common.config.CarryConfig;
|
||||
import tschipp.carryon.common.config.ListHandler;
|
||||
import tschipp.carryon.config.*;
|
||||
|
||||
|
|
@ -149,6 +147,7 @@ public class ConfigLoaderImpl {
|
|||
builder.add(category.category, categoryJson);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static void buildProperty(JsonObject builder, PropertyData data) throws IllegalAccessException {
|
||||
AnnotationData annotationData = data.getData();
|
||||
builder.addProperty("//"+data.getId(), annotationData.description());
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ package tschipp.carryon.events;
|
|||
|
||||
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
|
||||
import net.fabricmc.fabric.api.entity.event.v1.ServerLivingEntityEvents;
|
||||
import net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.CommonLifecycleEvents;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ public class FabricPlatformHelper implements IPlatformHelper {
|
|||
ConfigLoaderImpl.registerConfig(cfg);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T extends PacketBase, B extends FriendlyByteBuf> void registerServerboundPacket(CustomPacketPayload.Type<T> type, Class<T> clazz, StreamCodec<B, T> codec, BiConsumer<T, Player> handler, Object... args)
|
||||
{
|
||||
|
|
@ -76,6 +77,7 @@ public class FabricPlatformHelper implements IPlatformHelper {
|
|||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T extends PacketBase, B extends FriendlyByteBuf> void registerClientboundPacket(CustomPacketPayload.Type<T> type, Class<T> clazz, StreamCodec<B, T> codec, BiConsumer<T, Player> handler, Object... args)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
package tschipp.carryon.compat;
|
||||
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import tschipp.carryon.config.BuiltConfig;
|
||||
import tschipp.carryon.config.forge.ConfigLoaderImpl;
|
||||
|
||||
public class ClothConfigCompatForge {
|
||||
|
||||
// public static Screen createScreen(BuiltConfig client, BuiltConfig common, Screen screen) {
|
||||
//
|
||||
// return ClothConfigCompat.getConfigScreen(client, common, screen, () -> {
|
||||
// ConfigLoaderImpl.saveConfig(client); ConfigLoaderImpl.saveConfig(common);});
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -22,21 +22,13 @@ package tschipp.carryon.config.forge;
|
|||
|
||||
import com.electronwill.nightconfig.core.AbstractConfig;
|
||||
import com.electronwill.nightconfig.core.UnmodifiableConfig;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.common.ForgeConfigSpec;
|
||||
import net.minecraftforge.common.util.LogicalSidedProvider;
|
||||
import net.minecraftforge.eventbus.api.listener.SubscribeEvent;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.config.IConfigSpec;
|
||||
import net.minecraftforge.fml.config.ModConfig;
|
||||
import net.minecraftforge.fml.event.config.ModConfigEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.fml.loading.FMLServiceProvider;
|
||||
import net.minecraftforge.server.ServerLifecycleHooks;
|
||||
import tschipp.carryon.Constants;
|
||||
import tschipp.carryon.config.*;
|
||||
|
||||
|
|
@ -119,6 +111,7 @@ public class ConfigLoaderImpl {
|
|||
builder.pop();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static void buildProperty(ForgeConfigSpec.Builder builder, PropertyData data) throws IllegalAccessException {
|
||||
AnnotationData annotationData = data.getData();
|
||||
builder.comment(annotationData.description());
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ public class CommonEvents
|
|||
|
||||
@SubscribeEvent
|
||||
public static void onAttachCapabilities(AttachCapabilitiesEvent.Entities event) {
|
||||
if (event.getObject() instanceof Player player) {
|
||||
if (event.getObject() instanceof Player) {
|
||||
event.addCapability(ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, "carry_on_data"), new CarryOnDataCapabilityProvider());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,10 +24,8 @@ import net.minecraftforge.eventbus.api.listener.SubscribeEvent;
|
|||
import net.minecraftforge.fml.InterModComms;
|
||||
import net.minecraftforge.fml.InterModComms.IMCMessage;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent;
|
||||
import tschipp.carryon.Constants;
|
||||
import tschipp.carryon.client.modeloverride.ModelOverrideHandler;
|
||||
import tschipp.carryon.common.config.ListHandler;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
|
|
|||
|
|
@ -43,9 +43,7 @@ public class ModClientEvents
|
|||
public static void clientSetup(FMLClientSetupEvent event)
|
||||
{
|
||||
if(Services.PLATFORM.isModLoaded("cloth_config")) {
|
||||
|
||||
BuiltConfig[] configs = ConfigLoaderImpl.CONFIGS.values().toArray(new BuiltConfig[0]);
|
||||
//ModLoadingContext.get().registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class, () -> new ConfigScreenHandler.ConfigScreenFactory((mc, prevScreen) -> ClothConfigCompatForge.createScreen(configs[1], configs[0], prevScreen)));
|
||||
ConfigLoaderImpl.CONFIGS.values().toArray(new BuiltConfig[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,47 +0,0 @@
|
|||
/*
|
||||
* GNU Lesser General Public License v3
|
||||
* Copyright (C) 2024 Tschipp
|
||||
* mrtschipp@gmail.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package tschipp.carryon.mixin;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.particle.ParticleEngine;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.culling.Frustum;
|
||||
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.CallbackInfo;
|
||||
import tschipp.carryon.client.render.CarriedObjectRender;
|
||||
|
||||
@Mixin(ParticleEngine.class)
|
||||
public class ParticleEngineMixin
|
||||
{
|
||||
//I am injecting into a lambda, lord help me
|
||||
|
||||
// @Inject(method = "render(Lnet/minecraft/client/Camera;FLnet/minecraft/client/renderer/MultiBufferSource$BufferSource;Lnet/minecraft/client/renderer/culling/Frustum;)V",
|
||||
// at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;endBatch()V",
|
||||
// shift = At.Shift.AFTER))
|
||||
// private void onRenderLevel(Camera p_107340_, float partialTick, Frustum frustum, CallbackInfo ci)
|
||||
// {
|
||||
// CarriedObjectRender.drawThirdPerson(partialTick, new PoseStack().last().pose());
|
||||
// }
|
||||
}
|
||||
|
|
@ -9,7 +9,6 @@ import net.minecraft.world.entity.player.Player;
|
|||
import tschipp.carryon.Constants;
|
||||
import tschipp.carryon.common.carry.CarryOnData;
|
||||
import tschipp.carryon.common.carry.CarryOnDataManager;
|
||||
import tschipp.carryon.networking.clientbound.ClientboundStartRidingPacket;
|
||||
|
||||
public record ClientboundSyncCarryDataPacket(int iden, CarryOnData data) implements PacketBase {
|
||||
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ public class ForgePlatformHelper implements IPlatformHelper {
|
|||
ConfigLoaderImpl.registerConfig(cfg);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T extends PacketBase, B extends FriendlyByteBuf> void registerServerboundPacket(CustomPacketPayload.Type<T> type, Class<T> clazz, StreamCodec<B, T> codec, BiConsumer<T, Player> handler, Object... args)
|
||||
{
|
||||
|
|
@ -86,6 +87,7 @@ public class ForgePlatformHelper implements IPlatformHelper {
|
|||
CarryOnForge.network.messageBuilder(clazz).codec((StreamCodec<FriendlyByteBuf, T>) codec).consumerMainThread(serverHandler).add();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T extends PacketBase, B extends FriendlyByteBuf> void registerClientboundPacket(CustomPacketPayload.Type<T> type, Class<T> clazz, StreamCodec<B, T> codec, BiConsumer<T, Player> handler, Object... args)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
"ParticleEngineMixin"
|
||||
],
|
||||
"server": [
|
||||
],
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ public class ConfigLoaderImpl {
|
|||
builder.pop();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static void buildProperty(ModConfigSpec.Builder builder, PropertyData data) throws IllegalAccessException {
|
||||
AnnotationData annotationData = data.getData();
|
||||
builder.comment(annotationData.description());
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ import net.neoforged.bus.api.SubscribeEvent;
|
|||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.neoforge.client.event.ClientTickEvent;
|
||||
import net.neoforged.neoforge.client.event.RenderHandEvent;
|
||||
import net.neoforged.neoforge.client.event.RenderLevelStageEvent;
|
||||
import net.neoforged.neoforge.client.event.ScreenEvent;
|
||||
import tschipp.carryon.CarryOnCommonClient;
|
||||
import tschipp.carryon.Constants;
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ public class NeoForgePlatformHelper implements IPlatformHelper {
|
|||
ConfigLoaderImpl.registerConfig(cfg);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T extends PacketBase, B extends FriendlyByteBuf> void registerServerboundPacket(CustomPacketPayload.Type<T> type, Class<T> clazz, StreamCodec<B, T> codec, BiConsumer<T, Player> handler, Object... args) {
|
||||
PayloadRegistrar registrar = (PayloadRegistrar) args[0];
|
||||
|
|
@ -82,6 +83,7 @@ public class NeoForgePlatformHelper implements IPlatformHelper {
|
|||
registrar.playToServer(type, (StreamCodec<RegistryFriendlyByteBuf, T>)codec, serverHandler);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T extends PacketBase, B extends FriendlyByteBuf> void registerClientboundPacket(CustomPacketPayload.Type<T> type, Class<T> clazz, StreamCodec<B, T> codec, BiConsumer<T, Player> handler, Object... args)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user