Skip to content

Commit

Permalink
update to 1.19
Browse files Browse the repository at this point in the history
  • Loading branch information
PinkGoosik committed Jun 8, 2022
1 parent 03aaeff commit 318f0a0
Show file tree
Hide file tree
Showing 17 changed files with 87 additions and 64 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/publish-curseforge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,19 @@ jobs:
- name: Build artifacts
run: ./gradlew build
- name: publish artifacts
uses: Kir-Antipov/mc-publish@v2.1
uses: Kir-Antipov/mc-publish@v3.0
with:
curseforge-id: 521126
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}

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

version-type: beta
loaders: |
fabric
game-versions: |
1.18.2
1.19
dependencies: |
fabric-api | depends | *
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/publish-modrinth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,19 @@ jobs:
- name: Build artifacts
run: ./gradlew build
- name: publish artifacts
uses: Kir-Antipov/mc-publish@v2.1
uses: Kir-Antipov/mc-publish@v3.0
with:
modrinth-id: rI0hvYcd
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}

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

version-type: beta
loaders: |
fabric
game-versions: |
1.18.2
1.19
dependencies: |
fabric-api | depends | *
Expand Down
15 changes: 8 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id "fabric-loom" version "0.12-SNAPSHOT"
id "io.github.juuxel.loom-quiltflower" version "1.7.2"
id "io.github.p03w.machete" version "1.0.11"
id "io.github.p03w.machete" version "1.1.2"
}

archivesBaseName = project.archives_base_name
Expand All @@ -13,6 +13,7 @@ repositories {
url "https://api.modrinth.com/maven"
content { includeGroup "maven.modrinth" }
}
maven { url "https://maven.terraformersmc.com" } //modmenu
maven { url "https://maven.parchmentmc.org" } //parchment
maven { url "https://maven.shedaniel.me" } //cloth-config
maven { url "https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1" } //dev-auth
Expand All @@ -22,19 +23,19 @@ dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-1.18.2:2022.05.02@zip")
// parchment("org.parchmentmc.data:parchment-1.18.2:2022.05.02@zip")
}
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "maven.modrinth:modmenu:3.2.2"

modApi("me.shedaniel.cloth:cloth-config-fabric:6.2.62") {
modImplementation "com.terraformersmc:modmenu:4.0.0"
modImplementation("me.shedaniel.cloth:cloth-config-fabric:7.0.65") {
exclude(group: "net.fabricmc.fabric-api")
exclude(group: "com.terraformersmc")
}

modLocalRuntime "maven.modrinth:lazydfu:0.1.2"
modLocalRuntime "maven.modrinth:ferrite-core:4.2.0"
modLocalRuntime "maven.modrinth:starlight:1.0.2+1.18.2"
// modLocalRuntime "maven.modrinth:ferrite-core:4.2.0"
modLocalRuntime "maven.modrinth:starlight:1.1.0+1.19"
modLocalRuntime "me.djtheredstoner:DevAuth-fabric:1.0.0"
}

Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ org.gradle.jvmargs = -Xmx1G
org.gradle.parallel = true

# Mod Properties
mod_version = 0.4.2
mod_version = 0.5.0
maven_group = ru.pinkgoosik
archives_base_name = visuality

# Dependencies
minecraft_version = 1.18.2
loader_version = 0.14.5
fabric_version = 0.51.1+1.18.2
minecraft_version = 1.19
loader_version = 0.14.6
fabric_version = 0.55.1+1.19
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 @@ -20,7 +20,7 @@ public void onInitializeClient() {
ShinyBlockRegistry.reload();
}

