9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-25 01:49:30 +00:00

移除无用的hashcode

This commit is contained in:
XiaoMoMi
2025-09-11 04:56:47 +08:00
parent ae85ccdf23
commit d8347fb7ec
2 changed files with 3 additions and 19 deletions

View File

@@ -29,7 +29,6 @@ public final class ImmutableBlockState extends BlockStateHolder {
private BlockStateWrapper customBlockState;
private BlockStateWrapper vanillaBlockState;
private BlockBehavior behavior;
private Integer hashCode;
private BlockSettings settings;
private BlockEntityType<? extends BlockEntity> blockEntityType;
@Nullable
@@ -78,27 +77,12 @@ public final class ImmutableBlockState extends BlockStateHolder {
this.renderers = renderers;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof ImmutableBlockState state)) return false;
return state.owner == this.owner && state.tag.equals(this.tag);
}
@Override
public int hashCode() {
if (this.hashCode == null) {
this.hashCode = getNbtToSave().hashCode();
}
return this.hashCode;
}
public boolean hasBlockEntity() {
return this.blockEntityType != null;
}
public boolean hasBlockEntityRenderer() {
return this.renderers != null;
return this.renderers != null ;
}
public BlockStateWrapper customBlockState() {

View File

@@ -126,7 +126,7 @@ public class Int2ObjectBiMap<K> implements IndexedIterable<K> {
private int findIndex(@Nullable K value, int id) {
int i;
for(i = id; i < this.values.length; ++i) {
for (i = id; i < this.values.length; ++i) {
if (this.values[i] == value) {
return i;
}
@@ -136,7 +136,7 @@ public class Int2ObjectBiMap<K> implements IndexedIterable<K> {
}
}
for(i = 0; i < id; ++i) {
for (i = 0; i < id; ++i) {
if (this.values[i] == value) {
return i;
}