Skip to content

Commit

Permalink
Backport
Browse files Browse the repository at this point in the history
- Backported some stuff from 1.12
- Removed proxy logger
- Updated Gradle
  • Loading branch information
Jacky1356400 committed Jul 10, 2017
1 parent d880b75 commit 2774fef
Show file tree
Hide file tree
Showing 41 changed files with 296 additions and 249 deletions.
63 changes: 24 additions & 39 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,69 +10,54 @@ buildscript {
apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the nessasary things for Forge to be setup.


version = "${mc_version}-${mod_version}"
group= "me.jacky1356400.exchangers" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
group= "me.jacky1356400.exchangers"
archivesBaseName = "Exchangers"

sourceCompatibility = targetCompatibility = "1.8" // Need this here so eclipse task generates correctly.
sourceCompatibility = targetCompatibility = "1.8"
compileJava {
sourceCompatibility = targetCompatibility = "1.8"
}

minecraft {
version = "${mc_version}-${forge_version}"
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_${mappings_version}"
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
mappings = "${mappings_version}"
}

dependencies {
// you may put jars on which you depend on in ./libs
// or you may define them like so..
//compile "some.group:artifact:version:classifier"
//compile "some.group:artifact:version"

// real examples
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env

// the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
//provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'

// the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided,
// except that these dependencies get remapped to your current MCP mappings
//deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
//deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev'

// for more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
repositories {
maven {
url "http://dvs1.progwml6.com/files/maven"
}
maven {
url "http://maven.epoxide.xyz"
}
maven {
url "http://maven.amadornes.com/"
}
maven {
url "http://tehnut.info/maven"
}
}

dependencies {
compile files('libs/')
deobfCompile "mezz.jei:jei_1.10.2:3.14.7.420:api"
runtime "mezz.jei:jei_1.10.2:3.14.7.420"
deobfCompile "mcp.mobius.waila:Hwyla:1.8.17-B31_1.10.2:api"
runtime "mcp.mobius.waila:Hwyla:1.8.17-B31_1.10.2"
}

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'
}
}

8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 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
org.gradle.jvmargs=-Xmx4G
mc_version=1.10.2
forge_version=12.18.3.2297
mod_version=1.1
mappings_version=20161111
forge_version=12.18.3.2316
mod_version=1.2
mappings_version=snapshot_20161111
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-bin.zip
225 changes: 136 additions & 89 deletions src/main/java/me/jacky1356400/exchangers/Config.java

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main/java/me/jacky1356400/exchangers/Exchangers.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@Mod(modid = Exchangers.MODID, version = Exchangers.VERSION, name = Exchangers.MODNAME, dependencies = Exchangers.DEPENDS, useMetadata = true)
public class Exchangers {

public static final String VERSION = "1.10.2-1.1";
public static final String VERSION = "1.10.2-1.2";
public static final String MODID = "exchangers";
public static final String MODNAME = "Exchangers";
public static final String PREFIX = MODID + ".";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,9 @@ public static void initSpecialBlockLists() {
}
}

softBlocks.add(Blocks.SNOW);
softBlocks.add(Blocks.SNOW_LAYER);
softBlocks.add(Blocks.REDSTONE_WIRE);
softBlocks.add(Blocks.TRIPWIRE);
softBlocks.add(Blocks.VINE);
softBlocks.add(Blocks.FIRE);
softBlocks.add(Blocks.AIR);
Expand Down Expand Up @@ -460,6 +462,7 @@ public static String getBlockName(Block block, int meta) {
return s.getDisplayName();
}

