Skip to content

Commit

Permalink
block reach changed to 5 basic levels up from 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Lothrazar committed Oct 2, 2024
1 parent d9e5456 commit 07bfa29
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 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.12
mod_version=1.12.13-SNAPSHOT


# NEO FORGED
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/lothrazar/cyclic/ModCyclic.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public class ModCyclic {
public ModCyclic() {
FMLJavaModLoadingContext.get().getModEventBus().addListener(EventRegistry::setup);
FMLJavaModLoadingContext.get().getModEventBus().addListener(ClientRegistryCyclic::setupClient);
//TODO: before port fix warnings
DistExecutor.safeRunForDist(() -> ClientRegistryCyclic::new, () -> EventRegistry::new);
ConfigRegistry cfg = new ConfigRegistry();
cfg.setupMain();
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/com/lothrazar/cyclic/enchant/GrowthEnchant.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,8 @@ public void onEntityUpdate(LivingTickEvent event) {
return;
}
LivingEntity entity = event.getEntity();
if (entity instanceof Player) {
Player p = (Player) entity;
if (p.isSpectator() || !p.isAlive()) {
if (entity instanceof Player player) {
if (player.isSpectator() || !player.isAlive()) {
return;
}
}
Expand Down
25 changes: 20 additions & 5 deletions src/main/java/com/lothrazar/cyclic/enchant/ReachEnchant.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
public class ReachEnchant extends EnchantmentFlib {

private static final String NBT_REACH_ON = "reachon";
public static final int REACH_BOOST = 11; // 16 = 11 + 5
public static final String ID = "reach";
public static BooleanValue CFG;

Expand All @@ -48,6 +47,22 @@ 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 };

private int getBoost(int level) {
if (level < 0) {
return 0;
}
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];
}

@Override
public boolean isEnabled() {
return CFG.get();
Expand Down Expand Up @@ -80,7 +95,7 @@ public boolean canApplyAtEnchantingTable(ItemStack stack) {

@Override
public int getMaxLevel() {
return 1;
return 5;
}

public static final UUID ENCHANTMENT_REACH_ID = UUID.fromString("1abcdef2-eff2-4a81-b92b-a1cb95f115c6");
Expand All @@ -90,9 +105,9 @@ private void turnReachOff(Player player) {
AttributesUtil.removePlayerReach(ENCHANTMENT_REACH_ID, player);
}

private void turnReachOn(Player player) {
private void turnReachOn(Player player, int level) {
player.getPersistentData().putBoolean(NBT_REACH_ON, true);
AttributesUtil.setPlayerReach(ENCHANTMENT_REACH_ID, player, REACH_BOOST);
AttributesUtil.setPlayerReach(ENCHANTMENT_REACH_ID, player, getBoost(level));
}

@SubscribeEvent
Expand All @@ -114,7 +129,7 @@ public void onEntityUpdate(LivingTickEvent event) {
level = EnchantmentHelper.getEnchantments(armor).get(this);
}
if (level > 0) {
turnReachOn(player);
turnReachOn(player, level);
}
else {
//was it on before, do we need to do an off hit
Expand Down
1 change: 1 addition & 0 deletions update.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,5 +185,6 @@
"1.20.10": "fix #2407 item cable guidebook page. Lunchbox when inserting items into it in the inventory with right click; you can also open the lunchbox from your open inventory by right clicking with an empty mouse cursor. Copper, Gold and Netherite chains block model now extends the vanilla reference, meaning they are compatible with any 3D chain model resource pack (such as vanillatweaks). Merge pull request #2402 from Apollounknowndev Fix lime flower generation. Merge pull request #2404 from PocketSizedWeeb: JEI Changes: Fixes issue Solidifier doesn't show liquid requirements #2369; Made the JEI category for the Melter more closely match the Melter's GUI; Moved the JEI 'Show Recipe' area for the machines line up with the progress bar; Moved the JEI \"Show Recipe\" area for the generators line up with the generator name; Every applicable JEI Category got an energy bar added to show max consumed/produced RF; Every applicable JEI Category got a progress bar to show how long the machine will run for; Edited the Melter category texture to add space for energy bar; HashMap memory leak #2383 by caching an instance of Minecraft instead of grabbing it when needed in the Packager's JEI Category; Fix Peat bog cannot be saturated with water-logged leaves #2399 by allowing water-logged blocks to hydrate peat; Solidifier/Melter: fixes desync issue by making all of the processing server sided; Crushing Macerator continues to operate and void items if full #2343; Crushing Macerator allows items to be shift-clicked into output slots #2341; Evaporation Generator:; Removed tank tooltip from before it was rotated; Fixes ; Evaporation Generator 1.19.2 #2322 by implementing a workaround since the fluid portion of FluidTagIngredient was defaulting to empty which was not allowing tagged fluids in the generator; auto crafting machine duplicate glitch #2358 by checking input before processing; Fixed an issue where the preview slot wasn't updating until the machine was processing a craft; Wireless Transmitter:; Fixed gps card inside wireless transmitter disappearing #2403 by adding an onRemove method to the transmitter that drops the gps card"
,"1.20.11":"Fix create new world crash from previous version 'Feature order cycle found minecraft:frozen_peaks': Merge pull request #2426 from Apollounknowndev/trunk/1.20.1 "
,"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":"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)"
}
}

0 comments on commit 07bfa29

Please sign in to comment.