Skip to content

Commit

Permalink
Fix crash with Ars Magica (#304)
Browse files Browse the repository at this point in the history
* Fix crash with Ars Magica

* Address review
  • Loading branch information
miozune authored Apr 28, 2023
1 parent f803769 commit 2a08134
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Ignore spotlessApply reformat
a40ee7424f59aafd3f9e187a95bbb5cb91ec5697
385e163974b86edd071cac928bc7671d02d1da57
16 changes: 10 additions & 6 deletions src/main/java/appeng/parts/AEBasePart.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
package appeng.parts;

import java.io.IOException;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Random;
import java.util.*;

import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.crash.CrashReportCategory;
Expand Down Expand Up @@ -420,7 +417,7 @@ public final boolean onActivate(final EntityPlayer player, final Vec3 pos) {
x,
y,
z,
this.side.flag,
getSideIndexFromDirection(this.side),
player.getEntityWorld());
if (event.isCanceled()) return false;

Expand All @@ -439,7 +436,7 @@ public final boolean onShiftActivate(final EntityPlayer player, final Vec3 pos)
x,
y,
z,
this.side.flag,
getSideIndexFromDirection(this.side),
player.getEntityWorld());
if (event.isCanceled()) return false;

Expand Down Expand Up @@ -498,4 +495,11 @@ public ISimplifiedBundle getRenderCache() {
public void setRenderCache(final ISimplifiedBundle renderCache) {
this.renderCache = renderCache;
}

private static int getSideIndexFromDirection(ForgeDirection direction) {
if (direction == ForgeDirection.UNKNOWN || direction == null) {
return -1;
}
return direction.ordinal();
}
}

0 comments on commit 2a08134

Please sign in to comment.