Skip to content

Commit

Permalink
Fix API mods not working when more than one API is registered
Browse files Browse the repository at this point in the history
  • Loading branch information
Geometrically committed Feb 11, 2021
1 parent 8165a0a commit 3ac5c56
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 19 deletions.
35 changes: 23 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ group = project.maven_group
repositories {
jcenter()
maven {
url = "https://jitpack.io"
name = "TerraformersMC"
url = "https://maven.terraformersmc.com/"
}
maven {
name = "NerdHubMC"
url = "https://maven.abusedmaster.xyz/"
name = "Ladysnake Libs"
url = "https://dl.bintray.com/ladysnake/libs"
}
}

Expand All @@ -37,7 +38,7 @@ dependencies {
modImplementation "me.sargunvohra.mcmods:autoconfig1u:${project.auto_config_version}"
//Compat Mods
modImplementation "io.github.prospector:modmenu:${project.mod_menu_version}"
modImplementation "com.github.emilyploszaj:trinkets:${trinkets_version}"
modImplementation "dev.emi:trinkets:${trinkets_version}"

include "me.shedaniel.cloth:config-2:${project.cloth_config_version}"
include "me.sargunvohra.mcmods:autoconfig1u:${project.auto_config_version}"
Expand Down Expand Up @@ -91,19 +92,29 @@ jar {
publishing {
publications {
mavenJava(MavenPublication) {
// add all the jars that should be included when publishing to maven
artifact(remapJar) {
builtBy remapJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}

afterEvaluate {
artifact remapJar
}
}
}

// select the repositories you want to publish to
repositories {
// uncomment to publish to the local maven
// mavenLocal()
setupRepositories(repositories)
}

void setupRepositories(RepositoryHandler repositories) {
//repositories.mavenLocal() // uncomment for testing
def ENV = System.getenv()
if (ENV.MAVEN_URL) {
repositories.maven {
url ENV.MAVEN_URL
credentials {
username ENV.MAVEN_USERNAME
password ENV.MAVEN_PASSWORD
}
}
}
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yarn_mappings=1.16.2+build.47
loader_version=0.9.3+build.207

# Mod Properties
mod_version = v1.7
mod_version = v1.8
maven_group = net.guavy
archives_base_name = gravestones

Expand All @@ -19,4 +19,4 @@ fabric_version=0.20.1+build.401-1.16
cloth_config_version=4.8.1
auto_config_version=3.2.2
mod_menu_version=1.14.6+build.31
trinkets_version=2.6.4
trinkets_version=2.6.7
3 changes: 1 addition & 2 deletions src/main/java/net/guavy/gravestones/api/GravestonesApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
public interface GravestonesApi {
List<ItemStack> getInventory(PlayerEntity entity);

//Return extra items that don't fit!
List<ItemStack> setInventory(List<ItemStack> inventory, PlayerEntity entity);
void setInventory(List<ItemStack> inventory, PlayerEntity entity);

int getInventorySize(PlayerEntity entity);
}
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ private boolean RetrieveGrave(PlayerEntity playerEntity, World world, BlockPos p
int inventoryOffset = 41;

for (GravestonesApi gravestonesApi : Gravestones.apiMods) {
gravestonesApi.setInventory(items.subList(41, inventoryOffset + gravestonesApi.getInventorySize(playerEntity)), playerEntity);
gravestonesApi.setInventory(items.subList(inventoryOffset, inventoryOffset + gravestonesApi.getInventorySize(playerEntity)), playerEntity);
inventoryOffset += gravestonesApi.getInventorySize(playerEntity);
}

ItemScatterer.spawn(world, pos, dropItems);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ public List<ItemStack> getInventory(PlayerEntity entity) {
}

@Override
public List<ItemStack> setInventory(List<ItemStack> inventory, PlayerEntity entity) {
public void setInventory(List<ItemStack> inventory, PlayerEntity entity) {
for(ItemStack itemStack : inventory) {
TrinketsApi.getTrinketComponent(entity).equip(itemStack);
}
return null;
}

@Override
Expand Down

0 comments on commit 3ac5c56

Please sign in to comment.