Skip to content

Commit

Permalink
Fixed compile issue and restructured code
Browse files Browse the repository at this point in the history
  • Loading branch information
IGN-Styly committed Oct 20, 2024
1 parent fe7dcd2 commit 5a9a752
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 102 deletions.

This file was deleted.

This file was deleted.

77 changes: 0 additions & 77 deletions src/generated/resources/data/arcanus/recipe/test_recipe2.json

This file was deleted.

1 change: 0 additions & 1 deletion src/main/java/org/styly/arcanus/Arcanus.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.slf4j.Logger;
import org.styly.arcanus.events.CancelSpell;
import org.styly.arcanus.events.RegisterISSslot;
import org.styly.arcanus.events.RegisterRecipes;
import org.styly.arcanus.events.ServerPlayerEvents;
import org.styly.arcanus.registry.*;

Expand Down
59 changes: 59 additions & 0 deletions src/main/java/org/styly/arcanus/block/RitualBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LightningBolt;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
Expand All @@ -26,6 +28,7 @@
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
import org.styly.arcanus.Arcanus;
import org.styly.arcanus.recipe.RitualRecipe;
Expand Down Expand Up @@ -179,6 +182,7 @@ public ItemInteractionResult useItemOn(ItemStack pStack, BlockState state, Level
if(result!=ItemStack.EMPTY) {
ritualTile.setHeldItem(result);
clearPedestals(pLevel,pos);
spawnLightning(pLevel,pos);
}

}
Expand Down Expand Up @@ -238,6 +242,61 @@ public static void clearPedestals(Level pLevel, BlockPos pos){
Objects.requireNonNull((PedestalTile) pLevel.getBlockEntity(blockPos)).setHeldItem(ItemStack.EMPTY);
}
}
public static void spawnLightning(Level pLevel, BlockPos pos){
int level = getLevel(pLevel,pos);
ArrayList<BlockPos> poss= new ArrayList<>();
poss.add(pos);
if(level==1){
poss.add( new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ() - 3));
poss.add(new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ() - 3));

poss.add(new BlockPos(pos.getX() - 3, pos.getY(), pos.getZ() - 1));
poss.add(new BlockPos(pos.getX() + 3, pos.getY(), pos.getZ() - 1));


poss.add(new BlockPos(pos.getX() - 3, pos.getY(), pos.getZ() + 1));
poss.add(new BlockPos(pos.getX() + 3, pos.getY(), pos.getZ() + 1));

poss.add(new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ() + 3));
poss.add(new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ() + 3));
} else if (level==2){
poss.add( new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ() - 3));
poss.add(new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ() - 3));

poss.add(new BlockPos(pos.getX() - 3, pos.getY(), pos.getZ() - 1));
poss.add(new BlockPos(pos.getX() + 3, pos.getY(), pos.getZ() - 1));


poss.add(new BlockPos(pos.getX() - 3, pos.getY(), pos.getZ() + 1));
poss.add(new BlockPos(pos.getX() + 3, pos.getY(), pos.getZ() + 1));

poss.add(new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ() + 3));
poss.add(new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ() + 3));

poss.add(new BlockPos(pos.getX() - 4, pos.getY(), pos.getZ() - 4)); //t2
poss.add(new BlockPos(pos.getX(), pos.getY(), pos.getZ() - 5)); //t2
poss.add(new BlockPos(pos.getX() + 4, pos.getY(), pos.getZ() - 4)); //t2

poss.add(new BlockPos(pos.getX() - 5, pos.getY(), pos.getZ())); //t2
poss.add(new BlockPos(pos.getX() + 5, pos.getY(), pos.getZ())); //t2

poss.add( new BlockPos(pos.getX() - 4, pos.getY(), pos.getZ() + 4)); //t2
poss.add( new BlockPos(pos.getX(), pos.getY(), pos.getZ() + 5)); //t2
poss.add( new BlockPos(pos.getX() + 4, pos.getY(), pos.getZ() + 4)); //t2



}
for (BlockPos blockPos : poss) {
LightningBolt entity = EntityType.LIGHTNING_BOLT.create(pLevel);
assert entity != null;
entity.setPos(new Vec3(blockPos.getX(),blockPos.getY(),blockPos.getZ()));
entity.setDamage(50);
entity.setVisualOnly(true);
pLevel.addFreshEntity(entity);

}
}
public static boolean IsValid(Level pLevel, @NotNull BlockPos pos) {
BlockPos b0 = new BlockPos(pos.getX(), pos.getY(), pos.getZ()); //center aka result!

Expand Down

0 comments on commit 5a9a752

Please sign in to comment.