Fixed bugs

This commit is contained in:
Tschipp 2023-04-25 22:25:40 +02:00
parent fe85ff0075
commit e015a273e7
9 changed files with 143 additions and 92 deletions

View File

@ -1,44 +1,67 @@
buildscript { buildscript {
repositories { repositories {
jcenter() maven { url = 'https://maven.minecraftforge.net/' }
maven { url = "http://files.minecraftforge.net/maven" } mavenCentral()
} }
dependencies { 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 plugin: 'maven-publish'
apply from: 'https://raw.githubusercontent.com/MinecraftModDevelopment/Gradle-Collection/22e7d543a18cd30675277fbfa3669e3d9e206010/generic/secrets.gradle' apply from: 'https://raw.githubusercontent.com/MinecraftModDevelopment/Gradle-Collection/22e7d543a18cd30675277fbfa3669e3d9e206010/generic/secrets.gradle'
import groovy.json.JsonOutput
if (project.hasProperty('secretFile')) { if (project.hasProperty('secretFile')) {
loadSecrets(new File((String) findProperty('secretFile'))) loadSecrets(new File((String) findProperty('secretFile')))
} }
version = "${version}" version = "${project.version}"
group = "tschipp.carryon" group = "tschipp.carryon"
archivesBaseName = "carryon-${minecraft_version}" archivesBaseName = "carryon-${minecraft_version}"
sourceCompatibility = targetCompatibility = '1.8' sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
if (System.getenv('BUILD_NUMBER') != null) { if (System.getenv('BUILD_NUMBER') != null) {
version += "." + System.getenv('BUILD_NUMBER') version += "." + System.getenv('BUILD_NUMBER')
} }
minecraft { minecraft {
version = "1.12.2-14.23.5.2847" // The mappings can be changed at any time, and must be in the following format.
runDir = "run" // snapshot_YYYYMMDD Snapshot are built nightly.
// stable_# Stables are built at the discretion of the MCP team.
mappings = "snapshot_20171003" // 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. // 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 { repositories {
@ -54,13 +77,26 @@ repositories {
dependencies { dependencies {
minecraft 'net.minecraftforge:forge:1.12.2-14.23.5.2860'
// 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"
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) { task sourcesJar(type: Jar, dependsOn: classes) {
@ -136,12 +172,12 @@ publishing {
processResources { processResources {
inputs.property "version", project.version inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version inputs.property "mcversion", project.minecraft_version
from(sourceSets.main.resources.srcDirs) { from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info' include 'mcmod.info'
expand 'version':project.version, 'mcversion':project.minecraft.version expand 'version':project.version, 'mcversion':project.minecraft_version
} }
from(sourceSets.main.resources.srcDirs) { from(sourceSets.main.resources.srcDirs) {
@ -149,24 +185,24 @@ processResources {
} }
} }
task signJar(type: SignJar, dependsOn: reobfJar) { //task signJar(type: SignJar, dependsOn: reobfJar) {
//
// Skips if the keyStore property is missing. // // Skips if the keyStore property is missing.
onlyIf { // onlyIf {
project.hasProperty('modkeyStore') // project.hasProperty('modkeyStore')
} // }
//
// findProperty allows us to reference the property without it existing. // // findProperty allows us to reference the property without it existing.
// Using project.propName would cause the script to fail validation if // // Using project.propName would cause the script to fail validation if
// the property did not exist. // // the property did not exist.
keyStore = project.findProperty('modkeyStore') // keyStore = project.findProperty('modkeyStore')
alias = project.findProperty('modkeyStoreAlias') // alias = project.findProperty('modkeyStoreAlias')
storePass = project.findProperty('modkeyStorePass') // storePass = project.findProperty('modkeyStorePass')
keyPass = project.findProperty('modkeyStoreKeyPass') // keyPass = project.findProperty('modkeyStoreKeyPass')
inputFile = jar.archivePath // inputFile = jar.archivePath
outputFile = jar.archivePath // outputFile = jar.archivePath
} //}
// Runs this task automatically when build is ran. // Runs this task automatically when build is ran.
build.dependsOn signJar //build.dependsOn signJar

View File

@ -1,5 +1,5 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties. # 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. # This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G org.gradle.jvmargs=-Xmx3G
version=1.12.6 version=1.12.7
minecraft_version=1.12.2 minecraft_version=1.12.2

Binary file not shown.

View File

@ -1,6 +1,5 @@
#Mon Sep 14 12:28:28 PDT 2015
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists 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

View File

@ -1,31 +1,28 @@
package tschipp.carryon; 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 com.google.common.collect.ImmutableList;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy; 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.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.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent; 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 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.CommonProxy;
import tschipp.carryon.common.command.CommandCarryOn; import tschipp.carryon.common.command.CommandCarryOn;
import tschipp.carryon.common.command.CommandCarryOnReload; import tschipp.carryon.common.command.CommandCarryOnReload;
import tschipp.carryon.common.handler.ListHandler; import tschipp.carryon.common.handler.ListHandler;
import tschipp.carryon.common.handler.ModelOverridesHandler; import tschipp.carryon.common.handler.ModelOverridesHandler;
import java.io.File;
@EventBusSubscriber @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) @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 { public class CarryOn {
@ -74,13 +71,6 @@ public class CarryOn {
event.registerServerCommand(new CommandCarryOnReload()); 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 @EventHandler
public void imcEvent(IMCEvent event) public void imcEvent(IMCEvent event)
{ {

View File

@ -206,10 +206,12 @@ public class Configs {
"integrateddynamics:*", "integrateddynamics:*",
"bloodmagic:*", "bloodmagic:*",
"rftools:screen", "rftools:screen",
"rftools:creative_screen", "rftools:creative_screen",
"movingelevators:elevator_block", "movingelevators:elevator_block",
"movingelevators:display_block", "movingelevators:display_block",
"forgemultipartcbe:*",
"integrateddynamics:cable",
"mekanismgenerators:wind_generator"
}; };
@Comment("Entities that cannot be picked up") @Comment("Entities that cannot be picked up")
@ -236,7 +238,10 @@ public class Configs {
"mocreatures:*", "mocreatures:*",
"pixelmon:*", "pixelmon:*",
"thebetweenlands:draeton**", "thebetweenlands:draeton**",
"mysticalworld:*" "mysticalworld:*",
"securitycraft:*",
"taterzens:npc",
"minecolonies:*"
}; };

View File

@ -1,7 +1,5 @@
package tschipp.carryon.common.event; package tschipp.carryon.common.event;
import java.util.List;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving; 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.CarryOnOverride;
import tschipp.carryon.common.scripting.ScriptChecker; import tschipp.carryon.common.scripting.ScriptChecker;
import java.util.List;
public class ItemEntityEvents 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) @SubscribeEvent(priority = EventPriority.HIGH)
public void onEntityRightClick(PlayerInteractEvent.EntityInteract event) public void onEntityRightClick(PlayerInteractEvent.EntityInteract event)
@ -132,10 +147,11 @@ public class ItemEntityEvents
if (entity instanceof EntityLiving) if (entity instanceof EntityLiving)
((EntityLiving) entity).setHealth(0); ((EntityLiving) entity).setHealth(0);
entity.setPosition(entity.posX, -200, entity.posZ);
entity.setDead(); entity.setDead();
player.setHeldItem(EnumHand.MAIN_HAND, stack); player.setHeldItem(EnumHand.MAIN_HAND, stack);
event.setCanceled(true); 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); player.setHeldItem(EnumHand.MAIN_HAND, ItemStack.EMPTY);
ItemEvents.sendPacket(player, 9, 0); ItemEvents.sendPacket(player, 9, 0);
event.setCanceled(true); 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); world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_HORSE_SADDLE, SoundCategory.PLAYERS, 0.5F, 1.5F);
} }
else 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); world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.BLOCK_NOTE_BASS, SoundCategory.PLAYERS, 0.5F, 1.5F);
return; return;
} }
@ -203,6 +221,8 @@ public class ItemEntityEvents
} }
else 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); world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.BLOCK_NOTE_BASS, SoundCategory.PLAYERS, 0.5F, 1.5F);
return; 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);
} }
} }

