Merge pull request #8 from GlodBlock/p2pfix

fix crash with latest ae2 and dupe with security terminal
This commit is contained in:
Martin Robertz authored and GitHub committed 2022-05-29 13:32:40 +02:00
commit b1d641995f
3 files changed
+13 -14

No files matched your search

+2 -3
View File
@@ -1,8 +1,7 @@
// Add your dependencies here
dependencies {
compile 'com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-76-GTNH:dev'
compile 'com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-84-GTNH:dev'
compile 'com.github.GTNewHorizons:Forgelin:1.9.2-GTNH-1.7.10-Edition'
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.27:dev')
compile 'com.github.GTNewHorizons:BuildCraft:7.1.27:dev'
}
@@ -73,11 +73,10 @@ class GuiAdvancedMemoryCard(msg: S2CListP2P) : GuiScreen(), TextureBound {
super.initGui()
checkInfo()
scrollBar = WidgetScrollBar()
searchBar = MEGuiTextField(fontRendererObj, guiLeft + 148, guiTop + 3, 65, 10)
searchBar.maxStringLength = 25
searchBar.setTextColor(0xFFFFFF)
searchBar.visible = true
searchBar.enableBackgroundDrawing = false
searchBar = MEGuiTextField(65, 10)
searchBar.setMaxStringLength(25)
searchBar.x = guiLeft + 148
searchBar.y = guiTop + 5
scrollBar.displayX = guiLeft + 218
scrollBar.displayY = guiTop + 19
scrollBar.height = 114
@@ -20,7 +20,7 @@ fun linkP2P(player: EntityPlayer, inputIndex: Int, outputIndex: Int, status: P2P
val grid: IGrid? = input.gridNode?.grid
if (grid is ISecurityGrid) {
if (!grid.hasPermission(player, SecurityPermissions.BUILD)) {
if (!grid.hasPermission(player, SecurityPermissions.BUILD) || !grid.hasPermission(player, SecurityPermissions.SECURITY)) {
return null
}
}
@@ -39,22 +39,23 @@ fun linkP2P(player: EntityPlayer, inputIndex: Int, outputIndex: Int, status: P2P
// TODO reduce changes
if (input.frequency.toInt() == 0 || input.isOutput) {
frequency = System.currentTimeMillis()
updateP2P(input, frequency, false, input.customName)
updateP2P(input, frequency, false, player, input.customName)
}
if (cache.getInput(frequency) != null) {
val originalInput = cache.getInput(frequency)
if (originalInput != input)
updateP2P(originalInput, frequency, true, input.customName)
updateP2P(originalInput, frequency, true, player, input.customName)
}
return updateP2P(input, frequency, false, input.customName) to updateP2P(output, frequency, true, input.customName)
return updateP2P(input, frequency, false, player, input.customName) to updateP2P(output, frequency, true, player, input.customName)
}
/**
* Due to Applied Energistics' limit
*/
fun updateP2P(tunnel: PartP2PTunnel<*>, frequency: Long, output: Boolean, name: String): PartP2PTunnel<*> {
fun updateP2P(tunnel: PartP2PTunnel<*>, frequency: Long, output: Boolean, player: EntityPlayer, name: String): PartP2PTunnel<*> {
val side = tunnel.side
tunnel.host.removePart(side, true)
val data = NBTTagCompound()
@@ -67,7 +68,7 @@ fun updateP2P(tunnel: PartP2PTunnel<*>, frequency: Long, output: Boolean, name:
data.setLong("freq", frequency)
val newType = ItemStack.loadItemStackFromNBT(data)
val dir: ForgeDirection = tunnel.host?.addPart(newType, side, null) ?: throw RuntimeException("Cannot bind")
val dir: ForgeDirection = tunnel.host?.addPart(newType, side, player) ?: throw RuntimeException("Cannot bind")
val newBus: IPart = tunnel.host.getPart(dir)
if (newBus is PartP2PTunnel<*>) {