@SuppressWarnings("deprecation")
public static boolean exchangeBlocks(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
EnumFacing facing) {
Block newBlock = Block.getBlockFromName(stack.getTagCompound().getString("BlockName"));
Expand Down Expand Up @@ -505,52 +508,52 @@ public static boolean exchangeBlocks(ItemStack stack, EntityPlayer player, World
stack.damageItem(1, player);
}
//Ender IO Exchangers
if (stack.getItem() instanceof ItemConductiveIronExchanger && stack.getTagCompound().getInteger("Energy") >= Config.conductiveIronExchangerPerBlockRF) {
stack.getTagCompound().setInteger("Energy", energy - Config.conductiveIronExchangerPerBlockRF);
if (stack.getItem() instanceof ItemConductiveIronExchanger && stack.getTagCompound().getInteger("Energy") >= Config.conductivePerBlockUse) {
stack.getTagCompound().setInteger("Energy", energy - Config.conductivePerBlockUse);
}
if (stack.getItem() instanceof ItemPulsatingIronExchanger && stack.getTagCompound().getInteger("Energy") >= Config.pulsatingIronExchangerPerBlockRF) {
stack.getTagCompound().setInteger("Energy", energy - Config.pulsatingIronExchangerPerBlockRF);
if (stack.getItem() instanceof ItemPulsatingIronExchanger && stack.getTagCompound().getInteger("Energy") >= Config.pulsatingPerBlockUse) {
stack.getTagCompound().setInteger("Energy", energy - Config.pulsatingPerBlockUse);
}
if (stack.getItem() instanceof ItemElectricalSteelExchanger && stack.getTagCompound().getInteger("Energy") >= Config.electricalSteelExchangerPerBlockRF) {
stack.getTagCompound().setInteger("Energy", energy - Config.electricalSteelExchangerPerBlockRF);
if (stack.getItem() instanceof ItemElectricalSteelExchanger && stack.getTagCompound().getInteger("Energy") >= Config.electricalSteelPerBlockUse) {
stack.getTagCompound().setInteger("Energy", energy - Config.electricalSteelPerBlockUse);
}
if (stack.getItem() instanceof ItemEnergeticExchanger && stack.getTagCompound().getInteger("Energy") >= Config.energeticExchangerPerBlockRF) {
stack.getTagCompound().setInteger("Energy", energy - Config.energeticExchangerPerBlockRF);
if (stack.getItem() instanceof ItemEnergeticExchanger && stack.getTagCompound().getInteger("Energy") >= Config.energeticPerBlockUse) {
stack.getTagCompound().setInteger("Energy", energy - Config.energeticPerBlockUse);
}
if (stack.getItem() instanceof ItemDarkSteelExchanger && stack.getTagCompound().getInteger("Energy") >= Config.darkSteelExchangerPerBlockRF) {
stack.getTagCompound().setInteger("Energy", energy - Config.darkSteelExchangerPerBlockRF);
if (stack.getItem() instanceof ItemDarkSteelExchanger && stack.getTagCompound().getInteger("Energy") >= Config.darkSteelPerBlockUse) {
stack.getTagCompound().setInteger("Energy", energy - Config.darkSteelPerBlockUse);
}
if (stack.getItem() instanceof ItemVibrantExchanger && stack.getTagCompound().getInteger("Energy") >= Config.vibrantExchangerPerBlockRF) {
stack.getTagCompound().setInteger("Energy", energy - Config.vibrantExchangerPerBlockRF);
if (stack.getItem() instanceof ItemVibrantExchanger && stack.getTagCompound().getInteger("Energy") >= Config.vibrantPerBlockUse) {
stack.getTagCompound().setInteger("Energy", energy - Config.vibrantPerBlockUse);
}
//Thermal Expansion Exchangers
if (stack.getItem() instanceof ItemLeadstoneExchanger && stack.getTagCompound().getInteger("Energy") >= Config.leadstoneExchangerPerBlockRF) {
stack.getTagCompound().setInteger("Energy", energy - Config.leadstoneExchangerPerBlockRF);
if (stack.getItem() instanceof ItemLeadstoneExchanger && stack.getTagCompound().getInteger("Energy") >= Config.leadstonePerBlockUse) {
stack.getTagCompound().setInteger("Energy", energy - Config.leadstonePerBlockUse);
}
if (stack.getItem() instanceof ItemHardenedExchanger && stack.getTagCompound().getInteger("Energy") >= Config.hardenedExchangerPerBlockRF) {
stack.getTagCompound().setInteger("Energy", energy - Config.hardenedExchangerPerBlockRF);
if (stack.getItem() instanceof ItemHardenedExchanger && stack.getTagCompound().getInteger("Energy") >= Config.hardenedPerBlockUse) {
stack.getTagCompound().setInteger("Energy", energy - Config.hardenedPerBlockUse);
}
if (stack.getItem() instanceof ItemReinforcedExchanger && stack.getTagCompound().getInteger("Energy") >= Config.reinforcedExchangerPerBlockRF) {
stack.getTagCompound().setInteger("Energy", energy - Config.reinforcedExchangerPerBlockRF);
if (stack.getItem() instanceof ItemReinforcedExchanger && stack.getTagCompound().getInteger("Energy") >= Config.reinforcedPerBlockUse) {
stack.getTagCompound().setInteger("Energy", energy - Config.reinforcedPerBlockUse);
}
if (stack.getItem() instanceof ItemSignalumExchanger && stack.getTagCompound().getInteger("Energy") >= Config.signalumExchangerPerBlockRF) {
stack.getTagCompound().setInteger("Energy", energy - Config.signalumExchangerPerBlockRF);
if (stack.getItem() instanceof ItemSignalumExchanger && stack.getTagCompound().getInteger("Energy") >= Config.signalumPerBlockUse) {
stack.getTagCompound().setInteger("Energy", energy - Config.signalumPerBlockUse);
}
if (stack.getItem() instanceof ItemResonantExchanger && stack.getTagCompound().getInteger("Energy") >= Config.resonantExchangerPerBlockRF) {
stack.getTagCompound().setInteger("Energy", energy - Config.resonantExchangerPerBlockRF);
if (stack.getItem() instanceof ItemResonantExchanger && stack.getTagCompound().getInteger("Energy") >= Config.resonantPerBlockUse) {
stack.getTagCompound().setInteger("Energy", energy - Config.resonantPerBlockUse);
}
//Mekanism Exchangers
if (stack.getItem() instanceof ItemBasicExchanger && stack.getTagCompound().getInteger("Energy") >= Config.basicExchangerPerBlockRF) {
stack.getTagCompound().setInteger("Energy", energy - Config.basicExchangerPerBlockRF);
if (stack.getItem() instanceof ItemBasicExchanger && stack.getTagCompound().getInteger("Energy") >= Config.basicPerBlockUse) {
stack.getTagCompound().setInteger("Energy", energy - Config.basicPerBlockUse);
}
if (stack.getItem() instanceof ItemAdvancedExchanger && stack.getTagCompound().getInteger("Energy") >= Config.advancedExchangerPerBlockRF) {
stack.getTagCompound().setInteger("Energy", energy - Config.advancedExchangerPerBlockRF);
if (stack.getItem() instanceof ItemAdvancedExchanger && stack.getTagCompound().getInteger("Energy") >= Config.advancedPerBlockUse) {
stack.getTagCompound().setInteger("Energy", energy - Config.advancedPerBlockUse);
}
if (stack.getItem() instanceof ItemEliteExchanger && stack.getTagCompound().getInteger("Energy") >= Config.eliteExchangerPerBlockRF) {
stack.getTagCompound().setInteger("Energy", energy - Config.eliteExchangerPerBlockRF);
if (stack.getItem() instanceof ItemEliteExchanger && stack.getTagCompound().getInteger("Energy") >= Config.elitePerBlockUse) {
stack.getTagCompound().setInteger("Energy", energy - Config.elitePerBlockUse);
}
if (stack.getItem() instanceof ItemUltimateExchanger && stack.getTagCompound().getInteger("Energy") >= Config.ultimateExchangerPerBlockRF) {
stack.getTagCompound().setInteger("Energy", energy - Config.ultimateExchangerPerBlockRF);
if (stack.getItem() instanceof ItemUltimateExchanger && stack.getTagCompound().getInteger("Energy") >= Config.ultimatePerBlockUse) {
stack.getTagCompound().setInteger("Energy", energy - Config.ultimatePerBlockUse);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package me.jacky1356400.exchangers.handler;

import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent;
import me.jacky1356400.exchangers.client.Keys;
import me.jacky1356400.exchangers.handler.network.PacketHandler;
import me.jacky1356400.exchangers.handler.network.PacketToggleMode;
import me.jacky1356400.exchangers.client.Keys;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent;

public class KeyBindingsHandler {
@SubscribeEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import me.jacky1356400.exchangers.item.*;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
package me.jacky1356400.exchangers.handler;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import me.jacky1356400.exchangers.util.Exchange;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;

import java.util.*;

public class WorldEventHandler {

public static Map<Integer, Set<Exchange>> exchanges = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import io.netty.buffer.ByteBuf;
import me.jacky1356400.exchangers.handler.ExchangerHandler;
import me.jacky1356400.exchangers.item.ItemExchangerBase;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@

import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.capabilities.CapabilityInject;
import net.minecraftforge.energy.IEnergyStorage;

public class EnergyHelper {

@CapabilityInject (IEnergyStorage.class)

public static ItemStack setDefaultEnergyTag(ItemStack container, int energy) {

if (!container.hasTagCompound()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public static String localize(String unlocalized, Object... args) {
return localize(unlocalized, true, args);
}

@SuppressWarnings("deprecation")
public static String localize(String unlocalized, boolean prefix, Object... args) {
String toLocalize = (prefix ? Exchangers.PREFIX : "") + unlocalized;
if(args != null && args.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
package me.jacky1356400.exchangers.item;

import me.jacky1356400.exchangers.handler.ExchangerHandler;
import me.jacky1356400.exchangers.helper.StringHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;

import java.util.List;

import static me.jacky1356400.exchangers.helper.StringHelper.localize;

public class ItemExchangerBase extends ExchangerHandler {

public boolean showDurabilityBar(ItemStack stack) {
return stack.isItemDamaged();
}

public boolean isPowered() {
return false;
}

@Override
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean bool) {
super.addInformation(stack, player, tooltip, bool);
if (!isPowered()){
tooltip.add(StringHelper.formatNumber(stack.getMaxDamage() - stack.getItemDamage()) + " / " + StringHelper.formatNumber(stack.getMaxDamage()) + " " + localize("tooltip.durability"));
}
}

}
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
package me.jacky1356400.exchangers.item;

import cofh.api.energy.IEnergyContainerItem;
import me.jacky1356400.exchangers.handler.ExchangerHandler;
import me.jacky1356400.exchangers.helper.EnergyHelper;
import me.jacky1356400.exchangers.helper.NBTHelper;
import me.jacky1356400.exchangers.helper.StringHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;

import java.text.NumberFormat;
import java.util.List;

public class ItemExchangerBaseRF extends ExchangerHandler implements IEnergyContainerItem {
public class ItemExchangerBaseRF extends ItemExchangerBase implements IEnergyContainerItem {

@Override
public int receiveEnergy(ItemStack container, int energy, boolean simulate) {
Expand Down Expand Up @@ -57,4 +55,9 @@ public boolean isDamaged(ItemStack stack) {
return true;
}

@Override
public boolean isPowered() {
return true;
}

}
Loading

0 comments on commit 2774fef

Please sign in to comment.