mirror of
https://github.com/GTNewHorizons/ForgeMultipart.git
synced 2026-11-26 15:03:18 +00:00
CCC-Public cleanup
This commit is contained in:
1 parent
a95f579e88
commit
20ce3e153a
4 files changed
+27
-8
No files matched your search
+3
-3
@@ -1,12 +1,12 @@
|
||||
package codechicken.microblock;
|
||||
package codechicken.microblock
|
||||
|
||||
/**
|
||||
* Implement this on center parts that connect through hollow covers to have the covers render their hollows to fit the connection size
|
||||
*/
|
||||
public interface IHollowConnect
|
||||
trait IHollowConnect
|
||||
{
|
||||
/**
|
||||
* @return The size (width and height) of the connection in pixels. Must be be less than 12 and more than 0
|
||||
*/
|
||||
public int getSize();
|
||||
def getSize:Int
|
||||
}
|
||||
@@ -22,7 +22,6 @@ import scala.collection.mutable.HashSet
|
||||
import codechicken.multipart.handler.MultipartProxy
|
||||
import net.minecraft.block.Block
|
||||
import net.minecraft.item.ItemStack
|
||||
import codechicken.core.inventory.InventoryUtils
|
||||
import codechicken.core.vec.Vector3
|
||||
import net.minecraft.nbt.NBTTagList
|
||||
import net.minecraft.client.particle.EffectRenderer
|
||||
@@ -36,6 +35,7 @@ import scala.collection.mutable.Queue
|
||||
import codechicken.multipart.handler.MultipartSPH
|
||||
import codechicken.core.lighting.LazyLightMatrix
|
||||
import net.minecraft.world.ChunkCoordIntPair
|
||||
import net.minecraft.entity.item.EntityItem
|
||||
|
||||
trait TileMultipart extends TileEntity
|
||||
{
|
||||
@@ -278,7 +278,7 @@ trait TileMultipart extends TileEntity
|
||||
def dropItems(items:Seq[ItemStack])
|
||||
{
|
||||
val pos = Vector3.fromTileEntityCenter(this)
|
||||
items.foreach(item => InventoryUtils.dropItem(item, worldObj, pos))
|
||||
items.foreach(item => TileMultipartObj.dropItem(item, worldObj, pos))
|
||||
}
|
||||
|
||||
def markRender()
|
||||
@@ -494,4 +494,13 @@ object TileMultipartObj
|
||||
tmb.loadParts(parts)
|
||||
return tmb
|
||||
}
|
||||
|
||||
def dropItem(stack:ItemStack, world:World, pos:Vector3)
|
||||
{
|
||||
val item = new EntityItem(world, pos.x, pos.y, pos.z, stack);
|
||||
item.motionX = world.rand.nextGaussian() * 0.05;
|
||||
item.motionY = world.rand.nextGaussian() * 0.05 + 0.2F;
|
||||
item.motionZ = world.rand.nextGaussian() * 0.05;
|
||||
world.spawnEntityInWorld(item);
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import cpw.mods.fml.common.registry.GameRegistry
|
||||
import java.io.File
|
||||
import codechicken.multipart.handler.MultipartProxy._
|
||||
import codechicken.multipart.BlockMultipartImpl
|
||||
import codechicken.core.CommonUtils
|
||||
import codechicken.multipart.MultipartRenderer
|
||||
import java.util.HashMap
|
||||
import net.minecraftforge.common.MinecraftForge
|
||||
@@ -23,6 +22,7 @@ import cpw.mods.fml.client.registry.KeyBindingRegistry
|
||||
import codechicken.multipart.ControlKeyHandler
|
||||
import cpw.mods.fml.common.network.NetworkRegistry
|
||||
import cpw.mods.fml.common.registry.TickRegistry
|
||||
import net.minecraft.block.Block
|
||||
|
||||
class MultipartProxy_serverImpl
|
||||
{
|
||||
@@ -38,7 +38,7 @@ class MultipartProxy_serverImpl
|
||||
|
||||
def postInit()
|
||||
{
|
||||
block = new BlockMultipartImpl(config.getTag("block.id").getIntValue(CommonUtils.getFreeBlockID(1281)))
|
||||
block = new BlockMultipartImpl(config.getTag("block.id").getIntValue(getFreeBlockID(1281)))
|
||||
block.setUnlocalizedName("ccmultipart")
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(MultipartEventHandler)
|
||||
@@ -47,6 +47,14 @@ class MultipartProxy_serverImpl
|
||||
TickRegistry.registerTickHandler(MultipartEventHandler, Side.SERVER)
|
||||
}
|
||||
|
||||
def getFreeBlockID(preferred:Int):Int =
|
||||
{
|
||||
for(i <- (preferred until 4096) ++ (preferred-1 until 255))
|
||||
if(Block.blocksList(i) == null)
|
||||
return i
|
||||
throw new RuntimeException("Out of Block IDs")
|
||||
}
|
||||
|
||||
def onTileClassBuilt(t:Class[_ <: TileEntity])
|
||||
{
|
||||
MultipartSaveLoad.registerTileClass(t)
|
||||
|
||||
@@ -4,7 +4,6 @@ import codechicken.core.packet.PacketCustom;
|
||||
import codechicken.core.raytracer.RayTracer;
|
||||
import codechicken.core.vec.BlockCoord;
|
||||
import codechicken.core.vec.Vector3;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
import codechicken.multipart.TileMultipartObj;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -34,6 +33,9 @@ public class EventHandler
|
||||
BlockCoord pos = new BlockCoord(hit.blockX, hit.blockY, hit.blockZ).offset(hit.sideHit);
|
||||
ItemStack held = player.getHeldItem();
|
||||
McBlockPart part = null;
|
||||
if(held == null)
|
||||
return false;
|
||||
|
||||
if(held.itemID == Block.torchWood.blockID)
|
||||
part = TorchPart.placement(world, pos, hit.sideHit);
|
||||
|
||||
|
||||
Reference in new issue
Block a user