mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
Added ability for custom blocks to drop a range of items. MOD BLOCK
FILES WILL NEED TO BE REDONE.
This commit is contained in:
parent
d73521e0a0
commit
eae665c1c5
@ -8,8 +8,10 @@ Key:
|
|||||||
- Removal
|
- Removal
|
||||||
|
|
||||||
Version 1.3.10-dev
|
Version 1.3.10-dev
|
||||||
= Fixed admin chat being seen by everyone
|
+ Added permission node for Iron Grip ability (mcmmo.ability.unarmed.irongrip)
|
||||||
|
+ Added ability for custom blocks to drop a range of items.
|
||||||
= Fixed players never being removed from memory (memory leak)
|
= Fixed players never being removed from memory (memory leak)
|
||||||
|
= Fixed admin chat being seen by everyone
|
||||||
|
|
||||||
Version 1.3.09
|
Version 1.3.09
|
||||||
+ Added compatibility with AntiCheat (Which I highly recommend to prevent cheating)
|
+ Added compatibility with AntiCheat (Which I highly recommend to prevent cheating)
|
||||||
|
@ -63,7 +63,8 @@ public class CustomBlocksConfig extends ModConfigLoader{
|
|||||||
boolean dropItem = config.getBoolean(skillType + "." + blockName + ".Drop_Item", false);
|
boolean dropItem = config.getBoolean(skillType + "." + blockName + ".Drop_Item", false);
|
||||||
int dropID = config.getInt(skillType + "." + blockName + ".Drop_Item_ID", 0);
|
int dropID = config.getInt(skillType + "." + blockName + ".Drop_Item_ID", 0);
|
||||||
byte dropData = (byte) config.getInt(skillType + "." + blockName + ".Drop_Item_Data_Value", 0);
|
byte dropData = (byte) config.getInt(skillType + "." + blockName + ".Drop_Item_Data_Value", 0);
|
||||||
int dropAmount = config.getInt(skillType + "." + blockName + ".Drop_Item_Amount", 1);
|
int minimumDropAmount = config.getInt(skillType + "." + blockName + ".Min_Drop_Item_Amount", 1);
|
||||||
|
int maxiumDropAmount = config.getInt(skillType + "." + blockName + ".Max_Drop_Item_Amount", 1);
|
||||||
|
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
plugin.getLogger().warning("Missing ID. This block will be skipped.");
|
plugin.getLogger().warning("Missing ID. This block will be skipped.");
|
||||||
@ -80,13 +81,13 @@ public class CustomBlocksConfig extends ModConfigLoader{
|
|||||||
ItemStack blockItem;
|
ItemStack blockItem;
|
||||||
|
|
||||||
if (dropItem) {
|
if (dropItem) {
|
||||||
itemDrop = new ItemStack(dropID, dropAmount, (short) 0, dropData);
|
itemDrop = new ItemStack(dropID, 1, (short) 0, dropData);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
itemDrop = new ItemStack(id, dropAmount, (short) 0, data);
|
itemDrop = new ItemStack(id, 1, (short) 0, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
block = new CustomBlock(itemDrop, tier, xp, data, id);
|
block = new CustomBlock(minimumDropAmount, maxiumDropAmount, itemDrop, tier, xp, data, id);
|
||||||
blockItem = new ItemStack(id, 1, (short) 0, data);
|
blockItem = new ItemStack(id, 1, (short) 0, data);
|
||||||
|
|
||||||
if (skillType.equals("Mining") && config.getBoolean(skillType + "." + blockName + ".Is_Ore")) {
|
if (skillType.equals("Mining") && config.getBoolean(skillType + "." + blockName + ".Is_Ore")) {
|
||||||
|
@ -8,13 +8,17 @@ public class CustomBlock {
|
|||||||
private int xpGain;
|
private int xpGain;
|
||||||
private int tier;
|
private int tier;
|
||||||
private ItemStack itemDrop;
|
private ItemStack itemDrop;
|
||||||
|
private int minimumDropAmount;
|
||||||
|
private int maximumDropAmount;
|
||||||
|
|
||||||
public CustomBlock(ItemStack itemDrop, int tier, int xpGain, byte dataValue, int itemID) {
|
public CustomBlock(int minimumDropAmount, int maximumDropAmount, ItemStack itemDrop, int tier, int xpGain, byte dataValue, int itemID) {
|
||||||
this.itemID = itemID;
|
this.itemID = itemID;
|
||||||
this.dataValue = dataValue;
|
this.dataValue = dataValue;
|
||||||
this.xpGain = xpGain;
|
this.xpGain = xpGain;
|
||||||
this.tier = tier;
|
this.tier = tier;
|
||||||
this.itemDrop = itemDrop;
|
this.itemDrop = itemDrop;
|
||||||
|
this.minimumDropAmount = minimumDropAmount;
|
||||||
|
this.maximumDropAmount = maximumDropAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getItemID() {
|
public int getItemID() {
|
||||||
@ -56,4 +60,20 @@ public class CustomBlock {
|
|||||||
public void setItemDrop(ItemStack itemDrop) {
|
public void setItemDrop(ItemStack itemDrop) {
|
||||||
this.itemDrop = itemDrop;
|
this.itemDrop = itemDrop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getMinimumDropAmount() {
|
||||||
|
return minimumDropAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMinimumDropAmount(int minimumDropAmount) {
|
||||||
|
this.minimumDropAmount = minimumDropAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaximumDropAmount() {
|
||||||
|
return maximumDropAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaximumDropAmount(int maximumDropAmount) {
|
||||||
|
this.maximumDropAmount = maximumDropAmount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ import com.gmail.nossr50.config.mods.CustomBlocksConfig;
|
|||||||
import com.gmail.nossr50.datatypes.AbilityType;
|
import com.gmail.nossr50.datatypes.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.SkillType;
|
import com.gmail.nossr50.datatypes.SkillType;
|
||||||
|
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.runnables.GreenThumbTimer;
|
import com.gmail.nossr50.runnables.GreenThumbTimer;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
@ -281,7 +282,19 @@ public class Herbalism {
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
if (customPlant) {
|
if (customPlant) {
|
||||||
Misc.dropItem(loc, is);
|
CustomBlock customBlock = ModChecks.getCustomBlock(block);
|
||||||
|
int minimumDropAmount = customBlock.getMinimumDropAmount();
|
||||||
|
int maximumDropAmount = customBlock.getMaximumDropAmount();
|
||||||
|
|
||||||
|
is = customBlock.getItemDrop();
|
||||||
|
|
||||||
|
if (minimumDropAmount != maximumDropAmount) {
|
||||||
|
Misc.dropItems(loc, is, minimumDropAmount);
|
||||||
|
Misc.randomDropItems(loc, is, 50, maximumDropAmount - minimumDropAmount);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Misc.dropItems(loc, is, minimumDropAmount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ import com.gmail.nossr50.mcMMO;
|
|||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.SkillType;
|
import com.gmail.nossr50.datatypes.SkillType;
|
||||||
|
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||||
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
|
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
|
||||||
import com.gmail.nossr50.spout.SpoutSounds;
|
import com.gmail.nossr50.spout.SpoutSounds;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
@ -196,8 +197,19 @@ public class Mining {
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
if (ModChecks.isCustomMiningBlock(block)) {
|
if (ModChecks.isCustomMiningBlock(block)) {
|
||||||
|
CustomBlock customBlock = ModChecks.getCustomBlock(block);
|
||||||
|
int minimumDropAmount = customBlock.getMinimumDropAmount();
|
||||||
|
int maximumDropAmount = customBlock.getMaximumDropAmount();
|
||||||
|
|
||||||
item = ModChecks.getCustomBlock(block).getItemDrop();
|
item = ModChecks.getCustomBlock(block).getItemDrop();
|
||||||
Misc.dropItem(loc, item);
|
|
||||||
|
if (minimumDropAmount != maximumDropAmount) {
|
||||||
|
Misc.dropItems(loc, item, minimumDropAmount);
|
||||||
|
Misc.randomDropItems(loc, item, 50, maximumDropAmount - minimumDropAmount);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Misc.dropItems(loc, item, minimumDropAmount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,18 @@ public class WoodCutting {
|
|||||||
x.setData((byte) 0x0);
|
x.setData((byte) 0x0);
|
||||||
x.setType(Material.AIR);
|
x.setType(Material.AIR);
|
||||||
|
|
||||||
Misc.dropItem(x.getLocation(), item);
|
int minimumDropAmount = block.getMinimumDropAmount();
|
||||||
|
int maximumDropAmount = block.getMaximumDropAmount();
|
||||||
|
|
||||||
|
item = block.getItemDrop();
|
||||||
|
|
||||||
|
if (minimumDropAmount != maximumDropAmount) {
|
||||||
|
Misc.dropItems(x.getLocation(), item, minimumDropAmount);
|
||||||
|
Misc.randomDropItems(x.getLocation(), item, 50, maximumDropAmount - minimumDropAmount);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Misc.dropItems(x.getLocation(), item, minimumDropAmount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (ModChecks.isCustomLeafBlock(x)) {
|
else if (ModChecks.isCustomLeafBlock(x)) {
|
||||||
CustomBlock block = ModChecks.getCustomBlock(x);
|
CustomBlock block = ModChecks.getCustomBlock(x);
|
||||||
@ -298,9 +309,20 @@ public class WoodCutting {
|
|||||||
Location location;
|
Location location;
|
||||||
|
|
||||||
if (configInstance.getBlockModsEnabled() && ModChecks.isCustomLogBlock(block)) {
|
if (configInstance.getBlockModsEnabled() && ModChecks.isCustomLogBlock(block)) {
|
||||||
item = ModChecks.getCustomBlock(block).getItemDrop();
|
CustomBlock customBlock = ModChecks.getCustomBlock(block);
|
||||||
|
int minimumDropAmount = customBlock.getMinimumDropAmount();
|
||||||
|
int maximumDropAmount = customBlock.getMaximumDropAmount();
|
||||||
|
|
||||||
|
item = customBlock.getItemDrop();
|
||||||
location = block.getLocation();
|
location = block.getLocation();
|
||||||
Misc.dropItem(location, item);
|
|
||||||
|
if (minimumDropAmount != maximumDropAmount) {
|
||||||
|
Misc.dropItems(location, item, minimumDropAmount);
|
||||||
|
Misc.randomDropItems(location, item, 50, maximumDropAmount - minimumDropAmount);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Misc.dropItems(location, item, minimumDropAmount);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -9,7 +9,8 @@ Excavation:
|
|||||||
Drop_Item: false
|
Drop_Item: false
|
||||||
Drop_Item_ID: 999
|
Drop_Item_ID: 999
|
||||||
Drop_Item_Data_Value: 0
|
Drop_Item_Data_Value: 0
|
||||||
Drop_Item_Amount: 1
|
Min_Drop_Item_Amount: 1
|
||||||
|
Max_Drop_Item_Amount: 1
|
||||||
Block_2:
|
Block_2:
|
||||||
ID: 999
|
ID: 999
|
||||||
Data_Value: 0
|
Data_Value: 0
|
||||||
@ -17,7 +18,8 @@ Excavation:
|
|||||||
Drop_Item: false
|
Drop_Item: false
|
||||||
Drop_Item_ID: 999
|
Drop_Item_ID: 999
|
||||||
Drop_Item_Data_Value: 0
|
Drop_Item_Data_Value: 0
|
||||||
Drop_Item_Amount: 1
|
Min_Drop_Item_Amount: 1
|
||||||
|
Max_Drop_Item_Amount: 1
|
||||||
|
|
||||||
#
|
#
|
||||||
# Settings for Custom Herbalism Blocks
|
# Settings for Custom Herbalism Blocks
|
||||||
@ -30,7 +32,8 @@ Herbalism:
|
|||||||
Drop_Item: false
|
Drop_Item: false
|
||||||
Drop_Item_ID: 999
|
Drop_Item_ID: 999
|
||||||
Drop_Item_Data_Value: 0
|
Drop_Item_Data_Value: 0
|
||||||
Drop_Item_Amount: 1
|
Min_Drop_Item_Amount: 1
|
||||||
|
Max_Drop_Item_Amount: 1
|
||||||
Block_2:
|
Block_2:
|
||||||
ID: 999
|
ID: 999
|
||||||
Data_Value: 0
|
Data_Value: 0
|
||||||
@ -38,7 +41,8 @@ Herbalism:
|
|||||||
Drop_Item: false
|
Drop_Item: false
|
||||||
Drop_Item_ID: 999
|
Drop_Item_ID: 999
|
||||||
Drop_Item_Data_Value: 0
|
Drop_Item_Data_Value: 0
|
||||||
Drop_Item_Amount: 1
|
Min_Drop_Item_Amount: 1
|
||||||
|
Max_Drop_Item_Amount: 1
|
||||||
|
|
||||||
#
|
#
|
||||||
# Settings for Custom Mining Blocks
|
# Settings for Custom Mining Blocks
|
||||||
@ -53,7 +57,8 @@ Mining:
|
|||||||
Drop_Item: false
|
Drop_Item: false
|
||||||
Drop_Item_ID: 999
|
Drop_Item_ID: 999
|
||||||
Drop_Item_Data_Value: 0
|
Drop_Item_Data_Value: 0
|
||||||
Drop_Item_Amount: 1
|
Min_Drop_Item_Amount: 1
|
||||||
|
Max_Drop_Item_Amount: 1
|
||||||
Block_2:
|
Block_2:
|
||||||
ID: 999
|
ID: 999
|
||||||
Data_Value: 0
|
Data_Value: 0
|
||||||
@ -63,7 +68,8 @@ Mining:
|
|||||||
Drop_Item: false
|
Drop_Item: false
|
||||||
Drop_Item_ID: 999
|
Drop_Item_ID: 999
|
||||||
Drop_Item_Data_Value: 0
|
Drop_Item_Data_Value: 0
|
||||||
Drop_Item_Amount: 1
|
Min_Drop_Item_Amount: 1
|
||||||
|
Max_Drop_Item_Amount: 1
|
||||||
|
|
||||||
#
|
#
|
||||||
# Settings for Custom Woodcutting Blocks
|
# Settings for Custom Woodcutting Blocks
|
||||||
@ -77,7 +83,8 @@ Woodcutting:
|
|||||||
Drop_Item: false
|
Drop_Item: false
|
||||||
Drop_Item_ID: 999
|
Drop_Item_ID: 999
|
||||||
Drop_Item_Data_Value: 0
|
Drop_Item_Data_Value: 0
|
||||||
Drop_Item_Amount: 1
|
Min_Drop_Item_Amount: 1
|
||||||
|
Max_Drop_Item_Amount: 1
|
||||||
Block_2:
|
Block_2:
|
||||||
ID: 999
|
ID: 999
|
||||||
Data_Value: 0
|
Data_Value: 0
|
||||||
@ -86,4 +93,5 @@ Woodcutting:
|
|||||||
Drop_Item: false
|
Drop_Item: false
|
||||||
Drop_Item_ID: 999
|
Drop_Item_ID: 999
|
||||||
Drop_Item_Data_Value: 0
|
Drop_Item_Data_Value: 0
|
||||||
Drop_Item_Amount: 1
|
Min_Drop_Item_Amount: 1
|
||||||
|
Max_Drop_Item_Amount: 1
|
Loading…
Reference in New Issue
Block a user