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
|
Version 2.1.176
|
||||||
Fixed a bug where mcMMO would occasionally give a 65 item stack from a double smelt on a furnace
|
Added another measure to prevent item stacks from reaching 65 from double smelt
|
||||||
Fixed a bug where arrows could be duped when fired from a crossbow with piercing enchantment
|
Updated Adventure (our text dependency) fixes some errors when using color codes in party/admin chat (thanks TheBusyBiscuit)
|
||||||
Added setting to enable or disable Green Thumb automatically replanting crops per crop to config.yml under 'Green_Thumb_Replanting_Crops' section
|
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
|
(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
|
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
|
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
|
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.
|
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
|
Version 2.1.174
|
||||||
Some legacy color codes in our locale file were swapped to &-code equivalents (thanks ViaSnake)
|
Some legacy color codes in our locale file were swapped to &-code equivalents (thanks ViaSnake)
|
||||||
Updated hu_HU locale (thanks andris155)
|
Updated hu_HU locale (thanks andris155)
|
||||||
|
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||||
<artifactId>mcMMO</artifactId>
|
<artifactId>mcMMO</artifactId>
|
||||||
<version>2.1.175-SNAPSHOT</version>
|
<version>2.1.176-SNAPSHOT</version>
|
||||||
<name>mcMMO</name>
|
<name>mcMMO</name>
|
||||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||||
<scm>
|
<scm>
|
||||||
|
@ -117,7 +117,7 @@ public class InventoryListener implements Listener {
|
|||||||
//Profile doesn't exist
|
//Profile doesn't exist
|
||||||
if(offlineProfile != null) {
|
if(offlineProfile != null) {
|
||||||
//Process smelting
|
//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.Permissions;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
|
import org.bukkit.block.Furnace;
|
||||||
import org.bukkit.event.inventory.FurnaceBurnEvent;
|
import org.bukkit.event.inventory.FurnaceBurnEvent;
|
||||||
import org.bukkit.event.inventory.FurnaceSmeltEvent;
|
import org.bukkit.event.inventory.FurnaceSmeltEvent;
|
||||||
|
import org.bukkit.inventory.FurnaceInventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@ -109,31 +111,43 @@ public class SmeltingManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void smeltProcessing(@NotNull FurnaceSmeltEvent furnaceSmeltEvent) {
|
public void smeltProcessing(@NotNull FurnaceSmeltEvent furnaceSmeltEvent, @NotNull Furnace furnace) {
|
||||||
ItemStack sourceItemStack = furnaceSmeltEvent.getSource();
|
applyXpGain(Smelting.getResourceXp(furnaceSmeltEvent.getSource()), XPGainReason.PVE, XPGainSource.PASSIVE); //Add XP
|
||||||
ItemStack resultItemStack = furnaceSmeltEvent.getResult();
|
|
||||||
|
|
||||||
applyXpGain(Smelting.getResourceXp(sourceItemStack), XPGainReason.PVE, XPGainSource.PASSIVE); //Add XP
|
processDoubleSmelt(furnaceSmeltEvent, furnace);
|
||||||
int itemLimit = resultItemStack.getMaxStackSize();
|
|
||||||
|
|
||||||
processDoubleSmelt(furnaceSmeltEvent, resultItemStack, itemLimit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processDoubleSmelt(@NotNull FurnaceSmeltEvent furnaceSmeltEvent, @NotNull ItemStack resultItemStack, int itemLimit) {
|
private void processDoubleSmelt(@NotNull FurnaceSmeltEvent furnaceSmeltEvent, @NotNull Furnace furnace) {
|
||||||
//TODO: Permission check work around, could store it as NBT on the furnace
|
ItemStack resultItemStack = furnaceSmeltEvent.getResult();
|
||||||
//We don't do permission checks because this can be for an offline player and Bukkit has nothing to grab permissions for offline players
|
/*
|
||||||
|
doubleSmeltCondition should be equal to the max
|
||||||
|
*/
|
||||||
|
|
||||||
//Process double smelt
|
//Process double smelt
|
||||||
if (Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.SMELTING, resultItemStack.getType())
|
if (Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.SMELTING, resultItemStack.getType())
|
||||||
&& resultItemStack.getAmount() < itemLimit
|
&& canDoubleSmeltItemStack(furnace) //Effectively two less than max stack size
|
||||||
&& isSecondSmeltSuccessful()) {
|
&& isSecondSmeltSuccessful()) {
|
||||||
|
|
||||||
ItemStack newResult = resultItemStack.clone();
|
ItemStack doubleSmeltStack = resultItemStack.clone(); //TODO: Necessary?
|
||||||
newResult.setAmount(Math.min(resultItemStack.getAmount() + 1, itemLimit)); //Don't go over max stack limits
|
doubleSmeltStack.setAmount(resultItemStack.getAmount() + 1); //Add one
|
||||||
furnaceSmeltEvent.setResult(newResult);
|
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) {
|
public int vanillaXPBoost(int experience) {
|
||||||
return experience * getVanillaXpMultiplier();
|
return experience * getVanillaXpMultiplier();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user