Skip to content

Commit

Permalink
Move TNIL-Fabric to Kotlin DSL.
Browse files Browse the repository at this point in the history
  • Loading branch information
creatorfromhell committed Jun 11, 2024
1 parent 0cc128f commit 025807c
Show file tree
Hide file tree
Showing 17 changed files with 380 additions and 24 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@
/Core/build/
/TNIL-Sponge/build/
*.lock
/TNIL-Fabric/build/
/TNIL-Fabric/.gradle/
10 changes: 6 additions & 4 deletions Bukkit/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

plugins {
id("java")
id("com.github.johnrengelman.shadow") version "8.1.1"
id("com.github.johnrengelman.shadow") version "8.1.1" apply true
}

dependencies {
Expand All @@ -16,9 +16,11 @@ repositories {
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
tasks {
compileJava {
sourceCompatibility = "17"
targetCompatibility = "17"
}
}

description = "The New Item Library Bukkit"
10 changes: 6 additions & 4 deletions Core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

plugins {
id("java")
id("com.github.johnrengelman.shadow") version "8.1.1"
id("com.github.johnrengelman.shadow") version "8.1.1" apply true
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
tasks {
compileJava {
sourceCompatibility = "17"
targetCompatibility = "17"
}
}

description = "The New Item Library Core"
16 changes: 16 additions & 0 deletions HEADER.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
${project}

Copyright (C) ${year} Daniel "creatorfromhell" Vidmar

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
13 changes: 13 additions & 0 deletions TNIL-Fabric.iml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,17 @@
<sourceFolder url="file://$MODULE_DIR$/TNIL-Fabric/src/main/java" isTestSource="false" />
</content>
</component>
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>MCP</platformType>
</autoDetectTypes>
<projectReimportVersion>1</projectReimportVersion>
</configuration>
</facet>
</component>
<component name="McpModuleSettings">
<option name="srgType" value="SRG" />
</component>
</module>
62 changes: 62 additions & 0 deletions TNIL-Fabric/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
plugins {
id("java")
id("com.github.johnrengelman.shadow") version "8.1.1" apply true
id("fabric-loom") version "1.6-SNAPSHOT" apply true
id("maven-publish") apply true
}

group = property("maven_group")!!
version = property("tnil_version")!!

repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
}

dependencies {
minecraft("com.mojang:minecraft:${property("minecraft_version")}")
mappings("net.fabricmc:yarn:${property("yarn_mappings")}:v2")
modImplementation("net.fabricmc:fabric-loader:${property("loader_version")}")
modImplementation("net.fabricmc.fabric-api:fabric-api:${property("fabric_version")}")
api(project(":TNIL-Core"))
}

tasks {
compileJava {
sourceCompatibility = "21"
targetCompatibility = "21"
}

processResources {
inputs.property("version", project.version)
filesMatching("fabric.mod.json") {
expand(getProperties())
expand(mutableMapOf("version" to project.version))
}
}

shadowJar {
archiveFileName = "TNIL-Fabric-${project.version}-shadow.jar"

dependencies {
exclude("net.fabricmc:.*")
include(dependency(":TNIL-Core"))
exclude("/mappings/*")
}
}

remapJar {
dependsOn(shadowJar)
addNestedDependencies = true
archiveFileName = "TNIL-Fabric-${project.version}.jar"
}
}

java {
//withSourcesJar()
}

description = "The New Item Library Fabric"
242 changes: 242 additions & 0 deletions TNIL-Fabric/src/main/java/net/tnemc/item/fabric/FabricItemStack.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
package net.tnemc.item.fabric;
/*
* The New Kings
* Copyright (C) 2022 - 2024 Daniel "creatorfromhell" Vidmar
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import net.minecraft.item.ItemStack;
import net.tnemc.item.AbstractItemStack;
import net.tnemc.item.SerialItem;
import net.tnemc.item.SerialItemData;
import net.tnemc.item.attribute.SerialAttribute;

import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;

/**
* FabricItemStack
*
* @author creatorfromhell
* @since 0.0.1.0
*/
public class FabricItemStack implements AbstractItemStack<ItemStack> {

private boolean dirty = false;
private ItemStack stack;



@Override
public AbstractItemStack<ItemStack> of(String material, int amount) {
return null;
}

@Override
public AbstractItemStack<ItemStack> of(SerialItem<ItemStack> serialItem) {
return null;
}

@Override
public AbstractItemStack<ItemStack> of(ItemStack locale) {
return null;
}

@Override
public AbstractItemStack<ItemStack> flags(List<String> flags) {
return null;
}

@Override
public AbstractItemStack<ItemStack> lore(List<String> lore) {
return null;
}

@Override
public AbstractItemStack<ItemStack> attribute(String name, SerialAttribute attribute) {
return null;
}

@Override
public AbstractItemStack<ItemStack> attribute(Map<String, SerialAttribute> attributes) {
return null;
}

@Override
public AbstractItemStack<ItemStack> enchant(String enchantment, int level) {
return null;
}

@Override
public AbstractItemStack<ItemStack> enchant(Map<String, Integer> enchantments) {
return null;
}

@Override
public AbstractItemStack<ItemStack> enchant(List<String> enchantments) {
return null;
}

@Override
public AbstractItemStack<ItemStack> material(String material) {
return null;
}

@Override
public AbstractItemStack<ItemStack> amount(int amount) {
return null;
}

@Override
public AbstractItemStack<ItemStack> slot(int slot) {
return null;
}

@Override
public AbstractItemStack<ItemStack> display(String display) {
return null;
}

@Override
public AbstractItemStack<ItemStack> damage(short damage) {
return null;
}

@Override
public AbstractItemStack<ItemStack> modelData(int modelData) {
return null;
}

@Override
public AbstractItemStack<ItemStack> unbreakable(boolean unbreakable) {
return null;
}

@Override
public AbstractItemStack<ItemStack> applyData(SerialItemData<ItemStack> data) {
return null;
}

@Override
public List<String> flags() {
return List.of();
}

@Override
public List<String> lore() {
return List.of();
}

@Override
public Map<String, SerialAttribute> attributes() {
return Map.of();
}

@Override
public Map<String, Integer> enchantments() {
return Map.of();
}

@Override
public String material() {
return "";
}

@Override
public int amount() {
return 0;
}

@Override
public void setAmount(int amount) {

}

@Override
public int slot() {
return 0;
}

@Override
public String display() {
return "";
}

@Override
public short damage() {
return 0;
}

@Override
public int modelData() {
return 0;
}

@Override
public boolean unbreakable() {
return false;
}

@Override
public void markDirty() {

}

@Override
public Optional<SerialItemData<ItemStack>> data() {
return Optional.empty();
}

/**
* Returns true if the provided item is similar to this. An item is similar if the basic
* information is the same, except for the amount. What this includes: - material - display -
* modelData - flags - lore - attributes - enchantments
*
* What this does not include: - Item Data.
*
* @param compare The stack to compare.
*
* @return True if the two are similar, otherwise false.
*/
@Override
public boolean similar(AbstractItemStack<? extends ItemStack> compare) {
return false;
}

/**
* @return An instance of the implementation's locale version of AbstractItemStack.
*/
@Override
public ItemStack locale() {
return null;
}

@Override
public <V> boolean listsEquals(List<V> list1, List<V> list2) {
return AbstractItemStack.super.listsEquals(list1, list2);
}

@Override
public <V> boolean setsEquals(Set<V> list1, Set<V> list2) {
return AbstractItemStack.super.setsEquals(list1, list2);
}

@Override
public AbstractItemStack<ItemStack> of(org.json.simple.JSONObject json) {
return null;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.tnemc;
package net.tnemc.item.fabric;

import net.fabricmc.api.ModInitializer;

Expand Down
Loading

0 comments on commit 025807c

Please sign in to comment.