Skip to content

Commit

Permalink
Fixed WAILA bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jrddunbr committed Jan 19, 2021
1 parent 3a9d63c commit 0ff3a4d
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 20 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MAJORVERSION = 1
MINORVERSION = 18
REVISION = 2
REVISION = 3

GROUP = 'net.electricalage.eln'
ARCHIVE_NAME = 'ElectricalAge-jrddunbr'
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/mods/eln/ghost/GhostBlock.kt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class GhostBlock : Block(Material.iron) {
}
}

override fun collisionRayTrace(world: World, x: Int, y: Int, z: Int, startVec: Vec3, endVec: Vec3): MovingObjectPosition {
override fun collisionRayTrace(world: World, x: Int, y: Int, z: Int, startVec: Vec3, endVec: Vec3): MovingObjectPosition? {
val meta = world.getBlockMetadata(x, y, z)
when (meta) {
tFloor -> maxY = 0.0625
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/mods/eln/ghost/GhostElement.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class GhostElement : INBTTReady {
var uUID = 0

constructor() {}
constructor(elementCoordinate: Coordinate?, observatorCoordinate: Coordinate?, UUID: Int) {
constructor(elementCoordinate: Coordinate, observatorCoordinate: Coordinate, UUID: Int) {
this.elementCoordinate = elementCoordinate
observatorCoordonate = observatorCoordinate
uUID = UUID
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/mods/eln/ghost/GhostGroup.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class GhostGroup {
return true
}

fun plot(coordinate: Coordinate, observerCoordinate: Coordinate?, UUID: Int): Boolean {
fun plot(coordinate: Coordinate, observerCoordinate: Coordinate, UUID: Int): Boolean {
if (!canBePloted(coordinate.world(), coordinate.x, coordinate.y, coordinate.z)) return false
for (element in elementList) {
val offsetCoordinate = coordinate.newWithOffset(element.x, element.y, element.z)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/mods/eln/ghost/GhostManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class GhostManager(par1Str: String?) : WorldSavedData(par1Str) {
}

@JvmOverloads
fun createGhost(coordinate: Coordinate, observerCoordinate: Coordinate?, UUID: Int, block: Block? = Eln.ghostBlock, meta: Int = GhostBlock.tCube) {
fun createGhost(coordinate: Coordinate, observerCoordinate: Coordinate, UUID: Int, block: Block? = Eln.ghostBlock, meta: Int = GhostBlock.tCube) {
var coordinate = coordinate
coordinate.world().setBlockToAir(coordinate.x, coordinate.y, coordinate.z)
if (coordinate.world().setBlock(coordinate.x, coordinate.y, coordinate.z, block, meta, 3)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import mcp.mobius.waila.api.IWailaDataProvider
import mcp.mobius.waila.api.SpecialChars
import mods.eln.misc.Coordinate
import mods.eln.misc.Direction
import mods.eln.misc.Utils
import mods.eln.packets.GhostNodeWailaResponsePacket
import net.minecraft.entity.player.EntityPlayerMP
import net.minecraft.item.ItemStack
Expand All @@ -34,7 +35,10 @@ class GhostNodeWailaProvider(private val transparentNodeProvider: TransparentNod
override fun getRenderingPosition() = accessor.renderingPosition
override fun getNBTData() = accessor.nbtData
override fun getTileEntity() = accessor.tileEntity
override fun getWorld() = coord.world()
override fun getWorld(): World {
Utils.println("Debugging WAILA, getWorld: $coord ${coord.x} ${coord.y} ${coord.z} ${coord.dimension} ${coord.world()}")
return coord.world()
}
override fun getBlock() = accessor.block
override fun getNBTInteger(tag: NBTTagCompound?, keyname: String?) = accessor.getNBTInteger(tag, keyname)
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/mods/eln/misc/Coordinate.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ package mods.eln.misc
import cpw.mods.fml.common.FMLCommonHandler
import mods.eln.node.NodeBlockEntity
import net.minecraft.block.Block
import net.minecraft.client.Minecraft
import net.minecraft.entity.Entity
import net.minecraft.nbt.NBTTagCompound
import net.minecraft.tileentity.TileEntity
import net.minecraft.util.AxisAlignedBB
import net.minecraft.util.Vec3
import net.minecraft.world.World
import net.minecraftforge.client.MinecraftForgeClient
import net.minecraftforge.common.DimensionManager
import kotlin.math.abs

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/mods/eln/node/six/SixNodeElement.kt
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,11 @@ abstract class SixNodeElement(sixNode: SixNode, @JvmField var side: Direction, d
return true
}

open fun getWaila(): Map<String, String> {
val wailaList: MutableMap<String, String> = HashMap()
wailaList["Info"] = multiMeterString()
return wailaList
}
open fun getWaila(): Map<String, String>? {
val wailaList: MutableMap<String, String> = HashMap()
wailaList["Info"] = multiMeterString()
return wailaList
}

init {
itemStackDamageId = sixNode.sideElementIdList[side.int]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package mods.eln.packets

import cpw.mods.fml.common.network.simpleimpl.IMessageHandler
import cpw.mods.fml.common.network.simpleimpl.MessageContext
import mods.eln.misc.Utils
import mods.eln.node.NodeManager
import mods.eln.node.six.SixNode
import net.minecraft.item.ItemStack
Expand All @@ -16,7 +17,10 @@ class SixNodeWailaRequestPacketHandler : IMessageHandler<SixNodeWailaRequestPack
if (node != null) {
val element = node.getElement(side)
if (element != null) {
stringMap = element.getWaila().filter { true }
if (element.getWaila() == null) {
Utils.println("Waila got a null getWaila() descriptor for ${element.sixNodeElementDescriptor.name}")
}
stringMap = element.getWaila()?.filter { true }?: mapOf()
itemStack = element.sixNodeElementDescriptor.newItemStack()
}
}
Expand Down
10 changes: 2 additions & 8 deletions src/main/java/mods/eln/sixnode/hub/HubElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,10 @@ public int getConnectionMask(LRDU lrdu) {
return 0;
}

@Override
public String multiMeterString() {
return "";// Utils.plotVolt("U:", electricalLoad.Uc) +
// Utils.plotAmpere("I:", electricalLoad.getCurrent());
}

@NotNull
@Override
public Map<String, String> getWaila() {
return null;
public String multiMeterString() {
return "";
}

@NotNull
Expand Down

0 comments on commit 0ff3a4d

Please sign in to comment.