Skip to content

Commit

Permalink
Fixed bug in the item cyclic:offset_scepter #2427 and rebalance reach…
Browse files Browse the repository at this point in the history
… enchant
  • Loading branch information
Lothrazar committed Oct 18, 2024
1 parent 99864df commit c736392
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ org.gradle.daemon=false

mod_id=cyclic
curse_id=239286
mod_version=1.12.15-SNAPSHOT
mod_version=1.12.15


# NEO FORGED
Expand Down
21 changes: 12 additions & 9 deletions src/main/java/com/lothrazar/cyclic/enchant/ReachEnchant.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@
******************************************************************************/
package com.lothrazar.cyclic.enchant;

import java.util.Map;
import java.util.UUID;
import com.lothrazar.library.enchant.EnchantmentFlib;
import com.lothrazar.library.util.AttributesUtil;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.item.enchantment.EnchantmentCategory;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraftforge.common.ForgeConfigSpec.BooleanValue;
Expand All @@ -47,9 +49,9 @@ public ReachEnchant(Rarity rarityIn, EnchantmentCategory typeIn, EquipmentSlot..
MinecraftForge.EVENT_BUS.register(this);
}

// TOTAL: 5 + boost 5 8 10 12 14 16 ... 20 ... 24
// level 0 1 2 3 4 5
final static int[] LEVELS = { 0, 3, 5, 7, 9, 11 };
// TOTAL: 5 + boost 5 9 12 16 20 24
// level 0 1 2 3 4 5
final static int[] LEVELS = { 0, 4, 7, 11, 16, 19 };

