mirror of
https://github.com/GTNewHorizons/bdlib.git
synced 2026-11-19 19:59:35 +00:00
Fixed tile entity names not being scoped, should prevent collisions
This commit is contained in:
1 parent
49a2f0baec
commit
0b87dd83e7
2 files changed
+11
-3
No files matched your search
+1
-1
@@ -14,7 +14,7 @@ buildscript {
|
||||
apply plugin: 'forge'
|
||||
apply plugin: 'scala'
|
||||
|
||||
version = "1.2.2"
|
||||
version = "1.2.3"
|
||||
|
||||
if (project.hasProperty('buildnum')) {
|
||||
project.version = project.version + '.' + project.buildnum
|
||||
|
||||
@@ -13,8 +13,11 @@ import net.minecraft.item.ItemStack
|
||||
import net.minecraft.block.Block
|
||||
import cpw.mods.fml.common.registry.GameRegistry
|
||||
import net.bdew.lib.block.HasTE
|
||||
import net.bdew.lib.Misc
|
||||
|
||||
class BlockManager(val ids: IdManager) {
|
||||
class BlockManager(val ids: IdManager, addOldTileNames: Boolean = true) {
|
||||
|
||||
def this(ids: IdManager) = this(ids, true)
|
||||
|
||||
def regBlockCls[T <: Block](blockCls: Class[T], name: String, addStack: Boolean = true): T = {
|
||||
val block = blockCls.getConstructor(classOf[Int]).newInstance(ids.getBlockId(name): Integer)
|
||||
@@ -28,7 +31,12 @@ class BlockManager(val ids: IdManager) {
|
||||
GameRegistry.registerCustomItemStack(name, new ItemStack(block))
|
||||
|
||||
if (block.isInstanceOf[HasTE[_]])
|
||||
GameRegistry.registerTileEntity(block.asInstanceOf[HasTE[_]].TEClass, name)
|
||||
if (addOldTileNames)
|
||||
GameRegistry.registerTileEntityWithAlternatives(block.asInstanceOf[HasTE[_]].TEClass,
|
||||
"%s.%s".format(Misc.getActiveModId, name), name)
|
||||
else
|
||||
GameRegistry.registerTileEntity(block.asInstanceOf[HasTE[_]].TEClass,
|
||||
"%s.%s".format(Misc.getActiveModId, name))
|
||||
|
||||
return block
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user