Skip to content

Commit

Permalink
Merge pull request #10 from preprocessor/main
Browse files Browse the repository at this point in the history
Added better randomness and reset some positions 🙃
  • Loading branch information
Beta-51 authored Apr 7, 2024
2 parents b26cf46 + b072560 commit a4ec422
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
3 changes: 0 additions & 3 deletions src/main/java/lusiiplugin/commands/PayCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,10 @@ public boolean execute(CommandHandler handler, CommandSender sender, String[] ar
return true;
}


public boolean opRequired(String[] args) {
return false;
}



public void sendCommandSyntax(CommandHandler handler, CommandSender sender) {
sender.sendMessage("§3/pay §4<username> <amount>");
sender.sendMessage("§5Pay another user with points");
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/lusiiplugin/commands/RTPCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public boolean execute(CommandHandler handler, CommandSender sender, String[] ar
return true;
}
Random r = new Random();
int randX = r.nextInt() * (25000 + 25000 + 1) - 25000; // (r * 50001) - 25000
int randZ = r.nextInt() * (25000 + 25000 + 1) - 25000;
int randX = (int) (r.nextDouble() * 50001.0 - 25000.0);
int randZ = (int) (r.nextDouble() * 50001.0 - 25000.0);

tpInfo.update(p);

Expand Down
7 changes: 1 addition & 6 deletions src/main/java/lusiiplugin/mixin/ChunkMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ public void debugAddEntity(Entity entity, CallbackInfo ci) {
System.out.println("Problem entity: " + entity.getClass().getName());
System.out.println("Entity XYZ | entity's chunk XZ: " + entity.x + " " + entity.y + " " + entity.z + " | " + entity.chunkCoordX + " " + entity.chunkCoordZ);

double x = this.xPosition * 16.0;
double y = entity.y;
double z = this.zPosition * 16.0;

System.out.println("Attempting to move entity to: " + x + " " + y + " " + z);
entity.absMoveTo(x, y, z, entity.yRot, entity.xRot);
((EntityMixin) entity).invokeResetPos();
}
}
11 changes: 11 additions & 0 deletions src/main/java/lusiiplugin/mixin/EntityMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package lusiiplugin.mixin;

import net.minecraft.core.entity.Entity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(Entity.class)
public interface EntityMixin {
@Invoker("resetPos")
void invokeResetPos();
}
1 change: 1 addition & 0 deletions src/main/resources/lusiiplugin.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"CommandsMixin",
"ContainerWorkbenchMixin",
"EntityBobberMixin",
"EntityMixin",
"EntityPlayerMixin",
"EntityTNTMixin",
"NetServerHandlerMixin",
Expand Down

0 comments on commit a4ec422

Please sign in to comment.