Skip to content

Commit

Permalink
feat: make adjustable spell turrets use placer uuid from BasicSpellTu…
Browse files Browse the repository at this point in the history
…rretTile (#1564)
  • Loading branch information
Vonr authored Jan 1, 2025
1 parent 8cc1683 commit 682dd1f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class BasicSpellTurretTile extends ModdedTile implements ITooltipProvider

boolean playRecoil;
protected SpellCaster spellCaster = new SpellCaster(0, null, false, null, 1);
private @Nullable UUID uuid = null;
@Nullable UUID uuid = null;

public BasicSpellTurretTile(BlockEntityType<?> p_i48289_1_, BlockPos pos, BlockState state) {
super(p_i48289_1_, pos, state);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.hollingsworth.arsnouveau.common.network.PacketOneShotAnimation;
import com.hollingsworth.arsnouveau.common.util.PortUtil;
import com.hollingsworth.arsnouveau.setup.registry.BlockRegistry;
import com.mojang.authlib.GameProfile;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.HolderLookup;
Expand All @@ -27,6 +28,7 @@
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import net.neoforged.neoforge.common.util.FakePlayer;
import net.neoforged.neoforge.common.util.FakePlayerFactory;
import org.jetbrains.annotations.Nullable;

import static net.minecraft.core.Direction.*;
Expand Down Expand Up @@ -156,7 +158,9 @@ public void shootSpell() {
return;
Networking.sendToNearbyClient(level, pos, new PacketOneShotAnimation(pos));
Position iposition = RotatingSpellTurret.getDispensePosition(pos, this);
FakePlayer fakePlayer = ANFakePlayer.getPlayer(level);
FakePlayer fakePlayer = uuid != null
? FakePlayerFactory.get(level, new GameProfile(uuid, ""))
: ANFakePlayer.getPlayer(level);
fakePlayer.setPos(pos.getX(), pos.getY(), pos.getZ());
EntitySpellResolver resolver = new EntitySpellResolver(new SpellContext(level, spellCaster.getSpell(), fakePlayer, new TileCaster(this, SpellContext.CasterType.TURRET)));
if (resolver.castType != null && RotatingSpellTurret.ROT_TURRET_BEHAVIOR_MAP.containsKey(resolver.castType)) {
Expand Down

0 comments on commit 682dd1f

Please sign in to comment.