1
0
Fork 0

Compare commits

...

2 Commits

Author SHA1 Message Date
Ryan Fox 8c51919e4e
Partial upgrade to 1.18.1 2022-01-29 17:18:37 -08:00
Ryan Fox 326e9cc4fc
Nuke README 2022-01-29 14:48:16 -08:00
13 changed files with 48 additions and 110 deletions

View File

@ -1,66 +1,5 @@
-----------------------------
minecraft-tweaks-2a03
-----------------------------
minecraft-tweaks-2a03
Information
-----------
This repository contains simple modifications for the 2a03.party Minecraft
server. I have replaced the patches with a Fabric mod.
Simple modifications for mc.2a03.party.
Send questions, issues, and patches to flewkey@2a03.party.
Commands
--------
Some in-game commands are included.
/fly: Allow flying (TODO: Disable this in config)
/hat: Swap items between main hand and head
/head [username]: Get a playerhead (TODO: Specify optional amount)
/home: Teleport to home
/home set: Set your home
/spawn: Teleport to spawn
There are also commands which can only be used by operators.
/config reload: Reloads the config file
/home sudoset <uuid>: Set another user's home (TODO: Accept usernames)
/spawn set: Set the spawn location
Config
------
The config is stored in /config/minecraft-tweaks-2a03/2a03.json
disableFlyCommand: Disables the /fly command
disableTntExplosions: Disables TNT explosions
disableRespawnAnchorExplosions: Disables respawn anchor explosions
iphubApiKey: API key for iphub.info, currently unused
persistentFlight: Save players who disconnect mid-flight
spawn: The spawn location. To set it in-game, use /spawn set
Database
--------
Some features such as /home use a SQLite database to store data. Nobody else
uses this mod (as far as I know), so any changes to existing tables will have
to be made manually. My favourite tool for managing SQLite databases is
sqlitebrowser, which you can install with your package manager or from the
website: https://sqlitebrowser.org/.
If you are using an old version which stores player data in the config, you can
migrate their homes to the database using /scripts/migrate_players.py
For information about the tables in the database, refer to the source code. Here
is the relevant file: /src/main/java/party/_2a03/mc/util/Database.java
Building
--------
Building is handled by Gradle and Fabric Loom. You can install Gradle using your
package manager, or you can install it manually: https://gradle.org/install/.
Then, run "gradle build" and it should take care of everything. The mod will be
available in /build/libs/minecraft-tweaks-2a03.jar. You can also test changes
using "gradle runServer". For more information about Gradle and Loom, refer to
the appropriate docs.

View File

