aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/lorenz
diff options
context:
space:
mode:
authorLorenz <ESs95s3P5z8Pheb>2022-07-14 11:13:53 +0200
committerLorenz <ESs95s3P5z8Pheb>2022-07-14 11:13:53 +0200
commitb2108f37f551fba5cb43f4919d69e5db7bb1e44c (patch)
tree04efb1b7815e2e8625ed00810bee711ca2a132a7 /src/main/java/at/lorenz
parent26c36ab5f0135b50dbe0a983023d80504e2f66b4 (diff)
downloadskyhanni-b2108f37f551fba5cb43f4919d69e5db7bb1e44c.tar.gz
skyhanni-b2108f37f551fba5cb43f4919d69e5db7bb1e44c.tar.bz2
skyhanni-b2108f37f551fba5cb43f4919d69e5db7bb1e44c.zip
remove old skytils code
Diffstat (limited to 'src/main/java/at/lorenz')
-rw-r--r--src/main/java/at/lorenz/mod/dungeon/DungeonHighlightClickedBlocks.kt4
-rw-r--r--src/main/java/at/lorenz/mod/items/ItemDisplayOverlayFeatures.kt3
-rw-r--r--src/main/java/at/lorenz/mod/items/abilitycooldown/ItemAbilityCooldown.kt91
-rw-r--r--src/main/java/at/lorenz/mod/mixinhooks/RenderItemHook.kt59
-rw-r--r--src/main/java/at/lorenz/mod/mixins/MixinNetHandlerPlayClient.java8
-rw-r--r--src/main/java/at/lorenz/mod/utils/APIUtil.kt70
-rw-r--r--src/main/java/at/lorenz/mod/utils/RenderUtils.kt2
7 files changed, 6 insertions, 231 deletions
diff --git a/src/main/java/at/lorenz/mod/dungeon/DungeonHighlightClickedBlocks.kt b/src/main/java/at/lorenz/mod/dungeon/DungeonHighlightClickedBlocks.kt
index 86f205347..e824eb714 100644
--- a/src/main/java/at/lorenz/mod/dungeon/DungeonHighlightClickedBlocks.kt
+++ b/src/main/java/at/lorenz/mod/dungeon/DungeonHighlightClickedBlocks.kt
@@ -4,7 +4,7 @@ import at.lorenz.mod.events.LorenzChatEvent
import at.lorenz.mod.events.PacketEvent
import at.lorenz.mod.utils.*
import at.lorenz.mod.utils.BlockUtils.getBlockAt
-import at.lorenz.mod.utils.RenderUtils.drawSkytilsColor
+import at.lorenz.mod.utils.RenderUtils.drawColor
import at.lorenz.mod.utils.RenderUtils.drawString
import at.lorenz.mod.LorenzMod
import net.minecraft.init.Blocks
@@ -78,7 +78,7 @@ class DungeonHighlightClickedBlocks {
blocks.removeAll { System.currentTimeMillis() > it.time + 3000 }
blocks.forEach {
- event.drawSkytilsColor(it.position, it.color)
+ event.drawColor(it.position, it.color)
event.drawString(it.position.add(0.5, 0.5, 0.5), it.displayText, true)
}
}
diff --git a/src/main/java/at/lorenz/mod/items/ItemDisplayOverlayFeatures.kt b/src/main/java/at/lorenz/mod/items/ItemDisplayOverlayFeatures.kt
index c07b2fff4..3d16af280 100644
--- a/src/main/java/at/lorenz/mod/items/ItemDisplayOverlayFeatures.kt
+++ b/src/main/java/at/lorenz/mod/items/ItemDisplayOverlayFeatures.kt
@@ -17,10 +17,9 @@ class ItemDisplayOverlayFeatures {
@SubscribeEvent
fun onRenderItemOverlayPost(event: GuiRenderItemEvent.RenderOverlayEvent.Post) {
-
val item = event.stack ?: return
- if (!LorenzUtils.inSkyblock || item.stackSize != 1 || item.tagCompound?.hasKey("SkytilsNoItemOverlay") == true) return
+ if (!LorenzUtils.inSkyblock || item.stackSize != 1) return
val stackTip = getStackTip(item)
diff --git a/src/main/java/at/lorenz/mod/items/abilitycooldown/ItemAbilityCooldown.kt b/src/main/java/at/lorenz/mod/items/abilitycooldown/ItemAbilityCooldown.kt
index 2a0c215ab..6f4648817 100644
--- a/src/main/java/at/lorenz/mod/items/abilitycooldown/ItemAbilityCooldown.kt
+++ b/src/main/java/at/lorenz/mod/items/abilitycooldown/ItemAbilityCooldown.kt
@@ -98,7 +98,6 @@ class ItemAbilityCooldown {
if (!isEnabled()) return
val item = event.stack ?: return
-// if (item.stackSize != 1 || item.tagCompound?.hasKey("SkytilsNoItemOverlay") == true) return
if (item.stackSize != 1) return
var stackTip = ""
@@ -125,96 +124,6 @@ class ItemAbilityCooldown {
}
}
-// @SubscribeEvent
-// fun onRenderItemOverlayPost(event: GuiRenderItemEvent.RenderOverlayEvent.Pre) {
-// if (!isEnabled()) return
-//
-// val item = event.stack ?: return
-//// if (item.stackSize != 1 || item.tagCompound?.hasKey("SkytilsNoItemOverlay") == true) return
-// if (item.stackSize != 1) return
-//
-// var stackTip = ""
-//
-// val isActive = Minecraft.getMinecraft().currentScreen == null
-// val itemText = items.filter { it.key == item && it.value.active }
-// .firstNotNullOfOrNull { it.value }
-//
-// if (itemText != null) return
-//// if (!isActive && !itemText.active) return
-//
-// stackTip = "T"
-//
-//// items.filter { it.key == item }
-//// .forEach { stackTip = it.value.color.getChatColor() + it.value.text }
-//
-// if (stackTip.isNotEmpty()) {
-// GlStateManager.disableLighting()
-// GlStateManager.disableDepth()
-// GlStateManager.disableBlend()
-// event.fr.drawStringWithShadow(
-// stackTip,
-// (event.x + 17 - event.fr.getStringWidth(stackTip)).toFloat(),
-// (event.y + 9).toFloat(),
-// 16777215
-// )
-// GlStateManager.enableLighting()
-// GlStateManager.enableDepth()
-// }
-// }
-
-// @SubscribeEvent
-// fun onGuiDrawEvent(event: GuiContainerEvent.BackgroundDrawnEvent) {
-// if (!isEnabled())
-//
-// val guiContainer: GuiContainer? = event.gui
-// if (guiContainer != null && guiContainer !is GuiInventory) return
-// val chest = guiContainer.inventorySlots
-//
-//// val chestName = chest.lowerChestInventory.displayName.unformattedText.trim()
-//// if (chestName != "Spirit Leap") return
-//
-// for (slot in chest.inventorySlots) {
-// if (slot == null) continue
-//// if (slot.slotNumber == slot.slotIndex) continue
-// if (slot.stack == null) continue
-//
-// val stack = slot.stack
-//
-//// for ((item, text) in map) {
-//// if (item == stack) {
-//// slot highlight text.color
-//// }
-//// }
-// map.filter { it.key == stack }.forEach { slot highlight it.value.color }
-//
-//// slot highlight LorenzColor.WHITE
-//
-//// val displayName = stack.displayName
-//// if (displayName == " ") continue
-//
-//// val itemLore = stack.getLore()
-//// if (itemLore.size == 1 && itemLore[0] == "§eClick to teleport!") {
-////
-//// if (displayName.contains(witherDoorName)) {
-//// if (lastWitherDoorOpened + 10_000 > System.currentTimeMillis()) {
-//// slot highlight LorenzColor.YELLOW
-//// return
-//// }
-//// }
-//// if (displayName.contains(teleportName)) {
-//// if (lastTeleport + 10_000 > System.currentTimeMillis()) {
-//// slot highlight LorenzColor.AQUA
-//// return
-//// }
-//// }
-//// } else {
-//// //TODO hide the item totally?
-//// slot highlight LorenzColor.RED
-//// }
-//
-// }
-// }
-
private fun hasAbility(itemName: String): Ability? {
for (ability in Ability.values()) {
for (name in ability.itemNames) {
diff --git a/src/main/java/at/lorenz/mod/mixinhooks/RenderItemHook.kt b/src/main/java/at/lorenz/mod/mixinhooks/RenderItemHook.kt
index 0291782b7..f978fe823 100644
--- a/src/main/java/at/lorenz/mod/mixinhooks/RenderItemHook.kt
+++ b/src/main/java/at/lorenz/mod/mixinhooks/RenderItemHook.kt
@@ -10,16 +10,6 @@ val RES_ITEM_GLINT = ResourceLocation("textures/misc/enchanted_item_glint.png")
var skipGlint = false
-//fun renderRarity(stack: ItemStack, x: Int, y: Int, ci: CallbackInfo) {
-// if (Utils.inSkyblock && Skytils.config.showItemRarity) {
-// if (mc.currentScreen != null) {
-// if (isStorageMenuActive || isTradeWindowActive || isCustomAHActive) {
-// renderRarity(stack, x, y)
-// }
-// }
-// }
-//}
-
fun renderItemOverlayPost(
fr: FontRenderer,
stack: ItemStack?,
@@ -35,51 +25,4 @@ fun renderItemOverlayPost(
yPosition,
text
).postAndCatch()
-}
-
-//fun renderItemPre(stack: ItemStack, model: IBakedModel, ci: CallbackInfo) {
-// if (!Utils.inSkyblock) return
-// if (stack.item === Items.skull) {
-// val scale = Skytils.config.largerHeadScale.toDouble()
-// GlStateManager.scale(scale, scale, scale)
-// }
-//}
-
-//fun modifyGlintRendering(stack: ItemStack, model: IBakedModel, ci: CallbackInfo) {
-// if (Utils.inSkyblock) {
-// val itemId = getSkyBlockItemID(stack)
-// if (GlintCustomizer.glintColors.containsKey(itemId)) {
-// val color = GlintCustomizer.glintColors[itemId]!!.toInt()
-// GlStateManager.depthMask(false)
-// GlStateManager.depthFunc(514)
-// GlStateManager.disableLighting()
-// GlStateManager.blendFunc(768, 1)
-// mc.textureManager.bindTexture(RES_ITEM_GLINT)
-// GlStateManager.matrixMode(5890)
-// GlStateManager.pushMatrix()
-// GlStateManager.scale(8.0f, 8.0f, 8.0f)
-// val f = (Minecraft.getSystemTime() % 3000L).toFloat() / 3000.0f / 8.0f
-// GlStateManager.translate(f, 0.0f, 0.0f)
-// GlStateManager.rotate(-50.0f, 0.0f, 0.0f, 1.0f)
-// (mc.renderItem as AccessorRenderItem).invokeRenderModel(model, color)
-// GlStateManager.popMatrix()
-// GlStateManager.pushMatrix()
-// GlStateManager.scale(8.0f, 8.0f, 8.0f)
-// val f1 = (Minecraft.getSystemTime() % 4873L).toFloat() / 4873.0f / 8.0f
-// GlStateManager.translate(-f1, 0.0f, 0.0f)
-// GlStateManager.rotate(10.0f, 0.0f, 0.0f, 1.0f)
-// (mc.renderItem as AccessorRenderItem).invokeRenderModel(model, color)
-// GlStateManager.popMatrix()
-// GlStateManager.matrixMode(5888)
-// GlStateManager.blendFunc(770, 771)
-// GlStateManager.enableLighting()
-// GlStateManager.depthFunc(515)
-// GlStateManager.depthMask(true)
-// mc.textureManager.bindTexture(TextureMap.locationBlocksTexture)
-// ci.cancel()
-//
-// //Since we prematurely exited, we need to reset the matrices
-// GlStateManager.popMatrix()
-// }
-// }
-//} \ No newline at end of file
+} \ No newline at end of file
diff --git a/src/main/java/at/lorenz/mod/mixins/MixinNetHandlerPlayClient.java b/src/main/java/at/lorenz/mod/mixins/MixinNetHandlerPlayClient.java
index 383fc114e..08ddd69fa 100644
--- a/src/main/java/at/lorenz/mod/mixins/MixinNetHandlerPlayClient.java
+++ b/src/main/java/at/lorenz/mod/mixins/MixinNetHandlerPlayClient.java
@@ -23,12 +23,4 @@ public abstract class MixinNetHandlerPlayClient implements INetHandlerPlayClient
private void onSendPacket(Packet<?> packet, CallbackInfo ci) {
NetHandlerPlayClientHookKt.onSendPacket(packet, ci);
}
- // @Inject(method = "handleSpawnMob", at = @At("TAIL"))
- // private void onHandleSpawnMobTail(S0FPacketSpawnMob packetIn, CallbackInfo ci) {
- // Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityID());
- // MasterMode7Features.INSTANCE.onMobSpawned(entity);
- // ((ExtensionEntityLivingBase) entity).getSkytilsHook().onNewDisplayName(
- // entity.getDataWatcher().getWatchableObjectString(2)
- // );
- // }
}
diff --git a/src/main/java/at/lorenz/mod/utils/APIUtil.kt b/src/main/java/at/lorenz/mod/utils/APIUtil.kt
index 88d459ada..7e0193f50 100644
--- a/src/main/java/at/lorenz/mod/utils/APIUtil.kt
+++ b/src/main/java/at/lorenz/mod/utils/APIUtil.kt
@@ -1,6 +1,5 @@
package at.lorenz.mod.utils
-import com.google.gson.JsonArray
import com.google.gson.JsonObject
import com.google.gson.JsonParser
import org.apache.http.client.config.RequestConfig
@@ -9,34 +8,13 @@ import org.apache.http.impl.client.HttpClientBuilder
import org.apache.http.impl.client.HttpClients
import org.apache.http.message.BasicHeader
import org.apache.http.util.EntityUtils
-import scala.util.parsing.json.JSONArray
-import scala.util.parsing.json.JSONObject
-import java.awt.image.BufferedImage
-import java.net.HttpURLConnection
-import java.net.URL
-import java.security.cert.X509Certificate
-import javax.imageio.ImageIO
object APIUtil {
private val parser = JsonParser()
-// val sslContext = SSLContexts.custom()
-// .loadTrustMaterial { chain, authType ->
-// isValidCert(chain, authType)
-// }
-// .build()
-// val sslSocketFactory = SSLConnectionSocketFactoryBuilder.create()
-// .setSslContext(sslContext)
-// .build()
-
-// val cm = PoolingHttpClientConnectionManagerBuilder.create()
-// .setSSLSocketFactory(sslSocketFactory)
-
val builder: HttpClientBuilder =
HttpClients.custom().setUserAgent("LorenzMod")
-// .setConnectionManagerShared(true)
-// .setConnectionManager(cm.build())
.setDefaultHeaders(
mutableListOf(
BasicHeader("Pragma", "no-cache"),
@@ -45,27 +23,10 @@ object APIUtil {
)
.setDefaultRequestConfig(
RequestConfig.custom()
-// .setConnectTimeout(Timeout.ofMinutes(1))
-// .setResponseTimeout(Timeout.ofMinutes(1))
.build()
)
.useSystemProperties()
- /**
- * Taken from Elementa under MIT License
- * @link https://github.com/Sk1erLLC/Elementa/blob/master/LICENSE
- */
- fun URL.getImage(): BufferedImage {
- val connection = this.openConnection() as HttpURLConnection
-
- connection.requestMethod = "GET"
- connection.useCaches = true
- connection.addRequestProperty("User-Agent", "LorenzMod")
- connection.doOutput = true
-
- return ImageIO.read(connection.inputStream)
- }
-
fun getJSONResponse(urlString: String): JsonObject {
val client = builder.build()
try {
@@ -74,43 +35,14 @@ object APIUtil {
if (entity != null) {
val retSrc = EntityUtils.toString(entity)
return parser.parse(retSrc) as JsonObject
- // parsing JSON
-// val result = JSONObject(retSrc) //Convert String to JSON Object
-// val tokenList: JSONArray = result.getJSONArray("names")
-// val oj: JSONObject = tokenList.getJSONObject(0)
-// val token: String = oj.getString("name")
}
}
} catch (ex: Throwable) {
ex.printStackTrace()
- LorenzUtils.error("Skytils ran into an ${ex::class.simpleName ?: "error"} whilst fetching a resource. See logs for more details.")
+ LorenzUtils.error("Lorenz Mod ran into an ${ex::class.simpleName ?: "error"} whilst fetching a resource. See logs for more details.")
} finally {
client.close()
}
return JsonObject()
}
-
-// fun getArrayResponse(urlString: String): JsonArray {
-// val client = builder.build()
-// try {
-// client.execute(HttpGet(urlString)).use { response ->
-//// response.entity.content
-// response.entity.content { entity ->
-// val obj = parser.parse(EntityUtils.toString(entity)).asJsonArray
-// EntityUtils.consume(entity)
-// return obj
-// }
-// }
-// } catch (ex: Throwable) {
-// LorenzUtils.error("Skytils ran into an ${ex::class.simpleName ?: "error"} whilst fetching a resource. See logs for more details.")
-// ex.printStackTrace()
-// } finally {
-// client.close()
-// }
-// return JsonArray()
-// }
-
- private fun isValidCert(chain: Array<X509Certificate>, authType: String): Boolean {
- return chain.any { it.issuerDN.name == "CN=R3, O=Let's Encrypt, C=US" }
- }
} \ No newline at end of file
diff --git a/src/main/java/at/lorenz/mod/utils/RenderUtils.kt b/src/main/java/at/lorenz/mod/utils/RenderUtils.kt
index 7acd5b42b..2e422ed6a 100644
--- a/src/main/java/at/lorenz/mod/utils/RenderUtils.kt
+++ b/src/main/java/at/lorenz/mod/utils/RenderUtils.kt
@@ -31,7 +31,7 @@ object RenderUtils {
)
}
- fun RenderWorldLastEvent.drawSkytilsColor(location: LorenzVec, color: LorenzColor, beacon: Boolean = false) {
+ fun RenderWorldLastEvent.drawColor(location: LorenzVec, color: LorenzColor, beacon: Boolean = false) {
val (viewerX, viewerY, viewerZ) = getViewerPos(partialTicks)
val x = location.x - viewerX
val y = location.y - viewerY