View File

@ -1,13 +1,7 @@
package tschipp.carryon.common.handler; 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.Block;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.EnumCreatureType;
@ -18,17 +12,19 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.AttackEntityEvent; import net.minecraftforge.event.entity.player.AttackEntityEvent;
import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.fml.relauncher.ReflectionHelper; import net.minecraftforge.fml.relauncher.ReflectionHelper;
import tschipp.carryon.CarryOn;
import tschipp.carryon.common.config.CarryOnConfig; import tschipp.carryon.common.config.CarryOnConfig;
import tschipp.carryon.common.item.ItemTile; import tschipp.carryon.common.item.ItemTile;
import tschipp.carryon.common.scripting.CarryOnOverride; import tschipp.carryon.common.scripting.CarryOnOverride;
import tschipp.carryon.common.scripting.ScriptChecker; import tschipp.carryon.common.scripting.ScriptChecker;
import javax.annotation.Nullable;
import java.lang.reflect.Method;
import java.util.UUID;
public class PickupHandler public class PickupHandler
{ {
@ -135,6 +131,9 @@ public class PickupHandler
if (toPickUp instanceof EntityPlayer) if (toPickUp instanceof EntityPlayer)
return false; return false;
if(toPickUp.isDead)
return false;
CarryOnOverride override = ScriptChecker.inspectEntity(toPickUp); CarryOnOverride override = ScriptChecker.inspectEntity(toPickUp);
if (override != null) if (override != null)
{ {

View File

@ -1,23 +1,17 @@
package tschipp.carryon.common.scripting; 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.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileReader; import java.io.FileReader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; 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 public class ScriptReader
{ {
@ -28,7 +22,7 @@ public class ScriptReader
public static void preInit(FMLPreInitializationEvent event) 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()) if (!CarryOn.CONFIGURATION_FILE.exists())
CarryOn.CONFIGURATION_FILE.mkdir(); CarryOn.CONFIGURATION_FILE.mkdir();