Removed forge code

It is stored in a branch but it will need to be updated to 1.13
This commit is contained in:
Sekwah 2018-08-26 02:12:57 +01:00
parent 339e12dd0c
commit ec75924912
10 changed files with 3 additions and 403 deletions

View File

@ -1,14 +1,12 @@
buildscript {
repositories {
jcenter()
maven { url = "http://files.minecraftforge.net/maven" }
maven { url "http://repo.maven.apache.org/maven2" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'idea'
@ -19,19 +17,6 @@ version = '1.0.0'
description = ""
minecraft {
version = "1.12.2-14.23.2.2611"
runDir = "run"
// the mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD snapshot are built nightly.
// stable_# stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not allways work.
// simply re-run your setup task after changing the mappings to update your workspace.
mappings = "snapshot_20180607"
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
@ -55,7 +40,7 @@ dependencies {
compile group: 'com.google.code.gson', name: 'gson', version:'2.8.2'
includeLibs group: 'com.google.inject', name: 'guice', version:'4.0'
compile group: 'com.google.inject', name: 'guice', version:'4.0'
compile "org.bukkit:bukkit:1.12.1-R0.1-SNAPSHOT"
compile "org.bukkit:bukkit:1.13-R0.1-SNAPSHOT"
}
jar {
@ -69,28 +54,9 @@ task runJar() {
javaexec {
main "-jar"
args "${System.env.MC_SERVER_LOC}\\${System.env.MC_SERVER_JAR}.jar"
jvmArgs "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -DIReallyKnowWhatIAmDoingISwear=true"
jvmArgs "-DIReallyKnowWhatIAmDoingISwear=true -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"
workingDir "${System.env.MC_SERVER_LOC}"
}
}
}
processResources
{
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}

View File

@ -1,43 +0,0 @@
package com.sekwah.advancedportals.forge;
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
import com.sekwah.advancedportals.forge.coreconnector.command.ForgeCommandRegister;
import com.sekwah.advancedportals.forge.coreconnector.info.ForgeDataCollector;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
/**
* The mod is not needed client side but will add some useful additions
*/
@Mod(modid = AdvancedPortalsMod.modid, name = "Advanced Portals", version = AdvancedPortalsCore.version, acceptableRemoteVersions = "*")
public class AdvancedPortalsMod {
public static final String modid = "advancedportals";
public static final Logger logger = LogManager.getLogger("Advanced Portals");
private AdvancedPortalsCore portalsCore;
@Mod.EventHandler
public void init(FMLPreInitializationEvent event) {
this.portalsCore = new AdvancedPortalsCore(new File(event.getModConfigurationDirectory(), modid),
new ForgeInfoLogger(logger), new ForgeDataCollector(), new int[] {1,12,2});
}
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
}
@Mod.EventHandler
public void init(FMLServerStartingEvent event)
{
this.portalsCore.registerCommands(new ForgeCommandRegister(event));
}
}

View File

@ -1,23 +0,0 @@
package com.sekwah.advancedportals.forge;
import com.sekwah.advancedportals.core.util.InfoLogger;
import org.apache.logging.log4j.Logger;
public class ForgeInfoLogger extends InfoLogger {
private final Logger logger;
public ForgeInfoLogger(Logger logger) {
this.logger = logger;
}
@Override
public void logWarning(String s) {
this.logger.warn(s);
}
@Override
public void log(String s) {
this.logger.info(s);
}
}

View File

@ -1,55 +0,0 @@
package com.sekwah.advancedportals.forge.coreconnector.command;
import com.sekwah.advancedportals.core.commands.CommandTemplate;
import com.sekwah.advancedportals.forge.coreconnector.container.ForgeCommandSenderContainer;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.math.BlockPos;
import javax.annotation.Nullable;
import java.util.List;
public class ForgeCommandHandler extends CommandBase
{
private final String commandName;
private final CommandTemplate commandExecutor;
public ForgeCommandHandler(String commandName, CommandTemplate commandExecutor) {
this.commandName = commandName;
this.commandExecutor = commandExecutor;
}
@Override
public int getRequiredPermissionLevel() {
return 0;
}
@Override
public boolean checkPermission(MinecraftServer p_checkPermission_1_, ICommandSender p_checkPermission_2_) {
return true;
}
@Override
public String getName() {
return commandName;
}
@Override
public String getUsage(ICommandSender iCommandSender) {
return null;
}
@Override
public void execute(MinecraftServer minecraftServer, ICommandSender sender, String[] strings) throws CommandException {
this.commandExecutor.onCommand(new ForgeCommandSenderContainer(sender), this.commandName, strings);
}
@Override
public List<String> getTabCompletions(MinecraftServer mcServer, ICommandSender sender, String[] strings, @Nullable BlockPos location) {
return this.commandExecutor.onTabComplete(new ForgeCommandSenderContainer(sender), strings);
}
}

View File

@ -1,26 +0,0 @@
package com.sekwah.advancedportals.forge.coreconnector.command;
import com.sekwah.advancedportals.core.commands.CommandTemplate;
import com.sekwah.advancedportals.coreconnector.command.CommandRegister;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
/**
* Register the CommandTemplate files to the appropriate system
*/
public class ForgeCommandRegister implements CommandRegister {
private final FMLServerStartingEvent event;
public ForgeCommandRegister(FMLServerStartingEvent event) {
this.event = event;
}
/**
* Registers the command to the appropriate system
* @param commandName
* @param commandExecutor
*/
public void registerCommand(String commandName, CommandTemplate commandExecutor) {
event.registerServerCommand(new ForgeCommandHandler(commandName, commandExecutor));
}
}

View File

@ -1,26 +0,0 @@
package com.sekwah.advancedportals.forge.coreconnector.command;
import com.sekwah.advancedportals.core.entities.PortalLocation;
import com.sekwah.advancedportals.coreconnector.container.WorldContainer;
public class ForgeWorldContainer implements WorldContainer {
@Override
public void setBlock(PortalLocation location, String material) {
}
@Override
public void setBlockData(PortalLocation location, byte data) {
}
@Override
public String getBlock(PortalLocation location) {
return null;
}
@Override
public byte getBlockData(PortalLocation location) {
return 0;
}
}

View File

@ -1,59 +0,0 @@
package com.sekwah.advancedportals.forge.coreconnector.container;
import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer;
import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.server.management.UserListOpsEntry;
import net.minecraft.util.text.TextComponentString;
import net.minecraftforge.fml.common.FMLCommonHandler;
public class ForgeCommandSenderContainer implements CommandSenderContainer {
private final ICommandSender sender;
public ForgeCommandSenderContainer(ICommandSender sender) {
this.sender = sender;
}
@Override
public void sendMessage(String message) {
sender.sendMessage(new TextComponentString(message));
}
@Override
public boolean isOp() {
if(this.sender.getCommandSenderEntity() instanceof EntityPlayer) {
if(!FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().canSendCommands(((EntityPlayer) this.sender).getGameProfile())) {
return false;
}
else {
UserListOpsEntry userlistopsentry = FMLCommonHandler.instance().getMinecraftServerInstance()
.getPlayerList().getOppedPlayers().getEntry(((EntityPlayer) this.sender).getGameProfile());
// Intellij may say this will always be true but it isn't
if (userlistopsentry != null) {
return userlistopsentry.getPermissionLevel() >= 2;
} else {
return FMLCommonHandler.instance().getMinecraftServerInstance().getOpPermissionLevel() >= 2;
}
}
}
else {
return false;
}
}
@Override
public PlayerContainer getPlayerContainer() {
if(this.sender.getCommandSenderEntity() instanceof EntityPlayer) {
return new ForgePlayerContainer((EntityPlayer) this.sender);
}
return null;
}
@Override
public boolean hasPermission(String permission) {
return false;
}
}

View File

@ -1,87 +0,0 @@
package com.sekwah.advancedportals.forge.coreconnector.container;
import com.sekwah.advancedportals.core.entities.PlayerLocation;
import com.sekwah.advancedportals.core.entities.PortalLocation;
import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;
import com.sekwah.advancedportals.coreconnector.container.WorldContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.server.management.UserListOpsEntry;
import net.minecraftforge.fml.common.FMLCommonHandler;
import java.util.UUID;
public class ForgePlayerContainer implements PlayerContainer {
private EntityPlayer sender;
public ForgePlayerContainer(EntityPlayer sender) {
this.sender = sender;
}
@Override
public UUID getUUID() {
return null;
}
@Override
public void sendMessage(String message) {
}
@Override
public boolean isOp() {
UserListOpsEntry userlistopsentry = FMLCommonHandler.instance().getMinecraftServerInstance()
.getPlayerList().getOppedPlayers().getEntry(this.sender.getGameProfile());
if (userlistopsentry != null) {
return userlistopsentry.getPermissionLevel() >= 2;
} else {
return FMLCommonHandler.instance().getMinecraftServerInstance().getOpPermissionLevel() >= 2;
}
}
@Override
public PlayerLocation getLoc() {
return null;
}
@Override
public double getEyeHeight() {
return 0;
}
@Override
public void teleport(PlayerLocation location) {
}
@Override
public boolean hasPermission(String permission) {
return false;
}
@Override
public WorldContainer getWorld() {
return null;
}
@Override
public void sendFakeBlock(PortalLocation blockPos, String material) {
}
@Override
public void sendFakeBlockWithData(PortalLocation blockPos, String material, byte data) {
}
@Override
public void giveWool(String dyeColor, String itemName, String... itemDescription) {
}
@Override
public void giveItem(String material, String itemName, String... itemDescription) {
}
}

View File

@ -1,34 +0,0 @@
package com.sekwah.advancedportals.forge.coreconnector.info;
import com.sekwah.advancedportals.coreconnector.info.DataCollector;
import net.minecraft.block.Block;
import java.util.ArrayList;
import java.util.List;
public class ForgeDataCollector implements DataCollector {
private final List<String> blockMaterialList = new ArrayList<>();
public ForgeDataCollector() {
/**
* TODO Look at
* {@link net.minecraft.command.CommandGive#getTabCompletions}
* for inspiration for both spigot and forge versions
*/
//Block.REGISTRY.getKeys()
}
/**
* @param materialName this is given in the format minecraft:material
* @return
*/
public boolean materialExists(String materialName) {
return Block.getBlockFromName(materialName) != null;
}
@Override
public List<String> getMaterials() {
return null;
}
}

View File

@ -1,13 +0,0 @@
package com.sekwah.advancedportals.forge.effects;
import com.sekwah.advancedportals.core.api.effect.WarpEffect;
import com.sekwah.advancedportals.core.api.portal.AdvancedPortal;
import com.sekwah.advancedportals.core.entities.PortalLocation;
import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;
public class WarpEffectEnder extends WarpEffect {
@Override
protected void onWarp(PlayerContainer player, PortalLocation loc, Action action, Type type, AdvancedPortal portal) {
}
}