From e9d34187ec19f8bbf84363f1e0cf6c140fb350ad Mon Sep 17 00:00:00 2001 From: danny Date: Thu, 10 Jun 2021 22:29:18 -0500 Subject: [PATCH] -Version bump. -Minor efficiency improvement to PanelCellPos class. Index getter caches value to reduce calculations when grabbing index multiple times. --- build.gradle | 2 +- .../com/dannyandson/tinyredstone/blocks/PanelCellPos.java | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 57ad079..1619f83 100644 --- a/build.gradle +++ b/build.gradle @@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle' apply plugin: 'eclipse' apply plugin: 'maven-publish' -version = '1.16.5-1.8.2' +version = '1.16.5-1.8.3' group = 'com.dannyandson.tinyredstone' // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = 'tinyredstone' diff --git a/src/main/java/com/dannyandson/tinyredstone/blocks/PanelCellPos.java b/src/main/java/com/dannyandson/tinyredstone/blocks/PanelCellPos.java index fa6a2b4..8743e28 100644 --- a/src/main/java/com/dannyandson/tinyredstone/blocks/PanelCellPos.java +++ b/src/main/java/com/dannyandson/tinyredstone/blocks/PanelCellPos.java @@ -13,6 +13,7 @@ public class PanelCellPos { private final int row; private final int column; private final int level; + private Integer index=null; private final PanelTile panelTile; protected PanelCellPos(PanelTile panelTile, int row, int column, int level) { @@ -47,7 +48,9 @@ public int getLevel(){ } public int getIndex() { - return (level*64) + (row * 8) + column; + if (this.index==null) + this.index=(level*64) + (row * 8) + column; + return this.index; } public PanelTile getPanelTile(){