Skip to content

Commit

Permalink
Rework build process. Add NeoForge
Browse files Browse the repository at this point in the history
  • Loading branch information
tr7zw committed Dec 11, 2023
1 parent a70fd60 commit e8bc9e6
Show file tree
Hide file tree
Showing 39 changed files with 454 additions and 263 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 17
# to cache gradle files
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
cache-read-only: false
gradle-home-cache-cleanup: true
- name: make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlecw
Expand All @@ -26,6 +32,8 @@ jobs:
path: |
EntityCulling-Fabric/build/libs/*
EntityCulling-Forge/build/libs/*
EntityCulling-Neo/build/libs/*
EntityCulling-Versionless/build/libs/*
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
Expand Down
26 changes: 25 additions & 1 deletion .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,34 @@ jobs:
- name: make gradle wrapper executable
run: chmod +x ./gradlecw
- name: build
run: ./gradlecw build
run: ./gradlecw build -Pbuild.release=true
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
EntityCulling-Fabric/build/libs/*
EntityCulling-Forge/build/libs/*
EntityCulling-Neo/build/libs/*
EntityCulling-Versionless/build/libs/*
- name: Publish-Neo-Curseforge
uses: Kir-Antipov/[email protected]
with:
curseforge-id: 448233
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
loaders: neoforge
name: ${{github.ref_name}} - NeoForge
version-type: beta
files: '*Neo/build/libs/!(*-@(dev|sources|javadoc|all)).jar'
game-versions: 1.20.2
- name: Publish-Neo-Modrinth
uses: Kir-Antipov/[email protected]
with:
modrinth-id: NNAgCjsB
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
loaders: neoforge
name: ${{github.ref_name}} - NeoForge
files: '*Neo/build/libs/!(*-@(dev|sources|javadoc|all)).jar'
game-versions: 1.20.2
- name: Publish-Forge-Curseforge
uses: Kir-Antipov/[email protected]
with:
Expand All @@ -31,6 +52,7 @@ jobs:
name: ${{github.ref_name}} - Forge
version-type: beta
files: '*Forge/build/libs/!(*-@(dev|sources|javadoc|all)).jar'
game-versions: 1.20.2
- name: Publish-Forge-Modrinth
uses: Kir-Antipov/[email protected]
with:
Expand All @@ -39,6 +61,7 @@ jobs:
loaders: forge
name: ${{github.ref_name}} - Forge
files: '*Forge/build/libs/!(*-@(dev|sources|javadoc|all)).jar'
game-versions: 1.20.2
- name: Publish-Fabric
uses: Kir-Antipov/[email protected]
with:
Expand All @@ -49,3 +72,4 @@ jobs:
loaders: fabric
name: ${{github.ref_name}} - Fabric
files: '*Fabric/build/libs/!(*-@(dev|sources|javadoc|all)).jar'
game-versions: 1.20.2
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ logs/
*.properties
gradle/wrapper
VersionShared
UtilityCode
UtilityCode
formatter.xml
10 changes: 5 additions & 5 deletions CurseForge.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ Minecraft skips rendering things that are behind you, so why is it rendering eve

Make sure you pick the correct File depending on Forge/Fabric!

- 1.18.x [⬇️](https://www.curseforge.com/minecraft/mc-mods/entityculling/files/all?filter-status=1&filter-game-version=1738749986%3A73250)
- 1.17.x [⬇️](https://www.curseforge.com/minecraft/mc-mods/entityculling/files/all?filter-status=1&filter-game-version=1738749986%3A73242)
- 1.16.x [⬇️](https://www.curseforge.com/minecraft/mc-mods/entityculling/files/all?filter-status=1&filter-game-version=1738749986%3A70886)
- 1.18.x [⬇️](https://www.curseforge.com/minecraft/mc-mods/entityculling/files/all?filter-status=1&filter-game-version=1738749986%3A73250)
- 1.17.x [⬇️](https://www.curseforge.com/minecraft/mc-mods/entityculling/files/all?filter-status=1&filter-game-version=1738749986%3A73242)
- 1.16.x [⬇️](https://www.curseforge.com/minecraft/mc-mods/entityculling/files/all?filter-status=1&filter-game-version=1738749986%3A70886)
- 1.8.9 [⬇️](https://www.curseforge.com/minecraft/mc-mods/entityculling/files/all?filter-status=1&filter-game-version=1738749986%3A4)

## Note to why it works even with Sodium/Optifine

This has been tested with other mods, Optifine(Optifabric), Iris, and Sodium, in all cases resulting in fps gains in places like Game Server lobbies.
Expand All @@ -49,4 +49,4 @@ No. Since this mod just skips the rendering, mobs will still spawn/move/drop ite

RoboTricker created the original server-side async raytracing occlusion culling implementation for Transport-Pipes.

Support via [![Discord](https://tr7zw.dev/curse/Discord.png)](https://discord.gg/fWtMAkFaZF) or [Github](https://github.com/tr7zw/EntityCulling-Fabric)! The comments are not there to report bugs/crashes/get help.
Support via [![Discord](https://tr7zw.dev/curse/Discord.png)](https://discord.gg/fWtMAkFaZF) or [Github](https://github.com/tr7zw/EntityCulling-Fabric)! The comments are not there to report bugs/crashes/get help.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public void initModloader() {
ClientTickEvents.START_WORLD_TICK.register((event) -> {
this.worldTick();
});
ClientTickEvents.START_CLIENT_TICK.register(e ->
{
ClientTickEvents.START_CLIENT_TICK.register(e -> {
this.clientTick();
});
KeyBindingHelper.registerKeyBinding(keybind);
Expand Down
59 changes: 27 additions & 32 deletions EntityCulling-Fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
{
"schemaVersion": 1,
"id": "entityculling",
"version": "${version}",

"name": "EntityCulling-Fabric",
"description": "This mod uses async path-tracing to hide Tiles/Entities that are not visible.",
"authors": [
"tr7zw"
],
"contact": {
"homepage": "https://github.com/tr7zw/EntityCulling-Fabric",
"sources": "https://github.com/tr7zw/EntityCulling-Fabric",
"issues": "https://github.com/tr7zw/EntityCulling-Fabric/issues"
},

"license": "tr7zw Protective License",
"icon": "assets/entityculling/icon.png",

"environment": "client",
"entrypoints": {
"client": [
"dev.tr7zw.entityculling.EntityCullingMod"
]
},
"mixins": [
"entityculling.mixins.json"
],

"depends": {
"fabric-api": "*",
"minecraft": ">=1.20.2"
}
"schemaVersion": 1,
"id": "${mod_id}",
"version": "${version}",
"name": "${mod_name}",
"description": "${description}",
"authors": [
"${mod_author}"
],
"contact": {
"homepage": "${homepage_url}",
"sources": "${sources_url}",
"issues": "${issues_url}"
},
"license": "${license_name}",
"icon": "assets/${mod_id}/icon.png",
"environment": "CLIENT",
"entrypoints": {
"client": [
"dev.tr7zw.entityculling.EntityCullingMod"
]
},
"mixins": [
"${mod_id}.mixins.json"
],
"depends": {
"minecraft": "${minecraft_version_range_fabric}"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import org.objenesis.Objenesis;
import org.objenesis.ObjenesisStd;

import dev.tr7zw.entityculling.access.Cullable;
import dev.tr7zw.entityculling.access.EntityRendererInter;
import dev.tr7zw.entityculling.versionless.access.Cullable;
import net.minecraft.SharedConstants;
import net.minecraft.client.gui.components.DebugScreenOverlay;
import net.minecraft.client.multiplayer.ClientLevel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ public class EntityCullingBootstrap {
public EntityCullingBootstrap() {
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> EntityCullingMod::new);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;


public class EntityCullingMod extends EntityCullingModBase {

public EntityCullingMod() {
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
}
Expand All @@ -26,22 +25,22 @@ private void setup(final FMLCommonSetupEvent event) {
onInitialize();
}


@Override
public void initModloader() {
Minecraft.getInstance().options.keyMappings = ArrayUtils.add(Minecraft.getInstance().options.keyMappings, keybind);
Minecraft.getInstance().options.keyMappings = ArrayUtils.add(Minecraft.getInstance().options.keyMappings,
keybind);
MinecraftForge.EVENT_BUS.addListener(this::doClientTick);
MinecraftForge.EVENT_BUS.addListener(this::doWorldTick);
ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class,
() -> new IExtensionPoint.DisplayTest(
() -> ModLoadingContext.get().getActiveContainer().getModInfo().getVersion().toString(),
(remote, isServer) -> true));
}

private void doClientTick(ClientTickEvent event) {
this.clientTick();
}

private void doWorldTick(LevelTickEvent event) {
this.worldTick();
}
Expand All @@ -50,5 +49,5 @@ private void doWorldTick(LevelTickEvent event) {
public AABB setupAABB(BlockEntity entity, BlockPos pos) {
return entity.getRenderBoundingBox();
}

}
31 changes: 14 additions & 17 deletions EntityCulling-Forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
modLoader="javafml"
loaderVersion="[35,)"
license="tr7zw Protective License"
loaderVersion="${loader_version_range_forge}"
issueTrackerURL="${issues_url}"

license="${license_name}"
[[mods]]
modId="entityculling"
version="1.6.2"
displayName="EntityCulling"
authors="tr7zw"
modId="${mod_id}"
version="${version}"
displayName="${mod_name}"
displayURL="${homepage_url}"
logoFile="assets/${mod_id}/icon.png"
authors="${mod_author}"
description='''
Using async raytracing to hide Tile-/Entities that are hidden behind solid blocks.
${description}
'''
[[dependencies.entityculling]] #optional
modId="forge"
mandatory=true
versionRange="[35,)"
ordering="NONE"
side="CLIENT"
# Here's another dependency
[[dependencies.entityculling]]
[[dependencies.${mod_id}]]
modId="minecraft"
mandatory=true
versionRange="[1.20.2,)"
versionRange="${minecraft_version_range_forge}"
ordering="NONE"
side="CLIENT"
side="BOTH"
8 changes: 4 additions & 4 deletions EntityCulling-Forge/src/main/resources/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"pack": {
"description": "entityculling resources",
"pack_format": 15
}
"pack": {
"description": "Resources for ${mod_name}",
"pack_format": ${pack_format_number}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package dev.tr7zw.entityculling;

import net.neoforged.fml.common.Mod;
import net.neoforged.fml.loading.FMLEnvironment;

/**
* Stupid Forge bootstrap class to work around their removal of sidedness
*
* @author tr7zw
*
*/
@Mod("entityculling")
public class EntityCullingBootstrap {

public EntityCullingBootstrap() {
if (FMLEnvironment.dist.isClient()) {
new EntityCullingMod();
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package dev.tr7zw.entityculling;

import org.apache.commons.lang3.ArrayUtils;

import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.phys.AABB;
import net.neoforged.fml.IExtensionPoint;
import net.neoforged.fml.ModLoadingContext;
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
import net.neoforged.fml.javafmlmod.FMLJavaModLoadingContext;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.event.TickEvent.ClientTickEvent;
import net.neoforged.neoforge.event.TickEvent.LevelTickEvent;

public class EntityCullingMod extends EntityCullingModBase {

public EntityCullingMod() {
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
}

private void setup(final FMLCommonSetupEvent event) {
onInitialize();
}

@Override
public void initModloader() {
Minecraft.getInstance().options.keyMappings = ArrayUtils.add(Minecraft.getInstance().options.keyMappings,
keybind);
NeoForge.EVENT_BUS.addListener(this::doClientTick);
NeoForge.EVENT_BUS.addListener(this::doWorldTick);
ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class,
() -> new IExtensionPoint.DisplayTest(
() -> ModLoadingContext.get().getActiveContainer().getModInfo().getVersion().toString(),
(remote, isServer) -> true));
}

private void doClientTick(ClientTickEvent event) {
this.clientTick();
}

private void doWorldTick(LevelTickEvent event) {
this.worldTick();
}

@Override
public AABB setupAABB(BlockEntity entity, BlockPos pos) {
return new AABB(pos);
}

}
28 changes: 28 additions & 0 deletions EntityCulling-Neo/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
modLoader="javafml"
loaderVersion="${loader_version_range_neoforge}"
issueTrackerURL="${issues_url}"

license="${license_name}"
[[mods]]
modId="${mod_id}"
version="${version}"
displayName="${mod_name}"
displayURL="${homepage_url}"
logoFile="assets/${mod_id}/icon.png"
authors="${mod_author}"
description='''
${description}
'''
displayTest="IGNORE_ALL_VERSION"
[[dependencies.${mod_id}]]
modId="minecraft"
mandatory=true
versionRange="${minecraft_version_range_forge}"
ordering="NONE"
side="BOTH"
[[dependencies.${mod_id}]]
modId="neoforge"
mandatory=true
versionRange="${neo_version_range}"
ordering="NONE"
side="BOTH"
Loading

0 comments on commit e8bc9e6

Please sign in to comment.