Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d0ecf1aa13 | |||
| ce020acab8 | |||
| 6e40ca6564 | |||
| 04eae83ec5 | |||
| 28021c389a |
@@ -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.
|
||||||
@@ -16,3 +16,9 @@ Controls how much damage elytras take when boosting with a firework
|
|||||||
|
|
||||||
### elytraDamageFromRiptideTrident
|
### elytraDamageFromRiptideTrident
|
||||||
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
|
||||||
|
Decides if players should be able to crit
|
||||||
|
|
||||||
|
### pistonPushLimit
|
||||||
|
Controls how many blocks pistons can push
|
||||||
+5
-5
@@ -3,14 +3,14 @@ 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.0.0
|
mod_version = 1.2.0
|
||||||
maven_group = me.youhavetrouble.moregamerules
|
maven_group = me.youhavetrouble.moregamerules
|
||||||
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,6 +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.IntRule> PISTON_PUSH_LIMIT;
|
||||||
|
|
||||||
protected static void init() {
|
protected static void init() {
|
||||||
MAGMA_BLOCK_DAMAGE = GameRuleRegistry.register(
|
MAGMA_BLOCK_DAMAGE = GameRuleRegistry.register(
|
||||||
@@ -38,6 +40,16 @@ public class ExtraGameRule {
|
|||||||
GameRules.Category.MISC,
|
GameRules.Category.MISC,
|
||||||
GameRuleFactory.createIntRule(0, 0, Integer.MAX_VALUE)
|
GameRuleFactory.createIntRule(0, 0, Integer.MAX_VALUE)
|
||||||
);
|
);
|
||||||
|
PLAYER_CRITS = GameRuleRegistry.register(
|
||||||
|
"playerCrits",
|
||||||
|
GameRules.Category.PLAYER,
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package me.youhavetrouble.moregamerules.mixin;
|
||||||
|
|
||||||
|
import me.youhavetrouble.moregamerules.ExtraGameRule;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import org.objectweb.asm.Opcodes;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
@Mixin(PlayerEntity.class)
|
||||||
|
public class PlayerEntityMixin {
|
||||||
|
|
||||||
|
@Redirect(method = "attack", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/player/PlayerEntity;fallDistance:F", opcode = Opcodes.GETFIELD))
|
||||||
|
private float injected(PlayerEntity instance) {
|
||||||
|
if (instance.world.getGameRules().getBoolean(ExtraGameRule.PLAYER_CRITS)) {
|
||||||
|
return instance.fallDistance;
|
||||||
|
}
|
||||||
|
return 0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,6 +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.description": "Decides if players should be able to crit",
|
||||||
|
"gamerule.pistonPushLimit": "Piston push limit",
|
||||||
|
"gamerule.description": "Controls how many blocks pistons can push"
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"gamerule.magmaBlockDamage": "Obrażenia od bloku magmy",
|
||||||
|
"gamerule.magmaBlockDamage.description": "Decyduje, czy blok magmy powinien zadawać obrażenia",
|
||||||
|
"gamerule.lightningRodRange": "Zasięg piorunochronu",
|
||||||
|
"gamerule.lightningRodRange.description": "Zasięg, do jakiego piorunochron będzie przekierowywać pioruny",
|
||||||
|
"gamerule.elytraDamagePerSecond": "Uszkodzenia elytry na sekundę",
|
||||||
|
"gamerule.elytraDamagePerSecond.description": "Jak dużo uszkodzeń będą odnosić elytry podczas lotu",
|
||||||
|
"gamerule.elytraDamageFromFirework": "Uszkodzenia elytry od fajerwerków",
|
||||||
|
"gamerule.elytraDamageFromFirework.description": "Jak dużo uszkodzeń będą odnosić elytry przy użyciu fajerwerka",
|
||||||
|
"gamerule.elytraDamageFromRiptideTrident": "Uszkodzenia elytry od trójzębu",
|
||||||
|
"gamerule.elytraDamageFromRiptideTrident.description": "Jak dużo uszkodzeń będą odnosić elytry przy użyciu trójzębu z torpedą",
|
||||||
|
"gamerule.playerCrits": "Krytyki graczy",
|
||||||
|
"gamerule.playerCrits.description": "Czy gracze powinni móc zadawać krytyczne obrażenia",
|
||||||
|
"gamerule.pistonPushLimit": "Limit popychania tłoków",
|
||||||
|
"gamerule.description": "Jak dużo bloków może popchnąć tłok"
|
||||||
|
}
|
||||||
@@ -6,6 +6,8 @@
|
|||||||
"mixins": [
|
"mixins": [
|
||||||
"FireworkItemMixin",
|
"FireworkItemMixin",
|
||||||
"LivingEntityMixin",
|
"LivingEntityMixin",
|
||||||
|
"PistonPushLimitMixin",
|
||||||
|
"PlayerEntityMixin",
|
||||||
"ServerWorldMixin",
|
"ServerWorldMixin",
|
||||||
"TridentItemMixin"
|
"TridentItemMixin"
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user