-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A lot of fixes (AAAAAAAAAA), add metadata system to polymer networkin…
…g, add method for checking if client is bedrock (wraps floodgate)
- Loading branch information
Showing
52 changed files
with
614 additions
and
94 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
10 changes: 10 additions & 0 deletions
10
polymer-common/src/main/java/eu/pb4/polymer/common/impl/compat/FloodGateUtils.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,10 @@ | ||
package eu.pb4.polymer.common.impl.compat; | ||
|
||
import net.minecraft.server.network.ServerPlayerEntity; | ||
import org.geysermc.floodgate.api.FloodgateApi; | ||
|
||
public class FloodGateUtils { | ||
public static boolean isPlayerBroken(ServerPlayerEntity player) { | ||
return FloodgateApi.getInstance().isFloodgatePlayer(player.getUuid()); | ||
} | ||
} |
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
37 changes: 37 additions & 0 deletions
37
polymer-core/src/main/java/eu/pb4/polymer/core/impl/ImplPolymerRegistryEvent.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,37 @@ | ||
package eu.pb4.polymer.core.impl; | ||
|
||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; | ||
import net.minecraft.registry.Registry; | ||
import net.minecraft.util.Util; | ||
import org.jetbrains.annotations.ApiStatus; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.function.Consumer; | ||
|
||
@ApiStatus.Internal | ||
public class ImplPolymerRegistryEvent { | ||
private static final Map<Registry<?>, List<Consumer<?>>> EVENTS = new Object2ObjectOpenCustomHashMap<>(Util.identityHashStrategy()); | ||
public static void invokeRegistered(Registry<?> ts, Object entry) { | ||
//noinspection unchecked | ||
var x = (List<Consumer<Object>>) (Object) EVENTS.get(ts); | ||
|
||
if (x != null) { | ||
for (var a : x) { | ||
a.accept(entry); | ||
} | ||
} | ||
} | ||
|
||
public static <T> void register(Registry<T> registry, Consumer<T> tConsumer) { | ||
EVENTS.computeIfAbsent(registry, (a) -> new ArrayList<>()).add(tConsumer); | ||
} | ||
|
||
public static <T> void iterateAndRegister(Registry<T> registry, Consumer<T> tConsumer) { | ||
for (var x : registry) { | ||
tConsumer.accept(x); | ||
} | ||
register(registry, tConsumer); | ||
} | ||
} |
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
11 changes: 11 additions & 0 deletions
11
polymer-core/src/main/java/eu/pb4/polymer/core/impl/PolymerMetadataKeys.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,11 @@ | ||
package eu.pb4.polymer.core.impl; | ||
|
||
import net.minecraft.util.Identifier; | ||
import org.jetbrains.annotations.ApiStatus; | ||
|
||
import static eu.pb4.polymer.core.impl.PolymerImplUtils.id; | ||
|
||
@ApiStatus.Internal | ||
public class PolymerMetadataKeys { | ||
public static final Identifier BLOCKSTATE_BITS = id("core/blockstate_bits"); | ||
} |
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
Oops, something went wrong.