Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3 from beach-house-development/bed3-dev
Browse files Browse the repository at this point in the history
bedroom 3 pr
  • Loading branch information
srgantmoomoo authored May 31, 2021
2 parents a1d72fc + b11ac99 commit 4082950
Show file tree
Hide file tree
Showing 28 changed files with 249 additions and 84 deletions.
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,23 @@

bedroom is a latest version fabric base for minecraft clients. this was made to serve as the base for beach house, i'm just making it public so others can use it and learn from it.<br>
<br>
bedroom is intended for use as a latest version fabric base for minecraft anarchy clients, it can serve as a good starting tool and can have different aspects of it changed or added onto, like adding a more in depth command system, or adding some sort of your own ui elements, and of course you own modules.
bedroom is intended for use as a latest version fabric base for minecraft anarchy clients, it can serve as a good starting tool and can have different aspects of it changed or added onto, like adding a more in depth command system, or adding some sort of your own ui elements, and of course you own modules. currently this base is in the format of a template, you can edit anything you like... but i plan on eventually converting it to more of a api for a future release.
<br>
<br> this is not a cheat. it's intent is for minecraft anarchy clients, and it's use for otherwise is redundant. either way bedroom itself is not a cheat, nor are it's intended targets. also, due to previous events, i would like to remind u that fabric is "free to use for everyone. No exceptions." thank you :)
<br>
# bedroom's road map
**plans for bedroom 3**
- font renderer <br>
- notification system <br>
- switch config to JSON <br>
- ui stuff, clickgui maybe if i want to lol <br>
- command javadoc <br>
- support for baritone integration <br>
**plans for bedroom 4**
- make it a useable api via gradle
- JSON config
- font renderer

**bedroom 3** <br>
✔ command javadoc <br>
✔ main class tweaked a bit <br>
✔ fix module class... automatic event subscribing and event subscribing on launch fix <br>
✔ command sysetm overhaul <br>
✔ onUpdate method added <br>
✔ refactorization <br>

**bedroom 2** <br>
✔ improved command system <br>
Expand Down Expand Up @@ -48,7 +53,7 @@ public static final String nameCondensed = "bedroom";
public static final String version = "1";
```
you can change the modid, name, nameCondensed, and version variables to fit your own clients, but you have to make sure to update your `fabric.mod.json file` to fit these variables, and update the `bed.mixins.json` if you want to redo the entire structure of the client.<br>
you may also add different inits to the client under `// (your clients name)'s inits... if u need any.` <br>
you may also add different inits to the client under `public void clientInits() {` <br>

***command system*** <br>
as for all of the systems here, you can use the current commands as examples. <br>
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx2G
loader_version=0.11.2

# Mod Properties
mod_version = 2
mod_version = 3
maven_group = me.srgantmoomoo
archives_base_name = bedroom

