Skip to content

Commit

Permalink
improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
PinkGoosik committed Feb 17, 2022
1 parent cf1eb9f commit 72d8691
Show file tree
Hide file tree
Showing 12 changed files with 174 additions and 38 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/publish-curseforge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: publish-curseforge

on:
release:
types:
- published

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Change wrapper permissions
run: chmod +x ./gradlew
- name: Build artifacts
run: ./gradlew build
- name: publish artifacts
uses: Kir-Antipov/[email protected]
with:
curseforge-id: 521126
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}

files-primary: build/libs/!(*-@(dev|sources)).jar

version-type: beta
loaders: |
fabric
game-versions: |
1.18.1
1.18
dependencies: |
fabric-api | depends | *
java: |
17
retry-attempts: 2
retry-delay: 10000
26 changes: 26 additions & 0 deletions .github/workflows/publish-github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: publish-github

on:
release:
types:
- published

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Change wrapper permissions
run: chmod +x ./gradlew
- name: Build artifacts
run: ./gradlew build
- name: Upload assets to GitHub
uses: AButler/[email protected]
with:
files: 'build/libs/*'
repo-token: ${{ secrets.GH_TOKEN }}
28 changes: 28 additions & 0 deletions .github/workflows/publish-maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: publish-maven

on:
release:
types:
- published

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-20.04
container:
image: eclipse-temurin:17-jdk
options: --user root
steps:
- run: apt update && apt install git -y && git --version
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Change wrapper permissions
run: chmod +x ./gradlew
- uses: gradle/wrapper-validation-action@v1
- run: ./gradlew build publish --stacktrace
env:
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASS: ${{ secrets.MAVEN_PASS }}
43 changes: 43 additions & 0 deletions .github/workflows/publish-modrinth.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: publish-modrinth

on:
release:
types:
- published

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Change wrapper permissions
run: chmod +x ./gradlew
- name: Build artifacts
run: ./gradlew build
- name: publish artifacts
uses: Kir-Antipov/[email protected]
with:
modrinth-id: rI0hvYcd
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}

files-primary: build/libs/!(*-@(dev|sources)).jar

version-type: beta
loaders: |
fabric
game-versions: |
1.18.1
1.18
dependencies: |
fabric-api | depends | *
java: |
17
retry-attempts: 2
retry-delay: 10000
16 changes: 8 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
plugins {
id 'fabric-loom' version '0.10-SNAPSHOT'
id 'fabric-loom' version '0.11-SNAPSHOT'
id 'maven-publish'
id 'io.github.juuxel.loom-quiltflower-mini' version '1.2.1'
id 'io.github.juuxel.loom-quiltflower' version '1.6.0'
}

sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17

archivesBaseName = project.archives_base_name
version = project.mod_version + "-" + project.minecraft_version + "-fabric"
version = project.mod_version
group = project.maven_group

