Skip to content

Commit ed8818b

Browse files
author
BordListian
committed
- Adds Saw Recycling, allowing some wooden blocks to be recycled at a loss
- Adds Kiln Doubling, the Kiln will now smelt ores into two of whatever it would usually make. Best consumed with hardcore ores. - Fixes blocks with 0 hardness being unbreakable (oops) - Version 0.3
1 parent 13f5b3c commit ed8818b

4 files changed

Lines changed: 78 additions & 4 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ buildscript {
1515
apply plugin: 'net.minecraftforge.gradle.forge'
1616

1717

18-
version = "0.2"
18+
version = "0.3"
1919
group= "betterwithaddons" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
2020
archivesBaseName = "Better With Addons"
2121

src/main/java/betterwithaddons/config/ModConfiguration.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ public class ModConfiguration {
3232
ConfigOptionBool BTWTweak_Enabled = new ConfigOptionBool("addons.BTWTweak", "Enabled", InteractionBTWTweak.ENABLED);
3333
ConfigOptionBool BTWTweak_SoftWoods = new ConfigOptionBool("addons.BTWTweak", "SoftWoods", InteractionBTWTweak.SOFT_WOODS, "Spruce, Jungle and Dark Oak logs are much easier to break.");
3434
ConfigOptionBool BTWTweak_HardStumps = new ConfigOptionBool("addons.BTWTweak", "HardStumps", InteractionBTWTweak.HARD_STUMPS, "Makes treefarms great ag- I mean, makes logs with dirt underneath them much harder to break to encourage leaving awesome stumps.");
35+
ConfigOptionBool BTWTweak_SawRecycling = new ConfigOptionBool("addons.BTWTweak", "SawRecycling", InteractionBTWTweak.SAW_RECYCLING, "Many wooden blocks can be recycled by putting them infront of a saw, at a bit of a loss.");
36+
ConfigOptionBool BTWTweak_KilnDoubling = new ConfigOptionBool("addons.BTWTweak", "KilnDoubling", InteractionBTWTweak.KILN_DOUBLING, "Kilns double the amount of metal you get from one ore. Whether it be nuggets or ingots.");
37+
3538

3639
public void preInit(FMLPreInitializationEvent event)
3740
{
@@ -63,6 +66,8 @@ public void preInit(FMLPreInitializationEvent event)
6366
InteractionBTWTweak.ENABLED = BTWTweak_Enabled.init(configuration);
6467
InteractionBTWTweak.SOFT_WOODS = BTWTweak_SoftWoods.init(configuration);
6568
InteractionBTWTweak.HARD_STUMPS = BTWTweak_HardStumps.init(configuration);
69+
InteractionBTWTweak.SAW_RECYCLING = BTWTweak_SawRecycling.init(configuration);
70+
InteractionBTWTweak.KILN_DOUBLING = BTWTweak_KilnDoubling.init(configuration);
6671

6772
if (configuration.hasChanged())
6873
{

src/main/java/betterwithaddons/handler/StumpingHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void breakBlock(PlayerEvent.BreakSpeed breakEvent)
6363
}
6464
}
6565

66-
float hardnessMultiplier = (hardness * multiplier) / state.getBlockHardness(world,breakpos);
66+
float hardnessMultiplier = state.getBlockHardness(world,breakpos) != 0 ? (hardness * multiplier) / state.getBlockHardness(world,breakpos) : 1f;
6767

6868
breakEvent.setNewSpeed(speed / hardnessMultiplier);
6969
}

src/main/java/betterwithaddons/interaction/InteractionBTWTweak.java

Lines changed: 71 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
package betterwithaddons.interaction;
22

33
import betterwithaddons.handler.StumpingHandler;
4-
import betterwithaddons.util.BlockMeta;
4+
import betterwithmods.BWMBlocks;
5+
import betterwithmods.config.BWConfig;
6+
import betterwithmods.craft.BlockMetaRecipe;
7+
import betterwithmods.craft.KilnInteraction;
8+
import betterwithmods.craft.SawInteraction;
9+
import betterwithmods.items.ItemMaterial;
10+
import betterwithmods.util.InvUtils;
511
import net.minecraft.block.BlockPlanks;
612
import net.minecraft.init.Blocks;
13+
import net.minecraft.init.Items;
14+
import net.minecraft.item.Item;
15+
import net.minecraft.item.ItemBlock;
16+
import net.minecraft.item.ItemStack;
717
import net.minecraftforge.common.MinecraftForge;
818

919
import java.util.Arrays;
@@ -13,6 +23,8 @@ public class InteractionBTWTweak implements IInteraction {
1323
public static boolean ENABLED = true;
1424
public static boolean HARD_STUMPS = true;
1525
public static boolean SOFT_WOODS = true;
26+
public static boolean SAW_RECYCLING = true;
27+
public static boolean KILN_DOUBLING = true;
1628

1729
@Override
1830
public boolean isActive() {
@@ -48,10 +60,67 @@ public void init() {
4860
StumpingHandler.addSoftWood(Blocks.LOG,BlockPlanks.EnumType.JUNGLE.getMetadata(),1.0f);
4961
StumpingHandler.addSoftWood(Blocks.LOG2,BlockPlanks.EnumType.DARK_OAK.getMetadata() - 4,1.3f);
5062
}
63+
64+
if(SAW_RECYCLING)
65+
{
66+
SawInteraction.INSTANCE.addRecipe(Blocks.BOOKSHELF,0,new ItemStack(BWMBlocks.WOOD_SIDING, 4, BlockPlanks.EnumType.OAK.getMetadata()),new ItemStack(Items.BOOK,3));
67+
SawInteraction.INSTANCE.addRecipe(Blocks.CHEST,0,new ItemStack(BWMBlocks.WOOD_SIDING, 6, BlockPlanks.EnumType.OAK.getMetadata()));
68+
SawInteraction.INSTANCE.addRecipe(Blocks.JUKEBOX,0,new ItemStack(BWMBlocks.WOOD_SIDING, 6, BlockPlanks.EnumType.OAK.getMetadata()),new ItemStack(Items.DIAMOND,1));
69+
SawInteraction.INSTANCE.addRecipe(Blocks.LADDER,0,new ItemStack(Items.STICK,2));
70+
SawInteraction.INSTANCE.addRecipe(Blocks.NOTEBLOCK,0,new ItemStack(BWMBlocks.WOOD_SIDING, 6, BlockPlanks.EnumType.OAK.getMetadata()),new ItemStack(Items.REDSTONE,1));
71+
SawInteraction.INSTANCE.addRecipe(Blocks.TRAPDOOR,0,new ItemStack(BWMBlocks.WOOD_SIDING, 2, BlockPlanks.EnumType.OAK.getMetadata()));
72+
SawInteraction.INSTANCE.addRecipe(BWMBlocks.AXLE,0,new ItemStack(BWMBlocks.WOOD_CORNER, 2, BlockPlanks.EnumType.OAK.getMetadata()),new ItemStack(BWMBlocks.ROPE,1));
73+
SawInteraction.INSTANCE.addRecipe(BWMBlocks.BELLOWS,0,new ItemStack(BWMBlocks.WOOD_SIDING, 2, BlockPlanks.EnumType.OAK.getMetadata()), ItemMaterial.getMaterial("leather_belt"), ItemMaterial.getMaterial("gear"), ItemMaterial.getMaterial("tanned_leather_cut",3));
74+
SawInteraction.INSTANCE.addRecipe(BWMBlocks.GEARBOX,0,new ItemStack(BWMBlocks.WOOD_SIDING, 3, BlockPlanks.EnumType.OAK.getMetadata()), ItemMaterial.getMaterial("gear",3), ItemMaterial.getMaterial("redstone_latch"));
75+
SawInteraction.INSTANCE.addRecipe(BWMBlocks.SINGLE_MACHINES,4,new ItemStack(BWMBlocks.WOOD_MOULDING, 3, BlockPlanks.EnumType.OAK.getMetadata()), ItemMaterial.getMaterial("gear",1), new ItemStack(Blocks.WOODEN_PRESSURE_PLATE,1));
76+
SawInteraction.INSTANCE.addRecipe(BWMBlocks.PLATFORM,0,new ItemStack(BWMBlocks.WOOD_MOULDING, 3, BlockPlanks.EnumType.OAK.getMetadata()), new ItemStack(BWMBlocks.PANE,2,2));
77+
SawInteraction.INSTANCE.addRecipe(BWMBlocks.SINGLE_MACHINES,1,new ItemStack(BWMBlocks.WOOD_SIDING, 3, BlockPlanks.EnumType.OAK.getMetadata()), new ItemStack(Items.IRON_INGOT), ItemMaterial.getMaterial("gear"), ItemMaterial.getMaterial("redstone_latch"));
78+
SawInteraction.INSTANCE.addRecipe(BWMBlocks.SAW,0,new ItemStack(BWMBlocks.WOOD_SIDING, 1, BlockPlanks.EnumType.OAK.getMetadata()), ItemMaterial.getMaterial("leather_belt"), ItemMaterial.getMaterial("gear"), new ItemStack(Items.IRON_INGOT, 2));
79+
SawInteraction.INSTANCE.addRecipe(BWMBlocks.PUMP,0,new ItemStack(BWMBlocks.WOOD_SIDING, 3, BlockPlanks.EnumType.OAK.getMetadata()), ItemMaterial.getMaterial("screw"), new ItemStack(BWMBlocks.GRATE, 1, BlockPlanks.EnumType.OAK.getMetadata()));
80+
81+
BlockPlanks.EnumType[] woodtypes = BlockPlanks.EnumType.values();
82+
int len = woodtypes.length;
83+
84+
for(int i = 0; i < len; ++i) {
85+
BlockPlanks.EnumType woodtype = woodtypes[i];
86+
87+
SawInteraction.INSTANCE.addRecipe(BWMBlocks.WOOD_BENCH,woodtype.getMetadata(),new ItemStack(BWMBlocks.WOOD_CORNER, 2, woodtype.getMetadata()));
88+
SawInteraction.INSTANCE.addRecipe(BWMBlocks.WOOD_TABLE,woodtype.getMetadata(),new ItemStack(BWMBlocks.WOOD_CORNER, 3, woodtype.getMetadata()));
89+
}
90+
91+
SawInteraction.INSTANCE.addRecipe(Blocks.OAK_DOOR,0,new ItemStack(BWMBlocks.WOOD_SIDING, 4, BlockPlanks.EnumType.OAK.getMetadata()));
92+
SawInteraction.INSTANCE.addRecipe(Blocks.BIRCH_DOOR,0,new ItemStack(BWMBlocks.WOOD_SIDING, 4, BlockPlanks.EnumType.BIRCH.getMetadata()));
93+
SawInteraction.INSTANCE.addRecipe(Blocks.SPRUCE_DOOR,0,new ItemStack(BWMBlocks.WOOD_SIDING, 4, BlockPlanks.EnumType.SPRUCE.getMetadata()));
94+
SawInteraction.INSTANCE.addRecipe(Blocks.JUNGLE_DOOR,0,new ItemStack(BWMBlocks.WOOD_SIDING, 4, BlockPlanks.EnumType.JUNGLE.getMetadata()));
95+
SawInteraction.INSTANCE.addRecipe(Blocks.ACACIA_DOOR,0,new ItemStack(BWMBlocks.WOOD_SIDING, 4, BlockPlanks.EnumType.ACACIA.getMetadata()));
96+
SawInteraction.INSTANCE.addRecipe(Blocks.DARK_OAK_DOOR,0,new ItemStack(BWMBlocks.WOOD_SIDING, 4, BlockPlanks.EnumType.DARK_OAK.getMetadata()));
97+
98+
SawInteraction.INSTANCE.addRecipe(Blocks.OAK_FENCE_GATE,0,new ItemStack(BWMBlocks.WOOD_MOULDING, 3, BlockPlanks.EnumType.OAK.getMetadata()));
99+
SawInteraction.INSTANCE.addRecipe(Blocks.BIRCH_FENCE_GATE,0,new ItemStack(BWMBlocks.WOOD_MOULDING, 3, BlockPlanks.EnumType.BIRCH.getMetadata()));
100+
SawInteraction.INSTANCE.addRecipe(Blocks.SPRUCE_FENCE_GATE,0,new ItemStack(BWMBlocks.WOOD_MOULDING, 3, BlockPlanks.EnumType.SPRUCE.getMetadata()));
101+
SawInteraction.INSTANCE.addRecipe(Blocks.JUNGLE_FENCE_GATE,0,new ItemStack(BWMBlocks.WOOD_MOULDING, 3, BlockPlanks.EnumType.JUNGLE.getMetadata()));
102+
SawInteraction.INSTANCE.addRecipe(Blocks.ACACIA_FENCE_GATE,0,new ItemStack(BWMBlocks.WOOD_MOULDING, 3, BlockPlanks.EnumType.ACACIA.getMetadata()));
103+
SawInteraction.INSTANCE.addRecipe(Blocks.DARK_OAK_FENCE_GATE,0,new ItemStack(BWMBlocks.WOOD_MOULDING, 3, BlockPlanks.EnumType.DARK_OAK.getMetadata()));
104+
}
51105
}
52106

53107
@Override
54108
public void postInit() {
55-
109+
if(KILN_DOUBLING && BWConfig.canKilnSmeltOres)
110+
{
111+
InvUtils.oreNames.forEach(ore -> {
112+
if(ore.getItem() instanceof ItemBlock)
113+
{
114+
BlockMetaRecipe recipe = KilnInteraction.INSTANCE.getRecipe(ore);
115+
List<ItemStack> outputs = recipe.getOutputs();
116+
if(outputs.size() > 0)
117+
{
118+
ItemStack output = outputs.get(0).copy();
119+
output.stackSize = 2;
120+
outputs.set(0,output);
121+
}
122+
}
123+
});
124+
}
56125
}
57126
}

0 commit comments

Comments
 (0)