mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-04 02:53:43 +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:
		@@ -71,6 +71,7 @@ public class CustomBlocksConfig extends ModConfigLoader{
 | 
				
			|||||||
            int id = config.getInt(skillType + "." + blockName + ".ID", 0);
 | 
					            int id = config.getInt(skillType + "." + blockName + ".ID", 0);
 | 
				
			||||||
            byte data = (byte) config.getInt(skillType + "." + blockName + ".Data_Value", 0);
 | 
					            byte data = (byte) config.getInt(skillType + "." + blockName + ".Data_Value", 0);
 | 
				
			||||||
            int xp = config.getInt(skillType + "." + blockName + ".XP_Gain", 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);
 | 
					            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);
 | 
				
			||||||
@@ -97,7 +98,7 @@ public class CustomBlocksConfig extends ModConfigLoader{
 | 
				
			|||||||
                itemDrop = new ItemStack(id, dropAmount, (short) 0, data);
 | 
					                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);
 | 
					            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")) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,12 +6,14 @@ public class CustomBlock {
 | 
				
			|||||||
    private int itemID;
 | 
					    private int itemID;
 | 
				
			||||||
    private byte dataValue;
 | 
					    private byte dataValue;
 | 
				
			||||||
    private int xpGain;
 | 
					    private int xpGain;
 | 
				
			||||||
 | 
					    private int tier;
 | 
				
			||||||
    private ItemStack itemDrop;
 | 
					    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.itemID = itemID;
 | 
				
			||||||
        this.dataValue = dataValue;
 | 
					        this.dataValue = dataValue;
 | 
				
			||||||
        this.xpGain = xpGain;
 | 
					        this.xpGain = xpGain;
 | 
				
			||||||
 | 
					        this.tier = tier;
 | 
				
			||||||
        this.itemDrop = itemDrop;
 | 
					        this.itemDrop = itemDrop;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -39,6 +41,14 @@ public class CustomBlock {
 | 
				
			|||||||
        this.xpGain = xpGain;
 | 
					        this.xpGain = xpGain;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public int getTier() {
 | 
				
			||||||
 | 
					        return tier;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setTier(int tier) {
 | 
				
			||||||
 | 
					        this.tier = tier;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ItemStack getItemDrop() {
 | 
					    public ItemStack getItemDrop() {
 | 
				
			||||||
        return itemDrop;
 | 
					        return itemDrop;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -251,6 +251,10 @@ public class Mining {
 | 
				
			|||||||
        FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player);
 | 
					        FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (Config.getInstance().getBlockModsEnabled() && CustomBlocksConfig.getInstance().customItems.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) {
 | 
					        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)) {
 | 
					            if (mcMMO.placeStore.isTrue(block)) {
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -49,6 +49,7 @@ Mining:
 | 
				
			|||||||
        Data_Value: 0
 | 
					        Data_Value: 0
 | 
				
			||||||
        XP_Gain: 99
 | 
					        XP_Gain: 99
 | 
				
			||||||
        Is_Ore: true
 | 
					        Is_Ore: true
 | 
				
			||||||
 | 
					        Tier: 1
 | 
				
			||||||
        Drop_Item: false
 | 
					        Drop_Item: false
 | 
				
			||||||
        Drop_Item_ID: 999
 | 
					        Drop_Item_ID: 999
 | 
				
			||||||
        Drop_Item_Data_Value: 0
 | 
					        Drop_Item_Data_Value: 0
 | 
				
			||||||
@@ -58,6 +59,7 @@ Mining:
 | 
				
			|||||||
        Data_Value: 0
 | 
					        Data_Value: 0
 | 
				
			||||||
        XP_Gain: 99
 | 
					        XP_Gain: 99
 | 
				
			||||||
        Is_Ore: true
 | 
					        Is_Ore: true
 | 
				
			||||||
 | 
					        Tier: 1
 | 
				
			||||||
        Drop_Item: false
 | 
					        Drop_Item: false
 | 
				
			||||||
        Drop_Item_ID: 999
 | 
					        Drop_Item_ID: 999
 | 
				
			||||||
        Drop_Item_Data_Value: 0
 | 
					        Drop_Item_Data_Value: 0
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user