Skip to content

Commit

Permalink
feat: 1.20.4 initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bconlon1 committed Jan 20, 2024
1 parent 9fa33c7 commit 4205c1a
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 31 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ runs {
}

data {
programArguments.addAll '--mod', mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/'), '--existing', file('src/generated/resources/').getAbsolutePath()
programArguments.addAll '--mod', mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath(), '--existing', file('src/generated/resources/').getAbsolutePath()
}
}

Expand All @@ -49,7 +49,7 @@ sourceSets.main.resources {

subsystems {
parchment {
minecraftVersion = project.mc_version
minecraftVersion = '1.20.3' //todo
mappingsVersion = project.mappings
}
}
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ org.gradle.daemon=false
mod_id=cumulus_menus
mod_name=Cumulus
mod_version=1.0.0
mc_version=1.20.2
neoforge_version=20.2.88
mappings=2023.12.10
mc_version=1.20.4
neoforge_version=20.4.118-beta
mappings=2023.12.31

# Dependencies

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.20.1 2023-08-22T18:52:58.2097967 Pack Metadata
dd3c60fd02429ac402f8102d597a833e5a37450f pack.mcmeta
// 1.20.4 2024-01-20T00:47:05.7179247 Pack Metadata
d80ebb5841143cd1b3ac9926dc3100ca5b1a7759 pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.20.1 2023-08-22T18:52:58.1947962 Languages: en_us
// 1.20.4 2024-01-20T00:47:05.7039284 Languages: en_us for mod: cumulus_menus
0cb2af7dbbd8bd2ff78b335c92a753a3048b1730 assets/cumulus_menus/lang/en_us.json
2 changes: 1 addition & 1 deletion src/generated/resources/pack.mcmeta
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"description": {
"translate": "pack.cumulus_menus.mod.description"
},
"pack_format": 15
"pack_format": 22
}
}
18 changes: 7 additions & 11 deletions src/main/java/com/aetherteam/cumulus/Cumulus.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@
import net.neoforged.fml.ModLoadingContext;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.config.ModConfig;
import net.neoforged.fml.javafmlmod.FMLJavaModLoadingContext;
import net.neoforged.fml.loading.FMLEnvironment;
import net.neoforged.neoforge.data.event.GatherDataEvent;
import net.neoforged.neoforge.registries.DeferredRegister;
import net.neoforged.neoforge.registries.NewRegistryEvent;
import net.neoforged.neoforge.registries.RegistryBuilder;
import org.slf4j.Logger;

import java.util.Map;
import java.util.Optional;

