Port forge and finally fix build scripts

This commit is contained in:
2023-09-25 20:18:35 +02:00
parent ec5fa726a0
commit aef4992cf5
22 changed files with 156 additions and 141 deletions

View File

@@ -1,24 +1,27 @@
plugins {
id 'java'
id 'fabric-loom' version '0.12-SNAPSHOT'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '7.0.0'
id 'org.quiltmc.loom' version '1.3.+'
}
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'maven-publish'
archivesBaseName = "${mod_name}-common-${minecraft_version}"
loom {
shareCaches()
accessWidenerPath = project.file("src/main/resources/craterlib.aw")
remapArchives = false
mixin {
useLegacyMixinAp = false
}
runConfigs.configureEach {
ideConfigGenerated = false
}
}
dependencies {
minecraft "com.mojang:minecraft:${minecraft_version}"
mappings loom.officialMojangMappings()
modImplementation "org.quiltmc:quilt-loader:0.19.4"
compileOnly group: 'org.spongepowered', name: 'mixin', version: '0.8.5'
implementation "com.hypherionmc:rpcsdk:1.0"
}
@@ -31,19 +34,31 @@ processResources {
}
}
/**
* Shadowjar Config
*/
shadowJar {
exclude 'mappings/*'
dependencies {
include(dependency("me.hypherionmc.moon-config:core:${moon_config}"))
include(dependency("me.hypherionmc.moon-config:toml:${moon_config}"))
relocate 'me.hypherionmc.moonconfig', 'shadow.hypherionmc.moonconfig'
}
setArchiveClassifier('')
setArchiveClassifier('dev-shadow')
}
build.dependsOn shadowJar
reg.configureJarTask(shadowJar)
remapJar {
input.set shadowJar.archiveFile
dependsOn shadowJar
setArchiveClassifier(null)
}
//reg.configureJarTask(shadowJar)
/**
* Publishing Config
*/
publishing {
publications {
mavenJava(MavenPublication) {

2
Common/gradle.properties Normal file
View File

@@ -0,0 +1,2 @@
# We don't need the common jar to be remapped
fabric.loom.dontRemap = true

View File

@@ -19,9 +19,9 @@ import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.joml.Matrix4f;
import javax.annotation.Nullable;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.math.BigDecimal;

View File

@@ -6,8 +6,8 @@ import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.events.AbstractContainerEventHandler;
import net.minecraft.client.gui.components.events.GuiEventListener;
import net.minecraft.network.chat.Component;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

View File

@@ -1,15 +1,7 @@
package com.hypherionmc.craterlib.client.registry;
import com.hypherionmc.craterlib.api.rendering.DyableBlock;
import com.hypherionmc.craterlib.api.rendering.ItemDyable;
import com.hypherionmc.craterlib.client.rendering.ItemColorHandler;
import com.hypherionmc.craterlib.core.platform.ClientPlatform;
import com.hypherionmc.craterlib.core.systems.reg.RegistrationProvider;
import net.minecraft.client.color.block.BlockColors;
import net.minecraft.client.color.item.ItemColors;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import org.jetbrains.annotations.NotNull;
@@ -26,13 +18,13 @@ public class ClientRegistry {
* @param colors Existing block colors obtained from {@link com.hypherionmc.craterlib.api.event.client.ColorRegistrationEvent}
* @param blocks The blocks registered for the module
*/
public static void registerBlockColors(@NotNull BlockColors colors, @NotNull RegistrationProvider<Block> blocks) {
/*public static void registerBlockColors(@NotNull BlockColors colors, @NotNull RegistrationProvider<Block> blocks) {
blocks.getEntries().forEach(blockRegistryObject -> {
if (blockRegistryObject.get() instanceof DyableBlock dyableBlock) {
colors.register(dyableBlock.dyeHandler(), (Block) dyableBlock);
}
});
}
}*/
/**
* Register Item Color Handlers
@@ -40,13 +32,13 @@ public class ClientRegistry {
* @param colors Existing item colors obtained from {@link com.hypherionmc.craterlib.api.event.client.ColorRegistrationEvent}
* @param items The items registered for the module
*/
public static void registerItemColors(@NotNull ItemColors colors, @NotNull RegistrationProvider<Item> items) {
/*public static void registerItemColors(@NotNull ItemColors colors, @NotNull RegistrationProvider<Item> items) {
items.getEntries().forEach(itemRegistryObject -> {
if (itemRegistryObject.get() instanceof ItemDyable itemDyable) {
colors.register(new ItemColorHandler(), (Item) itemDyable);
}
});
}
}*/
/**
* Register a {@link net.minecraft.client.renderer.blockentity.BlockEntityRenderer} for a BlockEntity

View File

@@ -1,20 +1,16 @@
package com.hypherionmc.craterlib.core.platform;
import com.hypherionmc.craterlib.common.item.BlockItemDyable;
import com.hypherionmc.craterlib.core.systems.reg.RegistryObject;
import com.hypherionmc.craterlib.util.ServiceUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.network.Connection;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
/**
* @author HypherionSA
*/
@@ -24,7 +20,7 @@ public interface ClientPlatform {
void registerItemProperty(@NotNull BlockItemDyable item, @NotNull String property);
void registerCustomRenderTypes(@NotNull Collection<RegistryObject<Block>> blocks);
//void registerCustomRenderTypes(@NotNull Collection<RegistryObject<Block>> blocks);
Minecraft getClientInstance();

View File

@@ -13,8 +13,8 @@ import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.level.block.entity.BlockEntity;
import org.apache.commons.lang3.function.TriFunction;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.util.Optional;
import java.util.function.Consumer;

View File

@@ -3,7 +3,6 @@ package com.hypherionmc.craterlib.mixin.events.client;
import com.hypherionmc.craterlib.api.event.client.CraterSinglePlayerEvent;
import com.hypherionmc.craterlib.core.event.CraterEventBus;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.player.AbstractClientPlayer;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
import org.spongepowered.asm.mixin.Mixin;

View File

@@ -4,18 +4,18 @@ import com.hypherionmc.craterlib.api.event.client.ScreenEvent;
import com.hypherionmc.craterlib.core.event.CraterEventBus;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
import org.jetbrains.annotations.Nullable;
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 javax.annotation.Nullable;
@Mixin(Minecraft.class)
public class MinecraftMixin {
@Shadow @Nullable public Screen screen;
@Shadow @Nullable
public Screen screen;
@Inject(method = "setScreen", at = @At(value = "TAIL"))
private void injectScreenOpeningEvent(Screen screen, CallbackInfo ci) {

View File

@@ -1,4 +1,3 @@
accessWidener v1 named
accessible class net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo
accessible method net/minecraft/client/renderer/item/ItemProperties register (Lnet/minecraft/world/item/Item;Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/client/renderer/item/ClampedItemPropertyFunction;)V