-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bloomed calcite + worldgen + levita brick
- Loading branch information
Showing
52 changed files
with
584 additions
and
97 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
25 changes: 25 additions & 0 deletions
25
src/main/java/net/id/paradiselost/blocks/natural/crop/CropGrowthBlock.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,25 @@ | ||
package net.id.paradiselost.blocks.natural.crop; | ||
|
||
import net.minecraft.block.Block; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.block.CropBlock; | ||
import net.minecraft.server.world.ServerWorld; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.random.Random; | ||
|
||
public class CropGrowthBlock extends Block { | ||
|
||
final int boostChance; | ||
|
||
public CropGrowthBlock(Settings settings, int boostChance) { | ||
super(settings); | ||
this.boostChance = boostChance; | ||
} | ||
|
||
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { | ||
BlockState upBlock = world.getBlockState(pos.up(2)); | ||
if (upBlock.getBlock() instanceof CropBlock && random.nextInt(this.boostChance) == 0) { | ||
upBlock.randomTick(world, pos.up(2), random); | ||
} | ||
} | ||
} |
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
66 changes: 66 additions & 0 deletions
66
src/main/java/net/id/paradiselost/mixin/item/PotionItemMixin.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,66 @@ | ||
package net.id.paradiselost.mixin.item; | ||
|
||
import net.id.paradiselost.blocks.ParadiseLostBlocks; | ||
import net.id.paradiselost.tag.ParadiseLostBlockTags; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.block.Blocks; | ||
import net.minecraft.block.CauldronBlock; | ||
import net.minecraft.block.CryingObsidianBlock; | ||
import net.minecraft.block.RedstoneOreBlock; | ||
import net.minecraft.client.particle.FireworksSparkParticle; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.entity.projectile.FireworkRocketEntity; | ||
import net.minecraft.entity.projectile.thrown.PotionEntity; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.item.ItemUsage; | ||
import net.minecraft.item.ItemUsageContext; | ||
import net.minecraft.item.Items; | ||
import net.minecraft.item.PotionItem; | ||
import net.minecraft.particle.ParticleTypes; | ||
import net.minecraft.potion.PotionUtil; | ||
import net.minecraft.potion.Potions; | ||
import net.minecraft.sound.SoundCategory; | ||
import net.minecraft.sound.SoundEvents; | ||
import net.minecraft.stat.Stats; | ||
import net.minecraft.util.ActionResult; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.random.Random; | ||
import net.minecraft.world.World; | ||
import net.minecraft.world.event.GameEvent; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(PotionItem.class) | ||
public class PotionItemMixin { | ||
|
||
@Inject(method = "useOnBlock", at = @At("RETURN"), cancellable = true) | ||
public void useOnBlock(ItemUsageContext context, CallbackInfoReturnable<ActionResult> cir) { | ||
World world = context.getWorld(); | ||
BlockPos blockPos = context.getBlockPos(); | ||
PlayerEntity playerEntity = context.getPlayer(); | ||
ItemStack itemStack = context.getStack(); | ||
BlockState blockState = world.getBlockState(blockPos); | ||
Random random = world.random; | ||
if (blockState.isOf(Blocks.CALCITE) && (PotionUtil.getPotion(itemStack) == Potions.HEALING || PotionUtil.getPotion(itemStack) == Potions.STRONG_HEALING)) { | ||
playerEntity.setStackInHand(context.getHand(), ItemUsage.exchangeStack(itemStack, playerEntity, new ItemStack(Items.GLASS_BOTTLE))); | ||
world.setBlockState(blockPos, ParadiseLostBlocks.BLOOMED_CALCITE.getDefaultState()); | ||
// particles | ||
for (int i = 0; i < 16; i++) { | ||
double xOffset = random.nextDouble(); | ||
double yOffset = random.nextDouble(); | ||
double zOffset = random.nextDouble(); | ||
world.addParticle(ParticleTypes.ENTITY_EFFECT, blockPos.getX()+xOffset, blockPos.getY()+yOffset, blockPos.getZ()+zOffset, 0.97, 0.15, 0.14); | ||
} | ||
if (!world.isClient) { | ||
// sound | ||
world.playSound(null, blockPos, SoundEvents.ITEM_BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F); | ||
} | ||
cir.setReturnValue(ActionResult.success(world.isClient)); | ||
cir.cancel(); | ||
} | ||
} | ||
} |
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
7 changes: 7 additions & 0 deletions
7
src/main/resources/assets/paradise_lost/blockstates/bloomed_calcite.json
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,7 @@ | ||
{ | ||
"variants": { | ||
"": { | ||
"model": "paradise_lost:block/bloomed_calcite" | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/resources/assets/paradise_lost/blockstates/levita_brick.json
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,7 @@ | ||
{ | ||
"variants": { | ||
"": { | ||
"model": "paradise_lost:block/levita_brick" | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/resources/assets/paradise_lost/blockstates/levita_brick_slab.json
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,13 @@ | ||
{ | ||
"variants": { | ||
"type=bottom": { | ||
"model": "paradise_lost:block/levita_brick_slab" | ||
}, | ||
"type=double": { | ||
"model": "paradise_lost:block/levita_brick" | ||
}, | ||
"type=top": { | ||
"model": "paradise_lost:block/levita_brick_slab_top" | ||
} | ||
} | ||
} |
Oops, something went wrong.