Compare commits

...
1 Commits
Author SHA1 Message Date
Algent cb119dde15 Migrate to ForgeMultipart Java API (#119) 2026-11-22 19:59:26 +01:00
2 changed files with 22 additions and 5 deletions

No files matched your search

+1 -1
View File
@@ -12,7 +12,7 @@ dependencies {
compileOnly('com.github.GTNewHorizons:EnderStorage:1.8.9:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:waila:1.19.34:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:TinkersConstruct:1.14.120-GTNH:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.7.18:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:ForgeMultipart:2.0.0:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:CodeChickenCore:1.4.22:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.64-GTNH:api') {transitive=false}
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:api') {transitive=false}
@@ -6,20 +6,22 @@
package thaumic.tinkerer.common.multipart;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import com.google.common.collect.Lists;
import codechicken.lib.data.MCDataInput;
import codechicken.lib.vec.BlockCoord;
import codechicken.multipart.MultiPartRegistry;
import codechicken.multipart.MultiPartRegistry.IPartConverter;
import codechicken.multipart.MultiPartRegistry.IPartFactory;
import codechicken.multipart.MultiPartRegistry.IPartFactory2;
import codechicken.multipart.TMultiPart;
// This class is used by FMP to recreate a part during loading and to convert already existing non-mutlipart blocks into
// multiparts.
// this is copied from the version FMP uses for vanilla torches
public class RegisterBlockPart implements IPartFactory, IPartConverter {
public class RegisterBlockPart implements IPartFactory2, IPartConverter {
Block block = null;
Class<? extends TMultiPart> part = null;
@@ -41,7 +43,22 @@ public class RegisterBlockPart implements IPartFactory, IPartConverter {
}
@Override
public TMultiPart createPart(String name, boolean client) {
public TMultiPart createPart(String name, NBTTagCompound nbt) {
return newPart(name);
}
@Override
public TMultiPart createPart(String name, MCDataInput packet) {
return newPart(name);
}
// Matches the legacy IPartFactory adapter, which answered previews with the client part.
@Override
public TMultiPart createPartForClientPreview(String name, NBTTagCompound nbt) {
return newPart(name);
}
private TMultiPart newPart(String name) {
if (name.equals(name)) try {
return part.getConstructor().newInstance();
} catch (Exception e) {
@@ -55,7 +72,7 @@ public class RegisterBlockPart implements IPartFactory, IPartConverter {
public void init() {
if (name.isEmpty() || block == null || part == null) return;
MultiPartRegistry.registerConverter(this);
MultiPartRegistry.registerParts(this, new String[] { name });
MultiPartRegistry.registerPartFactory(this, name);
}
@Override