Skip to content

Commit

Permalink
Added insanebehaviors config options insaneBehaviorsIncrement and…
Browse files Browse the repository at this point in the history
… `insaneBehaviorsSkipVisitedPoints`, which both alter the behavior of the `insaneBehaviors` iterator.

Added semi-experimental survival carpet rule `VerticalRocketsFromStandStill` with accompanying config `verticalRocketPower`
Bump version to 2.2.0
  • Loading branch information
JoakimThorsen committed Mar 29, 2024
1 parent 3566163 commit 1b9781a
Show file tree
Hide file tree
Showing 12 changed files with 201 additions and 7 deletions.
49 changes: 48 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,57 @@ The command used for the `insaneBehaviors` rule.
* Options `true`, `ops`, `false`, `0`, `1`, `2`, `3`, `4`
* Default value: `ops`

### insaneBehaviorsIncrement
Determines the incrementing behavior of the `insaneBehaviors` rule. If set to `normal`, the counter increments normally until all points of the current resolution have been exhausted, then step to the next resolution.\n`loopCurrentResolution` will instead restart at the beginning of the current resolution.\n`Freeze` will stop both the counter and resolution from incrementing.

* Type: `String`
* Categories: `CREATIVE`, `JOA`
* Options `normal`, `loopCurrentResolution`, `freeze`
* Default value: `normal`

### insaneBehaviorsSkipVisitedPoints
Makes the `insaneBehaviors` rule skip points that coincide with previous resolutions, reducing the overall search space by a fraction that approaches 1/(2^resolution)

* Type: `Boolean`
* Categories: `CREATIVE`, `JOA`
* Options `true`, `false`
* Default value: `false`

### blockTickling
Lets you send manual block and/or shape updates to blocks using a feather item. Shape updates are sent from the block in front of the face you're clicking on. Useful if you're working with update interactions off or with budded blocks.

* Type: `String`
* Categories: `CREATIVE`, `JOA`
* Options `off`, `blockupdates`, `shapeupdates`, `both`
* Default value: `off`
* Default value: `off`

## disableEndermanGriefing
Disables enderman griefing.

* Type: `Boolean`
* Categories: `SURVIVAL`, `JOA`
* Options `true`, `false`
* Default value: `false`

## disableElytraRockets
Disables using rockets with elytra.

* Type: `Boolean`
* Categories: `SURVIVAL`, `JOA`
* Options `true`, `false`
* Default value: `false`

## verticalRocketsFromStandstill
Makes rocket flying only activate while standing on the ground, and makes it only propel you upwards. Disables using rockets while already flying.

* Type: `Boolean`
* Categories: `SURVIVAL`, `JOA`, `EXPERIMENTAL`
* Options `true`, `false`
* Default value: `false`

## verticalRocketPower
The vertical acceleration power used with the `verticalRocketsFromStandstill` rule.

* Type: `Double`
* Categories: `SURVIVAL`, `JOA`, `EXPERIMENTAL`
* Default value: `0.75`
2 changes: 1 addition & 1 deletion common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ if (System.getenv("JITPACK") == "true") {
version = 'v' + fullModVersion
} else {
base.archivesName = project.archives_base_name
version = 'mc' + project.minecraft_version + '-v' + fullModVersion
version = 'mc' + project.minecraft_display_version + '-v' + fullModVersion
}

// See https://youtrack.jetbrains.com/issue/IDEA-296490
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Mod Properties
mod_id=joacarpet
mod_name=JoaCarpet
mod_version=2.1.0
mod_version=2.2.0
maven_group=me.fallenbreath
archives_base_name=joacarpet

Expand Down
28 changes: 27 additions & 1 deletion src/main/java/com/joacarpet/JoaCarpetSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@

//#if MC >= 11900
import carpet.api.settings.Rule;
import carpet.api.settings.Validators;

import static carpet.api.settings.RuleCategory.*;
//#else
//$$ import carpet.settings.Rule;
//$$ import static carpet.settings.RuleCategory.*;
//$$ import carpet.settings.Validator;
//#endif

