Changes
|
@ -1,6 +1,7 @@
|
||||||
package modchest.networking;
|
package modchest.networking;
|
||||||
|
|
||||||
import modchest.REServerMod;
|
import modchest.REServerMod;
|
||||||
|
import modchest.networking.packet.getNamesOfRespawnButtonsS2CPacket;
|
||||||
import modchest.networking.packet.respawnRequestS2CPacket;
|
import modchest.networking.packet.respawnRequestS2CPacket;
|
||||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.network.PacketByteBuf;
|
||||||
|
|
||||||
public class getNamesOfRespawnButtonsS2CPacket {
|
public class getNamesOfRespawnButtonsS2CPacket {
|
||||||
|
|
||||||
public static void receive(MinecraftClient minecraftClient, ClientPlayNetworkHandler clientPlayNetworkHandler, PacketByteBuf packetByteBuf, PacketSender packetSender) {
|
public static String[] receive(MinecraftClient minecraftClient, ClientPlayNetworkHandler clientPlayNetworkHandler, PacketByteBuf packetByteBuf, PacketSender packetSender) {
|
||||||
String[] namesFromServer = new String[5];
|
String[] namesFromServer = new String[5];
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
namesFromServer[i] = (buf.readString(32767));
|
namesFromServer[i] = (buf.readString(32767));
|
||||||
|
|
1
src/client/java/modchest/networking/packet/respawnRequestS2CPacket.java
Normal file → Executable file
|
@ -1,6 +1,5 @@
|
||||||
package modchest.networking.packet;
|
package modchest.networking.packet;
|
||||||
|
|
||||||
import modchest.REServerModClient;
|
|
||||||
import net.fabricmc.fabric.api.networking.v1.PacketSender;
|
import net.fabricmc.fabric.api.networking.v1.PacketSender;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
package modchest.data;
|
package modchest.data;
|
||||||
|
|
||||||
import modchest.item.modItems;
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
|
||||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider;
|
import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider;
|
||||||
import modchest.block.modBlocks;
|
|
||||||
|
|
||||||
//vereinfacht das erstellen der einzelnen JSON files, bisher nicht verwendet, am besten auch nie verwenden; unten auskommentierter code ist example-code! Hier: die Loot-Tables also was ein Item beim Abbau dropt
|
//vereinfacht das erstellen der einzelnen JSON files, bisher nicht verwendet, am besten auch nie verwenden; unten auskommentierter code ist example-code! Hier: die Loot-Tables also was ein Item beim Abbau dropt
|
||||||
public class ModLootTableGenerator extends FabricBlockLootTableProvider {
|
public class ModLootTableGenerator extends FabricBlockLootTableProvider {
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
package modchest.data;
|
package modchest.data;
|
||||||
|
|
||||||
import modchest.block.modBlocks;
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
|
||||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider;
|
import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider;
|
||||||
import net.minecraft.data.client.BlockStateModelGenerator;
|
import net.minecraft.data.client.BlockStateModelGenerator;
|
||||||
import net.minecraft.data.client.ItemModelGenerator;
|
import net.minecraft.data.client.ItemModelGenerator;
|
||||||
import modchest.item.modItems;
|
|
||||||
import net.minecraft.data.client.Models;
|
|
||||||
|
|
||||||
//vereinfacht das erstellen der einzelnen JSON files, bisher nicht verwendet, am besten auch nie verwenden; unten auskommentierter code ist example-code! Hier: Für die generierung der Texturen
|
//vereinfacht das erstellen der einzelnen JSON files, bisher nicht verwendet, am besten auch nie verwenden; unten auskommentierter code ist example-code! Hier: Für die generierung der Texturen
|
||||||
public class ModModelProvider extends FabricModelProvider {
|
public class ModModelProvider extends FabricModelProvider {
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
package modchest.data;
|
package modchest.data;
|
||||||
|
|
||||||
import modchest.item.modItems;
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
|
||||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
|
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
|
||||||
import net.minecraft.data.server.recipe.RecipeJsonProvider;
|
import net.minecraft.data.server.recipe.RecipeJsonProvider;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
//vereinfacht das erstellen der einzelnen JSON files, bisher nicht verwendet, am besten auch nie verwenden; unten auskommentierter code ist example-code! Hier: würden die Rezepte erstellt werden
|
//vereinfacht das erstellen der einzelnen JSON files, bisher nicht verwendet, am besten auch nie verwenden; unten auskommentierter code ist example-code! Hier: würden die Rezepte erstellt werden
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package modchest.mixin;
|
package modchest.mixin;
|
||||||
|
|
||||||
import modchest.REServerMod;
|
|
||||||
import modchest.util.ServerPlayerEntityInterface;
|
import modchest.util.ServerPlayerEntityInterface;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
|
@ -10,8 +9,6 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
@Mixin(ServerPlayerEntity.class)
|
@Mixin(ServerPlayerEntity.class)
|
||||||
public abstract class ServerPlayerEntityMixin implements ServerPlayerEntityInterface {
|
public abstract class ServerPlayerEntityMixin implements ServerPlayerEntityInterface {
|
||||||
@Unique
|
@Unique
|
||||||
|
|
|
@ -5,7 +5,6 @@ import modchest.util.setAndGetMultiButtonsSpawn;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.text.Text;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
@ -14,7 +13,6 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package modchest.networking;
|
||||||
|
|
||||||
import modchest.REServerMod;
|
import modchest.REServerMod;
|
||||||
import modchest.networking.packet.deathScreenMultiButtonsC2SPacket;
|
import modchest.networking.packet.deathScreenMultiButtonsC2SPacket;
|
||||||
|
import modchest.networking.packet.setNamesOfRespawnButtonsC2SPacket;
|
||||||
import modchest.networking.packet.setNewRespawnsC2SPacket;
|
import modchest.networking.packet.setNewRespawnsC2SPacket;
|
||||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
|
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
1
src/main/java/modchest/networking/packet/deathScreenMultiButtonsC2SPacket.java
Normal file → Executable file
|
@ -14,7 +14,6 @@ import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class deathScreenMultiButtonsC2SPacket {
|
public class deathScreenMultiButtonsC2SPacket {
|
||||||
|
|
|
@ -9,8 +9,6 @@ import net.minecraft.server.network.ServerPlayNetworkHandler;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
public class setNewRespawnsC2SPacket {
|
public class setNewRespawnsC2SPacket {
|
||||||
public static void receive(MinecraftServer server, ServerPlayerEntity player, //Passiert auf dem Server!!!
|
public static void receive(MinecraftServer server, ServerPlayerEntity player, //Passiert auf dem Server!!!
|
||||||
ServerPlayNetworkHandler handler, PacketByteBuf buf, PacketSender responseSender) {
|
ServerPlayNetworkHandler handler, PacketByteBuf buf, PacketSender responseSender) {
|
||||||
|
|
|
@ -113,14 +113,15 @@ public class setAndGetMultiButtonsSpawn {
|
||||||
topNbt.put("multi_sleep", new NbtCompound());
|
topNbt.put("multi_sleep", new NbtCompound());
|
||||||
}
|
}
|
||||||
NbtCompound subNbt = (NbtCompound) topNbt.get("multi_sleep"); //wie bei setMultiSpawn()
|
NbtCompound subNbt = (NbtCompound) topNbt.get("multi_sleep"); //wie bei setMultiSpawn()
|
||||||
|
String names;
|
||||||
if (subNbt != null) {
|
if (subNbt != null) {
|
||||||
name = subNbt.getIntArray("names"); // holt sich den Namen
|
names = subNbt.getString("names"); // holt sich den Namen
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name.length == 0) { //das gleiche fuer den Namen
|
if (name.length == 0) { //das gleiche fuer den Namen
|
||||||
String[] names = {"#1", "#2", "#3", "#4", "#5"};
|
String names = {"#1", "#2", "#3", "#4", "#5"};
|
||||||
try {
|
try {
|
||||||
subNbt.putIntArray("names", names);
|
subNbt.putString("names", names);
|
||||||
topNbt.put("multi_sleep", subNbt);
|
topNbt.put("multi_sleep", subNbt);
|
||||||
castedPlayer.setDataSaver(topNbt);
|
castedPlayer.setDataSaver(topNbt);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 85 KiB |
Before Width: | Height: | Size: 453 B After Width: | Height: | Size: 453 B |
Before Width: | Height: | Size: 311 B After Width: | Height: | Size: 311 B |
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 85 KiB |