mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 07:06:45 +01:00
Mod support - able to define tiers for custom blocks now.
Tier 1 - breaks with wood/gold Tier 2 - breaks with stone Tier 3 - breaks with iron Tier 4 - breaks with diamond
This commit is contained in:
parent
efcc15d89d
commit
c559e70270
@ -71,6 +71,7 @@ public class CustomBlocksConfig extends ModConfigLoader{
|
||||
int id = config.getInt(skillType + "." + blockName + ".ID", 0);
|
||||
byte data = (byte) config.getInt(skillType + "." + blockName + ".Data_Value", 0);
|
||||
int xp = config.getInt(skillType + "." + blockName + ".XP_Gain", 0);
|
||||
int tier = config.getInt(skillType + "." + blockName + ".Tier", 1);
|
||||
boolean dropItem = config.getBoolean(skillType + "." + blockName + ".Drop_Item", false);
|
||||
int dropID = config.getInt(skillType + "." + blockName + ".Drop_Item_ID", 0);
|
||||
byte dropData = (byte) config.getInt(skillType + "." + blockName + ".Drop_Item_Data_Value", 0);
|
||||
@ -97,7 +98,7 @@ public class CustomBlocksConfig extends ModConfigLoader{
|
||||
itemDrop = new ItemStack(id, dropAmount, (short) 0, data);
|
||||
}
|
||||
|
||||
block = new CustomBlock(itemDrop, xp, data, id);
|
||||
block = new CustomBlock(itemDrop, tier, xp, data, id);
|
||||
blockItem = new ItemStack(id, 1, (short) 0, data);
|
||||
|
||||
if (skillType.equals("Mining") && config.getBoolean(skillType + "." + blockName + ".Is_Ore")) {
|
||||
|
@ -6,12 +6,14 @@ public class CustomBlock {
|
||||
private int itemID;
|
||||
private byte dataValue;
|
||||
private int xpGain;
|
||||
private int tier;
|
||||
private ItemStack itemDrop;
|
||||
|
||||
public CustomBlock(ItemStack itemDrop, int xpGain, byte dataValue, int itemID) {
|
||||
public CustomBlock(ItemStack itemDrop, int tier, int xpGain, byte dataValue, int itemID) {
|
||||
this.itemID = itemID;
|
||||
this.dataValue = dataValue;
|
||||
this.xpGain = xpGain;
|
||||
this.tier = tier;
|
||||
this.itemDrop = itemDrop;
|
||||
}
|
||||
|
||||
@ -39,6 +41,14 @@ public class CustomBlock {
|
||||
this.xpGain = xpGain;
|
||||
}
|
||||
|
||||
public int getTier() {
|
||||
return tier;
|
||||
}
|
||||
|
||||
public void setTier(int tier) {
|
||||
this.tier = tier;
|
||||
}
|
||||
|
||||
public ItemStack getItemDrop() {
|
||||
return itemDrop;
|
||||
}
|
||||
|
@ -251,6 +251,10 @@ public class Mining {
|
||||
FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player);
|
||||
|
||||
if (Config.getInstance().getBlockModsEnabled() && CustomBlocksConfig.getInstance().customItems.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) {
|
||||
if (ModChecks.getCustomBlock(block).getTier() < tier) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mcMMO.placeStore.isTrue(block)) {
|
||||
return;
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ Mining:
|
||||
Data_Value: 0
|
||||
XP_Gain: 99
|
||||
Is_Ore: true
|
||||
Tier: 1
|
||||
Drop_Item: false
|
||||
Drop_Item_ID: 999
|
||||
Drop_Item_Data_Value: 0
|
||||
@ -58,6 +59,7 @@ Mining:
|
||||
Data_Value: 0
|
||||
XP_Gain: 99
|
||||
Is_Ore: true
|
||||
Tier: 1
|
||||
Drop_Item: false
|
||||
Drop_Item_ID: 999
|
||||
Drop_Item_Data_Value: 0
|
||||
|
Loading…
Reference in New Issue
Block a user