-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
port(1.21.4): Begin initial port to 21.4
This is more or less a direct port of what existed to 21.4, fixing mixins as appropriate. There are a few bugs that need to be looked into before any real release: - The options menu does not properly listen to mouse input - Framerate limits are not yet implemented - Probably a whole lot of other bugs
- Loading branch information
1 parent
f8240c7
commit d3a8135
Showing
67 changed files
with
401 additions
and
677 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
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
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
47 changes: 47 additions & 0 deletions
47
...ain/java/org/embeddedt/embeddium/impl/mixin/core/collections/WeightedRandomListMixin.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,47 @@ | ||
package org.embeddedt.embeddium.impl.mixin.core.collections; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import net.minecraft.util.RandomSource; | ||
import net.minecraft.util.random.WeightedEntry; | ||
import net.minecraft.util.random.WeightedRandomList; | ||
import org.embeddedt.embeddium.impl.util.collections.WeightedRandomListExtended; | ||
import org.jetbrains.annotations.Nullable; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.Unique; | ||
|
||
import java.util.List; | ||
|
||
@Mixin(WeightedRandomList.class) | ||
public class WeightedRandomListMixin<E extends WeightedEntry> implements WeightedRandomListExtended<E> { | ||
@Shadow | ||
@Final | ||
private ImmutableList<E> items; | ||
|
||
@Shadow | ||
@Final | ||
private int totalWeight; | ||
|
||
@Override | ||
@Nullable | ||
public E embeddium$getRandomItem(RandomSource random) { | ||
return getAt(this.items, random.nextInt(this.totalWeight)); | ||
} | ||
|
||
@Unique | ||
private static <T extends WeightedEntry> T getAt(List<T> pool, int totalWeight) { | ||
int i = 0; | ||
int len = pool.size(); | ||
T weighted; | ||
do { | ||
if (i >= len) { | ||
return null; | ||
} | ||
|
||
weighted = pool.get(i++); | ||
totalWeight -= weighted.getWeight().asInt(); | ||
} while (totalWeight >= 0); | ||
return weighted; | ||
} | ||
} |
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
36 changes: 0 additions & 36 deletions
36
src/main/java/org/embeddedt/embeddium/impl/mixin/core/model/colors/ItemColorsMixin.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.