-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- First mod fix: prevent `ArrayIndexOutOfBoundsException` from occurring in `BlockIEBase#getPushReaction` with special cases
- Loading branch information
Showing
11 changed files
with
134 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 0 additions & 50 deletions
50
src/main/java/zone/rong/loliasm/common/memory/mixins/ModCandidateMixin.java
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
src/main/java/zone/rong/loliasm/common/modfixes/mixins/BlockIEBaseMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package zone.rong.loliasm.common.modfixes.mixins; | ||
|
||
import blusunrize.immersiveengineering.common.blocks.BlockIEBase; | ||
import net.minecraft.block.material.EnumPushReaction; | ||
import net.minecraft.block.state.IBlockState; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Overwrite; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
@Mixin(BlockIEBase.class) | ||
public abstract class BlockIEBaseMixin { | ||
|
||
@Shadow public abstract int getMetaFromState(IBlockState state); | ||
@Shadow(remap = false) protected EnumPushReaction[] metaMobilityFlags; | ||
|
||
/** | ||
* @author Rongmario | ||
* @reason Fixes ArrayIndexOutOfBoundsException | ||
*/ | ||
@Overwrite | ||
public EnumPushReaction getPushReaction(IBlockState state) { | ||
int meta = getMetaFromState(state); | ||
if (metaMobilityFlags.length <= meta || metaMobilityFlags[meta] == null) { | ||
return EnumPushReaction.NORMAL; | ||
} | ||
return metaMobilityFlags[meta]; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package zone.rong.loliasm.core; | ||
|
||
import it.unimi.dsi.fastutil.objects.ObjectArraySet; | ||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; | ||
import net.minecraftforge.fml.common.discovery.ASMDataTable; | ||
import net.minecraftforge.fml.common.discovery.ModCandidate; | ||
import zone.rong.loliasm.api.StringPool; | ||
|
||
import java.util.Set; | ||
|
||
public class LoliHooks { | ||
|
||
public static <K> ObjectArraySet<K> createArraySet() { | ||
return new ObjectArraySet<>(); | ||
} | ||
|
||
public static <K> ObjectOpenHashSet<K> createHashSet() { | ||
return new ObjectOpenHashSet<>(); | ||
} | ||
|
||
public static void modCandidate$override$addClassEntry(ModCandidate modCandidate, String name, Set<String> foundClasses, Set<String> packages, ASMDataTable table) { | ||
String className = name.substring(0, name.lastIndexOf('.')); | ||
foundClasses.add(className); | ||
className = className.replace('/','.'); | ||
int pkgIdx = className.lastIndexOf('.'); | ||
if (pkgIdx > -1) { | ||
String pkg = StringPool.canonize(className.substring(0, pkgIdx)); | ||
packages.add(pkg); | ||
table.registerPackage(modCandidate, pkg); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"package": "zone.rong.loliasm.common.modfixes.mixins", | ||
"refmap": "mixins.loliasm.refmap.json", | ||
"target": "@env(DEFAULT)", | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": [ | ||
"BlockIEBaseMixin" | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
} |