Skip to content

Commit

Permalink
Added support for all Minecraft versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Neocraftr committed Jul 24, 2023
1 parent 74b1a11 commit e934ec3
Show file tree
Hide file tree
Showing 9 changed files with 264 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ labyMod {
displayName = "GrieferGames"
author = "Neocraftr"
description = "This add-on adds many useful features for the GrieferGames.net server."
minecraftVersion = "1.8.9<1.12.2"
minecraftVersion = "*"
version = "1.0.0"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ public void onScoreboardTeams(ScoreboardTeamUpdateEvent event) {
String subServerName = griefergames.helper().componentToPlainText(event.team().getPrefix()).toLowerCase();
if(subServerName.isBlank() || subServerName.contains("lade")) return;

griefergames.setSubServer(subServerName);
GGSubServerChangeEvent changeEvent = new GGSubServerChangeEvent(subServerName);
Laby.labyAPI().eventBus().fire(changeEvent);
if(!griefergames.getSubServer().equals(subServerName)) {
griefergames.setSubServer(subServerName);
GGSubServerChangeEvent changeEvent = new GGSubServerChangeEvent(subServerName);
Laby.labyAPI().eventBus().fire(changeEvent);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package de.neocraftr.griefergames.v1_16_5;

import de.neocraftr.griefergames.utils.GrieferGamesController;
import net.labymod.api.models.Implements;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.inventory.ContainerScreen;
import javax.inject.Inject;
import javax.inject.Singleton;

@Singleton
@Implements(GrieferGamesController.class)
public class VersionedGrieferGamesController extends GrieferGamesController {

@Inject
public VersionedGrieferGamesController() {}

@Override
public boolean playerAllowedFlying() {
return Minecraft.getInstance().player.abilities.mayfly;
}

@Override
public boolean hideBoosterMenu() {
if(Minecraft.getInstance().player == null) return false;

Screen screen = Minecraft.getInstance().screen;
if(screen instanceof ContainerScreen) {
if(screen.getTitle().getString().equals("§6Booster - Übersicht")) {
Minecraft.getInstance().player.closeContainer();
return true;
}
}
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package de.neocraftr.griefergames.v1_17_1;

import de.neocraftr.griefergames.utils.GrieferGamesController;
import net.labymod.api.models.Implements;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.inventory.ContainerScreen;
import javax.inject.Inject;
import javax.inject.Singleton;

@Singleton
@Implements(GrieferGamesController.class)
public class VersionedGrieferGamesController extends GrieferGamesController {

@Inject
public VersionedGrieferGamesController() {}

@Override
public boolean playerAllowedFlying() {
return Minecraft.getInstance().player.getAbilities().mayfly;
}

@Override
public boolean hideBoosterMenu() {
if(Minecraft.getInstance().player == null) return false;

Screen screen = Minecraft.getInstance().screen;
if(screen instanceof ContainerScreen) {
if(screen.getTitle().getString().equals("§6Booster - Übersicht")) {
Minecraft.getInstance().player.closeContainer();
return true;
}
}
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package de.neocraftr.griefergames.v1_18_2;

import de.neocraftr.griefergames.utils.GrieferGamesController;
import net.labymod.api.models.Implements;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.inventory.ContainerScreen;
import javax.inject.Inject;
import javax.inject.Singleton;

@Singleton
@Implements(GrieferGamesController.class)
public class VersionedGrieferGamesController extends GrieferGamesController {

@Inject
public VersionedGrieferGamesController() {}

@Override
public boolean playerAllowedFlying() {
return Minecraft.getInstance().player.getAbilities().mayfly;
}

@Override
public boolean hideBoosterMenu() {
if(Minecraft.getInstance().player == null) return false;

Screen screen = Minecraft.getInstance().screen;
if(screen instanceof ContainerScreen) {
if(screen.getTitle().getString().equals("§6Booster - Übersicht")) {
Minecraft.getInstance().player.closeContainer();
return true;
}
}
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package de.neocraftr.griefergames.v1_19_2;

import de.neocraftr.griefergames.utils.GrieferGamesController;
import net.labymod.api.models.Implements;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.inventory.ContainerScreen;
import javax.inject.Inject;
import javax.inject.Singleton;

@Singleton
@Implements(GrieferGamesController.class)
public class VersionedGrieferGamesController extends GrieferGamesController {

@Inject
public VersionedGrieferGamesController() {}

@Override
public boolean playerAllowedFlying() {
return Minecraft.getInstance().player.getAbilities().mayfly;
}

@Override
public boolean hideBoosterMenu() {
if(Minecraft.getInstance().player == null) return false;

Screen screen = Minecraft.getInstance().screen;
if(screen instanceof ContainerScreen) {
if(screen.getTitle().getString().equals("§6Booster - Übersicht")) {
Minecraft.getInstance().player.closeContainer();
return true;
}
}
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package de.neocraftr.griefergames.v1_19_3;

import de.neocraftr.griefergames.utils.GrieferGamesController;
import javax.inject.Inject;
import javax.inject.Singleton;
import net.labymod.api.models.Implements;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.inventory.ContainerScreen;

@Singleton
@Implements(GrieferGamesController.class)
public class VersionedGrieferGamesController extends GrieferGamesController {

@Inject
public VersionedGrieferGamesController() {}

@Override
public boolean playerAllowedFlying() {
return Minecraft.getInstance().player.getAbilities().mayfly;
}

@Override
public boolean hideBoosterMenu() {
if(Minecraft.getInstance().player == null) return false;

Screen screen = Minecraft.getInstance().screen;
if(screen instanceof ContainerScreen) {
if(screen.getTitle().getString().equals("§6Booster - Übersicht")) {
Minecraft.getInstance().player.closeContainer();
return true;
}
}
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package de.neocraftr.griefergames.v1_19_4;

import de.neocraftr.griefergames.utils.GrieferGamesController;
import javax.inject.Inject;
import javax.inject.Singleton;
import net.labymod.api.models.Implements;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.inventory.ContainerScreen;

@Singleton
@Implements(GrieferGamesController.class)
public class VersionedGrieferGamesController extends GrieferGamesController {

@Inject
public VersionedGrieferGamesController() {}

@Override
public boolean playerAllowedFlying() {
return Minecraft.getInstance().player.getAbilities().mayfly;
}

@Override
public boolean hideBoosterMenu() {
if(Minecraft.getInstance().player == null) return false;

Screen screen = Minecraft.getInstance().screen;
if(screen instanceof ContainerScreen) {
if(screen.getTitle().getString().equals("§6Booster - Übersicht")) {
Minecraft.getInstance().player.closeContainer();
return true;
}
}
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package de.neocraftr.griefergames.v1_20_1;

import de.neocraftr.griefergames.utils.GrieferGamesController;
import net.labymod.api.models.Implements;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.inventory.ContainerScreen;
import net.minecraft.world.Container;
import net.minecraft.world.SimpleContainer;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.ChestMenu;
import net.minecraft.world.inventory.InventoryMenu;
import net.minecraft.world.level.block.entity.HopperBlockEntity;
import javax.inject.Inject;
import javax.inject.Singleton;

@Singleton
@Implements(GrieferGamesController.class)
public class VersionedGrieferGamesController extends GrieferGamesController {

@Inject
public VersionedGrieferGamesController() {}

@Override
public boolean playerAllowedFlying() {
return Minecraft.getInstance().player.getAbilities().mayfly;
}

@Override
public boolean hideBoosterMenu() {
if(Minecraft.getInstance().player == null) return false;

Screen screen = Minecraft.getInstance().screen;
if(screen instanceof ContainerScreen) {
if(screen.getTitle().getString().equals("§6Booster - Übersicht")) {
Minecraft.getInstance().player.closeContainer();
return true;
}
}
return false;
}
}

0 comments on commit e934ec3

Please sign in to comment.