Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Update to 1.9 #5

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ buildscript {
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-20160116.192356-17'
classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
classpath 'org.spongepowered:mixingradle:0.3-SNAPSHOT'
classpath 'gradle.plugin.net.minecrell:licenser:0.1.1'
classpath 'gradle.plugin.net.minecrell:licenser:0.1.2'
}
}

Expand Down Expand Up @@ -62,7 +62,7 @@ ext.apiVersion = '1.2.1-SNAPSHOT'

dependencies {
compile "net.canarymod:CanaryLib:$apiVersion"
compile('org.spongepowered:mixin:0.5.1-SNAPSHOT') {
compile('org.spongepowered:mixin:0.5.3-SNAPSHOT') {
exclude module: 'launchwrapper'
exclude module: 'guava'
}
Expand All @@ -80,8 +80,8 @@ license {
}

minecraft {
version = '1.8.9'
mappings = 'snapshot_20160216'
version = '1.9'
mappings = 'snapshot_20160403'
runDir = 'run'

tweakClass = 'org.neptunepowered.vanilla.launch.NeptuneServerTweaker'
Expand Down Expand Up @@ -118,7 +118,7 @@ jar {
manifest {
attributes(
'Main-Class': 'org.neptunepowered.vanilla.launch.NeptuneServerMain',
'Class-Path': 'minecraft_server.1.8.9.jar libraries/net/minecraft/launchwrapper/1.12/launchwrapper-1.12.jar'
'Class-Path': 'minecraft_server.1.9.jar libraries/net/minecraft/launchwrapper/1.12/launchwrapper-1.12.jar'
)
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/org/neptunepowered/vanilla/Neptune.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@
import net.canarymod.plugin.PluginLangLoader;
import net.canarymod.user.OperatorsProvider;
import net.canarymod.user.WhitelistProvider;
import net.minecraft.server.MinecraftServer;
import org.neptunepowered.vanilla.interfaces.minecraft.command.IMixinServerCommandManager;
import org.neptunepowered.vanilla.factory.NeptuneFactory;
import org.neptunepowered.vanilla.wrapper.NeptuneTranslator;
import org.neptunepowered.vanilla.wrapper.commandsys.NeptunePlayerSelector;
import org.neptunepowered.vanilla.factory.NeptuneFactory;
import org.neptunepowered.vanilla.wrapper.util.NeptuneJsonNBTUtility;

public class Neptune extends Canary {
Expand Down Expand Up @@ -80,7 +78,8 @@ public Neptune() {
}

public void registerCanaryCommands() {
((IMixinServerCommandManager) ((MinecraftServer) server).getCommandManager()).registerEarlyCommands();
// ((IMixinServerCommandManager) NeptuneVanilla.getServer().getCommandManager()).registerEarlyCommands();
// TODO: 1.9
try {
this.commandManager.registerCommands(new CommandList(), getServer(), true);
} catch (CommandDependencyException e) {
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/org/neptunepowered/vanilla/NeptuneVanilla.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
package org.neptunepowered.vanilla;

import net.canarymod.Canary;
import net.canarymod.api.Server;
import net.minecraft.server.MinecraftServer;

import java.io.File;
Expand All @@ -36,7 +35,10 @@ public static void main(String[] args) throws IOException {
MinecraftServer.main(args);
new File("config").mkdirs(); // TODO: Please fix this properly
initNeptune();
Canary.setServer((Server) MinecraftServer.getServer());
}

public static MinecraftServer getServer() {
return (MinecraftServer) Canary.getServer();
}

private static void initNeptune() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@
import net.canarymod.api.entity.living.monster.EntityMob;
import net.canarymod.api.entity.living.monster.RangedAttackMob;
import net.canarymod.api.factory.AIFactory;
import net.minecraft.entity.ai.EntityAIArrowAttack;
import net.minecraft.entity.ai.EntityAIAttackRanged;

public class NeptuneAIFactory implements AIFactory {

@Override
public AIArrowAttack newAIArrowAttack(RangedAttackMob mob, double moveSpeed, int attackTimeModifier,
int maxRangedAttackTime, int maxAttackDistance) {
return (AIArrowAttack) new EntityAIArrowAttack(null, moveSpeed, attackTimeModifier, maxRangedAttackTime,
return (AIArrowAttack) new EntityAIAttackRanged(null, moveSpeed, attackTimeModifier, maxRangedAttackTime,
maxAttackDistance);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ public class NeptuneAttributeFactory implements AttributeFactory {
private static Map<String, IAttribute> map = Maps.newHashMap();

static {
map.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(),
SharedMonsterAttributes.maxHealth);
map.put(SharedMonsterAttributes.followRange.getAttributeUnlocalizedName(),
SharedMonsterAttributes.followRange);
map.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(),
SharedMonsterAttributes.knockbackResistance);
map.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(),
SharedMonsterAttributes.movementSpeed);
map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(),
SharedMonsterAttributes.attackDamage);
map.put(SharedMonsterAttributes.MAX_HEALTH.getAttributeUnlocalizedName(),
SharedMonsterAttributes.MAX_HEALTH);
map.put(SharedMonsterAttributes.FOLLOW_RANGE.getAttributeUnlocalizedName(),
SharedMonsterAttributes.FOLLOW_RANGE);
map.put(SharedMonsterAttributes.KNOCKBACK_RESISTANCE.getAttributeUnlocalizedName(),
SharedMonsterAttributes.KNOCKBACK_RESISTANCE);
map.put(SharedMonsterAttributes.MOVEMENT_SPEED.getAttributeUnlocalizedName(),
SharedMonsterAttributes.MOVEMENT_SPEED);
map.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(),
SharedMonsterAttributes.ATTACK_DAMAGE);

map.put(EntityZombie.reinforcementChance.getAttributeUnlocalizedName(),
EntityZombie.reinforcementChance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
import net.canarymod.api.chat.HoverEvent;
import net.canarymod.api.chat.HoverEventAction;
import net.canarymod.api.factory.ChatComponentFactory;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import org.neptunepowered.vanilla.wrapper.chat.NeptuneChatComponent;
import org.neptunepowered.vanilla.wrapper.chat.NeptuneClickEventAction;
import org.neptunepowered.vanilla.wrapper.chat.NeptuneHoverEventAction;
Expand All @@ -41,7 +41,7 @@ public class NeptuneChatComponentFactory implements ChatComponentFactory {

@Override
public ChatComponent newChatComponent(String text) {
return new NeptuneChatComponent(new ChatComponentText(text));
return new NeptuneChatComponent(new TextComponentString(text));
}

@Override
Expand All @@ -56,17 +56,17 @@ public String decompileChatComponent(ChatComponent chatComponent) {

@Override
public ChatComponent deserialize(String json) {
return new NeptuneChatComponent(IChatComponent.Serializer.jsonToComponent(json));
return new NeptuneChatComponent(ITextComponent.Serializer.jsonToComponent(json));
}

@Override
public ChatFormatting getFormattingByName(String name) {
return (ChatFormatting) (Object) EnumChatFormatting.getValueByName(name);
return (ChatFormatting) (Object) TextFormatting.getValueByName(name);
}

@Override
public ChatFormatting getStyleByChar(char charcode) {
for (EnumChatFormatting chatFormatting : EnumChatFormatting.values()) {
for (TextFormatting chatFormatting : TextFormatting.values()) {
if (chatFormatting.formattingCode == charcode) {
return (ChatFormatting) (Object) chatFormatting;
}
Expand All @@ -76,167 +76,167 @@ public ChatFormatting getStyleByChar(char charcode) {

@Override
public ChatFormatting colorBlack() {
return (ChatFormatting) (Object) EnumChatFormatting.BLACK;
return (ChatFormatting) (Object) TextFormatting.BLACK;
}

@Override
public ChatFormatting colorDarkBlue() {
return (ChatFormatting) (Object) EnumChatFormatting.DARK_BLUE;
return (ChatFormatting) (Object) TextFormatting.DARK_BLUE;
}

@Override
public ChatFormatting colorDarkGreen() {
return (ChatFormatting) (Object) EnumChatFormatting.DARK_GREEN;
return (ChatFormatting) (Object) TextFormatting.DARK_GREEN;
}

@Override
public ChatFormatting colorDarkAqua() {
return (ChatFormatting) (Object) EnumChatFormatting.DARK_AQUA;
return (ChatFormatting) (Object) TextFormatting.DARK_AQUA;
}

@Override
public ChatFormatting colorDarkRed() {
return (ChatFormatting) (Object) EnumChatFormatting.DARK_RED;
return (ChatFormatting) (Object) TextFormatting.DARK_RED;
}

@Override
public ChatFormatting colorDarkPurple() {
return (ChatFormatting) (Object) EnumChatFormatting.DARK_PURPLE;
return (ChatFormatting) (Object) TextFormatting.DARK_PURPLE;
}

@Override
public ChatFormatting colorGold() {
return (ChatFormatting) (Object) EnumChatFormatting.GOLD;
return (ChatFormatting) (Object) TextFormatting.GOLD;
}

@Override
public ChatFormatting colorGray() {
return (ChatFormatting) (Object) EnumChatFormatting.GRAY;
return (ChatFormatting) (Object) TextFormatting.GRAY;
}

@Override
public ChatFormatting colorDarkGray() {
return (ChatFormatting) (Object) EnumChatFormatting.DARK_GRAY;
return (ChatFormatting) (Object) TextFormatting.DARK_GRAY;
}

@Override
public ChatFormatting colorBlue() {
return (ChatFormatting) (Object) EnumChatFormatting.BLUE;
return (ChatFormatting) (Object) TextFormatting.BLUE;
}

@Override
public ChatFormatting colorGreen() {
return (ChatFormatting) (Object) EnumChatFormatting.GREEN;
return (ChatFormatting) (Object) TextFormatting.GREEN;
}

@Override
public ChatFormatting colorAqua() {
return (ChatFormatting) (Object) EnumChatFormatting.AQUA;
return (ChatFormatting) (Object) TextFormatting.AQUA;
}

@Override
public ChatFormatting colorRed() {
return (ChatFormatting) (Object) EnumChatFormatting.RED;
return (ChatFormatting) (Object) TextFormatting.RED;
}

@Override
public ChatFormatting colorLightPurple() {
return (ChatFormatting) (Object) EnumChatFormatting.LIGHT_PURPLE;
return (ChatFormatting) (Object) TextFormatting.LIGHT_PURPLE;
}

@Override
public ChatFormatting colorYellow() {
return (ChatFormatting) (Object) EnumChatFormatting.YELLOW;
return (ChatFormatting) (Object) TextFormatting.YELLOW;
}

@Override
public ChatFormatting colorWhite() {
return (ChatFormatting) (Object) EnumChatFormatting.WHITE;
return (ChatFormatting) (Object) TextFormatting.WHITE;
}

@Override
public ChatFormatting styleObfuscated() {
return (ChatFormatting) (Object) EnumChatFormatting.OBFUSCATED;
return (ChatFormatting) (Object) TextFormatting.OBFUSCATED;
}

@Override
public ChatFormatting styleBold() {
return (ChatFormatting) (Object) EnumChatFormatting.BOLD;
return (ChatFormatting) (Object) TextFormatting.BOLD;
}

@Override
public ChatFormatting styleStrikethrough() {
return (ChatFormatting) (Object) EnumChatFormatting.STRIKETHROUGH;
return (ChatFormatting) (Object) TextFormatting.STRIKETHROUGH;
}

@Override
public ChatFormatting styleUnderline() {
return (ChatFormatting) (Object) EnumChatFormatting.UNDERLINE;
return (ChatFormatting) (Object) TextFormatting.UNDERLINE;
}

@Override
public ChatFormatting styleItalic() {
return (ChatFormatting) (Object) EnumChatFormatting.ITALIC;
return (ChatFormatting) (Object) TextFormatting.ITALIC;
}

@Override
public ChatFormatting styleReset() {
return (ChatFormatting) (Object) EnumChatFormatting.RESET;
return (ChatFormatting) (Object) TextFormatting.RESET;
}

@Override
public ClickEvent newClickEvent(ClickEventAction action, String value) {
return (ClickEvent) new net.minecraft.event.ClickEvent(((NeptuneClickEventAction) action).getHandle(), value);
return (ClickEvent) new net.minecraft.util.text.event.ClickEvent(((NeptuneClickEventAction) action).getHandle(), value);
}

@Override
public ClickEventAction getClickEventActionByName(String name) {
return new NeptuneClickEventAction(net.minecraft.event.ClickEvent.Action.getValueByCanonicalName(name));
return new NeptuneClickEventAction(net.minecraft.util.text.event.ClickEvent.Action.getValueByCanonicalName(name));
}

@Override
public ClickEventAction getOpenURL() {
return new NeptuneClickEventAction(net.minecraft.event.ClickEvent.Action.OPEN_URL);
return new NeptuneClickEventAction(net.minecraft.util.text.event.ClickEvent.Action.OPEN_URL);
}

@Override
public ClickEventAction getOpenFile() {
return new NeptuneClickEventAction(net.minecraft.event.ClickEvent.Action.OPEN_FILE);
return new NeptuneClickEventAction(net.minecraft.util.text.event.ClickEvent.Action.OPEN_FILE);
}

@Override
public ClickEventAction getRunCommand() {
return new NeptuneClickEventAction(net.minecraft.event.ClickEvent.Action.RUN_COMMAND);
return new NeptuneClickEventAction(net.minecraft.util.text.event.ClickEvent.Action.RUN_COMMAND);
}

@Override
public ClickEventAction getSuggestCommand() {
return new NeptuneClickEventAction(net.minecraft.event.ClickEvent.Action.SUGGEST_COMMAND);
return new NeptuneClickEventAction(net.minecraft.util.text.event.ClickEvent.Action.SUGGEST_COMMAND);
}

@Override
public HoverEvent newHoverEvent(HoverEventAction action, ChatComponent value) {
return (HoverEvent) new net.minecraft.event.HoverEvent(((NeptuneHoverEventAction) action).getHandle(),
return (HoverEvent) new net.minecraft.util.text.event.HoverEvent(((NeptuneHoverEventAction) action).getHandle(),
((NeptuneChatComponent) value).getHandle());
}

@Override
public HoverEventAction getHoverEventActionByName(String name) {
return new NeptuneHoverEventAction(net.minecraft.event.HoverEvent.Action.getValueByCanonicalName(name));
return new NeptuneHoverEventAction(net.minecraft.util.text.event.HoverEvent.Action.getValueByCanonicalName(name));
}

@Override
public HoverEventAction getShowText() {
return new NeptuneHoverEventAction(net.minecraft.event.HoverEvent.Action.SHOW_TEXT);
return new NeptuneHoverEventAction(net.minecraft.util.text.event.HoverEvent.Action.SHOW_TEXT);
}

@Override
public HoverEventAction getShowAchievement() {
return new NeptuneHoverEventAction(net.minecraft.event.HoverEvent.Action.SHOW_ACHIEVEMENT);
return new NeptuneHoverEventAction(net.minecraft.util.text.event.HoverEvent.Action.SHOW_ACHIEVEMENT);
}

@Override
public HoverEventAction getShowItem() {
return new NeptuneHoverEventAction(net.minecraft.event.HoverEvent.Action.SHOW_ITEM);
return new NeptuneHoverEventAction(net.minecraft.util.text.event.HoverEvent.Action.SHOW_ITEM);
}
}
Loading