Skip to content

Commit

Permalink
Update to 1.19.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ustc-zzzz committed Mar 17, 2023
1 parent eae5ba5 commit fde8792
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 68 deletions.
86 changes: 23 additions & 63 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,90 +1,59 @@
import java.time.Instant
import java.time.format.DateTimeFormatter
import java.time.temporal.ChronoUnit

buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net' }
maven { url = 'https://maven.parchmentmc.org' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
classpath group: 'org.parchmentmc', name: 'librarian', version: '1.+'
}
plugins {
id 'eclipse'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '5.1.+'
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
}

apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.parchmentmc.librarian.forgegradle'

apply plugin: 'eclipse'
apply plugin: 'maven-publish'

version = '0.4.0'
version = '0.5.0'
group = 'org.teacon'
archivesBaseName = 'ChromeBall-Forge-1.18'
archivesBaseName = 'ChromeBall-Forge-1.19'

java.toolchain.languageVersion = JavaLanguageVersion.of(17)

minecraft {
// mappings channel: 'official', version: '1.18.2'
mappings channel: 'parchment', version: '2022.03.06-1.18.1'
mappings channel: 'official', version: '1.19.4'
// mappings channel: 'parchment', version: '2022.03.06-1.18.1'

runs {
client {
workingDirectory project.file('run')

property 'forge.logging.markers', 'REGISTRIES'

property 'forge.logging.console.level', 'info'

property 'forge.enabledGameTestNamespaces', 'chromeball'
mods {
examplemod {
source sourceSets.main
}
chromeball { source sourceSets.main }
}
}

server {
workingDirectory project.file('run_server')

property 'forge.logging.markers', 'REGISTRIES'

property 'forge.logging.console.level', 'info'

property 'forge.enabledGameTestNamespaces', 'chromeball'
mods {
examplemod {
source sourceSets.main
}
chromeball { source sourceSets.main }
}
}

data {
workingDirectory project.file('run')

property 'forge.logging.markers', 'REGISTRIES'

property 'forge.logging.console.level', 'info'

args '--mod', 'chromeball', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')

mods {
examplemod {
source sourceSets.main
}
chromeball { source sourceSets.main }
}
}
}
}

sourceSets.main.resources { srcDir 'src/generated/resources' }

repositories {

}
repositories { /* no repository here*/ }

dependencies {
minecraft 'net.minecraftforge:forge:1.18.2-40.0.12'
minecraft 'net.minecraftforge:forge:1.19.4-45.0.9'
}

jar {
Expand All @@ -96,26 +65,21 @@ jar {
"Implementation-Title": project.name,
"Implementation-Version": "${project.version}",
"Implementation-Vendor": "TeaConMC",
"Implementation-Timestamp": DateTimeFormatter.ISO_INSTANT.format(Instant.now().truncatedTo(ChronoUnit.SECONDS))
"Implementation-Timestamp": "${Instant.now().truncatedTo(java.time.temporal.ChronoUnit.SECONDS)}"
])
}
}

def reobfFile = file("$buildDir/reobfJar/output.jar")
def reobfArtifact = artifacts.add('default', reobfFile) {
it.type = 'jar'
it.builtBy 'reobfJar'
}
jar.finalizedBy('reobfJar')

publishing {
publications {
release(MavenPublication) {
groupId = "org.teacon"
artifactId = "ChromeBall-Forge-1.18"

artifact reobfArtifact
artifactId = "ChromeBall-Forge-1.19"
artifact jar
pom {
name = 'ChromeBall for Minecraft 1.18'
name = 'ChromeBall for Minecraft 1.19'
description = 'ChromeBall! Just a Chrome Ball.'
licenses {
license {
Expand All @@ -138,18 +102,14 @@ publishing {
}

tasks.withType(PublishToMavenRepository) {
onlyIf {
System.env.ARCHIVE_ACCESS_KEY && System.env.ARCHIVE_SECRET_KEY
}
onlyIf { System.env.ARCHIVE_ACCESS_KEY && System.env.ARCHIVE_SECRET_KEY }
}

/**
* A simple task to pass down the artifact name and path to other GitHub actions.
*/
task("githubActionOutput") {
onlyIf {
System.env.GITHUB_ACTIONS
}
onlyIf { System.env.GITHUB_ACTIONS }
doLast {
println "::set-output name=artifact_path::${jar.archiveFile.get().asFile.absolutePath}"
println "::set-output name=artifact_name::${jar.archiveFileName.get()}"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
7 changes: 7 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven { url = 'https://maven.minecraftforge.net/' }
maven { url = 'https://maven.parchmentmc.org/' }
}
}
1 change: 1 addition & 0 deletions src/main/java/org/teacon/chromeball/ChromeBall.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public ChromeBall() {
var eventBus = FMLJavaModLoadingContext.get().getModEventBus();
CBRegistry.ITEMS.register(eventBus);
CBRegistry.ENTITIES.register(eventBus);
eventBus.addListener(CBRegistry::registerCreativeTabs);
}

public static Config getConfig() {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/teacon/chromeball/common/CBHitsByStat.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.stats.Stats;
import net.minecraftforge.eventbus.api.SubscribeEvent;
Expand All @@ -20,7 +21,7 @@ public class CBHitsByStat {
@SubscribeEvent
public static void registerStat(FMLCommonSetupEvent event) {
event.enqueueWork(() -> {
Registry.register(Registry.CUSTOM_STAT, INSTANCE, INSTANCE);
Registry.register(BuiltInRegistries.CUSTOM_STAT, INSTANCE, INSTANCE);
Stats.CUSTOM.get(INSTANCE);
});
}
Expand Down
13 changes: 10 additions & 3 deletions src/main/java/org/teacon/chromeball/common/CBRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.CreativeModeTabs;
import net.minecraft.world.item.Item;
import net.minecraftforge.event.CreativeModeTabEvent;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
Expand All @@ -16,10 +18,15 @@
@ParametersAreNonnullByDefault
public class CBRegistry {
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, ChromeBall.MOD_ID);
public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITIES, ChromeBall.MOD_ID);
public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, ChromeBall.MOD_ID);

public static final RegistryObject<CBItem> ITEM = ITEMS.register("chrome",
() -> new CBItem(new Item.Properties().stacksTo(16).tab(CreativeModeTab.TAB_MISC)));
public static final RegistryObject<CBItem> ITEM = ITEMS.register("chrome", () -> new CBItem(new Item.Properties().stacksTo(16)));
public static final RegistryObject<EntityType<CBEntity>> ENTITY_TYPE = ENTITIES.register("chrome",
() -> EntityType.Builder.<CBEntity>of(CBEntity::new, MobCategory.MISC).sized(0.25F, 0.25F).build("chrome"));

public static void registerCreativeTabs(CreativeModeTabEvent.BuildContents event) {
if (event.getTab().equals(CreativeModeTabs.SEARCH)) {
event.accept(CBRegistry.ITEM, CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS);
}
}
}

0 comments on commit fde8792

Please sign in to comment.