Skip to content

Commit

Permalink
coral! Thanks LukeisStuff for texture!
Browse files Browse the repository at this point in the history
  • Loading branch information
baguchi committed Nov 13, 2023
1 parent 574a80a commit 27617bd
Show file tree
Hide file tree
Showing 16 changed files with 179 additions and 4 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Better With Aquatic

## Credit

LukeisStuff - He sent me the coral texture.

## Current requirements

- BTA 1.7.7.0_02
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/baguchan/better_with_aquatic/BetterWithAquatic.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,36 @@
import baguchan.better_with_aquatic.entity.EntityBaseFish;
import baguchan.better_with_aquatic.entity.render.FishModel;
import baguchan.better_with_aquatic.entity.render.RenderFish;
import baguchan.better_with_aquatic.util.IDUtils;
import net.fabricmc.api.ModInitializer;
import net.minecraft.core.block.Block;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import turniplabs.halplibe.helper.EntityHelper;
import turniplabs.halplibe.util.ConfigHandler;

import java.util.Properties;


public class BetterWithAquatic implements ModInitializer {

public static final String MOD_ID = "better_with_aquatic";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);

private void handleConfig() {
Properties prop = new Properties();
prop.setProperty("starting_block_id", "561");
prop.setProperty("starting_item_id", "2000");
ConfigHandler config = new ConfigHandler(MOD_ID, prop);
IDUtils.initIds(
config.getInt("starting_block_id"),
config.getInt("starting_item_id"));
config.updateConfig();
}

@Override
public void onInitialize() {
this.handleConfig();
Block.lightOpacity[Block.fluidWaterFlowing.id] = 1;
Block.lightOpacity[Block.fluidWaterStill.id] = 1;
ModBlocks.createBlocks();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package baguchan.better_with_aquatic;

import baguchan.better_with_aquatic.block.ModBlocks;
import baguchan.better_with_aquatic.world.WorldFeatureCoral;
import baguchan.better_with_aquatic.world.WorldFeatureSeaGrass;
import net.minecraft.core.world.biome.Biome;
import net.minecraft.core.world.biome.Biomes;
Expand All @@ -16,6 +17,8 @@ public String getModID() {
@Override
public void onInitialize() {
ChunkDecoratorOverworldAPI.randomFeatures.addFeature(new WorldFeatureSeaGrass(ModBlocks.sea_grass.id), 1, -1, 6,
new Biome[]{Biomes.OVERWORLD_SWAMPLAND, Biomes.OVERWORLD_SWAMPLAND_MUDDY, Biomes.OVERWORLD_BIRCH_FOREST, Biomes.OVERWORLD_RETRO, Biomes.OVERWORLD_MEADOW, Biomes.OVERWORLD_FOREST, Biomes.OVERWORLD_BOREAL_FOREST, Biomes.OVERWORLD_SEASONAL_FOREST, Biomes.OVERWORLD_TAIGA, Biomes.OVERWORLD_SHRUBLAND});
new Biome[]{Biomes.OVERWORLD_SWAMPLAND, Biomes.OVERWORLD_SWAMPLAND_MUDDY, Biomes.OVERWORLD_BIRCH_FOREST, Biomes.OVERWORLD_RETRO, Biomes.OVERWORLD_MEADOW, Biomes.OVERWORLD_FOREST, Biomes.OVERWORLD_RAINFOREST, Biomes.OVERWORLD_BOREAL_FOREST, Biomes.OVERWORLD_SEASONAL_FOREST, Biomes.OVERWORLD_TAIGA, Biomes.OVERWORLD_SHRUBLAND});
ChunkDecoratorOverworldAPI.randomFeatures.addFeature(new WorldFeatureCoral(), 5, -1, 4,
new Biome[]{Biomes.OVERWORLD_BIRCH_FOREST, Biomes.OVERWORLD_RETRO, Biomes.OVERWORLD_MEADOW, Biomes.OVERWORLD_FOREST, Biomes.OVERWORLD_BOREAL_FOREST, Biomes.OVERWORLD_SEASONAL_FOREST, Biomes.OVERWORLD_SHRUBLAND, Biomes.OVERWORLD_RAINFOREST});
}
}
26 changes: 26 additions & 0 deletions src/main/java/baguchan/better_with_aquatic/block/CoralBlock.java
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[]{};
}
}
61 changes: 60 additions & 1 deletion src/main/java/baguchan/better_with_aquatic/block/ModBlocks.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package baguchan.better_with_aquatic.block;

