Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
org.gradle.jvmargs=-Xmx1G

# Fabric Versions
minecraft_version=1.17
yarn_mappings=1.17+build.11
minecraft_version=1.17.1
yarn_mappings=1.17.1+build.14
loader_version=0.11.6
fabric_version=0.35.1+1.17
fabric_version=0.37.0+1.17

# Dependency Versions
sgui_version=1.0.0-pre0-1.17-pre1
sgui_version=1.0.0-rc4+1.17.1
server_translations_version=1.4.4+1.17

# Mod Properties
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/io/github/aws404/easypainter/PaintingItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public PaintingItem(Settings settings) {
@Override
public Text getName(ItemStack stack) {
MutableText text = (MutableText) super.getName(stack);
if (stack.getTag() != null && stack.getTag().contains("EntityTag")) {
Identifier current = Identifier.tryParse(stack.getOrCreateSubTag("EntityTag").getString("Motive"));
if (stack.getNbt() != null && stack.getNbt().contains("EntityTag")) {
Identifier current = Identifier.tryParse(stack.getOrCreateSubNbt("EntityTag").getString("Motive"));
text.append(new TranslatableText("item.easy_painter.painting.set", EasyPainter.getPaintingDisplayName(current).formatted(Formatting.ITALIC)));
}
return text.setStyle(text.getStyle().withItalic(text.getStyle().isItalic()));
Expand All @@ -40,9 +40,9 @@ public Text getName(ItemStack stack) {
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
ItemStack stack = user.getStackInHand(hand);
if (user.isSneaking()) {
stack.getOrCreateTag().remove("EntityTag");
} else if (stack.getTag() != null && stack.getTag().contains("EntityTag")) {
NbtCompound entityTag = stack.getOrCreateSubTag("EntityTag");
stack.getOrCreateNbt().remove("EntityTag");
} else if (stack.getNbt() != null && stack.getNbt().contains("EntityTag")) {
NbtCompound entityTag = stack.getOrCreateSubNbt("EntityTag");
Identifier current = Identifier.tryParse(entityTag.getString("Motive"));
int newRaw = Registry.PAINTING_MOTIVE.getRawId(Registry.PAINTING_MOTIVE.get(current)) + 1;
if (newRaw >= Registry.PAINTING_MOTIVE.getIds().size()) {
Expand All @@ -51,7 +51,7 @@ public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand han

entityTag.putString("Motive", Registry.PAINTING_MOTIVE.getId(Registry.PAINTING_MOTIVE.get(newRaw)).toString());
} else {
NbtCompound entityTag = stack.getOrCreateSubTag("EntityTag");
NbtCompound entityTag = stack.getOrCreateSubNbt("EntityTag");
entityTag.putString("Motive", Registry.PAINTING_MOTIVE.getId(PaintingMotive.ALBAN).toString());
}

Expand All @@ -75,7 +75,7 @@ public ActionResult useOnBlock(ItemUsageContext context) {
World world = context.getWorld();
PaintingEntity paintingEntity = new PaintingEntity(world, blockPos2, direction);

NbtCompound nbtCompound = itemStack.getTag();
NbtCompound nbtCompound = itemStack.getNbt();
if (nbtCompound != null) {
EntityType.loadFromEntityNbt(world, playerEntity, paintingEntity, nbtCompound);
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/github/aws404/easypainter/SelectionGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import net.minecraft.entity.decoration.painting.PaintingMotive;
import net.minecraft.item.Items;
import net.minecraft.network.Packet;
import net.minecraft.network.packet.s2c.play.EntityDestroyS2CPacket;
import net.minecraft.network.packet.s2c.play.EntitiesDestroyS2CPacket;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.LiteralText;
Expand Down Expand Up @@ -57,7 +57,7 @@ private SelectionGui(PaintingEntity entity, List<PaintingMotive> motives, Server
private void changePainting(PaintingMotive motive) {
this.entity.motive = motive;
((AbstractDecorationEntityAccessor) this.entity).callUpdateAttachmentPosition();
this.entity.getServer().getPlayerManager().sendToAll(new EntityDestroyS2CPacket(this.entity.getId()));
this.entity.getServer().getPlayerManager().sendToAll(new EntitiesDestroyS2CPacket(this.entity.getId()));
Packet<?> packet = this.entity.createSpawnPacket();
if (packet != null) {
this.entity.getServer().getPlayerManager().sendToAll(packet);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ public static void register(CommandDispatcher<ServerCommandSource> source) {
.executes(context -> {
EasyPainterCommand.checkPrepared();

context.getSource().getMinecraftServer().save(false, true, true);
context.getSource().getMinecraftServer().getPlayerManager().saveAllPlayerData();
context.getSource().getMinecraftServer().stop(false);
context.getSource().getServer().save(false, true, true);
context.getSource().getServer().getPlayerManager().saveAllPlayerData();
context.getSource().getServer().stop(false);

PersistentStateManager manager = context.getSource().getMinecraftServer().getOverworld().getPersistentStateManager();
PersistentStateManager manager = context.getSource().getServer().getOverworld().getPersistentStateManager();
MotiveCacheState cache = MotiveCacheState.getOrCreate(manager);

for (Identifier key : cache.getKeys()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.network.Packet;
import net.minecraft.network.packet.s2c.play.EntityDestroyS2CPacket;
import net.minecraft.network.packet.s2c.play.EntitiesDestroyS2CPacket;
import net.minecraft.network.packet.s2c.play.EntitySpawnS2CPacket;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
Expand Down Expand Up @@ -88,7 +88,7 @@ public Packet<?> createSpawnPacket() {
if (this.painting.motive instanceof CustomMotivesManager.CustomMotive) {
return new EntitySpawnS2CPacket(this, EntityType.ITEM_FRAME, this.facing.getId(), this.getDecorationBlockPos());
}
return new EntityDestroyS2CPacket(this.getId());
return new EntitiesDestroyS2CPacket(this.getId());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public CustomMotive(MotiveCacheState.Entry state) {

public ItemStack createMapItem(int x, int y) {
ItemStack map = new ItemStack(Items.FILLED_MAP);
map.getOrCreateTag().putInt("map", state.mapIds[x][y]);
map.getOrCreateNbt().putInt("map", state.mapIds[x][y]);
return map;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.Packet;
import net.minecraft.network.packet.s2c.play.EntityDestroyS2CPacket;
import net.minecraft.network.packet.s2c.play.EntitiesDestroyS2CPacket;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
Expand Down Expand Up @@ -128,7 +128,7 @@ private void writeCustomDataToNbt(NbtCompound nbt, CallbackInfo ci) {
@Inject(method = "createSpawnPacket", at = @At("HEAD"), cancellable = true)
private void createSpawnPacket(CallbackInfoReturnable<Packet<?>> cir) {
if (this.motive instanceof CustomMotivesManager.CustomMotive) {
cir.setReturnValue(new EntityDestroyS2CPacket(this.getId()));
cir.setReturnValue(new EntitiesDestroyS2CPacket(this.getId()));
}
}

Expand Down