public class JoaCarpetSettings {
Expand All @@ -47,7 +50,7 @@ public class JoaCarpetSettings {
categories = {CREATIVE, JOA},
//#else
//$$ category = {CREATIVE, JOA},
//$$ desc="Determines the incrementing behavior of the `insaneBehaviors` rule. If set to normal, the counter increments normally until all points of the current resolution have been exhausted, then step to the next resolution.\n`loopCurrentResolution` will instead restart at the beginning of the current resolution.\n`Freeze` will stop both the counter and resolution from incrementing.",
//$$ desc="Determines the incrementing behavior of the `insaneBehaviors` rule. If set to `normal`, the counter increments normally until all points of the current resolution have been exhausted, then step to the next resolution.\n`loopCurrentResolution` will instead restart at the beginning of the current resolution.\n`Freeze` will stop both the counter and resolution from incrementing.",
//#endif
options = {"normal", "loopCurrentResolution", "freeze"}
)
Expand Down Expand Up @@ -107,4 +110,27 @@ public class JoaCarpetSettings {
options = {"true", "false"}
)
public static String disableElytraRockets = "false";

@Rule(
//#if MC >= 11900
categories = {SURVIVAL, JOA, EXPERIMENTAL},
//#else
//$$ category = {SURVIVAL, JOA},
//$$ desc="Makes rocket flying only activate while standing on the ground, and makes it only propel you upwards. Disables using rockets while already flying.",
//#endif
options = {"true", "false"}
)
public static String verticalRocketsFromStandstill = "false";

@Rule(
//#if MC >= 11900
categories = {SURVIVAL, JOA, EXPERIMENTAL},
validators = Validators.NonNegativeNumber.class
//#else
//$$ category = {SURVIVAL, JOA},
//$$ desc="The vertical acceleration power used with the `verticalRocketsFromStandstill` rule.",
//$$ validate = Validator.NONNEGATIVE_NUMBER.class
//#endif
)
public static double verticalRocketPower = 0.75;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* This file is part of the JoaCarpet project, licensed under the
* GNU Lesser General Public License v3.0
*
* Copyright (C) 2024 Joa and contributors
*
* JoaCarpet is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* JoaCarpet is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with JoaCarpet. If not, see <https://www.gnu.org/licenses/>.
*/

package com.joacarpet.mixin.miscSurvival;

import com.google.common.collect.Iterables;
import com.joacarpet.JoaCarpetSettings;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.FireworkRocketItem;
import net.minecraft.world.item.Items;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

import static com.google.common.collect.Iterables.get;

@Mixin(FireworkRocketItem.class)
public class VerticalRocketsFromStandstillMixin1 {

@WrapOperation(
method = "use",
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/player/Player;isFallFlying()Z")
)
private boolean requireOnGround(Player player, Operation<Boolean> original) {
if (JoaCarpetSettings.verticalRocketsFromStandstill.equals("true"))
return player.onGround()
&& Iterables.get(player.getArmorSlots(), 2).is(Items.ELYTRA)
&& Iterables.get(player.getArmorSlots(), 2).getDamageValue() < 431;
return original.call(player);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* This file is part of the JoaCarpet project, licensed under the
* GNU Lesser General Public License v3.0
*
* Copyright (C) 2024 Joa and contributors
*
* JoaCarpet is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* JoaCarpet is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with JoaCarpet. If not, see <https://www.gnu.org/licenses/>.
*/

package com.joacarpet.mixin.miscSurvival;

import com.joacarpet.JoaCarpetSettings;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.FireworkRocketEntity;
import net.minecraft.world.phys.Vec3;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArgs;
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;

@Mixin(FireworkRocketEntity.class)
public class VerticalRocketsFromStandstillMixin2 {

@WrapOperation(
method = "tick",
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;isFallFlying()Z")
)
private boolean ignoreIsFallFlying(LivingEntity livingEntity, Operation<Boolean> original) {
if (JoaCarpetSettings.verticalRocketsFromStandstill.equals("true")){
return true;
}
return original.call(livingEntity);
}

@ModifyArgs(
method = "tick",
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;setDeltaMovement(Lnet/minecraft/world/phys/Vec3;)V")
)
private void rocketStraightUp(Args args) {
if (JoaCarpetSettings.verticalRocketsFromStandstill.equals("true"))
args.set(0, new Vec3(0.0, JoaCarpetSettings.verticalRocketPower, 0.0));
}
}
6 changes: 4 additions & 2 deletions src/main/resources/assets/joacarpet/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"carpet.rule.insaneBehaviors.desc": "Makes the random velocities of droppers and projectiles (as well as both the position and velocity of blocks broken by pistons) systematically iterate through the most extreme values possible, and then repeatedly iterate through all the halfway points in between, in a sense attempting every point in a 3d/5d \"grid\" that slowly increases in resolution.\nFor droppers and projectiles, this setting determines whether the max value corresponds to the old gaussian randomness limits (\"extreme\"), or the limits of the triangular randomness introduced in 1.19 (\"sensible\"). Both settings function the same for blocks being broken by pistons.\nFor the `/insanebehaviors <reset/getstate/setstate>` command, see `/carpet commandInsaneBehaviors`.\nDo note that insaneBehaviors works on a global iterator: any triggering event will step through an iteration from all other insaneBehaviors events, too.",
"carpet.rule.insaneBehaviorsSkipVisitedPoints.desc": "Makes the `insaneBehaviors` rule skip points that coincide with previous resolutions, reducing the overall search space by a fraction that approaches 1/(2^resolution)",
"carpet.rule.insaneBehaviorsIncrement.desc": "Determines the incrementing behavior of the `insaneBehaviors` rule. If set to normal, the counter increments normally until all points of the current resolution have been exhausted, then step to the next resolution.\n`loopCurrentResolution` will instead restart at the beginning of the current resolution.\n`Freeze` will stop both the counter and resolution from incrementing.",
"carpet.rule.insaneBehaviorsIncrement.desc": "Determines the incrementing behavior of the `insaneBehaviors` rule. If set to `normal`, the counter increments normally until all points of the current resolution have been exhausted, then step to the next resolution.\n`loopCurrentResolution` will instead restart at the beginning of the current resolution.\n`Freeze` will stop both the counter and resolution from incrementing.",
"carpet.rule.commandInsaneBehaviors.desc": "The command used for the `insaneBehaviors` rule.\n\"reset\" sets the `resolution` and `counter` back to the default values. \"getstate\" and \"setstate\" are used to manually read and write the current iteration state.",
"carpet.rule.commandBlockTickling.desc": "Controls who can use the `/blocktickling` command, which lets you send manual block and/or shape updates to blocks using a feather item. Updates are sent from the block in front of the face you're clicking on. Useful if you're working with budded blocks, with /carpet interactionUpdates off, or with intricarpet's /interaction command.",
"carpet.rule.disableEndermanGriefing.desc": "Disables enderman griefing.",
"carpet.rule.disableElytraRockets.desc": "Disables using rockets with elytra."
"carpet.rule.disableElytraRockets.desc": "Disables using rockets with elytra.",
"carpet.rule.verticalRocketsFromStandstill.desc": "Makes rocket flying only activate while standing on the ground, and makes it only propel you upwards. Disables using rockets while already flying.\nOnly works in singleplayer, or with JoaCarpet installed both serverside and clientside.",
"carpet.rule.verticalRocketPower.desc": "The vertical acceleration power used with the `verticalRocketsFromStandstill` rule."
}
4 changes: 3 additions & 1 deletion src/main/resources/joacarpet.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"insaneBehaviors.PistonBaseBlockMixin",
"insaneBehaviors.ProjectileMixin",
"miscSurvival.DisableEndermanGriefingMixin",
"miscSurvival.DisableElytraRocketsMixin"
"miscSurvival.DisableElytraRocketsMixin",
"miscSurvival.VerticalRocketsFromStandstillMixin1",
"miscSurvival.VerticalRocketsFromStandstillMixin2"
],
"client": [
],
Expand Down
3 changes: 3 additions & 0 deletions versions/1.17.1/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
minecraft_version=1.17.1
yarn_mappings=1.17.1+build.65

# Jar build filename version
minecraft_display_version=1.17.x

# Fabric Mod Metadata
minecraft_dependency=1.17.x

Expand Down
3 changes: 3 additions & 0 deletions versions/1.18.2/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
minecraft_version=1.18.2
yarn_mappings=1.18.2+build.4

# Jar build filename version
minecraft_display_version=1.18.x

# Fabric Mod Metadata
minecraft_dependency=1.18.x

Expand Down
3 changes: 3 additions & 0 deletions versions/1.19.4/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
minecraft_version=1.19.4
yarn_mappings=1.19.4+build.2

# Jar build filename version
minecraft_display_version=1.19.x

# Fabric Mod Metadata
minecraft_dependency=1.19.x

Expand Down
3 changes: 3 additions & 0 deletions versions/1.20.2/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
minecraft_version=1.20.2
yarn_mappings=1.20.2+build.4

# Jar build filename version
minecraft_display_version=1.20.x

# Fabric Mod Metadata
minecraft_dependency=1.20.x

Expand Down

0 comments on commit 1b9781a

Please sign in to comment.