import baguchan.better_with_aquatic.BetterWithAquatic;
import baguchan.better_with_aquatic.util.IDUtils;
import net.minecraft.client.sound.block.BlockSounds;
import net.minecraft.core.block.Block;
import net.minecraft.core.block.material.Material;
Expand All @@ -18,7 +19,58 @@ public class ModBlocks {
.setTextures("sea_grass.png")
.setTags(BlockTags.IS_WATER, BlockTags.PLACE_OVERWRITES)
.setBlockSound(BlockSounds.GRASS)
.build(new BlockFluidWithSeagrass("sea_grass", findOpenIds(561), Material.water));
.build(new BlockFluidWithSeagrass("sea_grass", findOpenIds(IDUtils.getCurrBlockId()), Material.water));
public static final Block coral_blue = new BlockBuilder(BetterWithAquatic.MOD_ID)
.setHardness(0.6f)
.setResistance(0.65F)
.setTextures("coral_blue.png")
.setTags(BlockTags.MINEABLE_BY_SHEARS)
.setBlockSound(BlockSounds.GRASS)
.build(new CoralBlock("coral_blue", findOpenIds(IDUtils.getCurrBlockId()), Material.vegetable));
public static final Block coral_cyan = new BlockBuilder(BetterWithAquatic.MOD_ID)
.setHardness(0.6f)
.setResistance(0.65F)
.setTextures("coral_cyan.png")
.setTags(BlockTags.MINEABLE_BY_SHEARS)
.setBlockSound(BlockSounds.GRASS)
.build(new CoralBlock("coral_cyan", findOpenIds(IDUtils.getCurrBlockId()), Material.vegetable));
public static final Block coral_green = new BlockBuilder(BetterWithAquatic.MOD_ID)
.setHardness(0.6f)
.setResistance(0.65F)
.setTextures("coral_green.png")
.setTags(BlockTags.MINEABLE_BY_SHEARS)
.setBlockSound(BlockSounds.GRASS)
.build(new CoralBlock("coral_green", findOpenIds(IDUtils.getCurrBlockId()), Material.vegetable));
public static final Block coral_pink = new BlockBuilder(BetterWithAquatic.MOD_ID)
.setHardness(0.6f)
.setResistance(0.65F)
.setTextures("coral_pink.png")
.setTags(BlockTags.MINEABLE_BY_SHEARS)
.setBlockSound(BlockSounds.GRASS)
.build(new CoralBlock("coral_pink", findOpenIds(IDUtils.getCurrBlockId()), Material.vegetable));

public static final Block coral_purple = new BlockBuilder(BetterWithAquatic.MOD_ID)
.setHardness(0.6f)
.setResistance(0.65F)
.setTextures("coral_purple.png")
.setTags(BlockTags.MINEABLE_BY_SHEARS)
.setBlockSound(BlockSounds.GRASS)
.build(new CoralBlock("coral_purple", findOpenIds(IDUtils.getCurrBlockId()), Material.vegetable));
public static final Block coral_red = new BlockBuilder(BetterWithAquatic.MOD_ID)
.setHardness(0.6f)
.setResistance(0.65F)
.setTextures("coral_red.png")
.setTags(BlockTags.MINEABLE_BY_SHEARS)
.setBlockSound(BlockSounds.GRASS)
.build(new CoralBlock("coral_red", findOpenIds(IDUtils.getCurrBlockId()), Material.vegetable));
public static final Block coral_yellow = new BlockBuilder(BetterWithAquatic.MOD_ID)
.setHardness(0.6f)
.setResistance(0.65F)
.setTextures("coral_yellow.png")
.setTags(BlockTags.MINEABLE_BY_SHEARS)
.setBlockSound(BlockSounds.GRASS)
.build(new CoralBlock("coral_yellow", findOpenIds(IDUtils.getCurrBlockId()), Material.vegetable));



public static void createBlocks() {
Expand All @@ -27,5 +79,12 @@ public static void createBlocks() {

static {
Item.itemsList[sea_grass.id] = new ItemBlock(sea_grass);
Item.itemsList[coral_blue.id] = new ItemBlock(coral_blue);
Item.itemsList[coral_cyan.id] = new ItemBlock(coral_cyan);
Item.itemsList[coral_green.id] = new ItemBlock(coral_green);
Item.itemsList[coral_pink.id] = new ItemBlock(coral_pink);
Item.itemsList[coral_purple.id] = new ItemBlock(coral_purple);
Item.itemsList[coral_red.id] = new ItemBlock(coral_red);
Item.itemsList[coral_yellow.id] = new ItemBlock(coral_yellow);
}
}
15 changes: 15 additions & 0 deletions src/main/java/baguchan/better_with_aquatic/util/IDUtils.java
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;
}
}
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.
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.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Better With Aquatic",
"description": "This mod add Aquatic feature such as modern!.",
"authors": [
"Turnip Labs"
"bagu_chan"
],
"contact": {
"homepage": "",
Expand Down
8 changes: 7 additions & 1 deletion src/main/resources/lang/better_with_aquatic/en_US.lang
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

0 comments on commit 27617bd

Please sign in to comment.