mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-28 03:09:07 +00:00
@@ -5,19 +5,23 @@ Subject: [PATCH] Specialised Explosions
|
||||
|
||||
|
||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/common/list/IteratorSafeOrderedReferenceSet.java b/src/main/java/ca/spottedleaf/moonrise/common/list/IteratorSafeOrderedReferenceSet.java
|
||||
index ece6db7b9a0dfd535141c0c756947c4898140503..b9e4971b1a0bffbe2437f940e767539fe1b3ed39 100644
|
||||
index ece6db7b9a0dfd535141c0c756947c4898140503..fbe351a877aa0313d522b8b01fc06bcf36d567af 100644
|
||||
--- a/src/main/java/ca/spottedleaf/moonrise/common/list/IteratorSafeOrderedReferenceSet.java
|
||||
+++ b/src/main/java/ca/spottedleaf/moonrise/common/list/IteratorSafeOrderedReferenceSet.java
|
||||
@@ -127,6 +127,12 @@ public final class IteratorSafeOrderedReferenceSet<E> {
|
||||
}
|
||||
@@ -42,6 +42,16 @@ public final class IteratorSafeOrderedReferenceSet<E> {
|
||||
this.listElements = (E[])Array.newInstance(arrComponent, arrayCapacity);
|
||||
}
|
||||
|
||||
+ // Sakura start - specialised explosions; add indexOf method
|
||||
+ // Sakura start - specialised explosions; add indexOf and rawGet methods
|
||||
+ public E rawGet(final int index) {
|
||||
+ return this.listElements[index];
|
||||
+ }
|
||||
+
|
||||
+ public int indexOf(final E element) {
|
||||
+ return this.indexMap.getInt(element);
|
||||
+ }
|
||||
+ // Sakura end - specialised explosions; add indexOf method
|
||||
+ // Sakura end - specialised explosions; add indexOf and rawGet methods
|
||||
+
|
||||
public boolean remove(final E element) {
|
||||
final int index = this.indexMap.removeInt(element);
|
||||
if (index >= 0) {
|
||||
// includes null (gravestone) elements
|
||||
public E[] getListRaw() {
|
||||
return this.listElements;
|
||||
|
||||
@@ -162,8 +162,8 @@ public final class TntExplosion extends SpecialisedExplosion<PrimedTnt> {
|
||||
|
||||
entities.createRawIterator();
|
||||
// iterate over the entityTickList to find entities that are exploding in the same position.
|
||||
while ((index = entities.advanceRawIterator(index)) != -1) {
|
||||
Entity foundEntity = entities.getListRaw()[index];
|
||||
while ((index = entities.advanceRawIterator(index)) != Integer.MAX_VALUE) {
|
||||
Entity foundEntity = entities.rawGet(index);
|
||||
if (!(foundEntity instanceof MergeableEntity mergeEntity) || foundEntity.isRemoved() || !foundEntity.compareState(this.cause) || !mergeEntity.isSafeToMergeInto(this.cause, true))
|
||||
break;
|
||||
this.level().mergeHandler.mergeEntity(mergeEntity, this.cause);
|
||||
|
||||
Reference in New Issue
Block a user