From 9fd946ae9ab99503ae87007758865cefa70acf41 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Sun, 15 Mar 2020 15:33:54 -0400 Subject: [PATCH] 1.0.1 Fix Bug --- CHANGELOG.md | 3 +++ gradle.properties | 20 ++++++++++--------- .../{DataHolder.java => SpawnDataHolder.java} | 2 +- .../mixin/MixinCryingObsidianBlock.java | 13 +++++++++--- .../mixin/MixinPlayerEntity.java | 4 ++-- .../mixin/MixinServerPlayNetworkHandler.java | 4 ++-- .../mixin/MixinServerPlayerEntity.java | 8 ++++---- 7 files changed, 33 insertions(+), 21 deletions(-) rename src/main/java/com/thebrokenrail/obsidianspawn/{DataHolder.java => SpawnDataHolder.java} (84%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d689ff..62721a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ # Changelog +**1.0.1** +* Fix Bug + **1.0** * Initial Release \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index e6fda4c..94a13b0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,13 +1,15 @@ # Done to increase the memory available to gradle. org.gradle.jvmargs=-Xmx1G + # Fabric Properties -# check these on https://fabricmc.net/use -minecraft_version=20w11a -curseforge_id=367307 -simple_minecraft_version=1.16-Snapshot -yarn_mappings=20w11a+build.6 -loader_version=0.7.8+build.184 + # check these on https://fabricmc.net/use + minecraft_version = 20w11a + curseforge_id = 367307 + simple_minecraft_version = 1.16-Snapshot + yarn_mappings = 20w11a+build.6 + loader_version = 0.7.8+build.184 + # Mod Properties -mod_version=1.0.0 -maven_group=com.thebrokenrail -archives_base_name=obsidianspawn + mod_version = 1.0.1 + maven_group = com.thebrokenrail + archives_base_name = obsidianspawn diff --git a/src/main/java/com/thebrokenrail/obsidianspawn/DataHolder.java b/src/main/java/com/thebrokenrail/obsidianspawn/SpawnDataHolder.java similarity index 84% rename from src/main/java/com/thebrokenrail/obsidianspawn/DataHolder.java rename to src/main/java/com/thebrokenrail/obsidianspawn/SpawnDataHolder.java index a3ab5b2..6c77754 100644 --- a/src/main/java/com/thebrokenrail/obsidianspawn/DataHolder.java +++ b/src/main/java/com/thebrokenrail/obsidianspawn/SpawnDataHolder.java @@ -2,7 +2,7 @@ package com.thebrokenrail.obsidianspawn; import net.minecraft.world.dimension.DimensionType; -public interface DataHolder { +public interface SpawnDataHolder { void setSpawnDimension(DimensionType dimension); DimensionType getSpawnDimension(); diff --git a/src/main/java/com/thebrokenrail/obsidianspawn/mixin/MixinCryingObsidianBlock.java b/src/main/java/com/thebrokenrail/obsidianspawn/mixin/MixinCryingObsidianBlock.java index 1600af9..3c9dcdf 100644 --- a/src/main/java/com/thebrokenrail/obsidianspawn/mixin/MixinCryingObsidianBlock.java +++ b/src/main/java/com/thebrokenrail/obsidianspawn/mixin/MixinCryingObsidianBlock.java @@ -1,8 +1,10 @@ package com.thebrokenrail.obsidianspawn.mixin; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.CryingObsidianBlock; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.text.TranslatableText; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; @@ -10,12 +12,17 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import org.spongepowered.asm.mixin.Mixin; -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "deprecation"}) @Mixin(CryingObsidianBlock.class) -public class MixinCryingObsidianBlock { +public abstract class MixinCryingObsidianBlock extends Block { + public MixinCryingObsidianBlock(Settings settings) { + super(settings); + } + public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { if (!world.isClient()) { - player.setPlayerSpawn(pos, false, true); + player.setPlayerSpawn(pos, false, false); + player.sendMessage(new TranslatableText("block.minecraft.bed.set_spawn")); } return ActionResult.SUCCESS; } diff --git a/src/main/java/com/thebrokenrail/obsidianspawn/mixin/MixinPlayerEntity.java b/src/main/java/com/thebrokenrail/obsidianspawn/mixin/MixinPlayerEntity.java index 3809697..23f6000 100644 --- a/src/main/java/com/thebrokenrail/obsidianspawn/mixin/MixinPlayerEntity.java +++ b/src/main/java/com/thebrokenrail/obsidianspawn/mixin/MixinPlayerEntity.java @@ -1,7 +1,7 @@ package com.thebrokenrail.obsidianspawn.mixin; -import com.thebrokenrail.obsidianspawn.DataHolder; import com.thebrokenrail.obsidianspawn.ObsidianSpawn; +import com.thebrokenrail.obsidianspawn.SpawnDataHolder; import net.minecraft.block.Block; import net.minecraft.block.CryingObsidianBlock; import net.minecraft.entity.player.PlayerEntity; @@ -20,7 +20,7 @@ import java.util.Optional; @SuppressWarnings("unused") @Mixin(PlayerEntity.class) -public class MixinPlayerEntity implements DataHolder { +public class MixinPlayerEntity implements SpawnDataHolder { private DimensionType spawnDimension = DimensionType.OVERWORLD; @Inject(at = @At("HEAD"), method = "readCustomDataFromTag") diff --git a/src/main/java/com/thebrokenrail/obsidianspawn/mixin/MixinServerPlayNetworkHandler.java b/src/main/java/com/thebrokenrail/obsidianspawn/mixin/MixinServerPlayNetworkHandler.java index 6ac8cdd..a5e5792 100644 --- a/src/main/java/com/thebrokenrail/obsidianspawn/mixin/MixinServerPlayNetworkHandler.java +++ b/src/main/java/com/thebrokenrail/obsidianspawn/mixin/MixinServerPlayNetworkHandler.java @@ -1,7 +1,7 @@ package com.thebrokenrail.obsidianspawn.mixin; -import com.thebrokenrail.obsidianspawn.DataHolder; import com.thebrokenrail.obsidianspawn.ObsidianSpawn; +import com.thebrokenrail.obsidianspawn.SpawnDataHolder; import net.minecraft.block.Block; import net.minecraft.block.CryingObsidianBlock; import net.minecraft.server.network.ServerPlayNetworkHandler; @@ -18,7 +18,7 @@ public class MixinServerPlayNetworkHandler { @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/PlayerManager;respawnPlayer(Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/minecraft/world/dimension/DimensionType;Z)Lnet/minecraft/server/network/ServerPlayerEntity;"), method = "onClientStatus", index = 1) public DimensionType adjustRespawnDimension(ServerPlayerEntity player, DimensionType dimension, boolean alive) { if (player.getSpawnPosition() != null) { - DimensionType type = ((DataHolder) player).getSpawnDimension(); + DimensionType type = ((SpawnDataHolder) player).getSpawnDimension(); WorldView world = player.server.getWorld(type); Block block = world.getBlockState(player.getSpawnPosition()).getBlock(); if (!(block instanceof CryingObsidianBlock)) { diff --git a/src/main/java/com/thebrokenrail/obsidianspawn/mixin/MixinServerPlayerEntity.java b/src/main/java/com/thebrokenrail/obsidianspawn/mixin/MixinServerPlayerEntity.java index f0dd7ee..daa9d07 100644 --- a/src/main/java/com/thebrokenrail/obsidianspawn/mixin/MixinServerPlayerEntity.java +++ b/src/main/java/com/thebrokenrail/obsidianspawn/mixin/MixinServerPlayerEntity.java @@ -1,6 +1,6 @@ package com.thebrokenrail.obsidianspawn.mixin; -import com.thebrokenrail.obsidianspawn.DataHolder; +import com.thebrokenrail.obsidianspawn.SpawnDataHolder; import net.minecraft.server.network.ServerPlayerEntity; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -9,11 +9,11 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @SuppressWarnings("unused") @Mixin(ServerPlayerEntity.class) -public abstract class MixinServerPlayerEntity implements DataHolder { +public abstract class MixinServerPlayerEntity implements SpawnDataHolder { @Inject(at = @At("HEAD"), method = "copyFrom") public void copyFrom(ServerPlayerEntity oldPlayer, boolean alive, CallbackInfo info) { - DataHolder oldData = (DataHolder) oldPlayer; - DataHolder newData = this; + SpawnDataHolder oldData = (SpawnDataHolder) oldPlayer; + SpawnDataHolder newData = this; newData.setSpawnDimension(oldData.getSpawnDimension()); }