Skip to content

Commit

Permalink
compat with tfc 1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
eerussianguy committed Dec 3, 2023
1 parent 9e717b4 commit ba919c7
Show file tree
Hide file tree
Showing 148 changed files with 567 additions and 68 deletions.
65 changes: 40 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,52 +9,67 @@ jobs:
main:

runs-on: ubuntu-latest
timeout-minutes: 20

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
- name: Get Version
id: version
uses: actions/github-script@0.4.0
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string
script: |
let ref = '${{ github.ref }}';
return ref.startsWith('refs/tags/v') ? ref.replace('refs/tags/v', '') : 'indev';
- name: Get Version Type
id: version_type
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string
script: |
let version = '${{ steps.version.outputs.result }}';
return version.includes('alpha') ? 'alpha' : (version.includes('beta') ? 'beta' : 'release');
- name: Log Version Info
env:
VERSION: ${{ steps.version.outputs.result }}
VERSION_TYPE: ${{ steps.version_type.outputs.result }}
run: echo "version = $VERSION, type = $VERSION_TYPE"
- name: Build
uses: gradle/gradle-build-action@v2
with:
arguments: build
env:
VERSION: ${{ steps.version.outputs.result }}
- name: Create Release
id: create_release
if: ${{ success() }}
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.version.outputs.result }}
release_name: BetterFoliage v${{ steps.version.outputs.result }}
body: |
Version ${{ steps.version.outputs.result }}
### Changes
- todo: document changes
draft: true
- name: Publish
id: publish
if: ${{ success() }}
uses: gradle/gradle-build-action@v2
if: ${{ steps.version.outputs.result != 'alpha' && success() }}
uses: Kir-Antipov/[email protected]
with:
arguments: curseforge
env:
VERSION: ${{ steps.version.outputs.result }}
CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }}
modrinth-id: czNFt8ef
modrinth-token: ${{ secrets.MODRINTH_API_KEY }}

curseforge-id: 470013
curseforge-token: ${{ secrets.CURSEFORGE_API_KEY }}

github-tag: ${{ github.ref }}
github-draft: true
github-prerelease: false
github-token: ${{ secrets.GITHUB_TOKEN }}

name: BetterFoliageRenewed ${{ steps.version.outputs.result }}
version: ${{ steps.version.outputs.result }}
version-type: ${{ steps.version_type.outputs.result }}
java: 17
loaders: |
forge
neoforge
changelog-file: CHANGELOG.md
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Changes

- This release is compatible with the newly released beta of TerraFirmaCraft for 1.20.1.
48 changes: 15 additions & 33 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
plugins {
id 'com.matthewprenger.cursegradle' version '1.4.0'
id 'idea'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'maven-publish'
}

def envVersion = System.getenv('VERSION')
version = envVersion == null ? '0.0.0-indev' : envVersion
group = 'com.eerussianguy.betterfoliage' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'betterfoliage'

def tfcVersion = 4915584
def patchouliVersion = "1.20.1-81-FORGE"

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