repositories {
maven { url "https://maven.gegy.dev" } //databreaker
maven { url "https://cursemaven.com" }
maven { url "https://maven.pinkgoosik.ru" } //cosmetica, goosik-config
maven { url "https://maven.terraformersmc.com" } //modmenu
maven { url "https://maven.parchmentmc.org" } //parchment
Expand All @@ -26,11 +26,11 @@ dependencies {
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

include modImplementation ("ru.pinkgoosik:cosmetica:0.3.2-1.17.1-fabric")
include modImplementation ("ru.pinkgoosik:goosik-config:0.2.0-1.17.1-fabric")

modRuntimeOnly "supercoder79:databreaker:0.2.8"
modRuntimeOnly "com.terraformersmc:modmenu:3.0.1"
modRuntimeOnly "curse.maven:lazydfu-433518:3209972"
modRuntimeOnly "curse.maven:ferritecore-fabric-459857:3550048"
}

processResources {
Expand Down Expand Up @@ -64,8 +64,8 @@ publishing {
maven {
url "https://maven.pinkgoosik.ru/"
credentials {
username System.getenv("MAVEN_REPO_USER")
password System.getenv("MAVEN_REPO_PASS")
username System.getenv("MAVEN_USER")
password System.getenv("MAVEN_PASS")
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/versions.html
minecraft_version=1.18
minecraft_version=1.18.1
yarn_mappings=1.18+build.1
loader_version=0.12.8
loader_version=0.13.2

# Mod Properties
mod_version = 0.4.0
mod_version = 0.4.1
maven_group = ru.pinkgoosik
archives_base_name = visuality

# Dependencies
fabric_version=0.43.1+1.18
fabric_version=0.46.4+1.18
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.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion src/main/java/ru/pinkgoosik/visuality/VisualityMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void onInitializeClient() {
ShinyBlockRegistry.reload();
}

public static ResourceLocation newId(String path) {
public static ResourceLocation locate(String path) {
return new ResourceLocation(MOD_ID, path);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@

@Mixin(AmethystClusterBlock.class)
public abstract class AmethystClusterBlockMixin extends AmethystBlock implements SimpleWaterloggedBlock {
private int hgHeight;
private int visuality$height;

protected AmethystClusterBlockMixin(BlockBehaviour.Properties props) {
super(props);
}

@Inject(method = "<init>", at=@At("RETURN"))
public void onInit(int i, int j, Properties props, CallbackInfo ci) {
this.hgHeight = i;
this.visuality$height = i;
}

@Override
public void animateTick(BlockState state, Level level, BlockPos pos, Random random) {
super.animateTick(state, level, pos, random);
if(VisualityMod.CONFIG.getBoolean("crystal_sparkle")){
if(state.getBlock() instanceof AmethystClusterBlock && hgHeight > 5 && random.nextFloat() > 0.5) {
if(VisualityMod.CONFIG.getBoolean("crystal_sparkle")) {
if(state.getBlock() instanceof AmethystClusterBlock && visuality$height > 5 && random.nextFloat() > 0.5) {
double x = pos.getX() + random.nextDouble();
double y = pos.getY() + random.nextDouble();
double z = pos.getZ() + random.nextDouble();
Expand Down
30 changes: 13 additions & 17 deletions src/main/java/ru/pinkgoosik/visuality/mixin/BlockMixin.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ru.pinkgoosik.visuality.mixin;

import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.ItemLike;
Expand Down Expand Up @@ -55,25 +56,20 @@ void animateTick(BlockState state, Level level, BlockPos pos, Random random, Cal
}
}
if (VisualityMod.CONFIG.getBoolean("enabled", "shiny_blocks")) {
if(ShinyBlockRegistry.ENTRIES.contains(this) && visuality$isAirAttached(level, pos)) {
if (random.nextFloat() > 0.4) {
double x = pos.getX() + random.nextFloat() * 2 - 0.5;
double y = pos.getY() + random.nextFloat() + 0.5;
double z = pos.getZ() + random.nextFloat() * 2 - 0.5;
ParticleUtils.add(level, VisualityParticles.SPARKLE, x, y, z);
if(ShinyBlockRegistry.ENTRIES.contains(this)) {
for(Direction direction : Direction.values()) {
BlockPos blockPos = pos.relative(direction);
if (!level.getBlockState(blockPos).isSolidRender(level, blockPos)) {
if (random.nextFloat() > 0.8) {
Direction.Axis axis = direction.getAxis();
double x = axis == Direction.Axis.X ? 0.5 + 0.5625 * (double)direction.getStepX() : (double)random.nextFloat();
double y = axis == Direction.Axis.Y ? 0.5 + 0.5625 * (double)direction.getStepY() : (double)random.nextFloat();
double z = axis == Direction.Axis.Z ? 0.5 + 0.5625 * (double)direction.getStepZ() : (double)random.nextFloat();
ParticleUtils.add(level, VisualityParticles.SPARKLE, (double)pos.getX() + x, (double)pos.getY() + y, (double)pos.getZ() + z);
}
}
}
}
}
}

private boolean visuality$isAirAttached(Level level, BlockPos pos) {
boolean bl;
if(level.getBlockState(pos.above()).isAir()) bl = true;
else if(level.getBlockState(pos.below()).isAir()) bl = true;
else if(level.getBlockState(pos.north()).isAir()) bl = true;
else if(level.getBlockState(pos.south()).isAir()) bl = true;
else if(level.getBlockState(pos.west()).isAir()) bl = true;
else bl = level.getBlockState(pos.east()).isAir();
return bl;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public LivingEntityMixin(EntityType<?> type, Level world) {
@Inject(method = "tick", at = @At("TAIL"))
private void tick(CallbackInfo ci) {
if(level.isClientSide && ticksDelay != 0) ticksDelay--;
if(level.isClientSide && this.isAlive() && Minecraft.getInstance().player != null && VisualityMod.CONFIG.getBoolean("sparkle")) {
if(level.isClientSide && this.isAlive() && Minecraft.getInstance().player != null && VisualityMod.CONFIG.getBoolean("enabled", "shiny_armor")) {
int shinyLevel = ShinyArmorUtils.getShinyLevel(self);
if(Minecraft.getInstance().player.getUUID().equals(this.getUUID())) {
if(!Minecraft.getInstance().options.getCameraType().isFirstPerson()) {
Expand All @@ -52,7 +52,7 @@ private void tick(CallbackInfo ci) {

@Inject(method = "hurt", at = @At("HEAD"))
void damage(DamageSource source, float amount, CallbackInfoReturnable<Boolean> cir) {
if(level.isClientSide && source.getEntity() instanceof LivingEntity attacker && ticksDelay == 0 && this.isAlive() && VisualityMod.CONFIG.getBoolean("enabled", "hit_particles")){
if(level.isClientSide && source.getEntity() instanceof LivingEntity attacker && ticksDelay == 0 && this.isAlive() && VisualityMod.CONFIG.getBoolean("enabled", "hit_particles")) {
HitParticleRegistry.ENTRIES.forEach(entry -> {
if(this.getType().equals(entry.entity())) {
ticksDelay = 10;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ public static void register() {
}

private static SimpleParticleType add(String name) {
return Registry.register(Registry.PARTICLE_TYPE, VisualityMod.newId(name), FabricParticleTypes.simple());
return Registry.register(Registry.PARTICLE_TYPE, VisualityMod.locate(name), FabricParticleTypes.simple());
}
}

0 comments on commit 72d8691

Please sign in to comment.