Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fabric/1.20.4 #354

Merged
merged 9 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Automatically build the project and run any configured tests for every push
# and submitted pull request. This can help catch issues that only occur on
# certain platforms or Java versions, and provides a first line of defence
# against bad commits.

name: build
on: [pull_request, push]

jobs:
build:
strategy:
matrix:
# Use these Java versions
java: [
17, # Current Java LTS & minimum supported by Minecraft
21, # Current Java LTS
]
# and run on both Linux and Windows
os: [ubuntu-22.04, windows-2022]
runs-on: ${{ matrix.os }}
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: setup jdk ${{ matrix.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'microsoft'
- name: make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: build
run: ./gradlew build
- name: capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '21' }} # Only upload artifacts built from latest java on one OS
uses: actions/upload-artifact@v3
with:
name: Artifacts
path: build/libs/
3 changes: 2 additions & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ jobs:
if: endswith(github.ref_name, 'master') && github.ref_protected && github.ref_type == 'branch'
runs-on: ubuntu-latest
env:
APPVEYOR_BUILD_VERSION: '3.2.1'
APPVEYOR_BUILD_VERSION: '3.2.3'
CURSETOKEN: ${{ secrets.CURSETOKEN }}
MODRINTHTOKEN: ${{ secrets.MODRINTHTOKEN }}
steps:
- uses: actions/checkout@v3
with:
Expand Down
91 changes: 59 additions & 32 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
plugins {
id 'fabric-loom' version '1.5-SNAPSHOT'
id 'maven-publish'
id "com.matthewprenger.cursegradle" version "1.4.0"
id "com.modrinth.minotaur" version "2.+"
}

version = project.mod_version
group = project.maven_group

def ver = System.getenv("APPVEYOR_BUILD_VERSION")
if(ver == null)
ver = "dev"
version = ver
group = 'com.troblecodings'
base {
archivesName = project.archives_base_name
archivesName = 'TC-Redstone-1.20.4-Fabric'
}

sourceSets{
Expand All @@ -18,39 +22,68 @@ sourceSets{
}
}

repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
def key = System.getenv("CURSETOKEN")
if(key == null)
key = 'dev'
curseforge {
apiKey = key
project {
id = '503143'
changelog = file('changelog.md')
changelogType = 'markdown'
releaseType = 'release'
addGameVersion 'Java 17'
mainArtifact(remapJar) {
displayName = "Example $project.version"
}
}
options {
forgeGradleIntegration = false
}
}

afterEvaluate {
tasks.curseforge503143.dependsOn remapJar
}


def token = System.getenv("MODRINTHTOKEN")
if(key == null)
key = 'dev'
modrinth {
token = token
projectId = 'rMlghquR'
versionNumber = ver
versionType = 'release'
versionName = 'TC-Redstone-1.20.4-Fabric'
uploadFile = remapJar
gameVersions = ['1.20.4']
loaders = ['fabric']
}

loom {
splitEnvironmentSourceSets()

mods {
"modid" {
"tcredstone" {
sourceSet sourceSets.main
sourceSet sourceSets.client
}
}

}

task publishToModSites {
publishToModSites.dependsOn modrinth
publishToModSites.dependsOn curseforge
}

dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

// Uncomment the following line to enable the deprecated Fabric API modules.
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.

// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
minecraft "com.mojang:minecraft:1.20.4"
mappings "net.fabricmc:yarn:1.20.4+build.1:v2"
modImplementation "net.fabricmc:fabric-loader:0.15.0"

modImplementation "net.fabricmc.fabric-api:fabric-api:0.91.1+1.20.4"
}

processResources {
Expand All @@ -66,9 +99,6 @@ tasks.withType(JavaCompile).configureEach {
}

java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_17
Expand All @@ -81,19 +111,16 @@ jar {
}
}

// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
maven {
url "file:///${project.projectDir}/mcmodsrepo"
}
}
}
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [1.20.4 Fabric - 3.2.3]

* port to fabric

## [1.20.1-3.2.1]

* added multi linking tool
Expand Down

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions src/client/resources/tcredstone.client.mixins.json

This file was deleted.

88 changes: 49 additions & 39 deletions src/main/java/com/troblecodings/tcredstone/init/TCInit.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,51 +29,61 @@

