-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed blockstate bugs, fixed incompatibility with CodeChickenLib
- Fixes #150 - Fixes #149 - Fixes #148 - Fixes #146 - Fixes #143 - Fixes #142 - Fixes #149 - Fixes #144 - Fixes #145
- Loading branch information
Showing
6 changed files
with
87 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.dimdev.utils; | ||
|
||
import java.util.Objects; | ||
|
||
public class Pair<L, R> { | ||
public final L left; | ||
public final R right; | ||
|
||
public Pair(L left, R right) { | ||
this.left = left; | ||
this.right = right; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
return obj instanceof Pair && | ||
Objects.equals(((Pair<?, ?>) obj).left, left) && | ||
Objects.equals(((Pair<?, ?>) obj).right, right); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hashCode(left) + Objects.hashCode(right) * 31; | ||
} | ||
} |
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
34 changes: 34 additions & 0 deletions
34
src/main/java/org/dimdev/vanillafix/dynamicresources/EventUtil.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,34 @@ | ||
package org.dimdev.vanillafix.dynamicresources; | ||
|
||
import net.minecraftforge.common.MinecraftForge; | ||
import net.minecraftforge.fml.common.eventhandler.Event; | ||
import net.minecraftforge.fml.common.eventhandler.EventBus; | ||
import net.minecraftforge.fml.common.eventhandler.IEventListener; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
import java.lang.reflect.Field; | ||
|
||
public class EventUtil { | ||
private static final Logger LOGGER = LogManager.getLogger(); | ||
|
||
public static void postEventAllowingErrors(Event event) { | ||
int busID; | ||
try { | ||
Field busIDField = EventBus.class.getDeclaredField("busID"); | ||
busIDField.setAccessible(true); | ||
busID = (int) busIDField.get(MinecraftForge.EVENT_BUS); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Runemoro
Author
Member
|
||
} catch (ReflectiveOperationException e) { | ||
throw new RuntimeException(e); | ||
} | ||
|
||
IEventListener[] listeners = event.getListenerList().getListeners(busID); | ||
for (IEventListener listener : listeners) { | ||
try { | ||
listener.invoke(event); | ||
} catch (Throwable t) { | ||
LOGGER.error(event + " listener '" + listener + "' threw exception, models may be broken", t); | ||
} | ||
} | ||
} | ||
} |
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
Why not
Field#getInt
rather than casting fromObject
?