println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
Expand Down Expand Up @@ -38,7 +39,11 @@ minecraft {
sourceSets.main.resources { srcDir 'src/generated/resources' }

dependencies {
minecraft 'net.minecraftforge:forge:1.20.1-47.1.0'
minecraft 'net.minecraftforge:forge:1.20.1-47.1.3'

compileOnly(fg.deobf("curse.maven:tfc-302973:${tfcVersion}"))
//runtimeOnly(fg.deobf("curse.maven:tfc-302973:${tfcVersion}"))
//runtimeOnly(fg.deobf("vazkii.patchouli:Patchouli:$patchouliVersion"))

//runtimeOnly fg.deobf('bop:BiomesOPlenty-1.18.2:16.0.0.109-universal')
//runtimeOnly fg.deobf('tb:TerraBlender-forge-1.18.2:1.1.0.102')
Expand All @@ -48,43 +53,20 @@ repositories {
flatDir {
dir 'libs'
}
maven {
url "https://www.cursemaven.com"
content {
includeGroup("curse.maven")
}
}
maven { url "https://maven.blamejared.com" }
}

// Example for how to get properties into the manifest for reading by the runtime..
jar {
manifest {
attributes([
"Specification-Title": "betterfoliage",
"Specification-Vendor": "eerussianguy",
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": project.version,
"Implementation-Vendor" :"eerussianguy",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}

curseforge {
final String envApiKey = System.getenv('CURSEFORGE_API_KEY');
final String versionType = 'release'

apiKey = envApiKey == null ? 'nope' : envApiKey

project {
id = '470013'
changelog = "[Changelog ${version}](https://github.com/eerussianguy/Better-Foliage/releases/tag/v${project.version})"
changelogType = "markdown"

releaseType = versionType
addGameVersion "1.20.1"

mainArtifact(jar) {
displayName = System.getenv('VERSION').toString().replace('v', '')
}

relations {
optionalDependency 'terrafirmacraft'
}
}
}
16 changes: 13 additions & 3 deletions resources/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,19 @@

def generate(rm: ResourceManager):
vanilla_woods = ('oak', 'acacia', 'dark_oak', 'birch', 'jungle', 'spruce', 'azalea', 'flowering_azalea', 'mangrove', 'cherry')
tfc_woods = ('acacia', 'ash', 'aspen', 'birch', 'blackwood', 'chestnut', 'douglas_fir', 'hickory', 'kapok', 'mangrove',
'maple', 'oak', 'pine', 'rosewood', 'sequoia', 'spruce', 'sycamore', 'white_cedar', 'willow') # palm omitted
tfc_fruits = ('cherry', 'green_apple', 'lemon', 'olive', 'orange', 'peach', 'plum', 'red_apple')
for wood in tfc_woods:
leaves_model(rm, 'tfc:wood/leaves/%s' % wood, 'tfc:block/wood/leaves/%s' % wood, 'tfc:block/wood/leaves/%s_fluff' % wood)
# compat for vexxels pack
leaves_model(rm, 'tfc:wood/leaves/mirrored/%s' % wood, 'tfc:block/wood/leaves/%s' % wood, 'tfc:block/wood/leaves/%s_fluff' % wood)
for fruit in tfc_fruits:
for life in ('', '_fruiting', '_flowering', '_dry'):
leaves_model(rm, 'tfc:plant/%s%s_leaves' % (fruit, life), 'tfc:block/fruit_tree/%s%s_leaves' % (fruit, life), 'betterfoliage:block/tfc/%s%s_leaves_fluff' % (fruit, life), tint_leaves=False)

for wood in vanilla_woods:
leaves_model(rm, 'minecraft:%s_leaves' % wood, 'minecraft:block/%s_leaves' % wood, 'betterfoliage:block/%s_fluff' % wood)
leaves_model(rm, 'minecraft:%s_leaves' % wood, 'minecraft:block/%s_leaves' % wood, 'betterfoliage:block/%s_fluff' % wood, tint_leaves=False if wood == 'cherry' else None)

pad = 0
for flower in range(0, 1 + 1):
Expand Down Expand Up @@ -103,11 +113,11 @@ def block_atlas(rm: ResourceManager, namespace: str):
})


def leaves_model(rm: ResourceManager, model: str, block: str, fluff: str, overlay: str = None):
def leaves_model(rm: ResourceManager, model: str, block: str, fluff: str, overlay: str = None, tint_leaves: bool = None):
rm.custom_block_model(model, 'betterfoliage:leaves', {
'leaves': block,
'fluff': fluff,
'overlay': overlay,
'tintLeaves': False if model == 'minecraft:cherry_leaves' else None
'tintLeaves': tint_leaves
})

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public class BetterFoliage

public static final String MOD_ID = "betterfoliage";

public static boolean LEAVES_DISABLED_BY_MOD = false;

public BetterFoliage()
{
if (FMLEnvironment.dist == Dist.CLIENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ private static void clientSetup(final FMLClientSetupEvent event)
{
ForgeConfig.CLIENT.experimentalForgeLightPipelineEnabled.set(true);
}

if (ModList.get().isLoaded("tfc"))
{
BetterFoliage.LEAVES_DISABLED_BY_MOD = true;
}
}

private static void onModelBake(final ModelEvent.BakingCompleted event)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private static void onClientTick(TickEvent.ClientTickEvent event)
{
Helpers.addParticle(particle, getTextures(ParticleLocation.SNOWBALL, atlas));
}
else if (BFConfig.CLIENT.leaves.get())
else if (BFConfig.CLIENT.leaves.get() && !BetterFoliage.LEAVES_DISABLED_BY_MOD)
{
Holder<Biome> biome = level.getBiome(searchPos);
if (biome.is(BiomeTags.IS_TAIGA))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ private void buildCrosses()
private void buildCross(int ordinal, float x, float y, float z)
{
Map<Direction, BlockElementFace> mapFacesIn = Maps.newEnumMap(Direction.class);
mapFacesIn.put(Direction.NORTH, Helpers.makeTintedFace(Helpers.UV_DEFAULT));
mapFacesIn.put(Direction.SOUTH, Helpers.makeTintedFace(Helpers.UV_DEFAULT));
mapFacesIn.put(Direction.NORTH, tintLeaves ? Helpers.makeTintedFace(Helpers.UV_DEFAULT) : Helpers.makeFace(Helpers.UV_DEFAULT));
mapFacesIn.put(Direction.SOUTH, tintLeaves ? Helpers.makeTintedFace(Helpers.UV_DEFAULT) : Helpers.makeFace(Helpers.UV_DEFAULT));

Vector3f from = new Vector3f(-8f, -8f, 8f);
Vector3f to = new Vector3f(24f, 24f, 8f);
Expand All @@ -110,6 +110,7 @@ private void buildCross(int ordinal, float x, float y, float z)
BlockElement part = new BlockElement(from, to, mapFacesIn, makeRotation(45f), false);
BlockElement partR = new BlockElement(from, to, mapFacesIn, makeRotation(-45f), false);

assert leavesTex != null;
SimpleBakedModel.Builder builder = new SimpleBakedModel.Builder(blockModel, ItemOverrides.EMPTY, false).particle(leavesTex);
Helpers.assembleFaces(builder, part, fluffTex, modelLocation);
Helpers.assembleFaces(builder, partR, fluffTex, modelLocation);
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@ Most changes are configurable via resource pack.
modId="biomesoplenty"
mandatory=false
versionRange="[0,)"
ordering="BEFORE"
ordering="AFTER"
side="BOTH"
[[dependencies.betterfoliage]]
modId="quark"
mandatory=false
versionRange="[0,)"
ordering="BEFORE"
ordering="AFTER"
side="BOTH"
[[dependencies.betterfoliage]]
modId="atmospheric"
mandatory=false
versionRange="[0,)"
ordering="BEFORE"
ordering="AFTER"
side="BOTH"
[[dependencies.betterfoliage]]
modId="tfc"
mandatory=false
versionRange="[0,)"
ordering="BEFORE"
ordering="AFTER"
side="BOTH"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from PIL import Image, ImageDraw, ImageEnhance


tfc_fruits = ('cherry', 'green_apple', 'lemon', 'olive', 'orange', 'peach', 'plum', 'red_apple')


def main():
for fruit in tfc_fruits:
for life in ('', '_fruiting', '_flowering', '_dry'):
fluff('%s%s_leaves' % (fruit, life))

def fluff(file):
img = Image.open(file + '.png').convert('RGBA')
bg = Image.new('RGBA', (32, 32), (0, 0, 0, 0))
for loc in ((0, 0), (16, 0), (0, 16), (16, 16)):
bg.paste(img, loc, img)
rad = int(bg.width / 2)
for x in range(0, bg.width):
for y in range(0, bg.height):
xr = x - 16
yr = y - 16
if xr * xr + yr * yr > rad * rad:
bg.putpixel((x, y), (0, 0, 0, 0))

bg.save(file + '_fluff.png')


if __name__ == '__main__':
main()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"__comment__": "This file was automatically created by mcresources",
"loader": "betterfoliage:leaves",
"leaves": "tfc:block/fruit_tree/cherry_dry_leaves",
"fluff": "betterfoliage:block/tfc/cherry_dry_leaves_fluff",
"tintLeaves": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"__comment__": "This file was automatically created by mcresources",
"loader": "betterfoliage:leaves",
"leaves": "tfc:block/fruit_tree/cherry_flowering_leaves",
"fluff": "betterfoliage:block/tfc/cherry_flowering_leaves_fluff",
"tintLeaves": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"__comment__": "This file was automatically created by mcresources",
"loader": "betterfoliage:leaves",
"leaves": "tfc:block/fruit_tree/cherry_fruiting_leaves",
"fluff": "betterfoliage:block/tfc/cherry_fruiting_leaves_fluff",
"tintLeaves": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"__comment__": "This file was automatically created by mcresources",
"loader": "betterfoliage:leaves",
"leaves": "tfc:block/fruit_tree/cherry_leaves",
"fluff": "betterfoliage:block/tfc/cherry_leaves_fluff",
"tintLeaves": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"__comment__": "This file was automatically created by mcresources",
"loader": "betterfoliage:leaves",
"leaves": "tfc:block/fruit_tree/green_apple_dry_leaves",
"fluff": "betterfoliage:block/tfc/green_apple_dry_leaves_fluff",
"tintLeaves": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"__comment__": "This file was automatically created by mcresources",
"loader": "betterfoliage:leaves",
"leaves": "tfc:block/fruit_tree/green_apple_flowering_leaves",
"fluff": "betterfoliage:block/tfc/green_apple_flowering_leaves_fluff",
"tintLeaves": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"__comment__": "This file was automatically created by mcresources",
"loader": "betterfoliage:leaves",
"leaves": "tfc:block/fruit_tree/green_apple_fruiting_leaves",
"fluff": "betterfoliage:block/tfc/green_apple_fruiting_leaves_fluff",
"tintLeaves": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"__comment__": "This file was automatically created by mcresources",
"loader": "betterfoliage:leaves",
"leaves": "tfc:block/fruit_tree/green_apple_leaves",
"fluff": "betterfoliage:block/tfc/green_apple_leaves_fluff",
"tintLeaves": false
}
Loading

0 comments on commit ba919c7

Please sign in to comment.