Expand Down
24 changes: 13 additions & 11 deletions src/main/java/me/srgantmoomoo/bedroom/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import me.srgantmoomoo.bedroom.api.event.EventProcessor;
import me.srgantmoomoo.bedroom.command.CommandManager;
import me.srgantmoomoo.bedroom.module.ModuleManager;
import me.srgantmoomoo.bedroom.setting.SettingManager;
import me.srgantmoomoo.bedroom.module.setting.SettingManager;
import me.srgantmoomoo.bedroom.ui.UI;
import me.zero.alpine.bus.EventBus;
import me.zero.alpine.bus.EventManager;
Expand All @@ -23,7 +23,7 @@ public class Main implements ModInitializer {
public static final String modid = "bed";
public static final String name = "bedroom";
public static final String nameCondensed = "bedroom"; // this is for if there are spaces in ur mod name... "mod name" -> "mod-name".
public static final String version = "2";
public static final String version = "3";

public static final Logger LOGGER = LogManager.getLogger("bedroom");
public static EventBus EVENTBUS = new EventManager();
Expand All @@ -44,8 +44,18 @@ public void printLog(String text) {

@Override
public void onInitialize() {
printLog("welcome to bedroom!");
bedroomInits();
clientInits();
}

public void clientInits() {
// put your clients inits here if u need any.

printLog(Main.name + " has finished initialization :)");
}

public void bedroomInits() {
printLog("welcome to bedroom!");
printLog("\n" +
" __ __ \n" +
"[ | | ] \n" +
Expand All @@ -54,8 +64,6 @@ public void onInitialize() {
" | \\__/ || \\__.,| \\__/ | | | | \\__. || \\__. | | | | | | | \n" +
"[__;.__.' '.__.' '.__.;__][___] '.__.' '.__.' [___||__||__] \n");

// bedroom inits

eventProcessor = new EventProcessor();
printLog("event system initialized.");

Expand All @@ -73,12 +81,6 @@ public void onInitialize() {

saveLoad = new SaveLoad();
printLog("config initialized.");

// (your clients name)'s inits... if u need any.

//

printLog(Main.name + " has finished initialization :)");
}

}
22 changes: 8 additions & 14 deletions src/main/java/me/srgantmoomoo/bedroom/api/config/SaveLoad.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
import me.srgantmoomoo.bedroom.command.CommandManager;
import me.srgantmoomoo.bedroom.module.Module;
import me.srgantmoomoo.bedroom.module.ModuleManager;
import me.srgantmoomoo.bedroom.setting.Setting;
import me.srgantmoomoo.bedroom.setting.settings.BooleanSetting;
import me.srgantmoomoo.bedroom.setting.settings.ModeSetting;
import me.srgantmoomoo.bedroom.setting.settings.NumberSetting;
import me.srgantmoomoo.bedroom.module.setting.Setting;
import me.srgantmoomoo.bedroom.module.setting.settings.BooleanSetting;
import me.srgantmoomoo.bedroom.module.setting.settings.ModeSetting;
import me.srgantmoomoo.bedroom.module.setting.settings.NumberSetting;
import net.minecraft.client.MinecraftClient;

/**
Expand All @@ -24,10 +24,10 @@
*/

public class SaveLoad {

private File dir;
private File dataFile;


@SuppressWarnings("resource")
public SaveLoad() {
dir = new File(MinecraftClient.getInstance().runDirectory, Main.name);
if(!dir.exists()) {
Expand All @@ -47,7 +47,6 @@ public void save() {
ArrayList<String> toSave = new ArrayList<String>();

for(Module mod : ModuleManager.modules) {
if(!mod.getName().equals("tabGui"))
toSave.add("MOD:" + mod.getName() + ":" + mod.isEnabled() + ":" + mod.getKey());
}

Expand All @@ -69,9 +68,8 @@ public void save() {
toSave.add("SET:" + mod.getName() + ":" + setting.name + ":" + mode.getMode());
}
}
}
}

// command prefix
toSave.add("COMMANDPREFIX:" + CommandManager.prefix);

try {
Expand Down Expand Up @@ -105,17 +103,13 @@ public void load() {
if(s.toLowerCase().startsWith("mod:")) {
Module m = Main.moduleManager.getModule(args[1]);
if(m != null) {
if(m.getName().equals("clickGuiModule") && m.getName().equals("hudEditor"))
m.setEnabled(!Boolean.parseBoolean(args[2]));

if(!m.getName().equals("clickGuiModule") && !m.getName().equals("hudEditor"))
m.setEnabled(Boolean.parseBoolean(args[2]));
m.setKey(Integer.parseInt(args[3]));
}
}else if(s.toLowerCase().startsWith("set:")) {
Module m = Main.moduleManager.getModule(args[1]);
if(m != null) {
Setting setting = Main.settingManager.getSettingByName(m,args[2]);
Setting setting = Main.settingManager.getSettingByName(m, args[2]);
if(setting != null) {
if(setting instanceof BooleanSetting) {
((BooleanSetting)setting).setEnabled(Boolean.parseBoolean(args[3]));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package me.srgantmoomoo.bedroom.api.event;

import me.srgantmoomoo.bedroom.Main;
import me.srgantmoomoo.bedroom.api.event.events.EventTick;
import me.srgantmoomoo.bedroom.module.ModuleManager;
import me.zero.alpine.listener.EventHandler;
import me.zero.alpine.listener.Listenable;
import me.zero.alpine.listener.Listener;
import net.minecraft.client.MinecraftClient;

/**
Expand All @@ -18,5 +22,12 @@ public EventProcessor() {
instance = this;
Main.EVENTBUS.subscribe(this);
}

@EventHandler
private final Listener<EventTick> listener = new Listener<>(e -> {
if (mc.player != null) {
ModuleManager.onUpdate();
}
});

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package me.srgantmoomoo.bedroom.api.event.events;

import me.srgantmoomoo.bedroom.api.event.Event;

public class EventTick extends Event {

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import me.srgantmoomoo.bedroom.api.event.Event;
import net.minecraft.network.Packet;

@SuppressWarnings("rawtypes")
public class PacketEvent extends Event {

private final Packet packet;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package me.srgantmoomoo.bedroom.api.mixin;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import me.srgantmoomoo.bedroom.Main;
import me.srgantmoomoo.bedroom.api.event.events.EventTick;
import net.minecraft.client.world.ClientWorld;

@Mixin(ClientWorld.class)
public class MixinClientWorld {

@Inject(method = "tickEntities", at = @At("HEAD"), cancellable = true)
public void tickEntities(CallbackInfo info) {
EventTick event = new EventTick();
Main.EVENTBUS.post(event);
if(event.isCancelled()) info.cancel();
}
}
5 changes: 5 additions & 0 deletions src/main/java/me/srgantmoomoo/bedroom/command/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ public Command(String name, String description, String syntax, String... aliases
this.aliases = Arrays.asList(aliases);
}

/**
* perform an action when a command is sent.
* @param args
* @param command
*/
public abstract void onCommand(String[] args, String command);

public String getName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,25 @@ public static void setCommandPrefix(String pre) {
}
}

/**
* send a client side chat message with a prefix to the minecraft chat.
* @param message
*/
@SuppressWarnings("resource")
public static void addChatMessage(String message) {
String messageWithPre = TextFormatting.AQUA + "@" + TextFormatting.ITALIC + Main.name + TextFormatting.GRAY + ": " + message;
Text textComponentString = new LiteralText(messageWithPre);
MinecraftClient.getInstance().inGameHud.getChatHud().addMessage(textComponentString);
}

/**
* send a client side message to the minecraft chat telling the user how to correctly use a certain command.
* @param name
* @param syntax
*/
@SuppressWarnings("resource")
public static void correctUsageMsg(String name, String syntax) {
String usage = "correct usage of " + name + " command -> " + prefix + syntax;
String usage = TextFormatting.RED + "correct usage of " + name + " command -> " + TextFormatting.GRAY + prefix + syntax;
String message = TextFormatting.AQUA + "@" + TextFormatting.ITALIC + Main.name + TextFormatting.GRAY + ": " + usage;

Text textComponentString = new LiteralText(message);
Expand Down
53 changes: 49 additions & 4 deletions src/main/java/me/srgantmoomoo/bedroom/command/commands/Help.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,68 @@
import me.srgantmoomoo.bedroom.api.util.TextFormatting;
import me.srgantmoomoo.bedroom.command.Command;
import me.srgantmoomoo.bedroom.command.CommandManager;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;

@SuppressWarnings("resource")
public class Help extends Command {

public Help() {
super("help", "helps u penis.", "help", "h");
}

public static Prefix prefix;
public static Toggle toggle;
public static ModuleList moduleList;

@Override
public void onCommand(String[] args, String command) {
prefix = new Prefix();
toggle = new Toggle();
moduleList = new ModuleList();

CommandManager.addChatMessage(TextFormatting.BOLD + Main.name + " " + Main.version + "!");
welcomeMessage();
helpMessage(prefix.getName(), prefix.getDescription(), prefix.getSyntax());
helpMessage(toggle.getName(), toggle.getDescription(), toggle.getSyntax());
helpMessage(moduleList.getName(), moduleList.getDescription(), moduleList.getSyntax());
goodbyeMessage();
}

private void helpMessage(String commandName, String commandDesc, String commandSyntax) {
String starter = TextFormatting.LIGHT_PURPLE + commandName + TextFormatting.GRAY + " - " + commandDesc;
String syntaxMessage = " [" + CommandManager.prefix + commandSyntax + "]";

CommandManager.addChatMessage("prefix - " + TextFormatting.ITALIC + "allows you to change the command prefix" + " -> " + CommandManager.prefix + "prefix <key>");
String message = starter;

CommandManager.addChatMessage("toggle - " + TextFormatting.ITALIC + "toggles modules on and off" + " -> " + CommandManager.prefix + "toggle <module>");
Text textComponentString = new LiteralText(message);
MinecraftClient.getInstance().inGameHud.getChatHud().addMessage(textComponentString);
Text syntaxTextComponentString = new LiteralText(syntaxMessage);
MinecraftClient.getInstance().inGameHud.getChatHud().addMessage(syntaxTextComponentString);
}

private void welcomeMessage() {
String welcomeString = TextFormatting.GRAY + "" + TextFormatting.BOLD + Main.name + " " + Main.version + "!";
String bedroom = TextFormatting.AQUA + "@" + TextFormatting.ITALIC + Main.name;
String nothing = " ";

CommandManager.addChatMessage("modulelist - " + TextFormatting.ITALIC + "shows all of the modules in the client" + " -> " + CommandManager.prefix + "modulelist");
Text textComponentString = new LiteralText(welcomeString);
MinecraftClient.getInstance().inGameHud.getChatHud().addMessage(textComponentString);
Text nothingTextComponentString = new LiteralText(nothing);
MinecraftClient.getInstance().inGameHud.getChatHud().addMessage(nothingTextComponentString);
Text bedroomTextComponentString = new LiteralText(bedroom);
MinecraftClient.getInstance().inGameHud.getChatHud().addMessage(bedroomTextComponentString);

}

private void goodbyeMessage() {
String uwu = TextFormatting.GRAY + "" + TextFormatting.BOLD + "uwu" + TextFormatting.AQUA + " ~";
String nothing = " ";

Text nothingTextComponentString = new LiteralText(nothing);
MinecraftClient.getInstance().inGameHud.getChatHud().addMessage(nothingTextComponentString);
Text textComponentString = new LiteralText(uwu);
MinecraftClient.getInstance().inGameHud.getChatHud().addMessage(textComponentString);
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.srgantmoomoo.bedroom.command.commands;

import me.srgantmoomoo.bedroom.api.util.TextFormatting;
import me.srgantmoomoo.bedroom.command.Command;
import me.srgantmoomoo.bedroom.command.CommandManager;
import me.srgantmoomoo.bedroom.module.Module;
Expand All @@ -8,14 +9,15 @@
public class ModuleList extends Command {

public ModuleList() {
super("modulelist", "gets a list of the modules.", "module", "ml");
super("modulelist", "gets a list of all the modules.", "moduleList", "ml");
}

@Override
public void onCommand(String[] args, String command) {
if(args.length == 0) {
for (Module module : ModuleManager.getModules())
CommandManager.addChatMessage(module.getName());
for(Module module : ModuleManager.getModules()) {
CommandManager.addChatMessage(TextFormatting.WHITE + module.getCategory().name + ": " + TextFormatting.GRAY + module.getName());
}
} if(args.length > 0) CommandManager.correctUsageMsg(name, syntax);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
public class Prefix extends Command {

public Prefix() {
super("prefix", "change the prefix", "prefix", "p");
super("prefix", "allows you to change the command prefix.", "prefix <key>", "p");
}

@Override
Expand Down
Loading

0 comments on commit 4082950

Please sign in to comment.