add piston push limit
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# More Game Rules
|
# More Game Rules
|
||||||
|
|
||||||
Self explanatory mod. Adds more game rules.
|
Self-explanatory mod. Adds more game rules.
|
||||||
|
|
||||||
### magmaBlockDamage
|
### magmaBlockDamage
|
||||||
Controls if magma blocks should do damage when stepped on.
|
Controls if magma blocks should do damage when stepped on.
|
||||||
@@ -18,4 +18,7 @@ Controls how much damage elytras take when boosting with a firework
|
|||||||
Controls how much damage elytras take when boosting with a riptide trident
|
Controls how much damage elytras take when boosting with a riptide trident
|
||||||
|
|
||||||
### playerCrits
|
### playerCrits
|
||||||
Decides if players should be able to crit
|
Decides if players should be able to crit
|
||||||
|
|
||||||
|
### pistonPushLimit
|
||||||
|
Controls how many blocks pistons can push
|
||||||
+4
-4
@@ -3,9 +3,9 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/develop
|
# check these on https://fabricmc.net/develop
|
||||||
minecraft_version=1.19.2
|
minecraft_version=1.19.3
|
||||||
yarn_mappings=1.19.2+build.8
|
yarn_mappings=1.19.3+build.5
|
||||||
loader_version=0.14.9
|
loader_version=0.14.12
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.1.0
|
mod_version = 1.1.0
|
||||||
@@ -13,4 +13,4 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
archives_base_name = MoreGameRules
|
archives_base_name = MoreGameRules
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
fabric_version=0.60.0+1.19.2
|
fabric_version=0.72.0+1.19.3
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ public class ExtraGameRule {
|
|||||||
public static GameRules.Key<GameRules.IntRule> ELYTRA_DAMAGE_PER_SECOND;
|
public static GameRules.Key<GameRules.IntRule> ELYTRA_DAMAGE_PER_SECOND;
|
||||||
public static GameRules.Key<GameRules.IntRule> ELYTRA_DAMAGE_FROM_FIREWORK_BOOST;
|
public static GameRules.Key<GameRules.IntRule> ELYTRA_DAMAGE_FROM_FIREWORK_BOOST;
|
||||||
public static GameRules.Key<GameRules.IntRule> ELYTRA_DAMAGE_FROM_RIPTIDE_BOOST;
|
public static GameRules.Key<GameRules.IntRule> ELYTRA_DAMAGE_FROM_RIPTIDE_BOOST;
|
||||||
|
|
||||||
public static GameRules.Key<GameRules.BooleanRule> PLAYER_CRITS;
|
public static GameRules.Key<GameRules.BooleanRule> PLAYER_CRITS;
|
||||||
|
public static GameRules.Key<GameRules.IntRule> PISTON_PUSH_LIMIT;
|
||||||
|
|
||||||
protected static void init() {
|
protected static void init() {
|
||||||
MAGMA_BLOCK_DAMAGE = GameRuleRegistry.register(
|
MAGMA_BLOCK_DAMAGE = GameRuleRegistry.register(
|
||||||
@@ -45,6 +45,11 @@ public class ExtraGameRule {
|
|||||||
GameRules.Category.PLAYER,
|
GameRules.Category.PLAYER,
|
||||||
GameRuleFactory.createBooleanRule(true)
|
GameRuleFactory.createBooleanRule(true)
|
||||||
);
|
);
|
||||||
|
PISTON_PUSH_LIMIT = GameRuleRegistry.register(
|
||||||
|
"pistonPushLimit",
|
||||||
|
GameRules.Category.MISC,
|
||||||
|
GameRuleFactory.createIntRule(12, 0, 512)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package me.youhavetrouble.moregamerules.mixin;
|
||||||
|
|
||||||
|
import me.youhavetrouble.moregamerules.ExtraGameRule;
|
||||||
|
import net.minecraft.block.piston.PistonHandler;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
@Mixin(PistonHandler.class)
|
||||||
|
public class PistonPushLimitMixin {
|
||||||
|
|
||||||
|
@ModifyConstant(method = "tryMove", constant = @Constant(intValue = 12))
|
||||||
|
private int injectedPushLimit(int range) throws NoSuchFieldException, IllegalAccessException {
|
||||||
|
PistonHandler pistonHandler = (PistonHandler)(Object) this;
|
||||||
|
|
||||||
|
// Get the associated world
|
||||||
|
Field worldField = PistonHandler.class.getDeclaredField("world");
|
||||||
|
worldField.setAccessible(true);
|
||||||
|
World world = (World) worldField.get(pistonHandler);
|
||||||
|
|
||||||
|
return world.getGameRules().getInt(ExtraGameRule.PISTON_PUSH_LIMIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,8 +7,10 @@
|
|||||||
"gamerule.elytraDamagePerSecond.description": "Controls how much damage elytras take when flying",
|
"gamerule.elytraDamagePerSecond.description": "Controls how much damage elytras take when flying",
|
||||||
"gamerule.elytraDamageFromFirework": "Elytra damage from firework boost",
|
"gamerule.elytraDamageFromFirework": "Elytra damage from firework boost",
|
||||||
"gamerule.elytraDamageFromFirework.description": "Controls how much damage elytras take when boosting with a firework",
|
"gamerule.elytraDamageFromFirework.description": "Controls how much damage elytras take when boosting with a firework",
|
||||||
"gamerule.elytraDamageFromRiptideTrident": "Elytra damage from firework boost",
|
"gamerule.elytraDamageFromRiptideTrident": "Elytra damage from trident boost",
|
||||||
"gamerule.elytraDamageFromRiptideTrident.description": "Controls how much damage elytras take when boosting with a riptide trident",
|
"gamerule.elytraDamageFromRiptideTrident.description": "Controls how much damage elytras take when boosting with a riptide trident",
|
||||||
"gamerule.playerCrits": "Player crits",
|
"gamerule.playerCrits": "Player crits",
|
||||||
"gamerule.playerCrits.description": "Decides if players should be able to crit"
|
"gamerule.playerCrits.description": "Decides if players should be able to crit",
|
||||||
|
"gamerule.pistonPushLimit": "Piston push limit",
|
||||||
|
"gamerule.description": "Controls how many blocks pistons can push"
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
"mixins": [
|
"mixins": [
|
||||||
"FireworkItemMixin",
|
"FireworkItemMixin",
|
||||||
"LivingEntityMixin",
|
"LivingEntityMixin",
|
||||||
|
"PistonPushLimitMixin",
|
||||||
"PlayerEntityMixin",
|
"PlayerEntityMixin",
|
||||||
"ServerWorldMixin",
|
"ServerWorldMixin",
|
||||||
"TridentItemMixin"
|
"TridentItemMixin"
|
||||||
|
|||||||
Reference in New Issue
Block a user