mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-18 11:39:14 +00:00
Allow chisel torches to be FMP microparts
This commit is contained in:
1 parent
9b6e30937c
commit
6699005c14
9 files changed
+202
-20
No files matched your search
@@ -0,0 +1,44 @@
|
||||
package com.cricketcraft.chisel.compat.fmp;
|
||||
|
||||
import com.cricketcraft.chisel.init.ChiselBlocks;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
import codechicken.lib.vec.BlockCoord;
|
||||
import codechicken.multipart.MultiPartRegistry.IPartConverter;
|
||||
import codechicken.multipart.MultiPartRegistry.IPartFactory;
|
||||
import codechicken.multipart.MultiPartRegistry;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
|
||||
public class FMPCompat implements IPartFactory, IPartConverter {
|
||||
|
||||
public void init() {
|
||||
MultiPartRegistry.registerConverter(this);
|
||||
MultiPartRegistry.registerParts(this, new String[] { "chisel_torch" });
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Block> blockTypes() {
|
||||
return Lists.newArrayList(ChiselBlocks.torches);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TMultiPart convert(World world, BlockCoord bc) {
|
||||
Block block = world.getBlock(bc.x, bc.y, bc.z);
|
||||
for (int i = 0; i < ChiselBlocks.torches.length; i++) {
|
||||
if (block == ChiselBlocks.torches[i]) {
|
||||
return new PartChiselTorch(i, world.getBlockMetadata(bc.x, bc.y, bc.z));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TMultiPart createPart(String type, boolean client) {
|
||||
if (type.equals("chisel_torch")) {
|
||||
return new PartChiselTorch();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user