start work on spell circles!
|
@ -1,3 +1,6 @@
|
|||
e26f9f72db9fab9b78bad75ec4c1746b4f84fa12 assets/hexcasting/blockstates/slate.json
|
||||
043abd5bbfd1186415049d24d185d4e4395320f9 assets/hexcasting/blockstates/slate_block.json
|
||||
d51541b464840530f4e734db1f67ed20e811ad14 assets/hexcasting/models/block/slate_block.json
|
||||
60c0f39882d22c2634cf738b0fe4e956eaa2adbe assets/hexcasting/models/item/abacus.json
|
||||
eb78f6a2b68dd772a5016fc5a3db10488a65abfa assets/hexcasting/models/item/amethyst_dust.json
|
||||
df940dd798240fac6fde700c57f8ae6aa43d1c9e assets/hexcasting/models/item/artifact.json
|
||||
|
@ -71,6 +74,7 @@ e7b88cde507911c0ad1bf60976dcc43a319d498d assets/hexcasting/models/item/pride_col
|
|||
9ef07e2885063ed1ffe1cb8f7728f26cb7c9881e assets/hexcasting/models/item/scroll.json
|
||||
297b05008b9ab37b5881820a0f5c99f7441a9dfe assets/hexcasting/models/item/scroll_ancient.json
|
||||
91765bdc3a764f3a3f10131e452a0030b207b03d assets/hexcasting/models/item/scroll_pristine.json
|
||||
cc66962ddeef9b9c3a623eef178b352605f1c922 assets/hexcasting/models/item/slate_block.json
|
||||
9a5f23f59453dc27233decd6110fbe9feab07a9d assets/hexcasting/models/item/spellbook.json
|
||||
4a33e6984bdf63dc4b7a5da5643bb1155b62b636 assets/hexcasting/models/item/sub_sandwich.json
|
||||
3b1f2d0b315e8117f4c5fe593bd3ae028617b413 assets/hexcasting/models/item/trinket.json
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "hexcasting:block/slate"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "hexcasting:block/slate_block"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:block/cube_all",
|
||||
"textures": {
|
||||
"all": "hexcasting:block/slate"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"parent": "hexcasting:block/slate_block"
|
||||
}
|
|
@ -1,6 +1,11 @@
|
|||
package at.petrak.hexcasting.api
|
||||
|
||||
import at.petrak.hexcasting.common.casting.colors.FrozenColorizer
|
||||
import at.petrak.hexcasting.common.network.HexMessages
|
||||
import at.petrak.hexcasting.common.network.MsgCastParticleAck
|
||||
import net.minecraft.server.level.ServerLevel
|
||||
import net.minecraft.world.phys.Vec3
|
||||
import net.minecraftforge.network.PacketDistributor
|
||||
|
||||
data class ParticleSpray(val pos: Vec3, val vel: Vec3, val fuzziness: Double, val spread: Double, val count: Int = 20) {
|
||||
companion object {
|
||||
|
@ -14,4 +19,16 @@ data class ParticleSpray(val pos: Vec3, val vel: Vec3, val fuzziness: Double, va
|
|||
return ParticleSpray(pos, Vec3(0.0, 0.001, 0.0), size, 0.0, count)
|
||||
}
|
||||
}
|
||||
|
||||
fun sprayParticles(world: ServerLevel, color: FrozenColorizer) {
|
||||
HexMessages.getNetwork().send(PacketDistributor.NEAR.with {
|
||||
PacketDistributor.TargetPoint(
|
||||
this.pos.x,
|
||||
this.pos.y,
|
||||
this.pos.z,
|
||||
128.0 * 128.0,
|
||||
world.dimension()
|
||||
)
|
||||
}, MsgCastParticleAck(this, color))
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ package at.petrak.hexcasting.client;
|
|||
import at.petrak.hexcasting.HexConfig;
|
||||
import at.petrak.hexcasting.api.SpellDatum;
|
||||
import at.petrak.hexcasting.client.particles.ConjureParticle;
|
||||
import at.petrak.hexcasting.common.blocks.BlockEntitySlate;
|
||||
import at.petrak.hexcasting.common.blocks.HexBlocks;
|
||||
import at.petrak.hexcasting.common.items.HexItems;
|
||||
import at.petrak.hexcasting.common.items.ItemFocus;
|
||||
|
@ -16,6 +17,7 @@ import net.minecraft.client.renderer.RenderType;
|
|||
import net.minecraft.client.renderer.item.ItemProperties;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraftforge.client.event.EntityRenderersEvent;
|
||||
import net.minecraftforge.client.event.ParticleFactoryRegisterEvent;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
@ -93,4 +95,9 @@ public class RegisterClientStuff {
|
|||
particleMan.register(HexParticles.LIGHT_PARTICLE.get(), ConjureParticle.Provider::new);
|
||||
particleMan.register(HexParticles.CONJURE_PARTICLE.get(), ConjureParticle.Provider::new);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerRenderers(EntityRenderersEvent.RegisterRenderers evt) {
|
||||
evt.registerBlockEntityRenderer(HexBlocks.SLATE_TILE.get(), BlockEntitySlate.Renderer::new);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package at.petrak.hexcasting.common.blocks;
|
||||
|
||||
import at.petrak.hexcasting.hexmath.HexDir;
|
||||
import at.petrak.hexcasting.hexmath.HexPattern;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.block.BlockRenderDispatcher;
|
||||
|
@ -11,12 +9,10 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockEntitySlate extends BlockEntity {
|
||||
private static final Random RANDOM = new Random();
|
||||
private HexPattern pattern = new HexPattern(HexDir.EAST, new ArrayList<>());
|
||||
|
||||
public static final String TAG_PATTERN = "pattern";
|
||||
|
||||
|
@ -24,7 +20,7 @@ public class BlockEntitySlate extends BlockEntity {
|
|||
super(HexBlocks.SLATE_TILE.get(), pos, state);
|
||||
}
|
||||
|
||||
public static class Renderer implements BlockEntityRenderer<BlockEntity> {
|
||||
public static class Renderer implements BlockEntityRenderer<BlockEntitySlate> {
|
||||
private final BlockRenderDispatcher dispatcher;
|
||||
|
||||
public Renderer(BlockEntityRendererProvider.Context ctx) {
|
||||
|
@ -32,13 +28,10 @@ public class BlockEntitySlate extends BlockEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(BlockEntity maybeTile, float pPartialTick, PoseStack ps,
|
||||
MultiBufferSource buffer, int pPackedLight, int pPackedOverlay) {
|
||||
|
||||
public void render(BlockEntitySlate tile, float pPartialTick, PoseStack ps,
|
||||
MultiBufferSource buffer, int light, int overlay) {
|
||||
|
||||
if (!(maybeTile instanceof BlockEntitySlate tile)) {
|
||||
return;
|
||||
}
|
||||
// uh
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,46 +2,31 @@ package at.petrak.hexcasting.common.blocks;
|
|||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.LevelReader;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.FaceAttachedHorizontalDirectionalBlock;
|
||||
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.block.state.properties.AttachFace;
|
||||
import net.minecraft.world.level.material.PushReaction;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
public class BlockSlate extends FaceAttachedHorizontalDirectionalBlock {
|
||||
|
||||
// FACING is the direction the *bottom* of the pattern points
|
||||
// (or which way is "down")
|
||||
public class BlockSlate extends HorizontalDirectionalBlock {
|
||||
protected static final double THICKNESS = 1;
|
||||
protected static final VoxelShape AABB_FLOOR = Block.box(0, 0, 0, 16, THICKNESS, 16);
|
||||
protected static final VoxelShape AABB_CEILING = Block.box(0, 16 - THICKNESS, 0, 16, 16, 16);
|
||||
protected static final VoxelShape AABB_EAST_WALL = Block.box(0, 0, 0, THICKNESS, 16, 16);
|
||||
protected static final VoxelShape AABB_WEST_WALL = Block.box(0, 16 - THICKNESS, 0, 16, 16, 16);
|
||||
protected static final VoxelShape AABB_SOUTH_WALL = Block.box(0, 0, 0, 16, 16, THICKNESS);
|
||||
protected static final VoxelShape AABB_NORTH_WALL = Block.box(0, 0, 16 - THICKNESS, 16, 16, 16);
|
||||
|
||||
public BlockSlate(Properties p_53182_) {
|
||||
super(p_53182_);
|
||||
this.registerDefaultState(
|
||||
this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(FACE, AttachFace.WALL));
|
||||
this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH));
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) {
|
||||
return switch (pState.getValue(FACE)) {
|
||||
case FLOOR -> AABB_FLOOR;
|
||||
case CEILING -> AABB_CEILING;
|
||||
case WALL -> switch (pState.getValue(FACING)) {
|
||||
case EAST -> AABB_EAST_WALL;
|
||||
case WEST -> AABB_WEST_WALL;
|
||||
case SOUTH -> AABB_SOUTH_WALL;
|
||||
// North case. I need to cover up and down, but presumably those
|
||||
// states are illegal?
|
||||
default -> AABB_NORTH_WALL;
|
||||
};
|
||||
};
|
||||
return AABB_FLOOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -51,6 +36,16 @@ public class BlockSlate extends FaceAttachedHorizontalDirectionalBlock {
|
|||
|
||||
@Override
|
||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
|
||||
builder.add(FACING, FACE);
|
||||
builder.add(FACING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockPlaceContext pContext) {
|
||||
return this.defaultBlockState().setValue(FACING, pContext.getHorizontalDirection().getOpposite());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSurvive(BlockState pState, LevelReader pLevel, BlockPos pPos) {
|
||||
return canSupportCenter(pLevel, pPos.below(), Direction.UP);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package at.petrak.hexcasting.common.blocks;
|
||||
|
||||
import at.petrak.hexcasting.HexMod;
|
||||
import at.petrak.hexcasting.common.blocks.impetuses.BlockAbstractImpetus;
|
||||
import at.petrak.hexcasting.common.blocks.impetuses.BlockEntityRightClickImpetus;
|
||||
import at.petrak.hexcasting.common.blocks.impetuses.BlockRightClickImpetus;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
@ -30,10 +33,22 @@ public class HexBlocks {
|
|||
.noOcclusion()
|
||||
.isSuffocating(HexBlocks::never)
|
||||
.isViewBlocking(HexBlocks::never)));
|
||||
|
||||
public static final RegistryObject<Block> SLATE = registerBlock("slate",
|
||||
new BlockSlate(BlockBehaviour.Properties.of(Material.STONE, MaterialColor.DEEPSLATE)
|
||||
.sound(SoundType.DEEPSLATE_TILES)
|
||||
.strength(2f, 4f)));
|
||||
public static final RegistryObject<BlockRightClickImpetus> IMPETUS_RIGHTCLICK = registerBlock("impetus_rightclick",
|
||||
new BlockRightClickImpetus(BlockBehaviour.Properties.of(Material.STONE, MaterialColor.DEEPSLATE)
|
||||
.sound(SoundType.DEEPSLATE_TILES)
|
||||
.strength(2f, 4f)
|
||||
.lightLevel(bs -> bs.getValue(BlockAbstractImpetus.LIT) ? 15 : 0)));
|
||||
|
||||
// Decoration?!
|
||||
public static final RegistryObject<Block> SLATE_BLOCK = registerBlock("slate_block",
|
||||
new Block(BlockBehaviour.Properties.of(Material.STONE, MaterialColor.DEEPSLATE)
|
||||
.sound(SoundType.DEEPSLATE_TILES)
|
||||
.strength(2f, 4f)));
|
||||
|
||||
public static final RegistryObject<BlockEntityType<BlockEntityConjured>> CONJURED_TILE = BLOCK_ENTITIES.register(
|
||||
"conjured_tile",
|
||||
|
@ -41,9 +56,12 @@ public class HexBlocks {
|
|||
public static final RegistryObject<BlockEntityType<BlockEntitySlate>> SLATE_TILE = BLOCK_ENTITIES.register(
|
||||
"slate_tile",
|
||||
() -> BlockEntityType.Builder.of(BlockEntitySlate::new, SLATE.get()).build(null));
|
||||
public static final RegistryObject<BlockEntityType<BlockEntityRightClickImpetus>> IMPETUS_RIGHTCLICK_TILE =
|
||||
BLOCK_ENTITIES.register("impetus_rightclick_tile",
|
||||
() -> BlockEntityType.Builder.of(BlockEntityRightClickImpetus::new, IMPETUS_RIGHTCLICK.get()).build(null));
|
||||
|
||||
|
||||
private static RegistryObject<Block> registerBlock(String label, Block block) {
|
||||
private static <T extends Block> RegistryObject<T> registerBlock(String label, T block) {
|
||||
ITEMS.register(label, () -> new BlockItem(block, new Item.Properties().tab(TAB)));
|
||||
return BLOCKS.register(label, () -> block);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package at.petrak.hexcasting.common.blocks.impetuses;
|
||||
|
||||
import at.petrak.hexcasting.common.lib.HexSounds;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
||||
|
||||
public abstract class BlockAbstractImpetus extends HorizontalDirectionalBlock {
|
||||
public static final BooleanProperty LIT = BlockStateProperties.LIT;
|
||||
|
||||
public BlockAbstractImpetus(Properties p_49795_) {
|
||||
super(p_49795_);
|
||||
this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(LIT, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
|
||||
builder.add(FACING, LIT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockPlaceContext pContext) {
|
||||
return this.defaultBlockState().setValue(FACING, pContext.getHorizontalDirection().getOpposite());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemove(BlockState pState, Level pLevel, BlockPos pPos, BlockState pNewState, boolean pIsMoving) {
|
||||
super.onRemove(pState, pLevel, pPos, pNewState, pIsMoving);
|
||||
if (pLevel.isClientSide) {
|
||||
Minecraft.getInstance().getSoundManager().stop(HexSounds.SPELL_CIRCLE_AMBIANCE.getId(), null);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
package at.petrak.hexcasting.common.blocks.impetuses;
|
||||
|
||||
import at.petrak.hexcasting.api.ParticleSpray;
|
||||
import at.petrak.hexcasting.common.blocks.HexBlocks;
|
||||
import at.petrak.hexcasting.common.casting.colors.FrozenColorizer;
|
||||
import at.petrak.hexcasting.common.items.HexItems;
|
||||
import at.petrak.hexcasting.common.lib.HexSounds;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.DyeColor;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public abstract class BlockEntityAbstractImpetus extends BlockEntity {
|
||||
public static final String
|
||||
TAG_ACTIVATOR = "activator",
|
||||
TAG_NEXT_BLOCK = "next_block",
|
||||
TAG_TRACKED_BLOCKS = "tracked_blocks";
|
||||
|
||||
@Nullable
|
||||
private UUID activator = null;
|
||||
@Nullable
|
||||
private BlockPos nextBlock = null;
|
||||
@Nullable
|
||||
private List<BlockPos> trackedBlocks = null;
|
||||
|
||||
public BlockEntityAbstractImpetus(BlockEntityType<?> pType, BlockPos pWorldPosition, BlockState pBlockState) {
|
||||
super(pType, pWorldPosition, pBlockState);
|
||||
}
|
||||
|
||||
protected void activateSpellCircle(Player activator) {
|
||||
this.level.scheduleTick(this.getBlockPos(), this.getBlockState().getBlock(), this.getTickSpeed());
|
||||
|
||||
this.activator = activator.getUUID();
|
||||
this.nextBlock = this.getBlockPos().above();
|
||||
this.level.setBlockAndUpdate(this.getBlockPos(), this.getBlockState().setValue(BlockAbstractImpetus.LIT, true));
|
||||
|
||||
activator.playSound(HexSounds.SPELL_CIRCLE_FAIL.get(), 1f, 1f);
|
||||
}
|
||||
|
||||
protected void stepCircle() {
|
||||
for (var pos : this.trackedBlocks) {
|
||||
if (!this.level.getBlockState(pos).is(HexBlocks.SLATE.get())) {
|
||||
this.errorParticles(Vec3.atBottomCenterOf(pos));
|
||||
this.stopCasting();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// This really only happens if you remove a block halfway thru casting ... but just to be safe.
|
||||
var blockChecking = this.level.getBlockState(this.nextBlock);
|
||||
if (!blockChecking.is(HexBlocks.SLATE.get())) {
|
||||
this.errorParticles(Vec3.atBottomCenterOf(this.nextBlock));
|
||||
this.stopCasting();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void errorParticles(Vec3 pos) {
|
||||
if (this.level instanceof ServerLevel serverLevel) {
|
||||
var spray = new ParticleSpray(pos, new Vec3(0, 1, 0), 0.1, Mth.PI / 4, 30);
|
||||
spray.sprayParticles(serverLevel, new FrozenColorizer(
|
||||
HexItems.DYE_COLORIZERS[DyeColor.RED.ordinal()].get(),
|
||||
this.activator));
|
||||
}
|
||||
level.playSound(null, pos.x, pos.y, pos.z, HexSounds.SPELL_CIRCLE_FAIL.get(), SoundSource.BLOCKS, 1f, 1f);
|
||||
}
|
||||
|
||||
protected void stopCasting() {
|
||||
this.activator = null;
|
||||
this.nextBlock = null;
|
||||
this.trackedBlocks = null;
|
||||
|
||||
this.level.setBlockAndUpdate(this.getBlockPos(),
|
||||
this.getBlockState().setValue(BlockAbstractImpetus.LIT, false));
|
||||
|
||||
if (this.level.isClientSide) {
|
||||
Minecraft.getInstance().getSoundManager().stop(HexSounds.SPELL_CIRCLE_AMBIANCE.getId(), null);
|
||||
}
|
||||
}
|
||||
|
||||
protected int getTickSpeed() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void saveAdditional(CompoundTag tag) {
|
||||
if (this.activator != null && this.nextBlock != null && this.trackedBlocks != null) {
|
||||
tag.putUUID(TAG_ACTIVATOR, this.activator);
|
||||
tag.put(TAG_NEXT_BLOCK, NbtUtils.writeBlockPos(this.nextBlock));
|
||||
var trackeds = new ListTag();
|
||||
for (var tracked : this.trackedBlocks) {
|
||||
trackeds.add(NbtUtils.writeBlockPos(tracked));
|
||||
}
|
||||
tag.put(TAG_TRACKED_BLOCKS, trackeds);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(CompoundTag tag) {
|
||||
super.load(tag);
|
||||
|
||||
this.activator = tag.getUUID(TAG_ACTIVATOR);
|
||||
this.nextBlock = NbtUtils.readBlockPos(tag.getCompound(TAG_NEXT_BLOCK));
|
||||
var trackeds = tag.getList(TAG_TRACKED_BLOCKS, Tag.TAG_COMPOUND);
|
||||
this.trackedBlocks = new ArrayList<>(trackeds.size());
|
||||
for (var tracked : trackeds) {
|
||||
this.trackedBlocks.add(NbtUtils.readBlockPos((CompoundTag) tracked));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package at.petrak.hexcasting.common.blocks.impetuses;
|
||||
|
||||
import at.petrak.hexcasting.common.blocks.HexBlocks;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class BlockEntityRightClickImpetus extends BlockEntityAbstractImpetus {
|
||||
public BlockEntityRightClickImpetus(BlockPos pWorldPosition, BlockState pBlockState) {
|
||||
super(HexBlocks.IMPETUS_RIGHTCLICK_TILE.get(), pWorldPosition, pBlockState);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package at.petrak.hexcasting.common.blocks.impetuses;
|
||||
|
||||
public class BlockRightClickImpetus extends BlockAbstractImpetus {
|
||||
public BlockRightClickImpetus(Properties p_49795_) {
|
||||
super(p_49795_);
|
||||
}
|
||||
}
|
|
@ -4,13 +4,10 @@ import at.petrak.hexcasting.api.ParticleSpray
|
|||
import at.petrak.hexcasting.api.RenderedSpell
|
||||
import at.petrak.hexcasting.api.SpellDatum
|
||||
import at.petrak.hexcasting.common.lib.HexStatistics
|
||||
import at.petrak.hexcasting.common.network.HexMessages
|
||||
import at.petrak.hexcasting.common.network.MsgCastParticleAck
|
||||
import at.petrak.hexcasting.datagen.Advancements
|
||||
import net.minecraft.Util
|
||||
import net.minecraft.network.chat.TextComponent
|
||||
import net.minecraft.network.chat.TranslatableComponent
|
||||
import net.minecraftforge.network.PacketDistributor
|
||||
import kotlin.random.Random
|
||||
import kotlin.random.nextInt
|
||||
|
||||
|
@ -56,18 +53,7 @@ sealed class OperatorSideEffect {
|
|||
data class Particles(val spray: ParticleSpray) :
|
||||
OperatorSideEffect() {
|
||||
override fun performEffect(harness: CastingHarness): Boolean {
|
||||
val colorizer = harness.getColorizer()
|
||||
val pos = spray.pos
|
||||
|
||||
HexMessages.getNetwork().send(PacketDistributor.NEAR.with {
|
||||
PacketDistributor.TargetPoint(
|
||||
pos.x,
|
||||
pos.y,
|
||||
pos.z,
|
||||
128.0 * 128.0,
|
||||
harness.ctx.world.dimension()
|
||||
)
|
||||
}, MsgCastParticleAck(spray, colorizer))
|
||||
this.spray.sprayParticles(harness.ctx.world, harness.getColorizer())
|
||||
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -19,9 +19,14 @@ public class HexSounds {
|
|||
public static final RegistryObject<SoundEvent> FAIL_PATTERN = sound("casting.fail_pattern");
|
||||
public static final RegistryObject<SoundEvent> CASTING_AMBIANCE = sound("casting.ambiance");
|
||||
public static final RegistryObject<SoundEvent> ACTUALLY_CAST = sound("casting.cast");
|
||||
|
||||
public static final RegistryObject<SoundEvent> ABACUS = sound("abacus");
|
||||
public static final RegistryObject<SoundEvent> ABACUS_SHAKE = sound("abacus.shake");
|
||||
|
||||
public static final RegistryObject<SoundEvent> SPELL_CIRCLE_AMBIANCE = sound("spellcircle.ambiance");
|
||||
public static final RegistryObject<SoundEvent> SPELL_CIRCLE_FIND_BLOCK = sound("spellcircle.find_block");
|
||||
public static final RegistryObject<SoundEvent> SPELL_CIRCLE_FAIL = sound("spellcircle.fail");
|
||||
|
||||
private static RegistryObject<SoundEvent> sound(String name) {
|
||||
return SOUNDS.register(name, () -> new SoundEvent(prefix(name)));
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package at.petrak.hexcasting.datagen;
|
||||
|
||||
import at.petrak.hexcasting.HexMod;
|
||||
import at.petrak.hexcasting.common.blocks.HexBlocks;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraftforge.client.model.generators.BlockStateProvider;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
|
||||
public class BlockStatesAndModels extends BlockStateProvider {
|
||||
|
||||
public BlockStatesAndModels(DataGenerator gen, ExistingFileHelper exFileHelper) {
|
||||
super(gen, HexMod.MOD_ID, exFileHelper);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerStatesAndModels() {
|
||||
simpleBlock(HexBlocks.SLATE.get(), models().getExistingFile(modLoc("slate")));
|
||||
var slateBlock = models().cubeAll("slate_block", modLoc("block/slate"));
|
||||
simpleBlock(HexBlocks.SLATE_BLOCK.get(), slateBlock);
|
||||
simpleBlockItem(HexBlocks.SLATE_BLOCK.get(), slateBlock);
|
||||
}
|
||||
}
|
|
@ -13,12 +13,12 @@ public class DataGenerators {
|
|||
ExistingFileHelper efh = ev.getExistingFileHelper();
|
||||
if (ev.includeClient()) {
|
||||
gen.addProvider(new ItemModels(gen, efh));
|
||||
gen.addProvider(new BlockStatesAndModels(gen, efh));
|
||||
}
|
||||
if (ev.includeServer()) {
|
||||
gen.addProvider(new Recipes(gen));
|
||||
gen.addProvider(new HexLootModifiers(gen));
|
||||
gen.addProvider(new Advancements(gen, efh));
|
||||
}
|
||||
// On both sides
|
||||
gen.addProvider(new HexLootModifiers(gen));
|
||||
gen.addProvider(new Advancements(gen, efh));
|
||||
}
|
||||
}
|
|
@ -48,6 +48,8 @@
|
|||
"item.hexcasting.pride_colorizer_13": "Aroace Pigment",
|
||||
"item.hexcasting.uuid_colorizer": "Soulglimmer Pigment",
|
||||
"block.hexcasting.conjured": "Conjured Block",
|
||||
"block.hexcasting.slate": "Blank Slate",
|
||||
"block.hexcasting.slate.written": "Patterned Slate",
|
||||
"itemGroup.hexcasting": "Hexcasting",
|
||||
|
||||
"hexcasting.tooltip.spellbook.page": "§7Selected Page §a§l%d§7/§a§l%d§r",
|
||||
|
|
56
src/main/resources/assets/hexcasting/models/block/slate.json
Normal file
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "hexcasting:block/slate",
|
||||
"particle": "hexcasting:block/slate"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 1, 16],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 16, 1], "texture": "#0"},
|
||||
"east": {"uv": [15, 0, 16, 16], "rotation": 90, "texture": "#0"},
|
||||
"south": {"uv": [0, 15, 16, 16], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 1, 16], "rotation": 270, "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 16, 16], "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 16, 16], "texture": "#0"}
|
||||
}
|
||||
}
|
||||
],
|
||||
"display": {
|
||||
"thirdperson_righthand": {
|
||||
"translation": [0, 3, 1],
|
||||
"scale": [0.55, 0.55, 0.55]
|
||||
},
|
||||
"thirdperson_lefthand": {
|
||||
"translation": [0, 3, 1],
|
||||
"scale": [0.55, 0.55, 0.55]
|
||||
},
|
||||
"firstperson_righthand": {
|
||||
"rotation": [0, -90, 25],
|
||||
"translation": [1.13, 3.2, 1.13],
|
||||
"scale": [0.68, 0.68, 0.68]
|
||||
},
|
||||
"firstperson_lefthand": {
|
||||
"rotation": [0, -90, 25],
|
||||
"translation": [1.13, 3.2, 1.13],
|
||||
"scale": [0.68, 0.68, 0.68]
|
||||
},
|
||||
"ground": {
|
||||
"translation": [0, 2, 0],
|
||||
"scale": [0.5, 0.5, 0.5]
|
||||
},
|
||||
"gui": {
|
||||
"rotation": [30, 225, 0],
|
||||
"scale": [0.625, 0.625, 0.625]
|
||||
},
|
||||
"head": {
|
||||
"rotation": [0, 180, 0],
|
||||
"translation": [0, 13, 7]
|
||||
},
|
||||
"fixed": {
|
||||
"rotation": [0, 180, 0]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
"casting.start_pattern": {
|
||||
"category": "master",
|
||||
"subtitle": "hexcasting.subtitles.start_pattern",
|
||||
"sounds": [
|
||||
{
|
||||
|
@ -11,7 +10,6 @@
|
|||
]
|
||||
},
|
||||
"casting.add_line": {
|
||||
"category": "master",
|
||||
"subtitle": "hexcasting.subtitles.add_line",
|
||||
"sounds": [
|
||||
{
|
||||
|
@ -22,33 +20,30 @@
|
|||
]
|
||||
},
|
||||
"casting.add_pattern": {
|
||||
"category": "master",
|
||||
"subtitle": "hexcasting.subtitles.add_pattern",
|
||||
"sounds": [
|
||||
"hexcasting:add_pattern"
|
||||
]
|
||||
},
|
||||
"casting.fail_pattern": {
|
||||
"category": "master",
|
||||
"subtitle": "hexcasting.subtitles.fail_pattern",
|
||||
"sounds": [
|
||||
"hexcasting:fail_pattern"
|
||||
]
|
||||
},
|
||||
"casting.ambiance": {
|
||||
"category": "master",
|
||||
"subtitle": "hexcasting.subtitles.ambiance",
|
||||
"sounds": [
|
||||
"hexcasting:casting_ambiance"
|
||||
]
|
||||
},
|
||||
"casting.cast": {
|
||||
"category": "master",
|
||||
"subtitle": "hexcasting.subtitles.cast",
|
||||
"sounds": [
|
||||
"hexcasting:cast_hex"
|
||||
]
|
||||
},
|
||||
|
||||
"abacus": {
|
||||
"subtitle": "hexcasting.subtitles.abacus",
|
||||
"sounds": [
|
||||
|
@ -62,5 +57,30 @@
|
|||
"sounds": [
|
||||
"hexcasting:abacus_shake"
|
||||
]
|
||||
},
|
||||
|
||||
"spellcircle.ambiance": {
|
||||
"sounds": [
|
||||
"hexcasting:casting_ambiance"
|
||||
],
|
||||
"subtitle": "hexcasting.subtitles.spellcircle.ambiance"
|
||||
},
|
||||
"spellcircle.find_block": {
|
||||
"sounds": [
|
||||
{
|
||||
"name": "hexcasting:add_pattern",
|
||||
"pitch": 0.8
|
||||
}
|
||||
],
|
||||
"subtitle": "hexcasting.subtitles.spellcircle.add_pattern"
|
||||
},
|
||||
"spellcircle.fail": {
|
||||
"sounds": [
|
||||
{
|
||||
"name": "hexcasting:fail_pattern",
|
||||
"pitch": 0.8
|
||||
}
|
||||
],
|
||||
"subtitle": "hexcasting.subtitles.spellcircle.fail"
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 358 B |
After Width: | Height: | Size: 355 B |
After Width: | Height: | Size: 387 B |
After Width: | Height: | Size: 378 B |
After Width: | Height: | Size: 406 B |
After Width: | Height: | Size: 403 B |
After Width: | Height: | Size: 388 B |
After Width: | Height: | Size: 383 B |
After Width: | Height: | Size: 389 B |
After Width: | Height: | Size: 384 B |
After Width: | Height: | Size: 393 B |
After Width: | Height: | Size: 399 B |
BIN
src/main/resources/assets/hexcasting/textures/block/slate.png
Normal file
After Width: | Height: | Size: 330 B |
BIN
src/main/resources/assets/hexcasting/textures/item/slate.png
Normal file
After Width: | Height: | Size: 348 B |
After Width: | Height: | Size: 443 B |