@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.4-SNAPSHOT'
id 'fabric-loom' version '0.11-SNAPSHOT'
}
repositories {
@ -9,13 +9,14 @@ repositories {
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modCompile "net.fabricmc:fabric-loader:${project.loader_version}"
modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modCompile "org.json:json:20200518"
modCompile "org.xerial:sqlite-jdbc:3.32.3.2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "org.json:json:20211205"
modImplementation "org.xerial:sqlite-jdbc:3.36.0.3"
modImplementation "com.google.code.findbugs:jsr305:3.0.2"
include "org.json:json:20200518"
include "org.xerial:sqlite-jdbc:3.32.3.2"
include "org.json:json:20211205"
include "org.xerial:sqlite-jdbc:3.36.0.3"
}
jar {

View File

@ -1,8 +1,8 @@
org.gradle.jvmargs=-Xmx1G
minecraft_version=1.16.3
yarn_mappings=1.16.3+build.47
loader_version=0.10.3+build.211
minecraft_version=1.18.1
yarn_mappings=1.18.1+build.22
loader_version=0.12.12
mod_version=1.2.0
maven_group=party.2a03.mc
maven_group=party._2a03.mc
archives_base_name=minecraft-tweaks-2a03
fabric_version=0.24.1+build.412-1.16
fabric_version=0.46.2+1.18

View File

@ -11,10 +11,10 @@ public class FlyCommand {
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
dispatcher.register(CommandManager.literal("fly").executes(ctx -> {
ServerCommandSource source = ctx.getSource();
if (Config.getBool("disableFlyCommand")) {
//if (Config.getBool("disableFlyCommand")) {
source.sendFeedback(new LiteralText("The /fly command is disabled"), true);
return 0;
}
/*}
ServerPlayerEntity sender = source.getPlayer();
boolean flight = sender.abilities.allowFlying;
sender.abilities.allowFlying = !flight;
@ -25,7 +25,7 @@ public class FlyCommand {
sender.abilities.flying = false;
}
sender.sendAbilitiesUpdate();
return 1;
return 1;*/
}));
}
}

View File

@ -6,7 +6,7 @@ import net.minecraft.block.Blocks;
import net.minecraft.entity.ItemEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
@ -23,9 +23,9 @@ public class HeadCommand {
private static int giveHead(ServerCommandSource source, ServerPlayerEntity sender, String skullowner) {
ItemStack itemstack = new ItemStack(Blocks.PLAYER_HEAD.asItem());
CompoundTag compoundtag = new CompoundTag();
compoundtag.putString("SkullOwner", skullowner);
itemstack.setTag(compoundtag);
NbtCompound nbt = new NbtCompound();
nbt.putString("SkullOwner", skullowner);
itemstack.setNbt(nbt);
ItemEntity itementity = sender.dropItem(itemstack, false);
itementity.resetPickupDelay();
itementity.setOwner(sender.getUuid());

View File

@ -34,9 +34,9 @@ public class HomeCommand {
double x = sender.getX();
double y = sender.getY();
double z = sender.getZ();
float yaw = sender.yaw;
float pitch = sender.pitch;
RegistryKey registrykey = sender.getServerWorld().getRegistryKey();
float yaw = sender.getYaw();
float pitch = sender.getPitch();
RegistryKey registrykey = sender.getWorld().getRegistryKey();
PlayerPosition location = new PlayerPosition(x, y, z, yaw, pitch, registrykey);
playerdata.setHome(location);
source.sendFeedback(new LiteralText("Your home has been updated"), true);
@ -52,9 +52,9 @@ public class HomeCommand {
double x = sender.getX();
double y = sender.getY();
double z = sender.getZ();
float yaw = sender.yaw;
float pitch = sender.pitch;
RegistryKey registrykey = sender.getServerWorld().getRegistryKey();
float yaw = sender.getYaw();
float pitch = sender.getPitch();
RegistryKey registrykey = sender.getWorld().getRegistryKey();
PlayerPosition location = new PlayerPosition(x, y, z, yaw, pitch, registrykey);
playerdata.setHome(location);
source.sendFeedback(new LiteralText("User's home has been updated (" + StringArgumentType.getString(ctx, "UUID") + ")"), true);

View File

@ -37,9 +37,9 @@ public class SpawnCommand {
double x = sender.getX();
double y = sender.getY();
double z = sender.getZ();
float yaw = sender.yaw;
float pitch = sender.pitch;
RegistryKey registrykey = sender.getServerWorld().getRegistryKey();
float yaw = sender.getYaw();
float pitch = sender.getPitch();
RegistryKey registrykey = sender.getWorld().getRegistryKey();
PlayerPosition location = new PlayerPosition(x, y, z, yaw, pitch, registrykey);
Config.setData("spawn", location.getJSON());
source.sendFeedback(new LiteralText("Spawn has been set"), true);

View File

@ -1,5 +1,7 @@
package party._2a03.mc.mixin;
import java.util.Collection;
import com.mojang.brigadier.context.CommandContext;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.command.GameModeCommand;
import net.minecraft.server.network.ServerPlayerEntity;
@ -8,14 +10,14 @@ import net.minecraft.world.GameMode;
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.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(GameModeCommand.class)
public class MixinGameModeCommand {
@Inject(method = "setGameMode", at = @At("HEAD"))
private static void OnSetGameMode(ServerCommandSource source, ServerPlayerEntity player, GameMode gameMode, CallbackInfo ci) {
@Inject(method = "execute", at = @At("HEAD"))
private static void OnExecute(CommandContext<ServerCommandSource> context, Collection<ServerPlayerEntity> targets, GameMode gameMode, CallbackInfoReturnable cir) {
if (gameMode == GameMode.CREATIVE) {
source.sendFeedback(new LiteralText("<Server> Creative mode? What are you, a cheater?"), false);
context.getSource().sendFeedback(new LiteralText("<Server> Creative mode? What are you, a cheater?"), false);
}
return;
}

View File

@ -31,11 +31,11 @@ public abstract class MixinServerPlayerEntity extends PlayerEntity {
}
}
@Inject(method = "setGameMode", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;sendAbilitiesUpdate()V"))
/*@Inject(method = "setGameMode", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;sendAbilitiesUpdate()V"))
public void disableFlightIfSafe(GameMode gameMode, CallbackInfo ci) {
if (gameMode != GameMode.CREATIVE && gameMode != GameMode.SPECTATOR) {
this.abilities.allowFlying = false;
this.abilities.flying = false;
}
}
}*/
}

View File

@ -13,13 +13,9 @@ import party._2a03.mc.util.Config;
@Mixin(TntEntity.class)
public abstract class MixinTntEntity extends Entity {
@Shadow
private int fuseTimer;
public MixinTntEntity(EntityType<? extends TntEntity> entityType, World world) {
super(entityType, world);
this.fuseTimer = 80;
this.inanimate = true;
this.intersectionChecked = true;
}
@Inject(method = "explode", at = @At("HEAD"), cancellable = true)

View File

@ -24,7 +24,7 @@ public class PlayerPosition {
this.z = data.getDouble(2);
this.yaw = data.getNumber(3).floatValue();
this.pitch = data.getNumber(4).floatValue();
this.registrykey = RegistryKey.of(Registry.DIMENSION, new Identifier(registry_string));
this.registrykey = RegistryKey.of(Registry.DIMENSION_KEY, new Identifier(registry_string));
}
}

View File

@ -2,17 +2,17 @@
"schemaVersion": 1,
"id": "minecraft-tweaks-2a03",
"version": "1.2.0",
"name": "2a03.party Tweaks",
"description": "Simple modifications for the 2a03.party Minecraft server.",
"name": "minecraft-tweaks-2a03",
"description": "Simple modifications for mc.2a03.party.",
"authors": [
"flewkey"
],
"contact": {
"homepage": "https://flewkey.com/",
"sources": "https://github.com/flewkey/minecraft-tweaks-2a03"
"sources": "https://git.sdf.org/flewkey/minecraft-tweaks-2a03"
},
"license": "MIT",
"icon": "assets/2a03-minecraft-tweaks/icon.png",
"icon": "assets/minecraft-tweaks-2a03/icon.png",
"environment": "*",
"entrypoints": {
"main": [
@ -23,8 +23,8 @@
"minecraft-tweaks-2a03.mixins.json"
],
"depends": {
"fabricloader": ">=0.8.2",
"fabricloader": ">=0.12.12",
"fabric": "*",
"minecraft": "1.16.x"
"minecraft": "1.18.1"
}
}

View File

@ -1,7 +1,7 @@
{
"required": true,
"package": "party._2a03.mc.mixin",
"compatibilityLevel": "JAVA_8",
"compatibilityLevel": "JAVA_17",
"server": [
"MixinGameMode",
"MixinGameModeCommand",