Skip to content

Commit

Permalink
1.2 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
JackyyTV committed Oct 3, 2020
1 parent 9820de4 commit 9de558c
Show file tree
Hide file tree
Showing 10 changed files with 104 additions and 97 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ Submit any bug reports / suggestions via [issue tracker](https://github.com/Jack
## Contact Me

- Twitter DM - [@JackyyTV](https://twitter.com/JackyyTV)
- Discord DM - Jacky#3044
- Discord DM - Jacky#1234
- Twitch PM - [Jackyy](https://www.twitch.tv/jackyy)
- Reddit DM - [Jacky1356400](https://www.reddit.com/message/compose/?to=Jacky1356400)
- Reddit DM - [JackyyTV](https://www.reddit.com/message/compose/?to=JackyyTV)

---

Expand All @@ -37,7 +37,7 @@ If you would like to set up the workspace yourself to submit PRs of features add
- Decompiled source: `gradlew setupDecompWorkspace`
- Obfuscated source: `gradlew setupDevWorkspace`
- CI server: `gradlew setupCIWorkspace`

3. Either use `gradlew build` to build the jar file (Output is in `build/libs`), or setup the IDE if you are going to modify any codes. Both IntelliJ IDEA and Eclipse are included below since they're more popular IDEs.
- IntelliJ IDEA: Do `gradlew idea`, open the `.ipr` file and import the gradle file, then execute the `genIntellijRuns` task in the "Gradle" tab.
- Eclipse: Do `gradlew eclipse` and open the directory as project.
109 changes: 55 additions & 54 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
buildscript {
repositories {
jcenter()
maven { url = "http://files.minecraftforge.net/maven" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
}
repositories {
jcenter()
maven { url = "http://files.minecraftforge.net/maven" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'

Expand All @@ -15,75 +15,76 @@ archivesBaseName = "AvaritiaTweaks"

sourceCompatibility = targetCompatibility = "1.8"
compileJava {
sourceCompatibility = targetCompatibility = "1.8"
sourceCompatibility = targetCompatibility = "1.8"
}

minecraft {
version = "${forge_version}"
runDir = "run"
mappings = "${mappings_version}"
version = "${forge_version}"
runDir = "run"
mappings = "${mappings_version}"

replace '@FINGERPRINT@', project.findProperty('signSHA1')
replaceIn "AvaritiaTweaks.java"
replace '@FINGERPRINT@', project.findProperty('signSHA1')
replaceIn "AvaritiaTweaks.java"
}

repositories {
maven {
name = "JEI Maven"
url = "http://dvs1.progwml6.com/files/maven"
}
maven {
name = "Hwyla Maven"
url = "https://tehnut.info/maven"
}
maven {
name = "CB Maven"
url = "http://chickenbones.net/maven"
}
maven {
name = "CoFH Maven"
url = "http://maven.covers1624.net"
}
maven {
name = "JEI Maven"
url = "https://dvs1.progwml6.com/files/maven"
}
maven {
name = "CB Maven"
url = "http://chickenbones.net/maven"
}
maven {
name = "CoFH Maven"
url = "http://maven.covers1624.net"
}
maven {
name = "Curse Maven"
url = "https://www.cursemaven.com"
}
}

dependencies {
compile files('libs/')
deobfCompile "mezz.jei:jei_1.10.2:+"
deobfCompile "mcp.mobius.waila:Hwyla:1.8.17-B31_1.10.2"
deobfCompile "codechicken:CodeChickenLib:1.10.2-+:universal"
deobfCompile "mezz.jei:jei_1.10.2:+"
deobfCompile "curse.maven:hwyla:2433252" //1.8.17-B31_1.10.2
deobfCompile "codechicken:CodeChickenLib:1.10.2-+:universal"
deobfCompile "curse.maven:avaritia:2441664" //1.10.2-2.2.7
deobfCompile "curse.maven:botania:2391169" //r1.9-341
}

processResources {
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'version':project.version, 'mcversion':project.minecraft.version
}
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'version':project.version, 'mcversion':project.minecraft.version
}
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}

task signJar(type: SignJar, dependsOn: reobfJar) {
onlyIf {
project.hasProperty('keyStore')
}
keyStore = project.findProperty('keyStore')
alias = project.findProperty('keyStoreAlias')
storePass = project.findProperty('keyStorePass')
keyPass = project.findProperty('keyStoreKeyPass')
inputFile = jar.archivePath
outputFile = jar.archivePath
onlyIf {
project.hasProperty('keyStore')
}
keyStore = project.findProperty('keyStore')
alias = project.findProperty('keyStoreAlias')
storePass = project.findProperty('keyStorePass')
keyPass = project.findProperty('keyStoreKeyPass')
inputFile = jar.archivePath
outputFile = jar.archivePath
}

build.dependsOn signJar

task deobfJar(type: Jar) {
from sourceSets.main.output
classifier = 'deobf'
from sourceSets.main.output
classifier = 'deobf'
}

artifacts {
archives deobfJar
archives deobfJar
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
org.gradle.jvmargs=-Xmx4G
mc_version=1.10.2
forge_version=1.10.2-12.18.3.2511
mod_version=1.1
mod_version=1.2
mappings_version=snapshot_20161111
Binary file removed libs/Avaritia-1.10.2-2.2.7-deobf.jar
Binary file not shown.
Binary file removed libs/Botania r1.9-341-deobf.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion src/main/java/jackyy/avaritiatweaks/AvaritiaTweaks.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class AvaritiaTweaks {

public static final String MODID = "avaritiatweaks";
public static final String MODNAME = "Avaritia Tweaks";
public static final String VERSION = "1.10.2-1.1";
public static final String VERSION = "1.10.2-1.2";
public static final String MCVERSION = "[1.10,1.11)";
public static final String DEPENDS = "required-after:avaritia;required-after:CodeChickenLib;after:Botania;";
public static final String GUIFACTORY = "jackyy.avaritiatweaks.config.ConfigGuiFactory";
Expand Down
59 changes: 22 additions & 37 deletions src/main/java/jackyy/avaritiatweaks/tweaks/ModEventsHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import jackyy.avaritiatweaks.config.ModConfig;
import jackyy.avaritiatweaks.packet.PacketHandler;
import jackyy.avaritiatweaks.packet.PacketToggleNoClip;
import jackyy.avaritiatweaks.util.ModUtils;
import morph.avaritia.handler.AvaritiaEventHandler;
import morph.avaritia.init.ModItems;
import morph.avaritia.item.ItemArmorInfinity;
import morph.avaritia.item.tools.ItemSwordInfinity;
import morph.avaritia.util.TextUtils;
import net.minecraft.block.Block;
Expand All @@ -17,8 +17,6 @@
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
Expand Down Expand Up @@ -72,48 +70,35 @@ public void onLeftClick(PlayerInteractEvent.LeftClickBlock event) {
public void armorTick(LivingEvent.LivingUpdateEvent event) {
if (event.getEntityLiving() instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer)event.getEntityLiving();
if (isArmorValid(player, EntityEquipmentSlot.HEAD)) {
checkAndAddEffect(player, ModConfig.infinityArmor.infinityHelmetPotionEffects);
if (ModUtils.isArmorValid(player, EntityEquipmentSlot.HEAD)) {
ModUtils.checkAndAddEffect(player, ModConfig.infinityArmor.infinityHelmetPotionEffects);
}
if (isArmorValid(player, EntityEquipmentSlot.CHEST)) {
checkAndAddEffect(player, ModConfig.infinityArmor.infinityChestplatePotionEffects);
if (ModUtils.isArmorValid(player, EntityEquipmentSlot.CHEST)) {
ModUtils.checkAndAddEffect(player, ModConfig.infinityArmor.infinityChestplatePotionEffects);
}
if (isArmorValid(player, EntityEquipmentSlot.LEGS)) {
checkAndAddEffect(player, ModConfig.infinityArmor.infinityLeggingsPotionEffects);
if (ModUtils.isArmorValid(player, EntityEquipmentSlot.LEGS)) {
ModUtils.checkAndAddEffect(player, ModConfig.infinityArmor.infinityLeggingsPotionEffects);
}
if (isArmorValid(player, EntityEquipmentSlot.FEET)) {
checkAndAddEffect(player, ModConfig.infinityArmor.infinityBootsPotionEffects);
if (ModUtils.isArmorValid(player, EntityEquipmentSlot.FEET)) {
ModUtils.checkAndAddEffect(player, ModConfig.infinityArmor.infinityBootsPotionEffects);
}
if (isArmorValid(player, EntityEquipmentSlot.CHEST) && AvaritiaEventHandler.isInfinite(player) && noClip) {
player.capabilities.isFlying = true;
player.noClip = true;
}
if (!AvaritiaEventHandler.isInfinite(player) && !noClip) {
player.noClip = false;
}
if (noClip && !player.capabilities.isFlying) {
player.capabilities.isFlying = true;
}
}
}

private static boolean isArmorValid(EntityPlayer player, EntityEquipmentSlot slot) {
ItemStack armor = player.getItemStackFromSlot(slot);
return armor != null && armor.getItem() instanceof ItemArmorInfinity
&& armor.getTagCompound() != null && armor.getTagCompound().getInteger("enhanced") == 1;
}

private static void checkAndAddEffect(EntityPlayer player, String[] potions) {
for (String potion : potions) {
Potion effect = Potion.getPotionFromResourceLocation(potion);
if (effect != null) {
player.addPotionEffect(new PotionEffect(effect, 300, 0, false, false));
if (ModConfig.infinityArmor.infinityArmorNoClip && !player.isSpectator()) {
if (ModUtils.isArmorValid(player, EntityEquipmentSlot.CHEST) && AvaritiaEventHandler.isInfinite(player) && noClip) {
player.capabilities.isFlying = true;
player.noClip = true;
}
if (!AvaritiaEventHandler.isInfinite(player) && !noClip) {
player.noClip = false;
}
if (noClip && !player.capabilities.isFlying) {
player.capabilities.isFlying = true;
}
}
}
}

public static void toggleNoClip(EntityPlayer player) {
if (isArmorValid(player, EntityEquipmentSlot.CHEST)) {
if (ModUtils.isArmorValid(player, EntityEquipmentSlot.CHEST)) {
if (MAP.containsKey(player) && MAP.get(player)) {
MAP.remove(player);
noClip = false;
Expand All @@ -134,7 +119,7 @@ public void onTooltip(ItemTooltipEvent event) {
if (item instanceof ItemSwordInfinity && ModConfig.tweaks.fixInfinitySwordTooltip) {
for (int x = 0; x < tooltip.size(); x++) {
if (tooltip.get(x).contains(I18n.format("attribute.name.generic.attackDamage"))) {
tooltip.set(x, " " + TextUtils.makeFabulous(I18n.format("tip.infinity")) + " "
tooltip.set(x, " " + TextUtils.makeFabulous(I18n.format("tooltips.avaritiatweaks.infinite")) + " "
+ TextFormatting.GRAY + I18n.format("attribute.name.generic.attackDamage"));
return;
}
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/jackyy/avaritiatweaks/util/ModUtils.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package jackyy.avaritiatweaks.util;

import jackyy.avaritiatweaks.tweaks.ModTweaks;
import morph.avaritia.item.ItemArmorInfinity;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Enchantments;
import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
Expand Down Expand Up @@ -89,4 +94,19 @@ public static void addEnhancementToolsRecipe(ItemStack input, ItemStack output,
GameRegistry.addShapelessRecipe(input, output);
}

public static boolean isArmorValid(EntityPlayer player, EntityEquipmentSlot slot) {
ItemStack armor = player.getItemStackFromSlot(slot);
return armor != null && armor.getItem() instanceof ItemArmorInfinity
&& armor.getTagCompound() != null && armor.getTagCompound().getInteger("enhanced") == 1;
}

public static void checkAndAddEffect(EntityPlayer player, String[] potions) {
for (String potion : potions) {
Potion effect = Potion.getPotionFromResourceLocation(potion);
if (effect != null) {
player.addPotionEffect(new PotionEffect(effect, 300, 0, false, false));
}
}
}

}
1 change: 1 addition & 0 deletions src/main/resources/assets/avaritiatweaks/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ tile.avaritiatweaks.gaia_block.name=Gaia Block
tooltips.avaritiatweaks.enhancement_crystal=Infinity isn't even enough.
tooltips.avaritiatweaks.noclip.enabled=No Clip Mode: §a§lEnabled§r
tooltips.avaritiatweaks.noclip.disabled=No Clip Mode: §c§lDisabled§r
tooltips.avaritiatweaks.infinite=Infinite

#Messages
msg.avaritiatweaks.noclip.enabled=No Clip Mode is now §aEnabled§r
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/mcmod.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"modid": "avaritiatweaks",
"name": "Avaritia Tweaks",
"description": "Enhances Avaritia to another level!",
"version": "1.10.2-1.1",
"version": "1.10.2-1.2",
"mcversion": "1.10.2",
"url": "https://github.com/JackyyTV/AvaritiaTweaks",
"updateUrl": "",
Expand Down

0 comments on commit 9de558c

Please sign in to comment.