mirror of
https://github.com/GTNewHorizons/ForgeMultipart.git
synced 2026-11-26 23:13:07 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
faa052f70c | ||
|
|
15298cb677 | ||
|
|
d3054211db |
No files matched your search
@@ -18,10 +18,17 @@ object ControlKeyModifer {
|
|||||||
implicit def playerControlValue(p: EntityPlayer) = new ControlKeyValue(p)
|
implicit def playerControlValue(p: EntityPlayer) = new ControlKeyValue(p)
|
||||||
|
|
||||||
class ControlKeyValue(p: EntityPlayer) {
|
class ControlKeyValue(p: EntityPlayer) {
|
||||||
def isControlDown = map(p)
|
def isControlDown = {
|
||||||
|
if (p.worldObj.isRemote) {
|
||||||
|
isClientPressing
|
||||||
|
} else {
|
||||||
|
map(p)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val map = HashMap[EntityPlayer, Boolean]().withDefaultValue(false)
|
val map = HashMap[EntityPlayer, Boolean]().withDefaultValue(false)
|
||||||
|
var isClientPressing = false;
|
||||||
|
|
||||||
/** Implicit static for Java users.
|
/** Implicit static for Java users.
|
||||||
*/
|
*/
|
||||||
@@ -38,7 +45,6 @@ object ControlKeyHandler
|
|||||||
) {
|
) {
|
||||||
import ControlKeyModifer._
|
import ControlKeyModifer._
|
||||||
var wasPressed = false
|
var wasPressed = false
|
||||||
var oldPlayer: EntityPlayer = null
|
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@@ -47,19 +53,11 @@ object ControlKeyHandler
|
|||||||
if (pressed != wasPressed) {
|
if (pressed != wasPressed) {
|
||||||
wasPressed = pressed
|
wasPressed = pressed
|
||||||
if (Minecraft.getMinecraft.getNetHandler != null) {
|
if (Minecraft.getMinecraft.getNetHandler != null) {
|
||||||
map.put(Minecraft.getMinecraft.thePlayer, pressed)
|
isClientPressing = pressed
|
||||||
val packet = new PacketCustom(MultipartCPH.channel, 1)
|
val packet = new PacketCustom(MultipartCPH.channel, 1)
|
||||||
packet.writeBoolean(pressed)
|
packet.writeBoolean(pressed)
|
||||||
packet.sendToServer()
|
packet.sendToServer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (oldPlayer != null) {
|
|
||||||
if (oldPlayer != Minecraft.getMinecraft.thePlayer) {
|
|
||||||
map.remove(oldPlayer)
|
|
||||||
oldPlayer = Minecraft.getMinecraft.thePlayer
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
oldPlayer = Minecraft.getMinecraft.thePlayer
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,7 +85,9 @@ object MultipartRenderer
|
|||||||
val state = CCRenderState.instance
|
val state = CCRenderState.instance
|
||||||
state.resetInstance()
|
state.resetInstance()
|
||||||
state.lightMatrix.locate(world, x, y, z)
|
state.lightMatrix.locate(world, x, y, z)
|
||||||
return tmpart.renderStatic(new Vector3(x, y, z), pass)
|
val b = tmpart.renderStatic(new Vector3(x, y, z), pass)
|
||||||
|
state.lightMatrix.access = null
|
||||||
|
b
|
||||||
}
|
}
|
||||||
|
|
||||||
override def renderInventoryBlock(
|
override def renderInventoryBlock(
|
||||||
|
|||||||
@@ -252,7 +252,9 @@ abstract class TMultiPart {
|
|||||||
* Incremental changes should be sent rather than the whole description
|
* Incremental changes should be sent rather than the whole description
|
||||||
* packet if possible.
|
* packet if possible.
|
||||||
*/
|
*/
|
||||||
def sendDescUpdate() = writeDesc(getWriteStream)
|
def sendDescUpdate() {
|
||||||
|
if (tile != null) writeDesc(getWriteStream)
|
||||||
|
}
|
||||||
|
|
||||||
/** Called when a part is added or removed from this block space. The part
|
/** Called when a part is added or removed from this block space. The part
|
||||||
* parameter may be null if several things have changed.
|
* parameter may be null if several things have changed.
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ import cpw.mods.fml.common.event.{
|
|||||||
FMLServerStoppedEvent
|
FMLServerStoppedEvent
|
||||||
}
|
}
|
||||||
import cpw.mods.fml.common.Mod.EventHandler
|
import cpw.mods.fml.common.Mod.EventHandler
|
||||||
import codechicken.multipart.MultiPartRegistry
|
import codechicken.multipart.{ControlKeyModifer, MultiPartRegistry, Tags}
|
||||||
import codechicken.multipart.Tags
|
|
||||||
|
|
||||||
@Mod(
|
@Mod(
|
||||||
modid = "ForgeMultipart",
|
modid = "ForgeMultipart",
|
||||||
@@ -46,5 +45,6 @@ object MultipartMod {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
def serverStopped(event: FMLServerStoppedEvent) {
|
def serverStopped(event: FMLServerStoppedEvent) {
|
||||||
MultipartSaveLoad.loadingWorld = null;
|
MultipartSaveLoad.loadingWorld = null;
|
||||||
|
ControlKeyModifer.map.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user