diff --git a/build.gradle b/build.gradle index 2e16e1f..dd93384 100644 --- a/build.gradle +++ b/build.gradle @@ -1,44 +1,67 @@ buildscript { repositories { - jcenter() - maven { url = "http://files.minecraftforge.net/maven" } - + maven { url = 'https://maven.minecraftforge.net/' } + mavenCentral() } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' + classpath 'net.minecraftforge.gradle:ForgeGradle:3.+' } } -apply plugin: 'net.minecraftforge.gradle.forge' +apply plugin: 'net.minecraftforge.gradle' apply plugin: 'maven-publish' apply from: 'https://raw.githubusercontent.com/MinecraftModDevelopment/Gradle-Collection/22e7d543a18cd30675277fbfa3669e3d9e206010/generic/secrets.gradle' -import groovy.json.JsonOutput - if (project.hasProperty('secretFile')) { loadSecrets(new File((String) findProperty('secretFile'))) } -version = "${version}" +version = "${project.version}" group = "tschipp.carryon" archivesBaseName = "carryon-${minecraft_version}" -sourceCompatibility = targetCompatibility = '1.8' -compileJava { - sourceCompatibility = targetCompatibility = '1.8' -} +sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. + if (System.getenv('BUILD_NUMBER') != null) { version += "." + System.getenv('BUILD_NUMBER') } minecraft { - version = "1.12.2-14.23.5.2847" - runDir = "run" - - mappings = "snapshot_20171003" + // 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 always work. + // Simply re-run your setup task after changing the mappings to update your workspace. + //mappings channel: 'snapshot', version: '20171003-1.12' + mappings channel: 'snapshot', version: '20171003-1.12' // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. + + // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') + + // Default run configurations. + // These can be tweaked, removed, or duplicated as needed. + runs { + client { + workingDirectory project.file('run') + + // Recommended logging data for a userdev environment + property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' + + // Recommended logging level for the console + property 'forge.logging.console.level', 'debug' + } + + server { + + // Recommended logging data for a userdev environment + property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' + + // Recommended logging level for the console + property 'forge.logging.console.level', 'debug' + } + } } repositories { @@ -54,13 +77,26 @@ repositories { -dependencies { - - // deobfCompile "net.darkhax.gamestages:GameStages-1.12.2:2.0.91" - - compile "com.mrcrayfish:obfuscate:0.2.6-1.12.2" - compile "net.ilexiconn:llibrary:1.7.9-1.12.2:dev" +dependencies { + minecraft 'net.minecraftforge:forge:1.12.2-14.23.5.2860' + + compile "com.mrcrayfish:obfuscate:0.2.6-1.12.2" + compile "net.ilexiconn:llibrary:1.7.9-1.12.2:dev" +} + +jar { + manifest { + attributes([ + "Specification-Title": "examplemod", + "Specification-Vendor": "examplemodsareus", + "Specification-Version": "1", // We are version 1 of ourselves + "Implementation-Title": project.name, + "Implementation-Version": "${version}", + "Implementation-Vendor" :"examplemodsareus", + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") + ]) + } } task sourcesJar(type: Jar, dependsOn: classes) { @@ -136,12 +172,12 @@ publishing { processResources { inputs.property "version", project.version - inputs.property "mcversion", project.minecraft.version + inputs.property "mcversion", project.minecraft_version from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' - expand 'version':project.version, 'mcversion':project.minecraft.version + expand 'version':project.version, 'mcversion':project.minecraft_version } from(sourceSets.main.resources.srcDirs) { @@ -149,24 +185,24 @@ processResources { } } -task signJar(type: SignJar, dependsOn: reobfJar) { - - // Skips if the keyStore property is missing. - onlyIf { - project.hasProperty('modkeyStore') - } - - // findProperty allows us to reference the property without it existing. - // Using project.propName would cause the script to fail validation if - // the property did not exist. - keyStore = project.findProperty('modkeyStore') - alias = project.findProperty('modkeyStoreAlias') - storePass = project.findProperty('modkeyStorePass') - keyPass = project.findProperty('modkeyStoreKeyPass') - inputFile = jar.archivePath - outputFile = jar.archivePath -} +//task signJar(type: SignJar, dependsOn: reobfJar) { +// +// // Skips if the keyStore property is missing. +// onlyIf { +// project.hasProperty('modkeyStore') +// } +// +// // findProperty allows us to reference the property without it existing. +// // Using project.propName would cause the script to fail validation if +// // the property did not exist. +// keyStore = project.findProperty('modkeyStore') +// alias = project.findProperty('modkeyStoreAlias') +// storePass = project.findProperty('modkeyStorePass') +// keyPass = project.findProperty('modkeyStoreKeyPass') +// inputFile = jar.archivePath +// outputFile = jar.archivePath +//} // Runs this task automatically when build is ran. -build.dependsOn signJar +//build.dependsOn signJar diff --git a/gradle.properties b/gradle.properties index 8c83cc7..a38bd3f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ # Sets default memory used for gradle commands. Can be overridden by user or command line properties. # This is required to provide enough memory for the Minecraft decompilation process. org.gradle.jvmargs=-Xmx3G -version=1.12.6 +version=1.12.7 minecraft_version=1.12.2 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 30d399d..7a3265e 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e18cba7..949819d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Mon Sep 14 12:28:28 PDT 2015 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip diff --git a/src/main/java/tschipp/carryon/CarryOn.java b/src/main/java/tschipp/carryon/CarryOn.java index f6cf05b..bcbcfa4 100644 --- a/src/main/java/tschipp/carryon/CarryOn.java +++ b/src/main/java/tschipp/carryon/CarryOn.java @@ -1,31 +1,28 @@ package tschipp.carryon; -import java.io.File; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - import com.google.common.collect.ImmutableList; - import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.SidedProxy; -import net.minecraftforge.fml.common.event.FMLFingerprintViolationEvent; import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLInterModComms.IMCEvent; +import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLServerStartingEvent; -import net.minecraftforge.fml.common.event.FMLInterModComms.IMCEvent; -import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage; import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import tschipp.carryon.common.CommonProxy; import tschipp.carryon.common.command.CommandCarryOn; import tschipp.carryon.common.command.CommandCarryOnReload; import tschipp.carryon.common.handler.ListHandler; import tschipp.carryon.common.handler.ModelOverridesHandler; +import java.io.File; + @EventBusSubscriber @Mod(modid = CarryOn.MODID, name = CarryOn.NAME, version = CarryOn.VERSION, guiFactory = "tschipp.carryon.client.gui.GuiFactoryCarryOn", dependencies = CarryOn.DEPENDENCIES, updateJSON = CarryOn.UPDATE_JSON, acceptedMinecraftVersions = CarryOn.ACCEPTED_VERSIONS, certificateFingerprint = CarryOn.CERTIFICATE_FINGERPRINT) public class CarryOn { @@ -74,13 +71,6 @@ public class CarryOn { event.registerServerCommand(new CommandCarryOnReload()); } - @EventHandler - public void onFingerprintViolation(FMLFingerprintViolationEvent event) { - - LOGGER.error("WARNING! Invalid fingerprint detected! The file " + event.getSource().getName() + " may have been tampered with! If you didn't download the file from https://minecraft.curseforge.com/projects/carry-on or through any kind of mod launcher, immediately delete the file and re-download it from https://minecraft.curseforge.com/projects/carry-on"); - FINGERPRINT_VIOLATED = true; - } - @EventHandler public void imcEvent(IMCEvent event) { diff --git a/src/main/java/tschipp/carryon/common/config/Configs.java b/src/main/java/tschipp/carryon/common/config/Configs.java index 6cabc33..40a38a3 100644 --- a/src/main/java/tschipp/carryon/common/config/Configs.java +++ b/src/main/java/tschipp/carryon/common/config/Configs.java @@ -206,10 +206,12 @@ public class Configs { "integrateddynamics:*", "bloodmagic:*", "rftools:screen", - "rftools:creative_screen", - "movingelevators:elevator_block", - "movingelevators:display_block", - + "rftools:creative_screen", + "movingelevators:elevator_block", + "movingelevators:display_block", + "forgemultipartcbe:*", + "integrateddynamics:cable", + "mekanismgenerators:wind_generator" }; @Comment("Entities that cannot be picked up") @@ -236,7 +238,10 @@ public class Configs { "mocreatures:*", "pixelmon:*", "thebetweenlands:draeton**", - "mysticalworld:*" + "mysticalworld:*", + "securitycraft:*", + "taterzens:npc", + "minecolonies:*" }; diff --git a/src/main/java/tschipp/carryon/common/event/ItemEntityEvents.java b/src/main/java/tschipp/carryon/common/event/ItemEntityEvents.java index ea6480e..60fac5e 100644 --- a/src/main/java/tschipp/carryon/common/event/ItemEntityEvents.java +++ b/src/main/java/tschipp/carryon/common/event/ItemEntityEvents.java @@ -1,7 +1,5 @@ package tschipp.carryon.common.event; -import java.util.List; - import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; @@ -37,6 +35,8 @@ import tschipp.carryon.common.item.ItemEntity; import tschipp.carryon.common.scripting.CarryOnOverride; import tschipp.carryon.common.scripting.ScriptChecker; +import java.util.List; + public class ItemEntityEvents { @@ -86,6 +86,21 @@ public class ItemEntityEvents } } } + @SubscribeEvent(priority = EventPriority.HIGH) + public void onEntityRightClickSpecific(PlayerInteractEvent.EntityInteractSpecific event) + { + EntityPlayer player = event.getEntityPlayer(); + + if (player instanceof EntityPlayerMP) + { + ItemStack main = player.getHeldItemMainhand(); + if (!main.isEmpty() && (main.getItem() == RegistrationHandler.itemTile || main.getItem() == RegistrationHandler.itemEntity)) + { + event.setCanceled(true); + event.setCancellationResult(EnumActionResult.SUCCESS); + } + } + } @SubscribeEvent(priority = EventPriority.HIGH) public void onEntityRightClick(PlayerInteractEvent.EntityInteract event) @@ -132,10 +147,11 @@ public class ItemEntityEvents if (entity instanceof EntityLiving) ((EntityLiving) entity).setHealth(0); + entity.setPosition(entity.posX, -200, entity.posZ); entity.setDead(); player.setHeldItem(EnumHand.MAIN_HAND, stack); event.setCanceled(true); - event.setCancellationResult(EnumActionResult.FAIL); + event.setCancellationResult(EnumActionResult.SUCCESS); } } } @@ -191,11 +207,13 @@ public class ItemEntityEvents player.setHeldItem(EnumHand.MAIN_HAND, ItemStack.EMPTY); ItemEvents.sendPacket(player, 9, 0); event.setCanceled(true); - event.setCancellationResult(EnumActionResult.FAIL); + event.setCancellationResult(EnumActionResult.SUCCESS); world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_HORSE_SADDLE, SoundCategory.PLAYERS, 0.5F, 1.5F); } else { + event.setCanceled(true); + event.setCancellationResult(EnumActionResult.SUCCESS); world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.BLOCK_NOTE_BASS, SoundCategory.PLAYERS, 0.5F, 1.5F); return; } @@ -203,6 +221,8 @@ public class ItemEntityEvents } else { + event.setCanceled(true); + event.setCancellationResult(EnumActionResult.SUCCESS); world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.BLOCK_NOTE_BASS, SoundCategory.PLAYERS, 0.5F, 1.5F); return; } @@ -210,6 +230,14 @@ public class ItemEntityEvents } + event.setCanceled(true); + event.setCancellationResult(EnumActionResult.SUCCESS); + + } + else if (!main.isEmpty() && main.getItem() == RegistrationHandler.itemTile) + { + event.setCanceled(true); + event.setCancellationResult(EnumActionResult.SUCCESS); } } diff --git a/src/main/java/tschipp/carryon/common/handler/PickupHandler.java b/src/main/java/tschipp/carryon/common/handler/PickupHandler.java index d62a368..673a6ca 100644 --- a/src/main/java/tschipp/carryon/common/handler/PickupHandler.java +++ b/src/main/java/tschipp/carryon/common/handler/PickupHandler.java @@ -1,13 +1,7 @@ package tschipp.carryon.common.handler; -import java.lang.reflect.Method; -import java.util.UUID; - -import javax.annotation.Nullable; - import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.EnumCreatureType; @@ -18,17 +12,19 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraft.world.WorldServer; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.AttackEntityEvent; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.fml.relauncher.ReflectionHelper; -import tschipp.carryon.CarryOn; import tschipp.carryon.common.config.CarryOnConfig; import tschipp.carryon.common.item.ItemTile; import tschipp.carryon.common.scripting.CarryOnOverride; import tschipp.carryon.common.scripting.ScriptChecker; +import javax.annotation.Nullable; +import java.lang.reflect.Method; +import java.util.UUID; + public class PickupHandler { @@ -135,6 +131,9 @@ public class PickupHandler if (toPickUp instanceof EntityPlayer) return false; + if(toPickUp.isDead) + return false; + CarryOnOverride override = ScriptChecker.inspectEntity(toPickUp); if (override != null) { diff --git a/src/main/java/tschipp/carryon/common/scripting/ScriptReader.java b/src/main/java/tschipp/carryon/common/scripting/ScriptReader.java index 6c0d4fa..88738b7 100644 --- a/src/main/java/tschipp/carryon/common/scripting/ScriptReader.java +++ b/src/main/java/tschipp/carryon/common/scripting/ScriptReader.java @@ -1,23 +1,17 @@ package tschipp.carryon.common.scripting; +import com.google.gson.*; +import net.minecraft.nbt.JsonToNBT; +import net.minecraft.nbt.NBTException; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import tschipp.carryon.CarryOn; +import tschipp.carryon.common.config.CarryOnConfig; + import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.util.ArrayList; import java.util.HashMap; -import java.util.HashSet; - -import com.google.gson.JsonElement; -import com.google.gson.JsonIOException; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import com.google.gson.JsonSyntaxException; - -import net.minecraft.nbt.JsonToNBT; -import net.minecraft.nbt.NBTException; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import tschipp.carryon.CarryOn; -import tschipp.carryon.common.config.CarryOnConfig; public class ScriptReader { @@ -28,7 +22,7 @@ public class ScriptReader public static void preInit(FMLPreInitializationEvent event) { - CarryOn.CONFIGURATION_FILE = new File(event.getModConfigurationDirectory(), "carryon-scripts/"); + CarryOn.CONFIGURATION_FILE = new File(event.getModConfigurationDirectory(), "carryon-scripts" + File.separator); if (!CarryOn.CONFIGURATION_FILE.exists()) CarryOn.CONFIGURATION_FILE.mkdir();