Moving to source sets
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package appeng.hooks;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.parts.CableRenderMode;
|
||||
import appeng.client.AppEngClient;
|
||||
import appeng.util.Platform;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class ClientTickHandler extends TickHandler {
|
||||
|
||||
private final HashMap<Integer, PlayerColor> cliPlayerColors = new HashMap<>();
|
||||
private CableRenderMode crm = CableRenderMode.STANDARD;
|
||||
|
||||
public ClientTickHandler() {
|
||||
ClientTickEvents.START_CLIENT_TICK.register(this::onBeforeClientTick);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<Integer, PlayerColor> getPlayerColors() {
|
||||
if (!Platform.isServer()) {
|
||||
return this.cliPlayerColors;
|
||||
}
|
||||
return super.getPlayerColors();
|
||||
}
|
||||
|
||||
private void onBeforeClientTick(MinecraftClient client) {
|
||||
this.tickColors(this.cliPlayerColors);
|
||||
final CableRenderMode currentMode = AEApi.instance().partHelper().getCableRenderMode();
|
||||
if (currentMode != this.crm) {
|
||||
this.crm = currentMode;
|
||||
AppEngClient.instance().triggerUpdates();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user