Skip to content

Commit f7359af

Browse files
committed
mining hammers no longer break bedrock or liquids, added cat helmet as desert labyrinth treasure, changed some mixins
1 parent ad21096 commit f7359af

21 files changed

+189
-70
lines changed

src/main/java/cursedbread/morefeatures/FeatureModel.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ public void initItemModels(ItemModelDispatcher dispatcher) {
584584
});
585585
}
586586

587-
if (FeaturesItems.bombQuibersEnabled == 1) {
587+
if (FeaturesItems.treasureEnabled == 1) {
588588
ModelHelper.setItemModel(FeaturesItems.bombBag,
589589
() -> {
590590
ItemModelStandard model = new ItemModelBombQuiver(FeaturesItems.bombBag, MOD_ID);
@@ -597,6 +597,13 @@ public void initItemModels(ItemModelDispatcher dispatcher) {
597597
model.icon = TextureRegistry.getTexture(FeaturesItems.bombBagGold.namespaceID);
598598
return model;
599599
});
600+
601+
ModelHelper.setItemModel(FeaturesItems.catHelmet,
602+
() -> {
603+
ItemModelStandard model = new ItemModelStandard(FeaturesItems.catHelmet, MOD_ID);
604+
model.icon = TextureRegistry.getTexture(FeaturesItems.catHelmet.namespaceID);
605+
return model;
606+
});
600607
}
601608

602609
if (FeaturesItems.newToolsEnabled == 1) {

src/main/java/cursedbread/morefeatures/FeaturesCraft.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ public void onRecipesReady() {
582582
.create("craftingOnAStick", new ItemStack(FeaturesItems.workbenchOnStick, 1));
583583
}
584584
//bomb quiver crafting
585-
if (FeaturesItems.bombQuibersEnabled == 1) {
585+
if (FeaturesItems.treasureEnabled == 1) {
586586
RecipeBuilder.Shaped(MOD_ID)
587587
.setShape("S S", "CCC", "LLL")
588588
.addInput('S', Items.STRING)
@@ -689,5 +689,11 @@ public void onRecipesReady() {
689689
.create("hammercraft", new ItemStack(hammerResult[i]));
690690
}
691691
}
692+
693+
if (FeaturesBlocks.miscBlocksEnabled == 1){
694+
RecipeBuilder.Shapeless(MOD_ID)
695+
.addInput(FeaturesBlocks.burnedLog)
696+
.create("burnedlogsintoplanks", new ItemStack(Blocks.PLANKS_OAK_PAINTED, 4, 15));
697+
}
692698
}
693699
}

src/main/java/cursedbread/morefeatures/FeaturesMain.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class FeaturesMain implements ModInitializer, GameStartEntrypoint, Client
4343
prop.setProperty("Block_armor", "1");
4444
prop.setProperty("Old_armor", "1");
4545
prop.setProperty("Misc_armor", "1");
46-
prop.setProperty("Bomb_bags", "1");
46+
prop.setProperty("Treasures", "1");
4747
prop.setProperty("New_tools", "1");
4848
prop.setProperty("Misc_items", "1");
4949

@@ -69,7 +69,7 @@ public class FeaturesMain implements ModInitializer, GameStartEntrypoint, Client
6969
FeaturesItems.blockArmorEnabled = config.getInt("Block_armor");
7070
FeaturesItems.oldArmorEnabled = config.getInt("Old_armor");
7171
FeaturesItems.miscArmorEnabled = config.getInt("Misc_armor");
72-
FeaturesItems.bombQuibersEnabled = config.getInt("Bomb_bags");
72+
FeaturesItems.treasureEnabled = config.getInt("Treasures");
7373
FeaturesItems.newToolsEnabled = config.getInt("New_tools");
7474
FeaturesItems.miscItemsEnabled = config.getInt("Misc_items");
7575
//Extra

src/main/java/cursedbread/morefeatures/blocks/FeaturesBlocks.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import cursedbread.morefeatures.blocks.glass.*;
55
import cursedbread.morefeatures.blocks.glowstone.*;
66
import cursedbread.morefeatures.blocks.ores.*;
7+
import cursedbread.morefeatures.blocks.other.BlockLogicBurnedLog;
78
import cursedbread.morefeatures.blocks.other.BlockLogicGilder;
89
import cursedbread.morefeatures.blocks.other.BlockLogicHam;
910
import cursedbread.morefeatures.blocks.paperwall.*;
@@ -363,7 +364,7 @@ public void initilizeBlocks() {
363364

364365
if (miscBlocksEnabled == 1){
365366
burnedLog = fullBlock
366-
.build("burned.log", blockId++, b -> new BlockLogicLog(b))
367+
.build("burned.log", blockId++, b -> new BlockLogicBurnedLog(b))
367368
.withSound(BlockSounds.WOOD)
368369
.withHardness(2.0F)
369370
.withDisabledNeighborNotifyOnMetadataChange()
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package cursedbread.morefeatures.blocks.other;
2+
3+
import net.minecraft.core.block.Block;
4+
import net.minecraft.core.block.BlockLogicLog;
5+
import net.minecraft.core.block.Blocks;
6+
import net.minecraft.core.block.entity.TileEntity;
7+
import net.minecraft.core.enums.EnumDropCause;
8+
import net.minecraft.core.item.ItemStack;
9+
import net.minecraft.core.item.Items;
10+
import net.minecraft.core.world.World;
11+
12+
import java.util.Objects;
13+
14+
public class BlockLogicBurnedLog extends BlockLogicLog {
15+
public BlockLogicBurnedLog(Block<?> block) {
16+
super(block);
17+
}
18+
19+
public ItemStack[] getBreakResult(World world, EnumDropCause dropCause, int meta, TileEntity tileEntity) {
20+
if (Objects.requireNonNull(dropCause) == EnumDropCause.PISTON_CRUSH) {
21+
return new ItemStack[]{new ItemStack((Items.COAL), 1 + world.rand.nextInt(4), 1)};
22+
}
23+
return new ItemStack[]{new ItemStack(this)};
24+
}
25+
}

src/main/java/cursedbread/morefeatures/blocks/other/BlockLogicGilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public boolean onBlockRightClicked(World world, int x, int y, int z, Player play
2525
// Init the hash map, done now due to init order
2626
if (!init) {
2727
item_map.put(Items.ARMOR_QUIVER.id, new ItemStack(Items.ARMOR_QUIVER_GOLD));
28-
if (FeaturesItems.bombQuibersEnabled == 1) {
28+
if (FeaturesItems.treasureEnabled == 1) {
2929
item_map.put(FeaturesItems.bombBag.id, new ItemStack(FeaturesItems.bombBagGold));
3030
}
3131
init = true;

src/main/java/cursedbread/morefeatures/item/FeaturesItems.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ public class FeaturesItems {
5151
public static ArmorMaterial quartzArmor = ArmorHelper.createArmorMaterial(MOD_ID, "quartz/armor_quartz", 200, 10f, 0f, 20f, 30f);
5252
public static ArmorMaterial quartzExtraArmor = ArmorHelper.createArmorMaterial(MOD_ID, "quartz/extra_armor_quartz", 200, 10f, 0f, 20f, 30f);
5353

54+
public static ArmorMaterial catArmor = ArmorHelper.createArmorMaterial(MOD_ID, "other/cat", 200, 0f, 0f, 0f, 0f);
55+
5456

5557
public static int crownsEnabled;
5658
//flower
@@ -111,9 +113,10 @@ public class FeaturesItems {
111113
public static Item quartzLeggings;
112114
public static Item quartzBoots;
113115

114-
public static int bombQuibersEnabled;
116+
public static int treasureEnabled;
115117
public static Item bombBag;
116118
public static Item bombBagGold;
119+
public static Item catHelmet;
117120

118121
public static int miscItemsEnabled;
119122
public static Item mobSoul;
@@ -272,11 +275,11 @@ public void initilizeItems() {
272275
.build(new ItemArmor("boots.quartz", "morefeatures:item/armor/quartz/quartz_boots", itemId++, quartzArmor, 0));
273276
}
274277

275-
if (bombQuibersEnabled == 1) {
278+
if (treasureEnabled == 1) {
276279
bombBag = new ItemBuilder(MOD_ID)
277-
.build(new ItemBombQuiver("bag.normal", "morefeatures:item/armor/bomb_bag/bomb_bag_empty", itemId++));
280+
.build(new ItemBombQuiver("bag.normal", "morefeatures:item/armor/artifacts/bomb_bag_empty", itemId++));
278281
bombBagGold = new ItemBuilder(MOD_ID)
279-
.build(new ItemBombQuiverEndless("bag.gold", "morefeatures:item/armor/bomb_bag/bomb_bag_gold", itemId++));
282+
.build(new ItemBombQuiverEndless("bag.gold", "morefeatures:item/armor/artifacts/bomb_bag_gold", itemId++));
280283
}
281284

282285
if (newToolsEnabled == 1) {
@@ -334,5 +337,10 @@ public void initilizeItems() {
334337
fluxSeed = new ItemBuilder(MOD_ID)
335338
.build(new ItemSeeds("flux.seed", "morefeatures:item/other/seed_flux", itemId++, FeaturesBlocks.fluxCropws));
336339
}
340+
341+
if (treasureEnabled == 1){
342+
catHelmet = new ItemBuilder(MOD_ID)
343+
.build(new ItemArmor("cat.helmet", "morefeatures:item/armor/artifacts/armor_helmet_cat", itemId++, catArmor, 3));
344+
}
337345
}
338346
}

src/main/java/cursedbread/morefeatures/item/bomb_bag/ItemModelBombQuiver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
@Environment(EnvType.CLIENT)
1313
public class ItemModelBombQuiver extends ItemModelStandard {
14-
IconCoordinate bombQuiverFull = TextureRegistry.getTexture("morefeatures:item/armor/bomb_bag/bomb_bag_full");
15-
IconCoordinate bombQuiverEmpty = TextureRegistry.getTexture("morefeatures:item/armor/bomb_bag/bomb_bag_empty");
14+
IconCoordinate bombQuiverFull = TextureRegistry.getTexture("morefeatures:item/armor/artifacts/bomb_bag_full");
15+
IconCoordinate bombQuiverEmpty = TextureRegistry.getTexture("morefeatures:item/armor/artifacts/bomb_bag_empty");
1616

1717
public ItemModelBombQuiver(Item item, String namespace) {
1818
super(item, namespace);

src/main/java/cursedbread/morefeatures/item/tool/ItemToolMiningHammer.java

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package cursedbread.morefeatures.item.tool;
22

33
import cursedbread.morefeatures.item.FeaturesItems;
4+
import net.minecraft.core.block.Block;
5+
import net.minecraft.core.block.Blocks;
6+
import net.minecraft.core.block.tag.BlockTags;
47
import net.minecraft.core.entity.Mob;
58
import net.minecraft.core.enums.EnumDropCause;
69
import net.minecraft.core.item.Item;
@@ -12,30 +15,50 @@
1215
import net.minecraft.core.world.World;
1316

1417
import java.util.Arrays;
18+
import java.util.List;
1519
import java.util.Objects;
1620

21+
1722
public class ItemToolMiningHammer extends ItemToolPickaxe {
1823
public ItemToolMiningHammer(String name, String namespaceId, int id, ToolMaterial enumtoolmaterial) {
1924
super(name, namespaceId, id, enumtoolmaterial);
2025
}
2126

27+
List<Integer> BlockHammersBlacklist = Arrays.asList(
28+
Blocks.BEDROCK.id(),
29+
Blocks.FLUID_LAVA_FLOWING.id(),
30+
Blocks.FLUID_LAVA_STILL.id(),
31+
Blocks.FLUID_WATER_FLOWING.id(),
32+
Blocks.FLUID_WATER_STILL.id()
33+
);
34+
35+
private static boolean isBlockMatchToBlacklist(int BlockId, List<Integer> list) {
36+
boolean BlockMatchToBlacklist;
37+
BlockMatchToBlacklist = list.contains(BlockId);
38+
return BlockMatchToBlacklist;
39+
}
40+
2241
protected void MineBlock(int x, int y, int z, World world, Mob mob) {
2342
Item GoldItem = FeaturesItems.miningHammerGold;
2443
Item heldItem = Objects.requireNonNull(mob.getHeldItem()).getItem();
25-
if (world.getBlock(x, y, z) != null)
26-
if (!heldItem.equals(GoldItem)) {
27-
ItemStack[] itemToDrop = Objects.requireNonNull(world.getBlock(x, y, z)).getBreakResult(world, EnumDropCause.PROPER_TOOL, x, y, z, world.getBlockMetadata(x, y, z), world.getTileEntity(x, y, z));
28-
world.setBlockWithNotify(x, y, z, 0);
29-
if (itemToDrop != null) {
30-
Arrays.stream(itemToDrop).filter(Objects::nonNull).forEach(expDrop -> world.dropItem(x, y, z, expDrop));
31-
}
32-
} else {
33-
ItemStack[] itemToDrop = Objects.requireNonNull(world.getBlock(x, y, z)).getBreakResult(world, EnumDropCause.SILK_TOUCH, x, y, z, world.getBlockMetadata(x, y, z), world.getTileEntity(x, y, z));
34-
world.setBlockWithNotify(x, y, z, 0);
35-
if (itemToDrop != null) {
36-
Arrays.stream(itemToDrop).filter(Objects::nonNull).forEach(expDrop -> world.dropItem(x, y, z, expDrop));
37-
}
44+
if (!world.isClientSide) {
45+
if (world.getBlock(x, y, z) != null && !isBlockMatchToBlacklist(world.getBlock(x, y, z).id(), BlockHammersBlacklist)){
46+
if (world.getBlock(x, y, z) != null)
47+
if (!heldItem.equals(GoldItem)) {
48+
ItemStack[] itemToDrop = Objects.requireNonNull(world.getBlock(x, y, z)).getBreakResult(world, EnumDropCause.PROPER_TOOL, x, y, z, world.getBlockMetadata(x, y, z), world.getTileEntity(x, y, z));
49+
world.setBlockWithNotify(x, y, z, 0);
50+
if (itemToDrop != null) {
51+
Arrays.stream(itemToDrop).filter(Objects::nonNull).forEach(expDrop -> world.dropItem(x, y, z, expDrop));
52+
}
53+
} else {
54+
ItemStack[] itemToDrop = Objects.requireNonNull(world.getBlock(x, y, z)).getBreakResult(world, EnumDropCause.SILK_TOUCH, x, y, z, world.getBlockMetadata(x, y, z), world.getTileEntity(x, y, z));
55+
world.setBlockWithNotify(x, y, z, 0);
56+
if (itemToDrop != null) {
57+
Arrays.stream(itemToDrop).filter(Objects::nonNull).forEach(expDrop -> world.dropItem(x, y, z, expDrop));
58+
}
59+
}
3860
}
61+
}
3962
}
4063

4164
public boolean onBlockDestroyed(World world, ItemStack itemstack, int i, int j, int k, int l, Side side, Mob mob) {

src/main/java/cursedbread/morefeatures/mixin/BurningLogMixin.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ public boolean canMelt(World world, int x, int y, int z) {
6363
public void updateTick(World world, int x, int y, int z, Random rand) {
6464
if (this.canMelt(world, x, y, z) && world.getBlockId(x, y, z) != FeaturesBlocks.burnedLog.id()) {
6565
int meta = world.getBlockMetadata(x, y, z);
66+
if (world.getBlockId(x, y+1, z) == 0){
67+
world.setBlockWithNotify(x, y+1, z, Blocks.FIRE.id());
68+
}
6669
world.setBlockAndMetadataWithNotify(x, y, z, FeaturesBlocks.burnedLog.id(), meta);
6770
world.playSoundEffect(null, SoundCategory.WORLD_SOUNDS, (double)x + 0.5, (double)y + 0.5, (double)z + 0.5, "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
6871
}

0 commit comments

Comments
 (0)