/
BlockIngredientRule.java
55 lines (38 loc) · 1.85 KB
/
BlockIngredientRule.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package com.creativemd.littletiles.common.util.ingredient.rules;
import com.creativemd.creativecore.common.utils.mc.BlockUtils;
import com.creativemd.littletiles.common.util.ingredient.BlockIngredientEntry;
import com.creativemd.littletiles.common.util.ingredient.IngredientUtils;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
public abstract class BlockIngredientRule {
public abstract BlockIngredientEntry getBlockIngredient(Block block, int meta, double value);
public static class BlockIngredientRuleFixedMeta extends BlockIngredientRule {
public int meta;
public BlockIngredientRuleFixedMeta(int meta) {
this.meta = meta;
}
@Override
public BlockIngredientEntry getBlockIngredient(Block block, int meta, double value) {
return IngredientUtils.create(block, this.meta, value);
}
}
public static class BlockIngredientRuleFixedBlock extends BlockIngredientRule {
public Block block;
public int meta;
public BlockIngredientRuleFixedBlock(Block block, int meta) {
this.block = block;
this.meta = meta;
}
@Override
public BlockIngredientEntry getBlockIngredient(Block block, int meta, double value) {
return IngredientUtils.create(this.block, this.meta, value);
}
}
public static abstract class BlockIngredientRuleMappedState extends BlockIngredientRule {
@Override
public BlockIngredientEntry getBlockIngredient(Block block, int meta, double value) {
return IngredientUtils.create(block, getMeta(BlockUtils.getState(block, meta), value), value);
}
public abstract int getMeta(IBlockState state, double value);
}
}