@Mod(Cumulus.MODID)
public class Cumulus {
Expand All @@ -37,19 +35,18 @@ public class Cumulus {
public static final ResourceKey<Registry<Menu>> MENU_REGISTRY_KEY = ResourceKey.createRegistryKey(new ResourceLocation(Cumulus.MODID, "menu"));
public static final Registry<Menu> MENU_REGISTRY = new RegistryBuilder<>(MENU_REGISTRY_KEY).sync(true).create();

public Cumulus() {
if (FMLEnvironment.dist == Dist.CLIENT) {
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
modEventBus.addListener(NewRegistryEvent.class, event -> event.register(MENU_REGISTRY));
public Cumulus(IEventBus bus, Dist dist) {
if (dist == Dist.CLIENT) {
bus.addListener(NewRegistryEvent.class, event -> event.register(MENU_REGISTRY));

modEventBus.addListener(this::dataSetup);
bus.addListener(this::dataSetup);

DeferredRegister<?>[] registers = {
Menus.MENUS,
};

for (DeferredRegister<?> register : registers) {
register.register(modEventBus);
register.register(bus);
}

ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, CumulusConfig.CLIENT_SPEC);
Expand All @@ -65,8 +62,7 @@ public void dataSetup(GatherDataEvent event) {

// pack.mcmeta
PackMetadataGenerator packMeta = new PackMetadataGenerator(packOutput);
Map<PackType, Integer> packTypes = Map.of(PackType.SERVER_DATA, SharedConstants.getCurrentVersion().getPackVersion(PackType.SERVER_DATA));
packMeta.add(PackMetadataSection.TYPE, new PackMetadataSection(Component.translatable("pack.cumulus_menus.mod.description"), SharedConstants.getCurrentVersion().getPackVersion(PackType.CLIENT_RESOURCES), packTypes));
packMeta.add(PackMetadataSection.TYPE, new PackMetadataSection(Component.translatable("pack.cumulus_menus.mod.description"), SharedConstants.getCurrentVersion().getPackVersion(PackType.CLIENT_RESOURCES), Optional.empty()));
generator.addProvider(true, packMeta);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ public class MenuSelectionList extends ObjectSelectionList<MenuSelectionList.Men

private static final int ENTRY_PADDING = 2;

public MenuSelectionList(MenuSelectionScreen parent, int width, int height, int top, int bottom, int itemHeight) {
super(parent.getMinecraft(), width, height, top, bottom, itemHeight);
public MenuSelectionList(MenuSelectionScreen parent, int width, int height, int y, int itemHeight) {
super(parent.getMinecraft(), width, height, y, itemHeight);
this.parent = parent;
this.refreshList();
}

@Override
protected void renderSelection(GuiGraphics guiGraphics, int top, int width, int height, int outerColor, int innerColor) {
int i = this.x0 + (this.width - width) / 2;
int j = this.x0 + (this.width + width) / 2;
int i = this.getX() + (this.width - width) / 2;
int j = this.getX() + (this.width + width) / 2;
guiGraphics.fill(i + 1, top - 3, j - 7, top + height + 1, -1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ public MenuSelectionScreen(Screen parentScreen) {

@Override
public void init() {
this.menuList = new MenuSelectionList(this, this.frameWidth - (EXTERIOR_WIDTH_PADDING * 2), this.frameHeight, (this.height / 2) - (this.frameHeight / 2) + EXTERIOR_TOP_PADDING, (this.height / 2) + (this.frameHeight / 2) - EXTERIOR_BOTTOM_PADDING, 24);
this.menuList = new MenuSelectionList(this, this.frameWidth - (EXTERIOR_WIDTH_PADDING * 2), this.frameHeight, (this.height / 2) - (this.frameHeight / 2) + EXTERIOR_TOP_PADDING, 24);
this.menuList.setRenderBackground(false);
this.menuList.setLeftPos((this.width / 2) - (this.frameWidth / 2) + EXTERIOR_WIDTH_PADDING);
this.menuList.setX((this.width / 2) - (this.frameWidth / 2) + EXTERIOR_WIDTH_PADDING);
this.addRenderableWidget(this.menuList);

this.launchButton = Button.builder(Component.translatable("gui.cumulus_menus.button.menu_launch"), press -> {
Expand Down
10 changes: 5 additions & 5 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ issueTrackerURL="https://github.com/The-Aether-Team/Cumulus/issues"
modId="cumulus_menus"
version="${file.jarVersion}"
displayName="Cumulus"
updateJSONURL="https://github.com/The-Aether-Team/Cumulus/raw/1.20.2-develop/update.json"
updateJSONURL="https://github.com/The-Aether-Team/Cumulus/raw/1.20.4-develop/update.json"
displayURL="https://modrinth.com/mod/cumulus"
logoFile="cumulus.png"
credits="The Aether Team; kingbdogz, for the original Main Menu API that this is inspired by"
Expand All @@ -17,14 +17,14 @@ description='''

[[dependencies.cumulus_menus]]
modId="neoforge"
mandatory=true
versionRange="[20.2.0,)"
type="required"
versionRange="[20.4.0,)"
ordering="NONE"
side="BOTH"
[[dependencies.cumulus_menus]]
modId="minecraft"
mandatory=true
versionRange="[1.20.2,1.20.3)"
type="required"
versionRange="[1.20.4,1.20.5)"
ordering="NONE"
side="BOTH"

Expand Down

0 comments on commit 4205c1a

Please sign in to comment.