public class TCInit {

public static final Item RS_LINKER = registerItem("linker", new Linkingtool(null, TCInit::acceptAcceptor),
ItemGroups.REDSTONE);
public static final Item RS_MULTILINKER = registerItem("multilinker",
new MultiLinkingTool(null, TCInit::acceptAcceptor), ItemGroups.REDSTONE);
public static final Item REMOTE_ACTIVATOR = registerItem("activator", new RemoteActivator(), ItemGroups.REDSTONE);
public static final Item RS_LINKER = registerItem("linker",
new Linkingtool(null, TCInit::acceptAcceptor), ItemGroups.REDSTONE);
public static final Item RS_MULTILINKER = registerItem("multilinker",
new MultiLinkingTool(null, TCInit::acceptAcceptor), ItemGroups.REDSTONE);
public static final Item REMOTE_ACTIVATOR = registerItem("activator",
new RemoteActivator(TCInit::acceptAcceptor), ItemGroups.REDSTONE);

@SuppressWarnings("deprecation")
public static final Block RS_ACCEPTOR = registerBlock("acceptor",
new BlockRedstoneAcceptor(FabricBlockSettings.of().strength(1.5f, 6.0f)), ItemGroups.REDSTONE);
@SuppressWarnings("deprecation")
public static final Block RS_EMITTER = registerBlock("emitter",
new BlockRedstoneEmitter(FabricBlockSettings.of().strength(1.5f, 6.0f)), ItemGroups.REDSTONE);
@SuppressWarnings("deprecation")
public static final Block RS_MULTI_EMITTER = registerBlock("multiemitter",
new BlockRedstoneMultiEmitter(FabricBlockSettings.of().strength(1.5f, 6.0f)), ItemGroups.REDSTONE);
@SuppressWarnings("deprecation")
public static final Block RS_ACCEPTOR = registerBlock("acceptor",
new BlockRedstoneAcceptor(FabricBlockSettings.of().strength(1.5f, 6.0f)),
ItemGroups.REDSTONE);
@SuppressWarnings("deprecation")
public static final Block RS_EMITTER = registerBlock("emitter",
new BlockRedstoneEmitter(FabricBlockSettings.of().strength(1.5f, 6.0f)),
ItemGroups.REDSTONE);
@SuppressWarnings("deprecation")
public static final Block RS_MULTI_EMITTER = registerBlock("multiemitter",
new BlockRedstoneMultiEmitter(FabricBlockSettings.of().strength(1.5f, 6.0f)),
ItemGroups.REDSTONE);

public static final BlockEntityType<TileRedstoneEmitter> EMITER_TILE = Registry.register(
Registries.BLOCK_ENTITY_TYPE, new Identifier(TCRedstoneMain.MODID, "emitter"),
FabricBlockEntityTypeBuilder.create(TileRedstoneEmitter::new, RS_EMITTER).build());
public static final BlockEntityType<TileRedstoneMultiEmitter> MULTI_EMITER_TILE = Registry.register(
Registries.BLOCK_ENTITY_TYPE, new Identifier(TCRedstoneMain.MODID, "multiemitter"),
FabricBlockEntityTypeBuilder.create(TileRedstoneMultiEmitter::new, RS_MULTI_EMITTER).build());
public static final BlockEntityType<TileRedstoneEmitter> EMITER_TILE = Registry.register(
Registries.BLOCK_ENTITY_TYPE, new Identifier(TCRedstoneMain.MODID, "emitter"),
FabricBlockEntityTypeBuilder.create(TileRedstoneEmitter::new, RS_EMITTER).build());
public static final BlockEntityType<TileRedstoneMultiEmitter> MULTI_EMITER_TILE =
Registry.register(Registries.BLOCK_ENTITY_TYPE,
new Identifier(TCRedstoneMain.MODID, "multiemitter"),
FabricBlockEntityTypeBuilder
.create(TileRedstoneMultiEmitter::new, RS_MULTI_EMITTER).build());

public static boolean acceptAcceptor(final World level, final BlockPos pos) {
return level.getBlockState(pos).getBlock() instanceof BlockRedstoneAcceptor;
}
public static boolean acceptAcceptor(final World level, final BlockPos pos) {
return level.getBlockState(pos).getBlock() instanceof BlockRedstoneAcceptor;
}

private static Block registerBlock(String name, Block block, RegistryKey<ItemGroup> group) {
registerBlockItem(name, block, group);
return Registry.register(Registries.BLOCK, new Identifier(TCRedstoneMain.MODID, name), block);
}
private static Block registerBlock(final String name, final Block block,
final RegistryKey<ItemGroup> group) {
registerBlockItem(name, block, group);
return Registry.register(Registries.BLOCK, new Identifier(TCRedstoneMain.MODID, name),
block);
}

private static Item registerBlockItem(String name, Block block, RegistryKey<ItemGroup> group) {
Item item = Registry.register(Registries.ITEM, new Identifier(TCRedstoneMain.MODID, name),
new BlockItem(block, new FabricItemSettings()));
ItemGroupEvents.modifyEntriesEvent(group).register(entries -> entries.add(item));
return item;
}
private static Item registerBlockItem(final String name, final Block block,
final RegistryKey<ItemGroup> group) {
Item item = Registry.register(Registries.ITEM, new Identifier(TCRedstoneMain.MODID, name),
new BlockItem(block, new FabricItemSettings()));
ItemGroupEvents.modifyEntriesEvent(group).register(entries -> entries.add(item));
return item;
}

private static Item registerItem(String name, Item item, RegistryKey<ItemGroup> group) {
ItemGroupEvents.modifyEntriesEvent(group).register(entries -> entries.add(item));
return Registry.register(Registries.ITEM, new Identifier(TCRedstoneMain.MODID, name), item);
}
private static Item registerItem(final String name, final Item item,
final RegistryKey<ItemGroup> group) {
ItemGroupEvents.modifyEntriesEvent(group).register(entries -> entries.add(item));
return Registry.register(Registries.ITEM, new Identifier(TCRedstoneMain.MODID, name), item);
}

public static void init() {
}
public static void init() {
}

}
Loading
Loading