Combine all versions into a single tree

This commit is contained in:
Jonas Herzig
2018-02-10 23:35:57 +01:00
parent ec50efec10
commit 748b9da443
95 changed files with 2731 additions and 644 deletions

View File

@@ -9,11 +9,12 @@ import de.johni0702.minecraft.gui.element.GuiImage;
import de.johni0702.minecraft.gui.element.IGuiImage;
import de.johni0702.minecraft.gui.layout.HorizontalLayout;
import net.minecraft.client.settings.GameSettings;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import org.lwjgl.input.Keyboard;
import static com.replaymod.core.versions.MCVer.*;
public class FullBrightness implements Extra {
private ReplayModReplay module;
@@ -40,7 +41,7 @@ public class FullBrightness implements Extra {
}
});
MinecraftForge.EVENT_BUS.register(this);
FML_BUS.register(this);
}
@SubscribeEvent

View File

@@ -17,7 +17,6 @@ import de.johni0702.minecraft.gui.layout.GridLayout;
import de.johni0702.minecraft.gui.layout.HorizontalLayout;
import de.johni0702.minecraft.gui.layout.LayoutData;
import net.minecraft.client.resources.I18n;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.lwjgl.input.Keyboard;
import org.lwjgl.util.Dimension;
@@ -28,6 +27,8 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.Map;
import static com.replaymod.core.versions.MCVer.*;
public class HotkeyButtons implements Extra {
private ReplayMod mod;
@@ -35,7 +36,7 @@ public class HotkeyButtons implements Extra {
public void register(ReplayMod mod) throws Exception {
this.mod = mod;
MinecraftForge.EVENT_BUS.register(this);
FML_BUS.register(this);
}
@SubscribeEvent

View File

@@ -5,10 +5,15 @@ import com.replaymod.core.ReplayMod;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.IResourcePack;
import net.minecraft.client.resources.data.IMetadataSection;
import net.minecraft.client.resources.data.MetadataSerializer;
import net.minecraft.util.ResourceLocation;
import org.apache.commons.io.IOUtils;
//#if MC>=10904
import net.minecraft.client.resources.data.MetadataSerializer;
//#else
//$$ import net.minecraft.client.resources.data.IMetadataSerializer;
//#endif
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -103,8 +108,13 @@ public class LocalizationExtra implements Extra {
return ImmutableSet.of("replaymod");
}
//#if MC>=10904
@Override
public <T extends IMetadataSection> T getPackMetadata(MetadataSerializer metadataSerializer, String metadataSectionName) throws IOException {
//#else
//$$ @Override
//$$ public IMetadataSection getPackMetadata(IMetadataSerializer metadataSerializer, String metadataSectionName) throws IOException {
//#endif
return null;
}

View File

@@ -19,6 +19,8 @@ import org.lwjgl.input.Keyboard;
import java.io.IOException;
import java.util.*;
import static com.replaymod.core.versions.MCVer.*;
public class PlayerOverview implements Extra {
private ReplayModReplay module;
@@ -34,7 +36,7 @@ public class PlayerOverview implements Extra {
public void run() {
if (module.getReplayHandler() != null) {
@SuppressWarnings("unchecked")
List<EntityPlayer> players = mod.getMinecraft().world.getPlayers(EntityPlayer.class, new Predicate() {
List<EntityPlayer> players = world(mod.getMinecraft()).getPlayers(EntityPlayer.class, new Predicate() {
@Override
public boolean apply(Object input) {
return !(input instanceof CameraEntity); // Exclude the camera entity
@@ -55,7 +57,8 @@ public class PlayerOverview implements Extra {
}
});
MinecraftForge.EVENT_BUS.register(this);
FML_BUS.register(this);
FORGE_BUS.register(this);
}
public boolean isHidden(UUID uuid) {

View File

@@ -21,12 +21,17 @@ import de.johni0702.minecraft.gui.utils.Colors;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EnumPlayerModelParts;
import net.minecraft.init.MobEffects;
import net.minecraft.init.SoundEvents;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.util.Dimension;
import org.lwjgl.util.ReadableDimension;
//#if MC>=10904
import net.minecraft.init.MobEffects;
import net.minecraft.init.SoundEvents;
//#else
//$$ import net.minecraft.potion.Potion;
//#endif
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@@ -47,14 +52,22 @@ public class PlayerOverviewGui extends GuiScreen implements Closeable {
public final GuiCheckbox checkAll = new GuiCheckbox(contentPanel){
@Override
public void onClick() {
//#if MC>=10904
getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
//#else
//$$ getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(BUTTON_SOUND, 1.0F));
//#endif
playersScrollable.forEach(IGuiCheckbox.class).setChecked(true);
}
}.setLabel("").setChecked(true).setTooltip(new GuiTooltip().setI18nText("replaymod.gui.playeroverview.showall"));
public final GuiCheckbox uncheckAll = new GuiCheckbox(contentPanel){
@Override
public void onClick() {
//#if MC>=10904
getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
//#else
//$$ getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(BUTTON_SOUND, 1.0F));
//#endif
playersScrollable.forEach(IGuiCheckbox.class).setChecked(false);
}
}.setLabel("").setChecked(false).setTooltip(new GuiTooltip().setI18nText("replaymod.gui.playeroverview.hideall"));
@@ -97,7 +110,11 @@ public class PlayerOverviewGui extends GuiScreen implements Closeable {
public void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo) {
renderer.bindTexture(texture);
renderer.drawTexturedRect(0, 0, 8, 8, 16, 16, 8, 8, 64, 64);
//#if MC>=10809
if (p.isWearing(EnumPlayerModelParts.HAT)) {
//#else
//$$ if (p.func_175148_a(EnumPlayerModelParts.HAT)) {
//#endif
renderer.drawTexturedRect(0, 0, 40, 8, size.getWidth(), size.getHeight(), 8, 8, 64, 64);
}
}
@@ -146,7 +163,11 @@ public class PlayerOverviewGui extends GuiScreen implements Closeable {
}
private static boolean isSpectator(EntityPlayer e) {
//#if MC>=10904
return e.isInvisible() && e.getActivePotionEffect(MobEffects.INVISIBILITY) == null;
//#else
//$$ return e.isInvisible() && e.getActivePotionEffect(Potion.invisibility) == null;
//#endif
}
private static final class PlayerComparator implements Comparator<EntityPlayer> {

View File

@@ -9,6 +9,8 @@ import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import static com.replaymod.core.versions.MCVer.*;
public class YoutubeUpload implements Extra {
@Override
public void register(ReplayMod mod) throws Exception {
@@ -17,8 +19,8 @@ public class YoutubeUpload implements Extra {
@SubscribeEvent
public void onGuiOpen(GuiScreenEvent.InitGuiEvent.Post event) {
if (GuiScreen.from(event.getGui()) instanceof GuiRenderingDone) {
GuiRenderingDone gui = (GuiRenderingDone) GuiScreen.from(event.getGui());
if (GuiScreen.from(getGui(event)) instanceof GuiRenderingDone) {
GuiRenderingDone gui = (GuiRenderingDone) GuiScreen.from(getGui(event));
// Check if there already is a youtube button
if (gui.actionsPanel.getChildren().stream().anyMatch(it -> it instanceof YoutubeButton)) {
return; // Button already added