public static ResourceLocation locate(String path) {
public static ResourceLocation id(String path) {
return new ResourceLocation(MOD_ID, path);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public class AbstractVisualityConfig {
public ArrayList<String> shinyBlockEntries = VisualityConfig.DEFAULT_SHINY_BLOCKS;

public static class WaterCirclesConfigOption {
public int density = 10;
public int radius = 16;
public boolean enabled = true;
public boolean colored = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import me.shedaniel.autoconfig.serializer.GsonConfigSerializer;
import me.shedaniel.clothconfig2.api.ConfigCategory;
import me.shedaniel.clothconfig2.api.ConfigEntryBuilder;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.network.chat.Component;
import ru.pinkgoosik.visuality.VisualityMod;
import ru.pinkgoosik.visuality.registry.HitParticleRegistry;
import ru.pinkgoosik.visuality.registry.ShinyArmorRegistry;
Expand All @@ -22,7 +22,7 @@ public class VisualityClothConfig extends AbstractVisualityConfig implements Con
public static ConfigScreenFactory<?> getModConfigScreenFactory() {

return parent -> {
ConfigBuilder builder = ConfigBuilder.create()
ConfigBuilder configBuilder = ConfigBuilder.create()
.setParentScreen(parent)
.setTitle(text("title"))
.setSavingRunnable(() -> {
Expand All @@ -31,80 +31,90 @@ public static ConfigScreenFactory<?> getModConfigScreenFactory() {
ShinyBlockRegistry.reload();
});

ConfigCategory general = builder.getOrCreateCategory(text("general"));
ConfigEntryBuilder entryBuilder = builder.entryBuilder();
ConfigCategory general = configBuilder.getOrCreateCategory(text("general"));
ConfigEntryBuilder entryBuilder = configBuilder.entryBuilder();
VisualityClothConfig.setupEntries(general, entryBuilder);

return builder.build();
return configBuilder.build();
};
}

public static void setupEntries(ConfigCategory category, ConfigEntryBuilder builder) {
public static void setupEntries(ConfigCategory category, ConfigEntryBuilder entryBuilder) {
var config = VisualityMod.config;
category.addEntry(builder.startBooleanToggle(text("option.slime"), config.slimeEnabled)
category.addEntry(entryBuilder.startBooleanToggle(text("option.slime"), config.slimeEnabled)
.setDefaultValue(true)
.setSaveConsumer(newValue -> config.slimeEnabled = newValue)
.build());

category.addEntry(builder.startBooleanToggle(text("option.charge"), config.chargeEnabled)
category.addEntry(entryBuilder.startBooleanToggle(text("option.charge"), config.chargeEnabled)
.setDefaultValue(true)
.setSaveConsumer(newValue -> config.chargeEnabled = newValue)
.build());

category.addEntry(builder.startBooleanToggle(text("option.sparkle"), config.sparkleEnabled)
category.addEntry(entryBuilder.startBooleanToggle(text("option.sparkle"), config.sparkleEnabled)
.setDefaultValue(true)
.setSaveConsumer(newValue -> config.sparkleEnabled = newValue)
.build());

category.addEntry(builder.startBooleanToggle(text("option.soul"), config.soulEnabled)
category.addEntry(entryBuilder.startBooleanToggle(text("option.soul"), config.soulEnabled)
.setDefaultValue(true)
.setSaveConsumer(newValue -> config.soulEnabled = newValue)
.build());

category.addEntry(builder.startBooleanToggle(text("option.waterCircle"), config.waterCircles.enabled)
category.addEntry(entryBuilder.startBooleanToggle(text("option.waterCircle"), config.waterCircles.enabled)
.setDefaultValue(true)
.setSaveConsumer(newValue -> config.waterCircles.enabled = newValue)
.build());

category.addEntry(builder.startBooleanToggle(text("option.waterCircle.colored"), config.waterCircles.colored)
category.addEntry(entryBuilder.startBooleanToggle(text("option.waterCircle.colored"), config.waterCircles.colored)
.setDefaultValue(true)
.setSaveConsumer(newValue -> config.waterCircles.colored = newValue)
.build());

category.addEntry(builder.startBooleanToggle(text("option.hitParticles"), config.hitParticlesEnabled)
category.addEntry(entryBuilder.startIntField(text("option.waterCircle.density"), config.waterCircles.density)
.setDefaultValue(10)
.setSaveConsumer(newValue -> config.waterCircles.density = newValue)
.build());

category.addEntry(entryBuilder.startIntField(text("option.waterCircle.radius"), config.waterCircles.radius)
.setDefaultValue(16)
.setSaveConsumer(newValue -> config.waterCircles.radius = newValue)
.build());

category.addEntry(entryBuilder.startBooleanToggle(text("option.hitParticles"), config.hitParticlesEnabled)
.setDefaultValue(true)
.setSaveConsumer(newValue -> config.hitParticlesEnabled = newValue)
.build());

category.addEntry(builder.startStrList(text("option.hitParticles.entries"), config.hitParticleEntries)
category.addEntry(entryBuilder.startStrList(text("option.hitParticles.entries"), config.hitParticleEntries)
.setDefaultValue(VisualityConfig.DEFAULT_HIT_PARTICLES)
.setSaveConsumer(newValue -> config.hitParticleEntries = (ArrayList<String>) newValue)
.build());

category.addEntry(builder.startBooleanToggle(text("option.shinyArmor"), config.shinyArmorEnabled)
category.addEntry(entryBuilder.startBooleanToggle(text("option.shinyArmor"), config.shinyArmorEnabled)
.setDefaultValue(true)
.setSaveConsumer(newValue -> config.shinyArmorEnabled = newValue)
.build());

category.addEntry(builder.startStrList(text("option.shinyArmor.entries"), config.shinyArmorEntries)
category.addEntry(entryBuilder.startStrList(text("option.shinyArmor.entries"), config.shinyArmorEntries)
.setDefaultValue(VisualityConfig.DEFAULT_SHINY_ARMOR)
.setSaveConsumer(newValue -> config.shinyArmorEntries = (ArrayList<String>) newValue)
.build());

category.addEntry(builder.startBooleanToggle(text("option.shinyBlocks"), config.shinyBlocksEnabled)
category.addEntry(entryBuilder.startBooleanToggle(text("option.shinyBlocks"), config.shinyBlocksEnabled)
.setDefaultValue(true)
.setSaveConsumer(newValue -> config.shinyBlocksEnabled = newValue)
.build());

category.addEntry(builder.startStrList(text("option.shinyBlocks.entries"), config.shinyBlockEntries)
category.addEntry(entryBuilder.startStrList(text("option.shinyBlocks.entries"), config.shinyBlockEntries)
.setDefaultValue(VisualityConfig.DEFAULT_SHINY_BLOCKS)
.setSaveConsumer(newValue -> config.shinyBlockEntries = (ArrayList<String>) newValue)
.build());

}

private static TranslatableComponent text(String key) {
return new TranslatableComponent("config.visuality." + key);
private static Component text(String key) {
return Component.translatable("config.visuality." + key);
}

public static void init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,45 @@
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.levelgen.Heightmap;
import ru.pinkgoosik.visuality.VisualityMod;
import ru.pinkgoosik.visuality.config.AbstractVisualityConfig;
import ru.pinkgoosik.visuality.registry.VisualityParticles;
import ru.pinkgoosik.visuality.util.ParticleUtils;

import java.util.Random;

public class CirclesOnWaterEvent {
static final Random random = new Random();
static final AbstractVisualityConfig config = VisualityMod.config;

public static void onTick(ClientLevel world) {
var client = Minecraft.getInstance();

if (!VisualityMod.config.waterCircles.enabled) return;
if (!config.waterCircles.enabled) return;
if(client.isPaused()) return;
if (client.options.particles == ParticleStatus.MINIMAL) return;
if (client.options.particles().get() == ParticleStatus.MINIMAL) return;
AbstractClientPlayer player = client.player;
if(player == null) return;
if(player.isUnderWater() || !Level.OVERWORLD.equals(world.dimension())) return;
if(!world.isRaining()) return;
Biome biome = world.getBiome(player.getOnPos()).value();
if (!(biome.getPrecipitation().equals(Biome.Precipitation.RAIN)) || !(biome.warmEnoughToRain(player.getOnPos()))) return;

for (int i = 0; i<= random.nextInt(10) + 5; i++) {
int x = random.nextInt(15) - 7;
int z = random.nextInt(15) - 7;
int density = config.waterCircles.density;
int radius = config.waterCircles.radius;

if(density <= 0 || radius <= 0) return;

int randomDensity = random.nextInt(density) + (density / 2);

for (int i = 0; i <= randomDensity; i++) {
int x = random.nextInt(radius) - (radius / 2);
int z = random.nextInt(radius) - (radius / 2);
BlockPos playerPos = new BlockPos((int)player.getX() + x, (int)player.getY(), (int)player.getZ() + z);
BlockPos pos = world.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, playerPos);

if (world.getBlockState(pos.below()).is(Blocks.WATER) && world.getBlockState(pos).isAir()) {
if(world.getFluidState(pos.below()).getAmount() == 8) {

int color;
if(VisualityMod.config.waterCircles.colored) {
color = biome.getWaterColor();
}
else color = 0;

int color = config.waterCircles.colored ? biome.getWaterColor() : 0;
ParticleUtils.add(world, VisualityParticles.WATER_CIRCLE, pos.getX() + random.nextDouble(), pos.getY() + 0.05D, pos.getZ() + random.nextDouble(), color);
}
}
Expand Down
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.util.RandomSource;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.AmethystBlock;
import net.minecraft.world.level.block.AmethystClusterBlock;
Expand All @@ -15,8 +16,6 @@
import ru.pinkgoosik.visuality.registry.VisualityParticles;
import ru.pinkgoosik.visuality.util.ParticleUtils;

import java.util.Random;

@Mixin(AmethystClusterBlock.class)
public abstract class AmethystClusterBlockMixin extends AmethystBlock implements SimpleWaterloggedBlock {
private int visuality$height;
Expand All @@ -31,7 +30,7 @@ public void onInit(int i, int j, Properties props, CallbackInfo ci) {
}

@Override
public void animateTick(BlockState state, Level level, BlockPos pos, Random random) {
public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource random) {
super.animateTick(state, level, pos, random);
if(VisualityMod.config.sparkleEnabled) {
if(state.getBlock() instanceof AmethystClusterBlock && visuality$height > 5 && random.nextFloat() > 0.5) {
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/ru/pinkgoosik/visuality/mixin/BlockMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.Level;
Expand All @@ -18,8 +19,6 @@
import ru.pinkgoosik.visuality.registry.VisualityParticles;
import ru.pinkgoosik.visuality.util.ParticleUtils;

import java.util.Random;

@Mixin(Block.class)
public abstract class BlockMixin extends BlockBehaviour implements ItemLike {

Expand All @@ -42,7 +41,7 @@ void fallOn(Level level, BlockState state, BlockPos pos, Entity entity, float f,
}

@Inject(method = "animateTick", at = @At("TAIL"))
void animateTick(BlockState state, Level level, BlockPos pos, Random random, CallbackInfo ci) {
void animateTick(BlockState state, Level level, BlockPos pos, RandomSource random, CallbackInfo ci) {
if(VisualityMod.config.soulEnabled) {
if(state.is(BlockTags.WITHER_SUMMON_BASE_BLOCKS)) {
if(level.getBlockState(pos.above()).isAir()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ private void tick(CallbackInfo ci) {
if(!client.options.getCameraType().isFirstPerson()) {
spawnSparkles(shinyLevel);
}
}else {
}
else {
spawnSparkles(shinyLevel);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ void addParticle(Level world, ParticleOptions particle, double x, double y, doub
private void spawnSlimeParticle(double x, double y, double z) {
if(getEntityData().get(ID_SIZE) == 1) {
ParticleUtils.add(level, VisualityParticles.SMALL_SLIME_BLOB, x, y, z, SlimeColors.VANILLA, 1.0D);
}else if(getEntityData().get(ID_SIZE) == 2) {
}
else if(getEntityData().get(ID_SIZE) == 2) {
ParticleUtils.add(level, VisualityParticles.MEDIUM_SLIME_BLOB, x, y, z, SlimeColors.VANILLA, 1.0D);
}else {
}
else {
ParticleUtils.add(level, VisualityParticles.BIG_SLIME_BLOB, x, y, z, SlimeColors.VANILLA, 2.0D);
}
}
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.locate(name), FabricParticleTypes.simple());
return Registry.register(Registry.PARTICLE_TYPE, VisualityMod.id(name), FabricParticleTypes.simple());
}
}
Loading

0 comments on commit 318f0a0

Please sign in to comment.