Skip to content

Commit

Permalink
Merge branch 'pumpkinAura'
Browse files Browse the repository at this point in the history
  • Loading branch information
anOtherAnalyse committed Oct 22, 2022
2 parents ed1296c + afb0e49 commit 24c94f4
Show file tree
Hide file tree
Showing 88 changed files with 1,509 additions and 314 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Java CI with Gradle

on: [push,pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Decomp Workspace
run: ./gradlew setupDecompWorkspace

- name: Build
run: ./gradlew build

- uses: actions/upload-artifact@v2
with:
name: Package
path: build/libs
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,16 @@ Use the ```backslash``` key to open the GUI (by default). Change it from Minecra

### Disclaimer
Most of these features are based on Minecraft network stack and do not work on singleplayer.

### Running in a Dev Environment:
```gradle
gradlew setupDecompWorkspace
gradlew runClient
```

### Compiling the client:
```gradle
gradlew setupDecompWorkspace
gradlew build
```
You will find your built jar in the directory `builds/libs`.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.


version = "1.1.4"
version = "1.1.5"
group = "com.bobeezz.family_fun_pack" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "family_fun_pack"

Expand Down
4 changes: 4 additions & 0 deletions modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@ Use ```.respawn``` to respawn.
##### Bowbomb

One-shot & ultra-fast arrows. Can only be shot horizontally though.

##### PumpkinAura

Super strong pumpkin aura for pumpkin pvp on auscpvp.org & 2b2t.org.au
6 changes: 3 additions & 3 deletions src/main/java/family_fun_pack/FamilyFunPack.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class FamilyFunPack
{
public static final String MODID = "family_fun_pack";
public static final String NAME = "Family Fun Pack";
public static final String VERSION = "1.1.4";
public static final String VERSION = "1.1.5";

private static NetworkHandler networkHandler;
private static Modules modules;
Expand Down Expand Up @@ -63,8 +63,8 @@ public static void addModuleKey(int key, Module module) {
}

/* Print message in chat */
public static void printMessage(String msg) {
Minecraft.getMinecraft().ingameGUI.addChatMessage(ChatType.SYSTEM, new TextComponentString(TextFormatting.BLUE + "[FFP] " + TextFormatting.RESET + msg));
public static void printMessage(String msg, Object... args) {
Minecraft.getMinecraft().ingameGUI.addChatMessage(ChatType.SYSTEM, new TextComponentString(TextFormatting.BLUE + "[FFP] " + TextFormatting.RESET + String.format(msg, args)));
}

@EventHandler
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/family_fun_pack/commands/BlockAtCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class BlockAtCommand extends Command implements PacketListener {

private int chg_count;
private boolean enabled;
private Random random;
private final Random random;
private int burst;

public BlockAtCommand() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/family_fun_pack/commands/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@SideOnly(Side.CLIENT)
public abstract class Command {

private String name;
private final String name;

public Command(String name) {
this.name = name;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/family_fun_pack/commands/Commands.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

@SideOnly(Side.CLIENT)
public class Commands {
private Map<String, Command> commands;
private final Map<String, Command> commands;

/* I'm too lazy to develop interfaces so let's add a lot of commands */

Expand All @@ -23,6 +23,7 @@ public Commands() {
this.registerCommand(new VanishCommand());
this.registerCommand(new VClipCommand());
this.registerCommand(new HClipCommand());
this.registerCommand(new HelpCommand());
this.registerCommand(new RaytraceCommand());
this.registerCommand(new UnloadedRideCommand());
this.registerCommand(new StalkCommand());
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/family_fun_pack/commands/DiffCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ public Packet<?> packetReceived(EnumPacketDirection direction, int id, Packet<?>
}
}
if(add) {
FamilyFunPack.printMessage("No additional players over " + Integer.toString(completion.getMatches().length) + " players");
FamilyFunPack.printMessage("No additional players over " + completion.getMatches().length + " players");
} else {
int total_tab = handler.getPlayerInfoMap().size();
FamilyFunPack.printMessage("Board contains [" + Integer.toString(total_tab) + "/" + Integer.toString(completion.getMatches().length) + "] players");
FamilyFunPack.printMessage("Board contains [" + total_tab + "/" + completion.getMatches().length + "] players");
}
}
return null;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/family_fun_pack/commands/FillBookCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public String execute(String[] args) {
FamilyFunPack.getNetworkHandler().registerListener(EnumPacketDirection.CLIENTBOUND, this, 22);

FamilyFunPack.getNetworkHandler().sendPacket(new CPacketCustomPayload(sign ? "MC|BSign" : "MC|BEdit", data));
return Integer.toString(data.writerIndex()) + " bytes written to book";
return data.writerIndex() + " bytes written to book";
}
return "Please hold a writable book";
}
Expand All @@ -85,7 +85,7 @@ public Packet<?> packetReceived(EnumPacketDirection direction, int id, Packet<?>
return packet;
}
size = buff.readerIndex() - size;
FamilyFunPack.printMessage("Server recorded " + Integer.toString(size) + " bytes");
FamilyFunPack.printMessage("Server recorded " + size + " bytes");
}
return packet;
}
Expand Down
49 changes: 49 additions & 0 deletions src/main/java/family_fun_pack/commands/HelpCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package family_fun_pack.commands;

import family_fun_pack.FamilyFunPack;
import family_fun_pack.modules.CommandsModule;
import family_fun_pack.network.PacketListener;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.network.EnumPacketDirection;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.server.SPacketCustomPayload;
import net.minecraft.world.storage.WorldInfo;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;

/* Dump all commands usage */

@SideOnly(Side.CLIENT)
public class HelpCommand extends Command {

public HelpCommand() {
super("help");
}

public String usage() {
return this.getName();
}

public String execute(String[] args) {
final StringBuilder sb = new StringBuilder();
final List<Command> list = new ArrayList<>(CommandsModule.getCommands().getCommands());

list.sort(Comparator.comparing(Command::getName));

for (Command command : list) {
sb.append("\n").append(CommandsModule.ESCAPE_CHARACTER).append(command.usage());
}

return sb.toString().replaceFirst("\n", "");
}
}
2 changes: 1 addition & 1 deletion src/main/java/family_fun_pack/commands/InfoCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public String execute(String[] args) {
stat += " max players: " + max_players;

if(mc.player.isRiding()) {
stat += ", riding: " + Integer.toString(mc.player.getRidingEntity().getEntityId());
stat += ", riding: " + mc.player.getRidingEntity().getEntityId();
}

return stat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ public String usage() {
public String execute(String[] args) {
ItemStack stack = Minecraft.getMinecraft().player.getHeldItemMainhand();
if(stack.isEmpty()) return "You are not holding any item";
return "Item weights " + Integer.toString(ItemSizeCommand.getItemSize(stack)) + " bytes";
return "Item weights " + ItemSizeCommand.getItemSize(stack) + " bytes";
}
}
4 changes: 2 additions & 2 deletions src/main/java/family_fun_pack/commands/KillDupeCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ public Packet<?> packetReceived(EnumPacketDirection direction, int id, Packet<?>
SPacketConfirmTransaction confirm = (SPacketConfirmTransaction) packet;
if(confirm.getWindowId() == this.window_id && confirm.getActionNumber() == -42) {
if(confirm.wasAccepted()) {
FamilyFunPack.printMessage("Swap " + Integer.toString(slot) + TextFormatting.GREEN + " succeeded");
FamilyFunPack.printMessage("Swap " + slot + TextFormatting.GREEN + " succeeded");
} else {
FamilyFunPack.printMessage("Swap " + Integer.toString(slot) + TextFormatting.RED + " failed");
FamilyFunPack.printMessage("Swap " + slot + TextFormatting.RED + " failed");
}
}
FamilyFunPack.getNetworkHandler().unregisterListener(EnumPacketDirection.CLIENTBOUND, this, 17);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/family_fun_pack/commands/LoadChunkCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public class LoadChunkCommand extends Command implements PacketListener {
private static final int BURST_SIZE = 3;
private static final int RE_SEND_TIME = 2000;

private Map<BlockPos, Long> window;
private ReadWriteLock window_lock;
private final Map<BlockPos, Long> window;
private final ReadWriteLock window_lock;

private ChunkPos[] chunks;
private int width;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public String execute(String[] args) {

WorldProvider provider = new WorldProviderSurface();

WorldInfo info = new WorldInfo(new WorldSettings(-8076723744225505211l, GameType.SURVIVAL, true, false, WorldType.DEFAULT), "tmp");
WorldInfo info = new WorldInfo(new WorldSettings(-8076723744225505211L, GameType.SURVIVAL, true, false, WorldType.DEFAULT), "tmp");

FakeWorld fake = new FakeWorld(null, info, provider);
provider.setWorld(fake);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public Packet<?> packetReceived(EnumPacketDirection direction, int id, Packet<?>
// Sync vehicle position
((CommandsModule)FamilyFunPack.getModules().getByName("FFP Commands")).getCommand("sync").execute(new String[0]);

mc.player.openGuiHorseInventory(fake, new ContainerHorseChest(open.getWindowTitle().appendText(" [" + Integer.toString(entity_id) + "]"), open.getSlotCount()));
mc.player.openGuiHorseInventory(fake, new ContainerHorseChest(open.getWindowTitle().appendText(" [" + entity_id + "]"), open.getSlotCount()));
mc.player.openContainer.windowId = open.getWindowId();
} else if(entity instanceof AbstractHorse) {
AbstractHorse horse = (AbstractHorse) entity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public Packet<?> packetReceived(EnumPacketDirection direction, int id, Packet<?>

if(id != this.last_id) {
if(this.last_packet != null) {
FamilyFunPack.printMessage("Received packet [" + this.last_packet + "] x " + Integer.toString(this.count));
FamilyFunPack.printMessage("Received packet [" + this.last_packet + "] x " + this.count);
}

if(packet instanceof SPacketEntityTeleport) {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/family_fun_pack/commands/PeekCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public String usage() {
public String execute(String[] args) {
Minecraft mc = Minecraft.getMinecraft();

boolean book = (args.length > 1 && args[1].equals("book")) ? true : false;
boolean book = args.length > 1 && args[1].equals("book");

double distance = 0;
ItemStack stack = null;
for(Entity entity : mc.world.<Entity>getEntitiesWithinAABB(Entity.class, mc.player.getEntityBoundingBox().grow(12.0D, 4.0D, 12.0D))) {
for(Entity entity : mc.world.getEntitiesWithinAABB(Entity.class, mc.player.getEntityBoundingBox().grow(12.0D, 4.0D, 12.0D))) {
if(entity == mc.player) continue;

ItemStack current = null;
Expand Down Expand Up @@ -85,7 +85,7 @@ public String execute(String[] args) {

if(! stack.getTagCompound().hasKey("pages", 9)) return "Book has no data";

FamilyFunPack.printMessage("Book size: " + Integer.toString(ItemSizeCommand.getItemSize(stack)) + " bytes");
FamilyFunPack.printMessage("Book size: " + ItemSizeCommand.getItemSize(stack) + " bytes");

this.screen = new GuiScreenBook(mc.player, stack, false);
MinecraftForge.EVENT_BUS.register(this);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/family_fun_pack/commands/PopulateCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public class PopulateCommand extends Command implements PacketListener {

private long last_send;

private BlockPos[] window;
private final BlockPos[] window;
private int completed;
private ReadWriteLock window_lock;
private final ReadWriteLock window_lock;

private boolean enabled;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public String execute(String[] args) {
return String.format("Block at (%d, %d, %d)", pos.getX(), pos.getY(), pos.getZ());
} else if(target_ray.typeOfHit == RayTraceResult.Type.ENTITY) {
Entity entity = target_ray.entityHit;
return String.format("Entity id is %d%s%s", entity.getEntityId(), (args.length > 1 && args[1].equals("+") ? " [" + entity.getUniqueID().toString() + "]" : ""), (entity.isRiding() ? String.format(" riding %d", entity.getRidingEntity().getEntityId()) : ""));
return String.format("Entity id is %d%s%s", entity.getEntityId(), (args.length > 1 && args[1].equals("+") ? " [" + entity.getUniqueID() + "]" : ""), (entity.isRiding() ? String.format(" riding %d", entity.getRidingEntity().getEntityId()) : ""));
}
return "No target";
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/family_fun_pack/commands/ReOpenCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public String execute(String[] args) {
// Forge event listener used to open GUI
private static class GuiOpener {

private GuiScreen gui;
private final GuiScreen gui;

public GuiOpener(GuiScreen gui) {
this.gui = gui;
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/family_fun_pack/commands/RemoteCaptureCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ public class RemoteCaptureCommand extends Command implements PacketListener {

private WorldCapture capture;

private Map<BlockPos, Long> window;
private ReadWriteLock window_lock;
private final Map<BlockPos, Long> window;
private final ReadWriteLock window_lock;

private List<ChunkPos> chunks;
private final List<ChunkPos> chunks;
private Chunk current;
private ReadWriteLock current_lock;
private final ReadWriteLock current_lock;

private boolean getting_signs;
private short retry_count;
Expand Down Expand Up @@ -306,7 +306,7 @@ public Packet<?> packetReceived(EnumPacketDirection direction, int id, Packet<?>
this.window_lock.writeLock().lock();
if(block instanceof BlockStandingSign || block instanceof BlockWallSign) {
this.getting_signs = true;
this.window.put(position, 0l);
this.window.put(position, 0L);
} else {
this.window.remove(position);
}
Expand Down Expand Up @@ -390,5 +390,5 @@ private void updateStatusLabel() {
else this.label_id = FamilyFunPack.getOverlay().addLabel(label);
}

public static enum Mode {FULL, HALF, SURFACE};
public enum Mode {FULL, HALF, SURFACE}
}
Original file line number Diff line number Diff line change
Expand Up @@ -159,5 +159,5 @@ private Vec3d outputedPos() {
return this.position.subtract(mc.player.posX, mc.player.posY, mc.player.posZ);
}

private static enum Mode {SIMPLE, DOUBLE, TMP, YEET};
private enum Mode {SIMPLE, DOUBLE, TMP, YEET}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public String execute(String[] args) {

if(! on) { // init

List<AbstractHorse> horses = mc.player.world.<AbstractHorse>getEntitiesWithinAABB(AbstractHorse.class, mc.player.getEntityBoundingBox().grow(6.0D, 2.0D, 6.0D));
List<AbstractHorse> horses = mc.player.world.getEntitiesWithinAABB(AbstractHorse.class, mc.player.getEntityBoundingBox().grow(6.0D, 2.0D, 6.0D));
if(horses.size() == 0) return "where's your ride ?";

Entity ride = horses.get(0);
Expand All @@ -60,7 +60,7 @@ public String execute(String[] args) {
this.on = true;
} else { // exec

List<AbstractChestHorse> donkeys = mc.player.world.<AbstractChestHorse>getEntitiesWithinAABB(AbstractChestHorse.class, mc.player.getEntityBoundingBox().grow(6.0D, 2.0D, 6.0D));
List<AbstractChestHorse> donkeys = mc.player.world.getEntitiesWithinAABB(AbstractChestHorse.class, mc.player.getEntityBoundingBox().grow(6.0D, 2.0D, 6.0D));

Entity ddonkey = null;
for(AbstractChestHorse c : donkeys) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public String execute(String[] args) {
return "Wrong UUID format";
}
FamilyFunPack.getNetworkHandler().sendPacket(new CPacketSpectate(uuid));
return "trying to spectate " + uuid.toString();
return "trying to spectate " + uuid;
}
return this.getUsage();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/family_fun_pack/commands/StealCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public Packet<?> packetReceived(EnumPacketDirection direction, int id, Packet<?>
this.enabled = false;

if(this.next_id != open.getWindowId()) {
FamilyFunPack.printMessage("Window id guessed wrongly, expected " + Integer.toString(this.next_id) + " ,was " + Integer.toString(open.getWindowId()));
FamilyFunPack.printMessage("Window id guessed wrongly, expected " + this.next_id + " ,was " + open.getWindowId());
}

this.next_id = open.getWindowId() % 100 + 1;
Expand Down
Loading

0 comments on commit 24c94f4

Please sign in to comment.