diff --git a/gradle.properties b/gradle.properties index 3946841..bccd495 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,9 +3,9 @@ org.gradle.jvmargs=-Xmx8G org.gradle.daemon=false -my_version=1.3.4.2 +my_version=1.3.4.3 mc_version=1.19.2 forge_version=43.1.32 jei_version=11.3.0.262 -libz_version=1.0.0.2 \ No newline at end of file +libz_version=1.0.1.0 \ No newline at end of file diff --git a/src/main/java/dev/zontreck/otemod/antigrief/HealerManager.java b/src/main/java/dev/zontreck/otemod/antigrief/HealerManager.java index 9bd1f06..5f0208d 100644 --- a/src/main/java/dev/zontreck/otemod/antigrief/HealerManager.java +++ b/src/main/java/dev/zontreck/otemod/antigrief/HealerManager.java @@ -3,9 +3,9 @@ package dev.zontreck.otemod.antigrief; import java.io.IOException; import java.util.Random; +import dev.zontreck.libzontreck.vectors.Vector3; import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.configs.OTEServerConfig; -import dev.zontreck.otemod.containers.Vector3; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvent; @@ -20,12 +20,14 @@ public class HealerManager implements Runnable } @Override public void run(){ + boolean skipWait=false; while(OTEMod.ALIVE) { // Run the queue // We want to restore one block per run, then halt for number of seconds in config try { - Thread.sleep(OTEServerConfig.HEALER_TIMER.get()); + if(!skipWait) + Thread.sleep(OTEServerConfig.HEALER_TIMER.get()); } catch (NumberFormatException e) { e.printStackTrace(); } catch (InterruptedException e) { @@ -78,6 +80,13 @@ public class HealerManager implements Runnable // Healer object should have been added to the validation list + + // Check if the block to restore, and the block at the location are identical + if(level.getBlockState(sb.getPos()).is(sb.getState().getBlock())){ + skipWait=true; + continue; // Skip the wait, and this block + } + level.getServer().execute(new Runnable(){ public void run() diff --git a/src/main/java/dev/zontreck/otemod/antigrief/StoredBlock.java b/src/main/java/dev/zontreck/otemod/antigrief/StoredBlock.java index 6f2da67..532219e 100644 --- a/src/main/java/dev/zontreck/otemod/antigrief/StoredBlock.java +++ b/src/main/java/dev/zontreck/otemod/antigrief/StoredBlock.java @@ -1,8 +1,8 @@ package dev.zontreck.otemod.antigrief; -import dev.zontreck.otemod.containers.Vector3; -import dev.zontreck.otemod.containers.WorldPosition; -import dev.zontreck.otemod.exceptions.InvalidDeserialization; +import dev.zontreck.libzontreck.exceptions.InvalidDeserialization; +import dev.zontreck.libzontreck.vectors.Vector3; +import dev.zontreck.libzontreck.vectors.WorldPosition; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtUtils; diff --git a/src/main/java/dev/zontreck/otemod/blocks/ModBlocks.java b/src/main/java/dev/zontreck/otemod/blocks/ModBlocks.java index bf81dba..55d9cee 100644 --- a/src/main/java/dev/zontreck/otemod/blocks/ModBlocks.java +++ b/src/main/java/dev/zontreck/otemod/blocks/ModBlocks.java @@ -43,7 +43,7 @@ public class ModBlocks { public static final RegistryObject AURORA_DOOR_I = ITEMS.register("aurora_door", () -> new BlockItem(AURORA_DOOR.get(), new Item.Properties().tab(CreativeModeTab.TAB_MISC))); - public static final RegistryObject CLEAR_GLASS_BLOCK = BLOCKS.register("clear_glass_block", () -> new Block(BlockBehaviour.Properties.copy(Blocks.GLASS).requiresCorrectToolForDrops().strength(1f).destroyTime(6))); + public static final RegistryObject CLEAR_GLASS_BLOCK = BLOCKS.register("clear_glass_block", () -> new Block(BlockBehaviour.Properties.copy(Blocks.GLASS).strength(1f).destroyTime(6))); public static final RegistryObject CLEAR_GLASS_BLOCK_I = ITEMS.register("clear_glass_block", () -> new BlockItem(CLEAR_GLASS_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_MISC))); diff --git a/src/main/java/dev/zontreck/otemod/commands/homes/HomeCommand.java b/src/main/java/dev/zontreck/otemod/commands/homes/HomeCommand.java index 52e1c73..8a5e50a 100644 --- a/src/main/java/dev/zontreck/otemod/commands/homes/HomeCommand.java +++ b/src/main/java/dev/zontreck/otemod/commands/homes/HomeCommand.java @@ -11,12 +11,12 @@ import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.exceptions.CommandSyntaxException; import dev.zontreck.libzontreck.chat.ChatColor; +import dev.zontreck.libzontreck.exceptions.InvalidDeserialization; import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.chat.ChatServerOverride; import dev.zontreck.otemod.commands.teleport.TeleportActioner; import dev.zontreck.otemod.commands.teleport.TeleportContainer; import dev.zontreck.otemod.database.TeleportDestination; -import dev.zontreck.otemod.exceptions.InvalidDeserialization; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.nbt.NbtUtils; diff --git a/src/main/java/dev/zontreck/otemod/commands/homes/SetHomeCommand.java b/src/main/java/dev/zontreck/otemod/commands/homes/SetHomeCommand.java index 3c42121..2336ca3 100644 --- a/src/main/java/dev/zontreck/otemod/commands/homes/SetHomeCommand.java +++ b/src/main/java/dev/zontreck/otemod/commands/homes/SetHomeCommand.java @@ -8,10 +8,10 @@ import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.arguments.StringArgumentType; import dev.zontreck.libzontreck.chat.ChatColor; +import dev.zontreck.libzontreck.vectors.Vector2; +import dev.zontreck.libzontreck.vectors.Vector3; import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.chat.ChatServerOverride; -import dev.zontreck.otemod.containers.Vector2; -import dev.zontreck.otemod.containers.Vector3; import dev.zontreck.otemod.database.TeleportDestination; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; diff --git a/src/main/java/dev/zontreck/otemod/commands/teleport/RTPCommand.java b/src/main/java/dev/zontreck/otemod/commands/teleport/RTPCommand.java index e472a9b..e92c235 100644 --- a/src/main/java/dev/zontreck/otemod/commands/teleport/RTPCommand.java +++ b/src/main/java/dev/zontreck/otemod/commands/teleport/RTPCommand.java @@ -10,9 +10,9 @@ import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.arguments.BoolArgumentType; import dev.zontreck.libzontreck.chat.ChatColor; +import dev.zontreck.libzontreck.vectors.Vector3; import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.chat.ChatServerOverride; -import dev.zontreck.otemod.containers.Vector3; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.core.BlockPos; diff --git a/src/main/java/dev/zontreck/otemod/commands/teleport/TeleportRunnable.java b/src/main/java/dev/zontreck/otemod/commands/teleport/TeleportRunnable.java index 8d5c130..6bde312 100644 --- a/src/main/java/dev/zontreck/otemod/commands/teleport/TeleportRunnable.java +++ b/src/main/java/dev/zontreck/otemod/commands/teleport/TeleportRunnable.java @@ -32,5 +32,7 @@ public class TeleportRunnable implements Runnable c.Assert(Action.PlayerInst); Action.PlayerInst.setPos(Action.Position); + + Action.PlayerInst.giveExperiencePoints(1); // Attempt to fix experience point bug } } diff --git a/src/main/java/dev/zontreck/otemod/commands/warps/DelWarpCommand.java b/src/main/java/dev/zontreck/otemod/commands/warps/DelWarpCommand.java index b9fe3b8..4c1fab4 100644 --- a/src/main/java/dev/zontreck/otemod/commands/warps/DelWarpCommand.java +++ b/src/main/java/dev/zontreck/otemod/commands/warps/DelWarpCommand.java @@ -8,10 +8,10 @@ import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.arguments.StringArgumentType; import dev.zontreck.libzontreck.chat.ChatColor; +import dev.zontreck.libzontreck.vectors.Vector2; +import dev.zontreck.libzontreck.vectors.Vector3; import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.chat.ChatServerOverride; -import dev.zontreck.otemod.containers.Vector2; -import dev.zontreck.otemod.containers.Vector3; import dev.zontreck.otemod.database.TeleportDestination; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; diff --git a/src/main/java/dev/zontreck/otemod/commands/warps/RTPWarpCommand.java b/src/main/java/dev/zontreck/otemod/commands/warps/RTPWarpCommand.java index fcc84ce..3325931 100644 --- a/src/main/java/dev/zontreck/otemod/commands/warps/RTPWarpCommand.java +++ b/src/main/java/dev/zontreck/otemod/commands/warps/RTPWarpCommand.java @@ -8,10 +8,10 @@ import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.arguments.StringArgumentType; import dev.zontreck.libzontreck.chat.ChatColor; +import dev.zontreck.libzontreck.vectors.Vector2; +import dev.zontreck.libzontreck.vectors.Vector3; import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.chat.ChatServerOverride; -import dev.zontreck.otemod.containers.Vector2; -import dev.zontreck.otemod.containers.Vector3; import dev.zontreck.otemod.database.TeleportDestination; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; diff --git a/src/main/java/dev/zontreck/otemod/commands/warps/SetWarpCommand.java b/src/main/java/dev/zontreck/otemod/commands/warps/SetWarpCommand.java index 2b925c6..9b5ebf7 100644 --- a/src/main/java/dev/zontreck/otemod/commands/warps/SetWarpCommand.java +++ b/src/main/java/dev/zontreck/otemod/commands/warps/SetWarpCommand.java @@ -8,10 +8,10 @@ import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.arguments.StringArgumentType; import dev.zontreck.libzontreck.chat.ChatColor; +import dev.zontreck.libzontreck.vectors.Vector2; +import dev.zontreck.libzontreck.vectors.Vector3; import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.chat.ChatServerOverride; -import dev.zontreck.otemod.containers.Vector2; -import dev.zontreck.otemod.containers.Vector3; import dev.zontreck.otemod.database.TeleportDestination; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; diff --git a/src/main/java/dev/zontreck/otemod/commands/warps/WarpsCommand.java b/src/main/java/dev/zontreck/otemod/commands/warps/WarpsCommand.java index aa50b81..4dfbf17 100644 --- a/src/main/java/dev/zontreck/otemod/commands/warps/WarpsCommand.java +++ b/src/main/java/dev/zontreck/otemod/commands/warps/WarpsCommand.java @@ -13,8 +13,6 @@ import dev.zontreck.libzontreck.chat.HoverTip; import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.chat.ChatServerOverride; import dev.zontreck.otemod.configs.Profile; -import dev.zontreck.otemod.containers.Vector2; -import dev.zontreck.otemod.containers.Vector3; import dev.zontreck.otemod.database.TeleportDestination; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; diff --git a/src/main/java/dev/zontreck/otemod/containers/NonAbsVector3.java b/src/main/java/dev/zontreck/otemod/containers/NonAbsVector3.java deleted file mode 100644 index 7f8c9ed..0000000 --- a/src/main/java/dev/zontreck/otemod/containers/NonAbsVector3.java +++ /dev/null @@ -1,18 +0,0 @@ -package dev.zontreck.otemod.containers; - -/* -* This is a non-serializable instanced Vector that is meant to slam positions down as a integer -*/ -public class NonAbsVector3 -{ - public long x; - public long y; - public long z; - - public NonAbsVector3(Vector3 origin) - { - x = Math.round(origin.x); - y = Math.round(origin.y); - z = Math.round(origin.z); - } -} diff --git a/src/main/java/dev/zontreck/otemod/containers/Vector2.java b/src/main/java/dev/zontreck/otemod/containers/Vector2.java deleted file mode 100644 index b493249..0000000 --- a/src/main/java/dev/zontreck/otemod/containers/Vector2.java +++ /dev/null @@ -1,68 +0,0 @@ -package dev.zontreck.otemod.containers; - -import dev.zontreck.otemod.exceptions.InvalidDeserialization; -import net.minecraft.world.phys.Vec2; -import net.minecraft.world.phys.Vec3; - -public class Vector2 -{ - public float x; - public float y; - - public Vec2 asMinecraftVector(){ - return new Vec2(x, y); - } - - public Vector2() - { - - } - - public Vector2(float x, float y) - { - this.x=x; - this.y=y; - } - - public Vector2(Vec2 pos) - { - x=pos.x; - y=pos.y; - } - - public Vector2(String pos) throws InvalidDeserialization - { - // This will be serialized most likely from the ToString method - // Parse - if(pos.startsWith("<")) - { - pos=pos.substring(1, pos.length()-1); // Rip off the ending bracket too - String[] positions = pos.split(", "); - if(positions.length!=2) - { - positions = pos.split(","); - } - - if(positions.length!=2) - { - throw new InvalidDeserialization("Positions must be in the same format provided by ToString() (ex. <1,1> or <1, 1>"); - } - - this.x = Float.parseFloat(positions[0]); - this.y = Float.parseFloat(positions[1]); - // We are done now - } - } - - public Vector2 Clone() - { - Vector2 n = new Vector2(x, y); - return n; - } - - @Override - public String toString() - { - return "<"+String.valueOf(x)+", "+String.valueOf(y) + ">"; - } -} diff --git a/src/main/java/dev/zontreck/otemod/containers/Vector3.java b/src/main/java/dev/zontreck/otemod/containers/Vector3.java deleted file mode 100644 index 1929e5d..0000000 --- a/src/main/java/dev/zontreck/otemod/containers/Vector3.java +++ /dev/null @@ -1,140 +0,0 @@ -package dev.zontreck.otemod.containers; - -import dev.zontreck.otemod.exceptions.InvalidDeserialization; -import net.minecraft.core.BlockPos; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.phys.Vec3; - -public class Vector3 -{ - public double x; - public double y; - public double z; - - public Vec3 asMinecraftVector(){ - return new Vec3(x, y, z); - } - - public BlockPos asBlockPos() - { - return new BlockPos(asMinecraftVector()); - } - - public Vector3() - { - - } - - public Vector3(double x, double y, double z) - { - this.x=x; - this.y=y; - this.z=z; - } - - public Vector3(Vec3 pos) - { - x=pos.x; - y=pos.y; - z=pos.z; - } - - public Vector3(BlockPos pos) - { - x=pos.getX(); - y=pos.getY(); - z=pos.getZ(); - } - - public Vector3(String pos) throws InvalidDeserialization - { - // This will be serialized most likely from the ToString method - // Parse - if(pos.startsWith("<")) - { - pos=pos.substring(1, pos.length()-1); // Rip off the ending bracket too - String[] positions = pos.split(", "); - if(positions.length!=3) - { - positions = pos.split(","); - } - - if(positions.length!=3) - { - throw new InvalidDeserialization("Positions must be in the same format provided by ToString() (ex. <1,1,1> or <1, 1, 1>"); - } - - this.x = Double.parseDouble(positions[0]); - this.y = Double.parseDouble(positions[1]); - this.z = Double.parseDouble(positions[2]); - // We are done now - } - } - - public Vector3 subtract(Vector3 other) - { - return new Vector3(x-other.x, y-other.y, z-other.z); - } - public Vector3 add(Vector3 other) - { - return new Vector3(x+other.x, y+other.y, z +other.z); - } - - public double distance(Vector3 other) - { - Vector3 sub = subtract(other); - return Math.sqrt((sub.x * sub.x + sub.y * sub.y + sub.z * sub.z)); - } - - public Vector3 moveUp() - { - Vector3 up = Clone(); - up.y+=1; - return up; - } - public Vector3 moveDown() - { - Vector3 up = Clone(); - up.y-=1; - return up; - } - - - public Vector3 Clone() - { - Vector3 n = new Vector3(x, y, z); - return n; - } - - @Override - public String toString() - { - return "<"+String.valueOf(x)+", "+String.valueOf(y)+", "+String.valueOf(z)+">"; - } - - public NonAbsVector3 rounded() - { - NonAbsVector3 cl = new NonAbsVector3(this); - return cl; - } - - public CompoundTag serialize() - { - CompoundTag tag = new CompoundTag(); - tag.putDouble("x", x); - tag.putDouble("y", y); - tag.putDouble("z", z); - - return tag; - } - - public Vector3(CompoundTag tag) { - this.deserialize(tag); - } - public void deserialize(CompoundTag tag) - { - x=tag.getDouble("x"); - y=tag.getDouble("y"); - z=tag.getDouble("z"); - } -} diff --git a/src/main/java/dev/zontreck/otemod/containers/WorldPosition.java b/src/main/java/dev/zontreck/otemod/containers/WorldPosition.java deleted file mode 100644 index 1999d8f..0000000 --- a/src/main/java/dev/zontreck/otemod/containers/WorldPosition.java +++ /dev/null @@ -1,94 +0,0 @@ -package dev.zontreck.otemod.containers; - -import dev.zontreck.otemod.OTEMod; -import dev.zontreck.otemod.exceptions.InvalidDeserialization; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.NbtUtils; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.level.ServerLevel; - -public class WorldPosition -{ - - public Vector3 Position; - public String Dimension; - - public WorldPosition(CompoundTag tag, boolean pretty) throws InvalidDeserialization - { - if(pretty){ - - Position = new Vector3(tag.getString("Position")); - Dimension = tag.getString("Dimension"); - }else { - Position = new Vector3(tag.getCompound("pos")); - Dimension = tag.getString("Dimension"); - } - - } - - public WorldPosition(Vector3 pos, String dim) - { - Position=pos; - Dimension=dim; - } - - public WorldPosition(Vector3 pos, ServerLevel lvl) - { - Position=pos; - Dimension = lvl.dimension().location().getNamespace() + ":"+lvl.dimension().location().getPath(); - } - - @Override - public String toString() - { - return NbtUtils.structureToSnbt(serialize()); - } - - public CompoundTag serializePretty() - { - CompoundTag tag = new CompoundTag(); - - tag.putString("Position", Position.toString()); - tag.putString("Dimension", Dimension); - - return tag; - } - - public CompoundTag serialize() - { - CompoundTag tag = new CompoundTag(); - tag.put("pos", Position.serialize()); - tag.putString("Dimension", Dimension); - - return tag; - } - - - - public ServerLevel getActualDimension() - { - - String dim = Dimension; - String[] dims = dim.split(":"); - - ResourceLocation rl = new ResourceLocation(dims[0], dims[1]); - ServerLevel dimL = null; - for (ServerLevel lServerLevel : OTEMod.THE_SERVER.getAllLevels()) { - ResourceLocation XL = lServerLevel.dimension().location(); - - if(XL.getNamespace().equals(rl.getNamespace())){ - if(XL.getPath().equals(rl.getPath())){ - dimL = lServerLevel; - } - } - } - - if(dimL == null) - { - OTEMod.LOGGER.error("DIMENSION COULD NOT BE FOUND : "+Dimension); - return null; - } - - return dimL; - } -} diff --git a/src/main/java/dev/zontreck/otemod/database/TeleportDestination.java b/src/main/java/dev/zontreck/otemod/database/TeleportDestination.java index 5a8873e..d3aec31 100644 --- a/src/main/java/dev/zontreck/otemod/database/TeleportDestination.java +++ b/src/main/java/dev/zontreck/otemod/database/TeleportDestination.java @@ -1,9 +1,9 @@ package dev.zontreck.otemod.database; -import dev.zontreck.otemod.containers.Vector2; -import dev.zontreck.otemod.containers.Vector3; -import dev.zontreck.otemod.containers.WorldPosition; -import dev.zontreck.otemod.exceptions.InvalidDeserialization; +import dev.zontreck.libzontreck.vectors.Vector2; +import dev.zontreck.libzontreck.vectors.Vector3; +import dev.zontreck.libzontreck.vectors.WorldPosition; +import dev.zontreck.libzontreck.exceptions.InvalidDeserialization; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtUtils; import net.minecraft.server.level.ServerLevel; diff --git a/src/main/java/dev/zontreck/otemod/exceptions/InvalidDeserialization.java b/src/main/java/dev/zontreck/otemod/exceptions/InvalidDeserialization.java deleted file mode 100644 index f645d92..0000000 --- a/src/main/java/dev/zontreck/otemod/exceptions/InvalidDeserialization.java +++ /dev/null @@ -1,11 +0,0 @@ -package dev.zontreck.otemod.exceptions; - -public class InvalidDeserialization extends Exception -{ - public InvalidDeserialization(String error){ - super(error); - } - public InvalidDeserialization(){ - super("Incorrect information was provided to the deserializer"); - } -} diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 7cca8fa..65b36eb 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -19,7 +19,7 @@ modId="otemod" #mandatory # The version number of the mod - there's a few well known ${} variables useable here or just hardcode it # ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata # see the associated build.gradle script for how to populate this completely automatically during a build -version="1.3.4.2" #mandatory +version="1.3.4.3" #mandatory # A display name for the mod displayName="OTEMod Resources" #mandatory # A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/ diff --git a/src/main/resources/assets/otemod/models/item/clear_glass_block.json b/src/main/resources/assets/otemod/models/item/clear_glass_block.json index f32d11b..6582543 100644 --- a/src/main/resources/assets/otemod/models/item/clear_glass_block.json +++ b/src/main/resources/assets/otemod/models/item/clear_glass_block.json @@ -1,3 +1,3 @@ { - "parent": "otemod:block/clear_glass_block" + "parent": "minecraft:block/glass" } \ No newline at end of file