Make state sensitive custom models cache more efficient (save memory)
This commit is contained in:
parent
0166895a7f
commit
c48ed688b2
22 changed files with 141 additions and 15 deletions
|
|
@ -184,4 +184,12 @@ public abstract class CustomRenderer {
|
|||
public RenderPatch getSidePatch(RenderPatchFactory rpf, int side, int rot, int textureidx) {
|
||||
return getSidePatch(rpf, side, 0.0, 0.0, 1.0, 0.0, 1.0, rot, textureidx);
|
||||
}
|
||||
/**
|
||||
* Test if the given renderer is purely a function of the block state of the given block (that is, not
|
||||
* directly tied to neighbor blocks, location, or other factors). If true, the returned model for a getRenderPatchList() is
|
||||
* cached by block state, versus by specific block location/instance.
|
||||
*/
|
||||
public boolean isOnlyBlockStateSensitive() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -549,4 +549,18 @@ public class DynmapBlockState {
|
|||
public String toString() {
|
||||
return fullName;
|
||||
}
|
||||
// Equals check
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) return true;
|
||||
if (obj instanceof DynmapBlockState) {
|
||||
return ((DynmapBlockState)obj).globalStateIndex == this.globalStateIndex;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Hashcode
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.globalStateIndex;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue