Skip to content

Commit 2e49ba9

Browse files
committed
small fixes
1 parent 5072193 commit 2e49ba9

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ import net.darkhax.curseforgegradle.TaskPublishCurseForge
33
import java.text.SimpleDateFormat
44

55
plugins {
6-
id "maven-publish"
6+
id 'checkstyle'
7+
id 'com.github.breadmoirai.github-release' version '2.5.2'
8+
id 'com.modrinth.minotaur' version '2.+'
9+
id 'java'
10+
id 'maven-publish'
711
id 'net.darkhax.curseforgegradle' version '1.1.16'
8-
id 'org.jetbrains.changelog' version '1.2.1'
9-
id "com.modrinth.minotaur" version "2.+"
10-
id "org.jetbrains.kotlin.jvm" version "1.6.10"
1112
id 'net.minecraftforge.gradle' version '[6.0.18,6.2)'
13+
id 'org.jetbrains.changelog' version '1.2.1'
14+
id 'org.jetbrains.kotlin.jvm' version '1.6.10'
1215
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
1316
id 'org.spongepowered.mixin' version '0.7.+'
14-
id "com.github.breadmoirai.github-release" version "2.5.2"
15-
id 'checkstyle'
16-
id 'java'
1717
}
1818

1919
java {

src/main/java/de/srendi/advancedperipherals/common/addons/computercraft/peripheral/plugins/AutomataEntityHandPlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public final MethodResult inspectAnimal(@NotNull IArguments arguments) throws Lu
7676
if (!(entity instanceof Animal animal))
7777
return MethodResult.of(null, "Well, entity is not animal entity, but how?");
7878

79-
return MethodResult.of(LuaConverter.animalToLua(animal, owner.getToolInMainHand(), true));
79+
return MethodResult.of(LuaConverter.completeEntityToLua(animal, owner.getToolInMainHand(), true));
8080
}
8181

8282
@LuaFunction(mainThread = true)

src/main/java/de/srendi/advancedperipherals/common/util/LuaConverter.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ public static <T extends Entity> void registerEntityConverter(Class<T> clazz, En
5959
ENTITY_CONVERTERS.computeIfAbsent(clazz, (k) -> new ArrayList<>(1)).add(converter);
6060
}
6161

62-
/**
63-
* register default entity converters
64-
*/
62+
// register default entity converters
6563
static {
6664
registerEntityConverter(Entity.class, (entity, data, ctx) -> {
6765
data.put("id", entity.getId());
@@ -73,7 +71,7 @@ public static <T extends Entity> void registerEntityConverter(Class<T> clazz, En
7371
data.put("name", type.builtInRegistryHolder().key().location().toString());
7472
if (ctx.detailed()) {
7573
data.put("type", type.getDescriptionId());
76-
data.put("category", type.getCategory());
74+
data.put("category", type.getCategory().getName());
7775
data.put("canBurn", entity.fireImmune());
7876
data.put("canFreeze", entity.canFreeze());
7977
data.put("tags", entity.getTags());
@@ -102,7 +100,7 @@ public static <T extends Entity> void registerEntityConverter(Class<T> clazz, En
102100
});
103101
registerEntityConverter(Animal.class, (entity, data, ctx) -> {
104102
data.put("inLove", entity.isInLove());
105-
if (ctx.detailed() && !ctx.itemInHand().isEmpty() entity instanceof IForgeShearable shareable) {
103+
if (ctx.detailed() && !ctx.itemInHand().isEmpty() && entity instanceof IForgeShearable shareable) {
106104
data.put("shareable", shareable.isShearable(ctx.itemInHand(), entity.level, entity.blockPosition()));
107105
}
108106
});
@@ -153,7 +151,7 @@ public static Map<String, Object> completeEntityToLua(Entity entity, ItemStack i
153151
List<EntityConverter<? extends Entity>> converters = ENTITY_CONVERTERS.get((Class<? extends Entity>) entityClass);
154152
if (converters != null) {
155153
for (EntityConverter<? extends Entity> converter : converters) {
156-
converter.entityToMap(entity, data, ctx);
154+
((EntityConverter<Entity>) converter).entityToMap(entity, data, ctx);
157155
}
158156
}
159157
}

0 commit comments

Comments
 (0)