mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 14:16:45 +01:00
Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO into endgame
This commit is contained in:
commit
3e937c183f
@ -1,7 +1,7 @@
|
||||
Version 2.1.175
|
||||
Fixed a bug where mcMMO would occasionally give a 65 item stack from a double smelt on a furnace
|
||||
Fixed a bug where arrows could be duped when fired from a crossbow with piercing enchantment
|
||||
Added setting to enable or disable Green Thumb automatically replanting crops per crop to config.yml under 'Green_Thumb_Replanting_Crops' section
|
||||
Version 2.1.176
|
||||
Added another measure to prevent item stacks from reaching 65 from double smelt
|
||||
Updated Adventure (our text dependency) fixes some errors when using color codes in party/admin chat (thanks TheBusyBiscuit)
|
||||
Added some support for negative Y values in anticipation of 1.17 world height changes (thanks t00thpick1)
|
||||
(API) Many skills with RNG elements now send out a SubSkillEvent (which can be used to modify probability or cancel the results), some skills without RNG still send out this event when activated, this event is cancellable so it can be used to make a skill fail
|
||||
Treasure drop rate from Shake, Fishing, Hylian, and Excavation now benefit from the Luck perk
|
||||
Added a setting to chat.yml to toggle sending party or admin chat messages to console
|
||||
@ -57,6 +57,11 @@ Version 2.1.175
|
||||
New Power Level Command
|
||||
This power level command gives you a view of all your current masteries, it also provides a summary of your power level.
|
||||
|
||||
Version 2.1.175
|
||||
Fixed a bug where mcMMO would occasionally give a 65 item stack from a double smelt on a furnace
|
||||
Fixed a bug where arrows could be duped when fired from a crossbow with piercing enchantment
|
||||
Added setting to enable or disable Green Thumb automatically replanting crops per crop to config.yml under 'Green_Thumb_Replanting_Crops' section
|
||||
|
||||
Version 2.1.174
|
||||
Some legacy color codes in our locale file were swapped to &-code equivalents (thanks ViaSnake)
|
||||
Updated hu_HU locale (thanks andris155)
|
||||
|
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>2.1.175-SNAPSHOT</version>
|
||||
<version>2.1.176-SNAPSHOT</version>
|
||||
<name>mcMMO</name>
|
||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||
<scm>
|
||||
|
@ -117,7 +117,7 @@ public class InventoryListener implements Listener {
|
||||
//Profile doesn't exist
|
||||
if(offlineProfile != null) {
|
||||
//Process smelting
|
||||
offlineProfile.getSmeltingManager().smeltProcessing(event);
|
||||
offlineProfile.getSmeltingManager().smeltProcessing(event, furnace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,8 +10,10 @@ import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import org.bukkit.block.Furnace;
|
||||
import org.bukkit.event.inventory.FurnaceBurnEvent;
|
||||
import org.bukkit.event.inventory.FurnaceSmeltEvent;
|
||||
import org.bukkit.inventory.FurnaceInventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -109,31 +111,43 @@ public class SmeltingManager extends SkillManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void smeltProcessing(@NotNull FurnaceSmeltEvent furnaceSmeltEvent) {
|
||||
ItemStack sourceItemStack = furnaceSmeltEvent.getSource();
|
||||
ItemStack resultItemStack = furnaceSmeltEvent.getResult();
|
||||
public void smeltProcessing(@NotNull FurnaceSmeltEvent furnaceSmeltEvent, @NotNull Furnace furnace) {
|
||||
applyXpGain(Smelting.getResourceXp(furnaceSmeltEvent.getSource()), XPGainReason.PVE, XPGainSource.PASSIVE); //Add XP
|
||||
|
||||
applyXpGain(Smelting.getResourceXp(sourceItemStack), XPGainReason.PVE, XPGainSource.PASSIVE); //Add XP
|
||||
int itemLimit = resultItemStack.getMaxStackSize();
|
||||
|
||||
processDoubleSmelt(furnaceSmeltEvent, resultItemStack, itemLimit);
|
||||
processDoubleSmelt(furnaceSmeltEvent, furnace);
|
||||
}
|
||||
|
||||
private void processDoubleSmelt(@NotNull FurnaceSmeltEvent furnaceSmeltEvent, @NotNull ItemStack resultItemStack, int itemLimit) {
|
||||
//TODO: Permission check work around, could store it as NBT on the furnace
|
||||
//We don't do permission checks because this can be for an offline player and Bukkit has nothing to grab permissions for offline players
|
||||
private void processDoubleSmelt(@NotNull FurnaceSmeltEvent furnaceSmeltEvent, @NotNull Furnace furnace) {
|
||||
ItemStack resultItemStack = furnaceSmeltEvent.getResult();
|
||||
/*
|
||||
doubleSmeltCondition should be equal to the max
|
||||
*/
|
||||
|
||||
//Process double smelt
|
||||
if (Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.SMELTING, resultItemStack.getType())
|
||||
&& resultItemStack.getAmount() < itemLimit
|
||||
&& canDoubleSmeltItemStack(furnace) //Effectively two less than max stack size
|
||||
&& isSecondSmeltSuccessful()) {
|
||||
|
||||
ItemStack newResult = resultItemStack.clone();
|
||||
newResult.setAmount(Math.min(resultItemStack.getAmount() + 1, itemLimit)); //Don't go over max stack limits
|
||||
furnaceSmeltEvent.setResult(newResult);
|
||||
ItemStack doubleSmeltStack = resultItemStack.clone(); //TODO: Necessary?
|
||||
doubleSmeltStack.setAmount(resultItemStack.getAmount() + 1); //Add one
|
||||
furnaceSmeltEvent.setResult(doubleSmeltStack); //Set result
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canDoubleSmeltItemStack(@NotNull Furnace furnace) {
|
||||
FurnaceInventory furnaceInventory = furnace.getInventory();
|
||||
ItemStack furnaceResult = furnaceInventory.getResult();
|
||||
|
||||
if(furnaceResult == null)
|
||||
return false;
|
||||
|
||||
int resultAmount = furnaceResult.getAmount(); //Amount before double smelt
|
||||
int itemLimit = furnaceResult.getMaxStackSize();
|
||||
int doubleSmeltCondition = itemLimit - 2; //Don't double smelt if it would cause an illegal stack size
|
||||
|
||||
return resultAmount <= doubleSmeltCondition;
|
||||
}
|
||||
|
||||
public int vanillaXPBoost(int experience) {
|
||||
return experience * getVanillaXpMultiplier();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user