Config options to remove nightmares and disable beds (both disabled by default)

master
Wynd 2024-01-06 22:16:36 +02:00
parent 09cd62e112
commit 456c2f9006
5 changed files with 71 additions and 5 deletions

View File

@ -22,6 +22,12 @@ public class ModConfig {
"Disables id tags showing above entities in F3 mode"); "Disables id tags showing above entities in F3 mode");
public static final Option<Boolean> BOOKSHELVES_DROP = make("Bookshelves Drops", true, public static final Option<Boolean> BOOKSHELVES_DROP = make("Bookshelves Drops", true,
"Drops 3 books when breaking a bookshelf"); "Drops 3 books when breaking a bookshelf");
public static final Option<Boolean> FENCE_SLIM_HITBOX = make("Slim Hitbox for Fences", true,
"Uses slim hitbox for fences on the X and Z axies (the height of the fence is not changed)");
public static final Option<Boolean> REMOVE_NIGHTMARES = make("Remove Nightmares", false,
"Removes nightmares completely");
public static final Option<Boolean> DISABLE_BEDS = make("Disable Beds", false,
"Disables bed mechanics such as setting spawn points and skipping the night, does NOT delete already placed blocks nor does it disable the crafting or placing of beds as decorative blocks");
public static final Option<Boolean> FIX_BOW_MODEL = make("Fix bow model", true, public static final Option<Boolean> FIX_BOW_MODEL = make("Fix bow model", true,
"Makes the box model held by players and skeletons bigger and facing forward"); "Makes the box model held by players and skeletons bigger and facing forward");

View File

@ -54,6 +54,16 @@ public class WyHelper {
public static void cheatCommand(Player player) { public static void cheatCommand(Player player) {
// int x = MathsHelper.floor(player.x);
// int y = MathsHelper.floor(player.boundingBox.minY);
// int z = MathsHelper.floor(player.z);
// int lightLevel = player.level.getLightLevel(x, y, z);
// System.out.println(lightLevel);
// player.dropItem(new ItemInstance(ItemType.swordDiamond, 1));
// player.dropItem(new ItemInstance(Tile.TORCH, 64));
// player.dropItem(new ItemInstance(Tile.BED, 64));
// player.dropItem(new ItemInstance(Tile.FENCE, 64)); // player.dropItem(new ItemInstance(Tile.FENCE, 64));
// player.dropItem(new ItemInstance(Tile.STONE_PRESSURE_PLATE, 64)); // player.dropItem(new ItemInstance(Tile.STONE_PRESSURE_PLATE, 64));
@ -83,9 +93,9 @@ public class WyHelper {
// player.level.spawnEntity(enemy); // player.level.spawnEntity(enemy);
player.level.setLevelTime(0); player.level.setLevelTime(0);
player.level.getProperties().setRaining(false); // player.level.getProperties().setRaining(false);
player.level.getProperties().setRainTime(0); // player.level.getProperties().setRainTime(0);
player.level.getProperties().setThundering(false); // player.level.getProperties().setThundering(false);
player.level.getProperties().setThunderTime(0); // player.level.getProperties().setThunderTime(0);
} }
} }

View File

@ -0,0 +1,23 @@
package xyz.pixelatedw.finalbeta.mixin;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.entity.player.Player;
import net.minecraft.level.Level;
import net.minecraft.tile.BedTile;
import xyz.pixelatedw.finalbeta.ModConfig;
@Mixin(BedTile.class)
public class BedTileMixin {
@Inject(method = "activate", at = @At("HEAD"), cancellable = true)
public void activate(Level level, int x, int y, int z, Player player, CallbackInfoReturnable<Boolean> cir) {
if (ModConfig.DISABLE_BEDS.get()) {
cir.setReturnValue(false);
}
}
}

View File

@ -0,0 +1,25 @@
package xyz.pixelatedw.finalbeta.mixin;
import java.util.List;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.entity.player.Player;
import net.minecraft.level.Level;
import net.minecraft.level.LevelMonsterSpawner;
import xyz.pixelatedw.finalbeta.ModConfig;
@Mixin(LevelMonsterSpawner.class)
public class LevelMonsterSpawnerMixin {
@Inject(method = "method_1869", at = @At("HEAD"), cancellable = true)
private static void nightmaresHandler(Level level, List<Player> playersList, CallbackInfoReturnable<Boolean> cir) {
if (ModConfig.REMOVE_NIGHTMARES.get()) {
cir.setReturnValue(false);
}
}
}

View File

@ -30,7 +30,9 @@
"GrassTileMixin", "GrassTileMixin",
"OverlayMixin", "OverlayMixin",
"BookshelfTileMixin", "BookshelfTileMixin",
"FenceTileMixin" "FenceTileMixin",
"LevelMonsterSpawnerMixin",
"BedTileMixin"
], ],
"injectors": { "injectors": {
"defaultRequire": -1 "defaultRequire": -1