Skip to content

Commit

Permalink
2.1.0:
Browse files Browse the repository at this point in the history
- Removed item steerable workaround
- Implemented config version
  • Loading branch information
onebeastchris committed Aug 15, 2024
1 parent 738d0b7 commit b738f5b
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 67 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Hurricane 2.0:
- Added 1.21 support
- Added NeoForge port
Hurricane 2.1:
- Added config version
- Removed the item steerables workaround due to it being implemented natively in Geyser
5 changes: 5 additions & 0 deletions fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ dependencies {
include(libs.configurate.core)
include(libs.geantyref)
include(libs.typesafe)

modLocalRuntime(libs.configurate.hocon)
modLocalRuntime(libs.configurate.core)
modLocalRuntime(libs.geantyref)
modLocalRuntime(libs.typesafe)
}

modrinth {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true

# Mod Properties
version=2.0.0
version=2.1.0
group=net.onebeastchris.hurricane
id=hurricane-modded
14 changes: 9 additions & 5 deletions shared/src/main/java/net/onebeastchris/hurricane/Hurricane.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,22 @@ public abstract class Hurricane {
private final Config config = MixinConfigPlugin.getConfig();

protected void onHurricaneInitialize() {
LOGGER.info("Starting Hurricane...");
if (config.isItemSteerableFix()) {
if (!BedrockUtils.isGeyserOrFloodgateInstalled()) {
LOGGER.warn("Hurricane's fix for item steerable mobs is enabled, but Geyser or Floodgate is not installed! This will not work.");
}
if (config.isBamboo() && !BedrockUtils.isGeyserOrFloodgateInstalled()) {
LOGGER.warn("Bamboo fix is enabled, but Geyser or Floodgate are not found! Without these mods, Hurricane cannot " +
"fix the bamboo lag-back for Bedrock players.");
}

if (config.isBamboo() || config.isPointedDripstone()) {
registerBlockPlaceEvent();
LOGGER.debug("BlockPlaceEvent registered, as the Bamboo or PointedDripstone fix is enabled.");
}

LOGGER.info("Started Hurricane!");

if (Config.shouldWarn) {
LOGGER.warn("Removed the item steerable configuration option, as Geyser now supports it natively! " +
"Please update Geyser if you have not done so already!");
}
}

public abstract void registerBlockPlaceEvent();
Expand Down
50 changes: 31 additions & 19 deletions shared/src/main/java/net/onebeastchris/hurricane/config/Config.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
package net.onebeastchris.hurricane.config;

import lombok.Getter;
import net.onebeastchris.hurricane.util.PlatformUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spongepowered.configurate.CommentedConfigurationNode;
import org.spongepowered.configurate.ConfigurateException;
import org.spongepowered.configurate.NodePath;
import org.spongepowered.configurate.hocon.HoconConfigurationLoader;
import org.spongepowered.configurate.transformation.ConfigurationTransformation;
import org.spongepowered.configurate.transformation.TransformAction;

@Getter
public class Config {
private static final Logger LOGGER = LoggerFactory.getLogger("Hurricane");
private boolean suppressWarnings;
private boolean itemSteerableFix;
private boolean bamboo;
private boolean pointedDripstone;

public static boolean shouldWarn = false;

public static HurricaneConfiguration config;

private final ConfigurationTransformation.Versioned transformer = ConfigurationTransformation.versionedBuilder()
.addVersion(1, zeroToOne())
.build();

public Config() {

if (PlatformUtil.oldConfigPath().toFile().exists()) {
Expand All @@ -32,34 +42,36 @@ Old Hurricane config found (geyserhacks.conf).
.build();

try {
final CommentedConfigurationNode node = loader.load();
config = node.get(HurricaneConfiguration.class);
loader.save(node);
final CommentedConfigurationNode rootNode = loader.load();
config = rootNode.get(HurricaneConfiguration.class);

// Attempt to upgrade our config here if we don't have a version set
var versionNode = rootNode.node("version");
if (versionNode.virtual()) {
shouldWarn = true;
versionNode.set(0); // Add a version config entry, set it to 1
versionNode.comment("The version of the config. DO NOT CHANGE!");

// Remove item steerable workaround
transformer.apply(rootNode);
}

rootNode.set(HurricaneConfiguration.class, config);
loader.save(rootNode);
} catch (ConfigurateException e) {
LOGGER.warn("Could not load config!");
e.printStackTrace();
return;
}

this.itemSteerableFix = config.itemSteerableFix();
this.bamboo = config.collisionFixes().bamboo();
this.pointedDripstone = config.collisionFixes().pointedDripstone();
this.suppressWarnings = config.suppressWarnings();
}

public boolean isItemSteerableFix() {
return itemSteerableFix;
}

public boolean isBamboo() {
return bamboo;
}

public boolean isPointedDripstone() {
return pointedDripstone;
}

public boolean isSuppressWarnings() {
return suppressWarnings;
private ConfigurationTransformation zeroToOne() {
return ConfigurationTransformation.builder()
.addAction(NodePath.path("item-steerable-fix"), TransformAction.remove())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ public final class HurricaneConfiguration {
Caveats: a custom client - Java or Bedrock - could take advantage of no collision and walk right through.
Additionally, placement of these blocks on both platforms may be buggier than usual.""")
private CollisionFixes collisionFixes = new CollisionFixes();
@Comment("""
Fixes Bedrock players being unable to control pigs and striders by controlling their movement serverside.
Java Edition controls pigs and striders on the client end. Bedrock depends on the server.
This option should be relatively safe but does modify server behavior. Geyser or Floodgate must be installed.""")
private boolean itemSteerableFix = true;

@Comment("""
Suppresses "Mismatch in destroy block pos" warnings so they don't spam each time e.g. grass is broken.\s
Expand All @@ -28,10 +23,6 @@ public CollisionFixes collisionFixes() {
return collisionFixes;
}

public boolean itemSteerableFix() {
return itemSteerableFix;
}

public boolean suppressWarnings() {
return suppressWarnings;
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public String getRefMapperConfig() {
@Override
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
return switch (mixinClassName) {
case "net.onebeastchris.hurricane.mixin.EntityMixin" -> config.isItemSteerableFix();
case "net.onebeastchris.hurricane.mixin.BambooBlockMixin" -> config.isBamboo();
case "net.onebeastchris.hurricane.mixin.PointedDripstoneBlockMixin" -> config.isPointedDripstone();
case "net.onebeastchris.hurricane.mixin.ServerPlayerInteractionManagerMixin" -> config.isSuppressWarnings();
Expand Down
3 changes: 1 addition & 2 deletions shared/src/main/resources/hurricane.mixins.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"required": true,
"package": "net.onebeastchris.hurricane.mixin",
"compatibilityLevel": "JAVA_21",
"compatibilityLevel": "JAVA_17",
"mixins": [
"BambooBlockMixin",
"EntityMixin",
"PointedDripstoneBlockMixin",
"ServerPlayerInteractionManagerMixin"
],
Expand Down

0 comments on commit b738f5b

Please sign in to comment.