Switch core to 1.14 (generated via ./gradlew :1.14:setCoreVersion)

This commit is contained in:
Jonas Herzig
2019-05-10 14:09:22 +02:00
parent 7f7d33def8
commit 7cbf7f7c94
183 changed files with 3250 additions and 3250 deletions

View File

@@ -11,23 +11,23 @@ import com.replaymod.replay.events.ReplayClosedCallback;
import com.replaymod.replay.events.ReplayOpenedCallback;
import de.johni0702.minecraft.gui.utils.EventRegistrations;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
//#if MC>=11400
//$$ import com.replaymod.core.events.PreRenderHandCallback;
//$$ import java.util.stream.Collectors;
import com.replaymod.core.events.PreRenderHandCallback;
import java.util.stream.Collectors;
//#else
import net.minecraftforge.client.event.RenderHandEvent;
//$$ import net.minecraftforge.client.event.RenderHandEvent;
//$$
//#if MC>=11300
//#else
//$$ import org.lwjgl.input.Keyboard;
//#endif
//$$
//#if MC>=10800
import com.google.common.base.Predicate;
//$$ import com.google.common.base.Predicate;
//#if MC>=11300
import net.minecraftforge.eventbus.api.SubscribeEvent;
//$$ import net.minecraftforge.eventbus.api.SubscribeEvent;
//#else
//$$ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
//#endif
@@ -59,20 +59,20 @@ public class PlayerOverview extends EventRegistrations implements Extra {
public void run() {
if (module.getReplayHandler() != null) {
//#if MC>=11400
//$$ List<PlayerEntity> players = mod.getMinecraft().world.getPlayers()
//$$ .stream()
//$$ .map(it -> (PlayerEntity) it)
//$$ .filter(it -> !(it instanceof CameraEntity))
//$$ .collect(Collectors.toList());
List<PlayerEntity> players = mod.getMinecraft().world.getPlayers()
.stream()
.map(it -> (PlayerEntity) it)
.filter(it -> !(it instanceof CameraEntity))
.collect(Collectors.toList());
//#else
@SuppressWarnings("unchecked")
//$$ @SuppressWarnings("unchecked")
//#if MC>=10800
List<EntityPlayer> players = mod.getMinecraft().world.getPlayers(EntityPlayer.class, new Predicate() {
@Override
public boolean apply(Object input) {
return !(input instanceof CameraEntity); // Exclude the camera entity
}
});
//$$ List<EntityPlayer> players = mod.getMinecraft().world.getPlayers(EntityPlayer.class, new Predicate() {
//$$ @Override
//$$ public boolean apply(Object input) {
//$$ return !(input instanceof CameraEntity); // Exclude the camera entity
//$$ }
//$$ });
//#else
//$$ List<EntityPlayer> players = mod.getMinecraft().theWorld.playerEntities;
//$$ players = players.stream()
@@ -82,7 +82,7 @@ public class PlayerOverview extends EventRegistrations implements Extra {
//#endif
if (!Utils.isCtrlDown()) {
// Hide all players that have an UUID v2 (commonly used for NPCs)
Iterator<EntityPlayer> iter = players.iterator();
Iterator<PlayerEntity> iter = players.iterator();
while (iter.hasNext()) {
UUID uuid = iter.next().getGameProfile().getId();
if (uuid != null && uuid.version() == 2) {
@@ -99,7 +99,7 @@ public class PlayerOverview extends EventRegistrations implements Extra {
ReplayClosedCallback.EVENT.register(this::onReplayClose);
//#if MC>=11400
//#else
FORGE_BUS.register(this);
//$$ FORGE_BUS.register(this);
//#endif
}
@@ -130,18 +130,18 @@ public class PlayerOverview extends EventRegistrations implements Extra {
}
//#if MC>=11400
//$$ { on(PreRenderHandCallback.EVENT, this::shouldHideHand); }
{ on(PreRenderHandCallback.EVENT, this::shouldHideHand); }
//#else
@SubscribeEvent
public void oRenderHand(RenderHandEvent event) {
if (shouldHideHand()) {
event.setCanceled(true);
}
}
//$$ @SubscribeEvent
//$$ public void oRenderHand(RenderHandEvent event) {
//$$ if (shouldHideHand()) {
//$$ event.setCanceled(true);
//$$ }
//$$ }
//#endif
private boolean shouldHideHand() {
Entity view = getRenderViewEntity(module.getCore().getMinecraft());
return view != null && isHidden(view.getUniqueID());
return view != null && isHidden(view.getUuid());
}
// See MixinRender for why this is 1.7.10 only

View File

@@ -20,17 +20,17 @@ import de.johni0702.minecraft.gui.layout.HorizontalLayout;
import de.johni0702.minecraft.gui.utils.Colors;
import de.johni0702.minecraft.gui.utils.lwjgl.Dimension;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Identifier;
//#if MC>=10904
import net.minecraft.init.MobEffects;
import net.minecraft.entity.effect.StatusEffects;
//#else
//$$ import net.minecraft.potion.Potion;
//#endif
//#if MC>=10800
import net.minecraft.entity.player.EnumPlayerModelParts;
import net.minecraft.client.render.entity.PlayerModelPart;
//#endif
import java.util.Collections;
@@ -89,12 +89,12 @@ public class PlayerOverviewGui extends GuiScreen implements Closeable {
private final PlayerOverview extra;
public PlayerOverviewGui(final PlayerOverview extra, List<EntityPlayer> players) {
public PlayerOverviewGui(final PlayerOverview extra, List<PlayerEntity> players) {
this.extra = extra;
Collections.sort(players, new PlayerComparator()); // Sort by name, spectators last
for (final EntityPlayer p : players) {
final ResourceLocation texture = Utils.getResourceLocationForPlayerUUID(p.getUniqueID());
for (final PlayerEntity p : players) {
final Identifier texture = Utils.getResourceLocationForPlayerUUID(p.getUuid());
final GuiClickable panel = new GuiClickable().setLayout(new HorizontalLayout().setSpacing(2)).addElements(
new HorizontalLayout.Data(0.5), new GuiImage() {
@Override
@@ -102,7 +102,7 @@ public class PlayerOverviewGui extends GuiScreen implements Closeable {
renderer.bindTexture(texture);
renderer.drawTexturedRect(0, 0, 8, 8, 16, 16, 8, 8, 64, 64);
//#if MC>=10809
if (p.isWearing(EnumPlayerModelParts.HAT)) {
if (p.isSkinOverlayVisible(PlayerModelPart.HEAD)) {
//#else
//#if MC>=10800
//$$ if (p.func_175148_a(EnumPlayerModelParts.HAT)) {
@@ -134,10 +134,10 @@ public class PlayerOverviewGui extends GuiScreen implements Closeable {
final GuiCheckbox checkbox = new GuiCheckbox() {
@Override
public GuiCheckbox setChecked(boolean checked) {
extra.setHidden(p.getUniqueID(), !checked);
extra.setHidden(p.getUuid(), !checked);
return super.setChecked(checked);
}
}.setChecked(!extra.isHidden(p.getUniqueID()));
}.setChecked(!extra.isHidden(p.getUuid()));
new GuiPanel(playersScrollable.getListPanel()).setLayout(new CustomLayout<GuiPanel>() {
@Override
protected void layout(GuiPanel container, int width, int height) {
@@ -167,17 +167,17 @@ public class PlayerOverviewGui extends GuiScreen implements Closeable {
extra.saveHiddenPlayers();
}
private static boolean isSpectator(EntityPlayer e) {
private static boolean isSpectator(PlayerEntity e) {
//#if MC>=10904
return e.isInvisible() && e.getActivePotionEffect(MobEffects.INVISIBILITY) == null;
return e.isInvisible() && e.getStatusEffect(StatusEffects.INVISIBILITY) == null;
//#else
//$$ return e.isInvisible() && e.getActivePotionEffect(Potion.invisibility) == null;
//#endif
}
private static final class PlayerComparator implements Comparator<EntityPlayer> {
private static final class PlayerComparator implements Comparator<PlayerEntity> {
@Override
public int compare(EntityPlayer o1, EntityPlayer o2) {
public int compare(PlayerEntity o1, PlayerEntity o2) {
if (isSpectator(o1) && !isSpectator(o2)) return 1;
if (isSpectator(o2) && !isSpectator(o1)) return -1;
//#if MC>=11300

View File

@@ -2,15 +2,15 @@ package com.replaymod.extras.playeroverview.mixin;
import com.replaymod.extras.ReplayModExtras;
import com.replaymod.extras.playeroverview.PlayerOverview;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
//#if MC>=10800
import net.minecraft.client.renderer.culling.ICamera;
import net.minecraft.client.render.VisibleRegion;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
//#else
//$$ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@@ -31,15 +31,15 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
*
* For 1.7.10, that method doesn't exist, so we use a combination of the event and inject into
*/
@Mixin(value = Render.class, priority = 1200)
@Mixin(value = EntityRenderer.class, priority = 1200)
public abstract class MixinRender {
//#if MC>=10800
@Inject(method = "shouldRender", at=@At("HEAD"), cancellable = true)
public void replayModExtras_isPlayerHidden(Entity entity, ICamera camera, double camX, double camY, double camZ, CallbackInfoReturnable<Boolean> ci) {
@Inject(method = "isVisible", at=@At("HEAD"), cancellable = true)
public void replayModExtras_isPlayerHidden(Entity entity, VisibleRegion camera, double camX, double camY, double camZ, CallbackInfoReturnable<Boolean> ci) {
ReplayModExtras.instance.get(PlayerOverview.class).ifPresent(playerOverview -> {
if (entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
if (playerOverview.isHidden(player.getUniqueID())) {
if (entity instanceof PlayerEntity) {
PlayerEntity player = (PlayerEntity) entity;
if (playerOverview.isHidden(player.getUuid())) {
ci.setReturnValue(false);
}
}