Skip to content

Commit

Permalink
1.2.3
Browse files Browse the repository at this point in the history
fix serverside/clientside problems
localization
  • Loading branch information
arlyon committed Aug 5, 2017
1 parent c507d29 commit b7d2571
Show file tree
Hide file tree
Showing 92 changed files with 150 additions and 20 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
version 1.2.

- fix serverside and clientside
- add rarity setting

version 1.2

- added enchantment book to creative
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.


version = "1.2.2"
version = "1.2.3"
group = "arlyon.felling" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "felling"

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/arlyon/felling/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

/**
* Created by Alexander Lyon on 30.07.2017.
*
* Controls the configurable options in the mod config menu.
*/

public class Configuration {
Expand All @@ -11,5 +13,6 @@ public class Configuration {
public static boolean disableWhenStanding = false;
public static int durabilityDamage = 2;
public static int leafMultiplier = 100;
public static int enchantmentRarity = 100;

}
2 changes: 1 addition & 1 deletion src/main/java/arlyon/felling/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
public class Constants {
public static final String MOD_NAME = "Felling";
public static final String MODID = "felling";
public static final String VERSION = "1.2.2";
public static final String VERSION = "1.2.3";
public static final Enchantment felling = new Enchantment(net.minecraft.enchantment.Enchantment.Rarity.UNCOMMON, EntityEquipmentSlot.MAINHAND);
}
42 changes: 27 additions & 15 deletions src/main/java/arlyon/felling/Enchantment.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,49 @@

import java.util.Arrays;

/**
* The enchantment class for the Felling enchantment.
*/
public class Enchantment extends net.minecraft.enchantment.Enchantment {

// creates a new enchantment type called axe that can be applied on any tool with the class axe.
private static EnumEnchantmentType AXE = EnumHelper.addEnchantmentType("AXE", item -> item.getToolClasses(new ItemStack(item)).stream().anyMatch(toolClass -> toolClass.equals("axe")));
/**
* Axe enchantment type.
*/
public static EnumEnchantmentType AXE = EnumHelper.addEnchantmentType("AXE", item -> {
assert item != null;
return item.getToolClasses(new ItemStack(item)).stream().anyMatch(toolClass -> toolClass.equals("axe"));
});

public Enchantment(Rarity rarityIn, EntityEquipmentSlot... slots) {
/**
* Sets name and registry name and assigns the proper predicate.
*
* @param rarityIn the rarity of the enchantment
* @param slots the slots in which the enchantment is valid
*/
Enchantment(Rarity rarityIn, EntityEquipmentSlot... slots) {
super(rarityIn, AXE, slots);
setName("felling");
setRegistryName("felling");

// add it to the creative tab
EnumEnchantmentType[] enchantmentTypes = CreativeTabs.TOOLS.getRelevantEnchantmentTypes();
enchantmentTypes = Arrays.copyOf(enchantmentTypes, enchantmentTypes.length+1);
enchantmentTypes[enchantmentTypes.length-1] = AXE;

CreativeTabs.TOOLS.setRelevantEnchantmentTypes(enchantmentTypes);
}

/**
* Returns the minimal value of enchantability needed on the enchantment level passed.
*
* Felling I - 20
* Felling II - 35
*
* @param enchantmentLevel The level you want to get minimum enchantability weight for.
* @return Minimus value of enchantability for the given enchantment level.
*/
public int getMinEnchantability(int enchantmentLevel) { return 5 + (enchantmentLevel) * 15; }
public int getMinEnchantability(int enchantmentLevel) { return ((5 + (enchantmentLevel) * 15) * Configuration.enchantmentRarity) / 100; }

/**
* Returns the maximum value of enchantability needed on the enchantment level passed.
* Felling I - 35
* Felling II - 50
*
* @param enchantmentLevel The level you want to get maximun enchantability weight for.
* @return Maximum value of enchantability for the given enchantment level.
*/
public int getMaxEnchantability(int enchantmentLevel) {
return this.getMinEnchantability(enchantmentLevel) + 50;
return this.getMinEnchantability(enchantmentLevel) + 15;
}

/**
Expand Down
15 changes: 13 additions & 2 deletions src/main/java/arlyon/felling/EventHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,19 @@
import java.util.Random;

/**
* Handles the destroying of trees with the felling enchantment.
* The event handler container for both the FellingEvent and the RegistryEvent
*/

public class EventHandler {

/**
* The felling event subscriber class, which contains all the required functions for the subscriber.
*/
@Mod.EventBusSubscriber(modid = Constants.MODID)
public static class FellingEventHandler {

/**
* Used to determine which part of the tree a block is.
*/
private enum TreePart {
LEAF,
LOG,
Expand Down Expand Up @@ -80,6 +86,11 @@ private static TreePart getTreePart(Block block) {
*/
@SubscribeEvent
public static void fellTreeSubscriber(BlockEvent.BreakEvent event) {

if (event.getWorld().isRemote) {
return;
}

EntityPlayer thePlayer = event.getPlayer();
ItemStack mainHandItem = thePlayer.getHeldItemMainhand();
int enchantmentLevel = EnchantmentHelper.getEnchantmentLevel(Constants.felling, mainHandItem);
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/arlyon/felling/proxy/ProxyClient.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
package arlyon.felling.proxy;

import arlyon.felling.Enchantment;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.EnumEnchantmentType;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

import java.util.Arrays;

public class ProxyClient extends ProxyCommon {

@Override
public void preInit(FMLPreInitializationEvent e) {

super.preInit(e);

// add it to the creative tab
EnumEnchantmentType[] enchantmentTypes = CreativeTabs.TOOLS.getRelevantEnchantmentTypes();
enchantmentTypes = Arrays.copyOf(enchantmentTypes, enchantmentTypes.length+1);
enchantmentTypes[enchantmentTypes.length-1] = Enchantment.AXE;
CreativeTabs.TOOLS.setRelevantEnchantmentTypes(enchantmentTypes);

}

@Override
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/af_ZA.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Afkap
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/ar_SA.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=قطع
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/az_AZ.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Kəsmə
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/be_BY.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=рубка
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/bg_BG.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=сечене
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/br_FR.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Abattage
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/ca-val_ES.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Tala
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/ca_ES.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Talla
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/cs_CZ.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Kácení
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/cy_GB.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Torrwch
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/de_AT.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Fällen
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/el_GR.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Περικόψει
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/en_7S.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Shiver m'Timber
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/en_AU.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Felling
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/en_CA.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Felling
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/en_GB.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Felling
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/en_NZ.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Felling
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/eo_UY.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Tala
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/es_AR.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Talar
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/es_MX.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Talar
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/es_UY.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Talar
3 changes: 3 additions & 0 deletions src/main/resources/assets/felling/lang/es_VE.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//Translation by: Dorzar / VeryHardChamp
//Act. 30/07/2017
enchantment.felling=Talado Rápido
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/et_EE.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Langetamine
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/eu_ES.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Mozketa
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/fa_IR.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=بریدن
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/fi_FI.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Hakku
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/fil_PH.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Putulin
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/fo_FO.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Felling
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/fr_CA.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Abattage
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/fr_FR.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Abattage
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/fy_NL.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Kappenfr_FR.lang
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/ga_IE.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Tala
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/gd_GB.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Tala
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/gl_ES.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Tala
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/gv_IM.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gd_GB.langenchantment.felling=Tala
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/haw.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Ana
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/he_IL.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=גְדִיעָה
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/hi_IN.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=कटाई
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/hr_HR.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Kivágás
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/hy_AM.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=կրճատել
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/id_ID.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Menebang
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/io.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Sneiða
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/is_IS.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Sneiða
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/it_IT.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Abbattere
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/ja_JP.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=伐採
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/jbo_EN.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Felling
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/ka_GE.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=დაჭრილი
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/ko_KR.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=벌목
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/ksh_DE.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Felling
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/kw_GB.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Felling
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/la_VA.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Caesa
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/lb_LU.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Opzedeelen
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/li_LI.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Felling
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/lt_LT.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Kirtavimas
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/lv_LV.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Ciršana
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/mi_NZ.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Whakairo
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/mk_MK.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Сеча
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/mn_MN.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Борлуулалт
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/ms_MY.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Penebangan
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/mt_MT.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Qtugħ
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/nds_DE.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Fällen
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/nl_NL.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Vellen
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/nn_NO.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Hogst
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/oc_FR.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Felling
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/pl_PL.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=wyrąb
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/pt_PT.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Corte
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/qya_AA.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Rist
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/ro_RO.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=tăiere
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/ru_RU.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=рубка
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/sk_SK.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=výrub
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/sl_SL.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Sečnja
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/sme.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Felling
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/so_SO.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Goynta
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/sq_AL.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=prerje
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/sr_SP.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Сечење
1 change: 1 addition & 0 deletions src/main/resources/assets/felling/lang/sv_SE.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enchantment.felling=Fällning
Loading

0 comments on commit b7d2571

Please sign in to comment.