generated from Turnip-Labs/bta-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
coral! Thanks LukeisStuff for texture!
- Loading branch information
Showing
16 changed files
with
179 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/java/baguchan/better_with_aquatic/block/CoralBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package baguchan.better_with_aquatic.block; | ||
|
||
import net.minecraft.core.block.Block; | ||
import net.minecraft.core.block.entity.TileEntity; | ||
import net.minecraft.core.block.material.Material; | ||
import net.minecraft.core.enums.EnumDropCause; | ||
import net.minecraft.core.item.ItemStack; | ||
import net.minecraft.core.world.World; | ||
|
||
public class CoralBlock extends Block { | ||
public CoralBlock(String name, int openIds, Material water) { | ||
super(name, openIds, water); | ||
} | ||
|
||
@Override | ||
public ItemStack[] getBreakResult(World world, EnumDropCause dropCause, int x, int y, int z, int meta, TileEntity tileEntity) { | ||
switch (dropCause) { | ||
case PICK_BLOCK: | ||
case PROPER_TOOL: | ||
case SILK_TOUCH: { | ||
return new ItemStack[]{new ItemStack(this)}; | ||
} | ||
} | ||
return new ItemStack[]{}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/main/java/baguchan/better_with_aquatic/util/IDUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,19 @@ | ||
package baguchan.better_with_aquatic.util; | ||
|
||
public class IDUtils { | ||
private static int curr_item_id = 0; | ||
private static int curr_block_id = 0; | ||
|
||
public static void initIds(int blockId, int itemId) { | ||
curr_item_id = itemId; | ||
curr_block_id = blockId; | ||
} | ||
|
||
public static int getCurrBlockId() { | ||
return curr_block_id; | ||
} | ||
|
||
public static int getCurrItemId() { | ||
return curr_item_id; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/baguchan/better_with_aquatic/world/WorldFeatureCoral.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package baguchan.better_with_aquatic.world; | ||
|
||
import baguchan.better_with_aquatic.block.ModBlocks; | ||
import net.minecraft.core.block.Block; | ||
import net.minecraft.core.world.World; | ||
import net.minecraft.core.world.generate.feature.WorldFeature; | ||
|
||
import java.util.Random; | ||
|
||
public class WorldFeatureCoral extends WorldFeature { | ||
public WorldFeatureCoral() { | ||
} | ||
|
||
@Override | ||
public boolean generate(World world, Random random, int x, int y, int z) { | ||
if (world.getBlockId(x, y - 1, z) != Block.fluidWaterStill.id) { | ||
return false; | ||
} | ||
int id = ModBlocks.coral_blue.id + random.nextInt(6); | ||
|
||
for (int l = 0; l < 4; ++l) { | ||
int i1 = x + random.nextInt(8) - random.nextInt(8); | ||
int k1 = z + random.nextInt(8) - random.nextInt(8); | ||
while (world.getBlockId(i1, y - 1, k1) == Block.fluidWaterStill.id) { | ||
--y; | ||
} | ||
if (world.getBlockId(i1, y - 1, k1) == Block.sand.id || world.getBlockId(i1, y - 1, k1) == Block.dirt.id) { | ||
world.setBlockRaw(i1, y, k1, id); | ||
this.generateCoralGroup(world, random, i1, y, k1, id); | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
private void generateCoralGroup(World world, Random random, int x, int y, int z, int id) { | ||
for (int l = 0; l < 9; ++l) { | ||
int i1 = x + random.nextInt(3) - random.nextInt(3); | ||
int j1 = y + random.nextInt(3) - random.nextInt(3); | ||
int k1 = z + random.nextInt(3) - random.nextInt(3); | ||
if (world.getBlockId(i1, j1, k1) == Block.fluidWaterStill.id) { | ||
world.setBlockRaw(i1, j1, k1, id); | ||
} | ||
} | ||
} | ||
} | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+763 Bytes
src/main/resources/assets/better_with_aquatic/block/coral_green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+777 Bytes
src/main/resources/assets/better_with_aquatic/block/coral_purple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+797 Bytes
src/main/resources/assets/better_with_aquatic/block/coral_yellow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
tile.better_with_aquatic.sea_grass_flow.name=Sea Grass | ||
tile.better_with_aquatic.sea_grass.name=Sea Grass | ||
tile.better_with_aquatic.coral_blue.name=Blue Coral | ||
tile.better_with_aquatic.coral_cyan.name=Cyan Coral | ||
tile.better_with_aquatic.coral_green.name=Green Coral | ||
tile.better_with_aquatic.coral_pink.name=Pink Coral | ||
tile.better_with_aquatic.coral_purple.name=Purple Coral | ||
tile.better_with_aquatic.coral_red.name=Red Coral | ||
tile.better_with_aquatic.coral_yellow.name=Yellow Coral |