private int getBoost(int level) {
if (level < 0) {
Expand All @@ -59,8 +61,8 @@ else if (level < LEVELS.length) {
return LEVELS[level];
}
//default max level is 5, but other mods can boost this ie apotheosis so give it some gas
int oldLevel = 5; // aka LEVELS.length
return 4 * (level - LEVELS.length) + LEVELS[oldLevel];
int oldLevel = LEVELS.length - 1; // aka LEVELS.length
return 4 * (level - oldLevel) + LEVELS[oldLevel];
}

@Override
Expand Down Expand Up @@ -107,6 +109,7 @@ private void turnReachOff(Player player) {

private void turnReachOn(Player player, int level) {
player.getPersistentData().putBoolean(NBT_REACH_ON, true);

AttributesUtil.setPlayerReach(ENCHANTMENT_REACH_ID, player, getBoost(level));
}

Expand All @@ -123,10 +126,10 @@ public void onEntityUpdate(LivingTickEvent event) {
//Ticking
ItemStack armor = this.getFirstArmorStackWithEnchant(player);
int level = 0;
if (armor.isEmpty() == false && EnchantmentHelper.getEnchantments(armor) != null
&& EnchantmentHelper.getEnchantments(armor).containsKey(this)) {
//todo: maybe any armor?
level = EnchantmentHelper.getEnchantments(armor).get(this);
Map<Enchantment, Integer> enchHere = EnchantmentHelper.getEnchantments(armor);
if (armor.isEmpty() == false && enchHere != null
&& enchHere.containsKey(this)) {
level = enchHere.get(this);
}
if (level > 0) {
turnReachOn(player, level);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class EnchantRegistry {
public static final RegistryObject<LifeLeechEnchant> LIFELEECH = ENCHANTMENTS.register(LifeLeechEnchant.ID, () -> new LifeLeechEnchant(Enchantment.Rarity.UNCOMMON, EnchantmentCategory.WEAPON, EquipmentSlot.MAINHAND));
public static final RegistryObject<MagnetEnchant> MAGNET = ENCHANTMENTS.register(MagnetEnchant.ID, () -> new MagnetEnchant(Enchantment.Rarity.VERY_RARE, EnchantmentCategory.BREAKABLE, EquipmentSlot.MAINHAND));
public static final RegistryObject<QuickdrawEnchant> QUICKDRAW = ENCHANTMENTS.register(QuickdrawEnchant.ID, () -> new QuickdrawEnchant(Enchantment.Rarity.UNCOMMON, EnchantmentCategory.BOW, EquipmentSlot.MAINHAND));
public static final RegistryObject<ReachEnchant> REACH = ENCHANTMENTS.register(ReachEnchant.ID, () -> new ReachEnchant(Enchantment.Rarity.RARE, EnchantmentCategory.WEARABLE, ARMOR_SLOTS));
public static final RegistryObject<ReachEnchant> REACH = ENCHANTMENTS.register(ReachEnchant.ID, () -> new ReachEnchant(Enchantment.Rarity.COMMON, EnchantmentCategory.WEARABLE, ARMOR_SLOTS));
public static final RegistryObject<StepEnchant> STEP = ENCHANTMENTS.register(StepEnchant.ID, () -> new StepEnchant(Enchantment.Rarity.RARE, EnchantmentCategory.ARMOR_LEGS, EquipmentSlot.LEGS));
public static final RegistryObject<VenomEnchant> VENOM = ENCHANTMENTS.register(VenomEnchant.ID, () -> new VenomEnchant(Enchantment.Rarity.VERY_RARE, EnchantmentCategory.WEAPON, EquipmentSlot.MAINHAND));
public static final RegistryObject<AutoSmeltEnchant> AUTOSMELT = ENCHANTMENTS.register(AutoSmeltEnchant.ID, () -> new AutoSmeltEnchant(Enchantment.Rarity.RARE, EnchantmentCategory.DIGGER, EquipmentSlot.MAINHAND));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public class ItemRegistry {
public static final RegistryObject<Item> WIRELESS_FLUID = ITEMS.register("wireless_fluid", () -> new BlockItem(BlockRegistry.WIRELESS_FLUID.get(), new Item.Properties()));
public static final RegistryObject<Item> BUILD_SCEPTER = ITEMS.register("build_scepter", () -> new BuilderItem(new Item.Properties(), BuildStyle.NORMAL));
public static final RegistryObject<Item> REPLACE_SCEPTER = ITEMS.register("replace_scepter", () -> new BuilderItem(new Item.Properties(), BuildStyle.REPLACE));
public static final RegistryObject<Item> OFFSET_SCEPTER = ITEMS.register("offset_scepter", () -> new BuilderItem(new Item.Properties(), BuildStyle.REPLACE));
public static final RegistryObject<Item> OFFSET_SCEPTER = ITEMS.register("offset_scepter", () -> new BuilderItem(new Item.Properties(), BuildStyle.OFFSET));
public static final RegistryObject<Item> RANDOMIZE_SCEPTER = ITEMS.register("randomize_scepter", () -> new RandomizerItem(new Item.Properties()));
public static final RegistryObject<Item> SPAWNINSPECTOR = ITEMS.register("spawn_inspector", () -> new SpawnInspectorTool(new Item.Properties().durability(256)));
public static final RegistryObject<Item> CHARM_WING = ITEMS.register("charm_wing", () -> new CharmWing(new Item.Properties().durability(64)));
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/assets/cyclic/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -581,16 +581,22 @@
"enchantment.cyclic.beekeeper": "Beekeeping",
"enchantment.cyclic.beekeeper.desc": "Protection against thorny and flying damage.",
"enchantment.cyclic.beekeeper.guide": "Protection against thorny and flying damage. First level prevent bee, bat, and llama spit damage. Level II or higher prevents phantom damage. ",
"block.cyclic.biomass_block": "Liquid Biomass",
"fluid_type.cyclic.biomass": "Liquid Biomass",
"fluid.cyclic.biomass.guide": "Combine solid Biomass with various organic material in a Melter to create Fluid Biomass.",
"block.cyclic.honey_block": "Liquid Honey",
"fluid_type.cyclic.honey": "Liquid Honey",
"fluid.cyclic.honey.guide": "Fluid Honey can be extracted from honey byproducts in a Melting Chamber and is used in a Solidification Chamber.",
"block.cyclic.wax_block": "Liquid Wax",
"fluid_type.cyclic.wax": "Liquid Wax",
"fluid.cyclic.wax.guide": "An empty honeycomb can be melted into wax. See recipes in Melting Chamber and Solidification Chamber.",
"block.cyclic.magma_block": "Liquid Magma",
"fluid_type.cyclic.magma": "Liquid Magma",
"fluid.cyclic.magma.guide": "Fluid Magma can be extracted from Magma Blocks or Magma Cream in a Melting Chamber and is used in a Solidification Chamber.",
"block.cyclic.slime_bock": "Liquid Slime",
"fluid_type.cyclic.slime": "Liquid Slime",
"fluid.cyclic.slime.guide": "Fluid Slime can be extracted from Slimeballs or Slime Blocks in a Melting Chamber and is used in a Solidification Chamber.",
"block.cyclic.xpjuice_block": "Liquid Experience",
"fluid_type.cyclic.xpjuice": "Liquid Experience",
"fluid.cyclic.xpjuice.guide": "Fluid Experience is created and used by the Experience Pylon.",
"item.cyclic.amber_bucket": "Amber Bucket",
Expand Down
2 changes: 1 addition & 1 deletion update.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,6 @@
,"1.12.12":"Added config controls to the settings in the item.laser_cannon laser beam; along with a new option to render the laser even when you miss. Battery and Claystone Battery now have their storage capacity defined in the config file. Some default config values have been changed, and upper limits have been raised. Increase capacity of the (creative) Infinite Battery. Rebalanced recipes for Breaker and Placer. Fix a bug where if the Item User is configured to consume energy, it still had the capability (connected to cables and showed RF in Jade); fixed to match behavior of other configured blocks "
,"1.12.13":"Fix Mattock not saving contents of Shulker Boxes when mined #2411. Block Reach enchantment now has max level 5 to give players more control of how far the reach boost is increased; so levels I through V are now available. Since players normally have 5 blocks of reach distance: level I reaches 8, II reaches 10, III reaches 12, IV reaches 14, and V reaches 16 blocks (+4 for anything beyond with something like apotheosis)"
,"1.12.14":"New feature with cables: hide them using solid blocks with a feature called 'facades', just sneak-left-click a block onto the cable (empty hand to remove it); this does not use any items and can be managed/disabled in the config file. Renamed 'Concentrated Glowstone' to 'Glowstone Facade' and 'Concentrated Soundproofing' to 'Soundproofing Facade'. Fixed issues with both blocks to correctly render facades (use sneak-left-click while not in creative), and they no longer have an inventory"
,"1.12.15":"Tweaked block model visuals of the Transfer Nodes. Add recipes in the solidifier machine for Waxed copper blocks "
,"1.12.15":"Fixed bug in the item cyclic:offset_scepter #2427. Slightly Boost the strength of the Reach enchantments. Tweaked block model visuals of the Transfer Nodes. Add recipes in the solidifier machine for Waxed copper blocks "
}
}

0 comments on commit c736392

Please sign in to comment.