Split up and reorganise WizardryUtilities
This commit is contained in:
@@ -173,7 +173,7 @@ public final class WizardryEventHandler {
|
||||
&& Wizardry.settings.discoveryMode){
|
||||
// Sound and text only happen server-side, in survival, with discovery mode on, and only when
|
||||
// the spell wasn't cast using commands.
|
||||
WizardryUtilities.playSoundAtPlayer(player, WizardrySounds.MISC_DISCOVER_SPELL, 1.25f, 1);
|
||||
EntityUtils.playSoundAtPlayer(player, WizardrySounds.MISC_DISCOVER_SPELL, 1.25f, 1);
|
||||
player.sendMessage(new TextComponentTranslation("spell.discover",
|
||||
event.getSpell().getNameForTranslationFormatted()));
|
||||
}
|
||||
@@ -389,7 +389,7 @@ public final class WizardryEventHandler {
|
||||
}
|
||||
}
|
||||
|
||||
for(ItemStack stack : WizardryUtilities.getPrioritisedHotbarAndOffhand(player)){
|
||||
for(ItemStack stack : InventoryUtils.getPrioritisedHotbarAndOffhand(player)){
|
||||
|
||||
if(stack.getItem() instanceof IManaStoringItem && !((IManaStoringItem)stack.getItem()).isManaFull(stack)
|
||||
&& WandHelper.getUpgradeLevel(stack, WizardryItems.siphon_upgrade) > 0){
|
||||
|
||||
@@ -7,8 +7,8 @@ import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.registry.WizardryTabs;
|
||||
import electroblob.wizardry.tileentity.TileEntityReceptacle;
|
||||
import electroblob.wizardry.util.GeometryUtils;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.block.BlockTorch;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.SoundType;
|
||||
@@ -178,7 +178,7 @@ public class BlockReceptacle extends BlockTorch implements ITileEntityProvider {
|
||||
|
||||
EnumFacing facing = state.getValue(FACING).getOpposite();
|
||||
|
||||
Vec3d centre = WizardryUtilities.getCentre(pos);
|
||||
Vec3d centre = GeometryUtils.getCentre(pos);
|
||||
if(facing.getAxis().isHorizontal()){
|
||||
centre = centre.add(new Vec3d(facing.getDirectionVec()).scale(WALL_PARTICLE_OFFSET)).add(0, 0.125, 0);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package electroblob.wizardry.block;
|
||||
|
||||
import electroblob.wizardry.tileentity.TileEntityStatue;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.BlockUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.SoundType;
|
||||
@@ -197,7 +197,7 @@ public class BlockStatue extends Block implements ITileEntityProvider {
|
||||
entity.extinguish();
|
||||
|
||||
// Short mobs such as spiders and pigs
|
||||
if((entity.height < 1.2 || entity.isChild()) && WizardryUtilities.canBlockBeReplaced(world, pos)){
|
||||
if((entity.height < 1.2 || entity.isChild()) && BlockUtils.canBlockBeReplaced(world, pos)){
|
||||
|
||||
world.setBlockState(pos, this.getDefaultState());
|
||||
if(world.getTileEntity(pos) instanceof TileEntityStatue){
|
||||
@@ -210,8 +210,8 @@ public class BlockStatue extends Block implements ITileEntityProvider {
|
||||
return true;
|
||||
}
|
||||
// Normal sized mobs like zombies and skeletons
|
||||
else if(entity.height < 2.5 && WizardryUtilities.canBlockBeReplaced(world, pos)
|
||||
&& WizardryUtilities.canBlockBeReplaced(world, pos.up())){
|
||||
else if(entity.height < 2.5 && BlockUtils.canBlockBeReplaced(world, pos)
|
||||
&& BlockUtils.canBlockBeReplaced(world, pos.up())){
|
||||
|
||||
world.setBlockState(pos, this.getDefaultState());
|
||||
if(world.getTileEntity(pos) instanceof TileEntityStatue){
|
||||
@@ -229,9 +229,9 @@ public class BlockStatue extends Block implements ITileEntityProvider {
|
||||
return true;
|
||||
}
|
||||
// Tall mobs like endermen
|
||||
else if(WizardryUtilities.canBlockBeReplaced(world, pos)
|
||||
&& WizardryUtilities.canBlockBeReplaced(world, pos.up())
|
||||
&& WizardryUtilities.canBlockBeReplaced(world, pos.up(2))){
|
||||
else if(BlockUtils.canBlockBeReplaced(world, pos)
|
||||
&& BlockUtils.canBlockBeReplaced(world, pos.up())
|
||||
&& BlockUtils.canBlockBeReplaced(world, pos.up(2))){
|
||||
|
||||
world.setBlockState(pos, this.getDefaultState());
|
||||
if(world.getTileEntity(pos) instanceof TileEntityStatue){
|
||||
|
||||
@@ -8,9 +8,9 @@ import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryBlocks;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.spell.Transportation;
|
||||
import electroblob.wizardry.util.GeometryUtils;
|
||||
import electroblob.wizardry.util.Location;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -162,7 +162,7 @@ public class BlockTransportationStone extends Block {
|
||||
for(int z = -1; z <= 1; z++){
|
||||
if(x == 0 && z == 0) continue;
|
||||
ParticleBuilder.create(ParticleBuilder.Type.PATH)
|
||||
.pos(WizardryUtilities.getCentre(centre).add(x, -0.3125, z)).clr(0x86ff65)
|
||||
.pos(GeometryUtils.getCentre(centre).add(x, -0.3125, z)).clr(0x86ff65)
|
||||
.time(200).scale(2).spawn(world);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,7 @@ import org.lwjgl.opengl.GL11;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Utility class containing some useful static methods for drawing GUIs. Previously these were spread across the main
|
||||
* {@code WizardryUtilities} class and various individual GUI classes.
|
||||
* Utility class containing some useful static methods for drawing GUIs, as well as general rendering.
|
||||
*
|
||||
* @author Electroblob
|
||||
* @since Wizardry 4.2
|
||||
@@ -269,4 +268,22 @@ public final class DrawingUtils {
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates a factor between 0 and 1 that results in a smooth, aesthetically-pleasing animation when used to scale
|
||||
* things. Mainly for rendering, but can be used anywhere since it's just a mathematical formula.
|
||||
* @param lifetime The lifetime of the thing being animated, in ticks (if this is negative, disappearing is ignored)
|
||||
* @param ticksExisted The current age of the thing being animated, in ticks
|
||||
* @param partialTicks The current partial tick time
|
||||
* @param startLength The length of the appearing animation, in ticks
|
||||
* @param endLength The length of the disappearing animation, in ticks
|
||||
* @return A fraction between 0 and 1, with the value at the very start and end being 0 and the constant middle
|
||||
* section having a value of 1.
|
||||
*/
|
||||
public static float smoothScaleFactor(int lifetime, int ticksExisted, float partialTicks, int startLength, int endLength){
|
||||
float age = ticksExisted + partialTicks;
|
||||
float s = MathHelper.clamp(age < startLength || lifetime < 0 ? age/startLength : (lifetime - age) / endLength, 0, 1);
|
||||
s = (float)Math.pow(s, 0.4); // Smooths the animation
|
||||
return s;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package electroblob.wizardry.client.animation;
|
||||
import electroblob.wizardry.data.WizardData;
|
||||
import electroblob.wizardry.item.SpellActions;
|
||||
import electroblob.wizardry.spell.Grapple;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.InventoryUtils;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -43,7 +43,7 @@ public abstract class ActionAnimation extends Animation {
|
||||
// Something (probably some sort of race condition) causes getActiveItemStack to sometimes be wrong
|
||||
if(player.getActiveItemStack() != player.getHeldItem(player.getActiveHand())) return;
|
||||
|
||||
EnumHandSide side = WizardryUtilities.getSideForHand(player, player.getActiveHand());
|
||||
EnumHandSide side = InventoryUtils.getSideForHand(player, player.getActiveHand());
|
||||
|
||||
float pitch = (float)Math.toRadians(player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTicks);
|
||||
float yaw = (float)Math.toRadians(player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks)
|
||||
@@ -61,7 +61,7 @@ public abstract class ActionAnimation extends Animation {
|
||||
@Override
|
||||
public void setRotationAngles(EntityPlayer player, ModelBiped model, float partialTicks, boolean firstPerson){
|
||||
if(player.getActiveItemStack() != player.getHeldItem(player.getActiveHand())) return;
|
||||
EnumHandSide side = WizardryUtilities.getSideForHand(player, player.getActiveHand());
|
||||
EnumHandSide side = InventoryUtils.getSideForHand(player, player.getActiveHand());
|
||||
ModelRendererExtended arm = (ModelRendererExtended)getArmForSide(model, side);
|
||||
arm.addRotation(-2.2f, side == EnumHandSide.RIGHT ? 0.2f : -0.2f, 0);
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public abstract class ActionAnimation extends Animation {
|
||||
public void setRotationAngles(EntityPlayer player, ModelBiped model, float partialTicks, boolean firstPerson){
|
||||
float tick = player.getItemInUseMaxCount() + partialTicks; // It's not the "max" use count at all!
|
||||
float y = Math.min(0.4f + tick * 0.05f, 0.7f);
|
||||
EnumHandSide side = WizardryUtilities.getSideForHand(player, player.getActiveHand());
|
||||
EnumHandSide side = InventoryUtils.getSideForHand(player, player.getActiveHand());
|
||||
ModelRendererExtended arm = (ModelRendererExtended)getArmForSide(model, side);
|
||||
arm.addRotation(-0.2f, side == EnumHandSide.RIGHT ? y : -y, 0);
|
||||
}
|
||||
@@ -103,7 +103,7 @@ public abstract class ActionAnimation extends Animation {
|
||||
target = new Vec3d(hit.entityHit.posX, hit.entityHit.getEntityBoundingBox().minY + hit.entityHit.height/2, hit.entityHit.posZ);
|
||||
}
|
||||
|
||||
EnumHandSide side = WizardryUtilities.getSideForHand(player, player.getActiveHand());
|
||||
EnumHandSide side = InventoryUtils.getSideForHand(player, player.getActiveHand());
|
||||
|
||||
ModelRendererExtended arm = (ModelRendererExtended)getArmForSide(model, side);
|
||||
|
||||
@@ -125,10 +125,10 @@ public abstract class ActionAnimation extends Animation {
|
||||
public void setRotationAngles(EntityPlayer player, ModelBiped model, float partialTicks, boolean firstPerson){
|
||||
float tick = player.getItemInUseMaxCount() + partialTicks; // It's not the "max" use count at all!
|
||||
float z = Math.max(1.5f - tick * 0.1f, 0.8f);
|
||||
EnumHandSide side = WizardryUtilities.getSideForHand(player, player.getActiveHand());
|
||||
EnumHandSide side = InventoryUtils.getSideForHand(player, player.getActiveHand());
|
||||
ModelRendererExtended arm = (ModelRendererExtended)getArmForSide(model, side);
|
||||
arm.addRotation(-1.2f, side == EnumHandSide.RIGHT ? -0.2f : 0.2f, side == EnumHandSide.RIGHT ? z : -z);
|
||||
if(!player.getHeldItem(WizardryUtilities.getHandForSide(player, side.opposite())).isEmpty()){
|
||||
if(!player.getHeldItem(InventoryUtils.getHandForSide(player, side.opposite())).isEmpty()){
|
||||
((ModelRendererExtended)getArmForSide(model, side.opposite())).addRotation(-0.8f, side == EnumHandSide.LEFT ? 0.3f : -0.3f, 0);
|
||||
}
|
||||
}
|
||||
@@ -138,11 +138,11 @@ public abstract class ActionAnimation extends Animation {
|
||||
@Override
|
||||
public void setRotationAngles(EntityPlayer player, ModelBiped model, float partialTicks, boolean firstPerson){
|
||||
if(player.getActiveItemStack() != player.getHeldItem(player.getActiveHand())) return;
|
||||
EnumHandSide side = WizardryUtilities.getSideForHand(player, player.getActiveHand());
|
||||
EnumHandSide side = InventoryUtils.getSideForHand(player, player.getActiveHand());
|
||||
ModelRendererExtended arm = (ModelRendererExtended)getArmForSide(model, side);
|
||||
float y = side == EnumHandSide.RIGHT ? -0.6f : 0.6f;
|
||||
arm.addRotation(-1.2f, y, 0);
|
||||
if(player.getHeldItem(WizardryUtilities.getHandForSide(player, side.opposite())).isEmpty()){
|
||||
if(player.getHeldItem(InventoryUtils.getHandForSide(player, side.opposite())).isEmpty()){
|
||||
ModelRendererExtended otherArm = (ModelRendererExtended)getArmForSide(model, side.opposite());
|
||||
otherArm.setRotation(arm.rotateAngleX - 1.2f, -arm.rotateAngleY - y, otherArm.rotateAngleZ);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@ package electroblob.wizardry.client.animation;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.item.SpellActions;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.InventoryUtils;
|
||||
import electroblob.wizardry.util.JavaUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
@@ -93,7 +94,7 @@ public class PlayerAnimator {
|
||||
|
||||
for(LayerRenderer<?> layer : layers){
|
||||
|
||||
for(Field field : WizardryUtilities.getAllFields(layer.getClass())){
|
||||
for(Field field : JavaUtils.getAllFields(layer.getClass())){
|
||||
|
||||
field.setAccessible(true);
|
||||
|
||||
@@ -123,7 +124,7 @@ public class PlayerAnimator {
|
||||
// This needs to be lazy-loaded because we need access to an actual item
|
||||
for(LayerRenderer<? extends EntityLivingBase> layer : playerLayers.get(renderer)){
|
||||
if(layer instanceof LayerBipedArmor){
|
||||
for(EntityEquipmentSlot slot : WizardryUtilities.ARMOUR_SLOTS){
|
||||
for(EntityEquipmentSlot slot : InventoryUtils.ARMOUR_SLOTS){
|
||||
|
||||
ItemStack armour = player.getItemStackFromSlot(slot);
|
||||
ModelBiped model = ForgeHooksClient.getArmorModel(player, armour, slot, ((LayerBipedArmor)layer).getModelFromSlot(slot));
|
||||
|
||||
@@ -3,7 +3,7 @@ package electroblob.wizardry.client.audio;
|
||||
import electroblob.wizardry.data.DispenserCastingData;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import net.minecraft.client.audio.PositionedSound;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -49,7 +49,7 @@ public abstract class SoundLoopSpell extends SoundLoop {
|
||||
|
||||
@Override
|
||||
protected boolean stillCasting(Spell spell){
|
||||
return WizardryUtilities.isCasting(source, spell);
|
||||
return EntityUtils.isCasting(source, spell);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ import electroblob.wizardry.packet.WizardryPacketHandler;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.spell.Resurrection;
|
||||
import electroblob.wizardry.util.InventoryUtils;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiGameOver;
|
||||
@@ -52,7 +52,7 @@ public class GuiButtonResurrect extends GuiButton {
|
||||
public static void onGuiScreenInitEvent(GuiScreenEvent.InitGuiEvent event){
|
||||
|
||||
if(event.getGui() instanceof GuiGameOver && ItemArtefact.isArtefactActive(Minecraft.getMinecraft().player, WizardryItems.amulet_resurrection)
|
||||
&& WizardryUtilities.getHotbar(Minecraft.getMinecraft().player).stream().anyMatch(s -> Resurrection.canStackResurrect(s, Minecraft.getMinecraft().player))){
|
||||
&& InventoryUtils.getHotbar(Minecraft.getMinecraft().player).stream().anyMatch(s -> Resurrection.canStackResurrect(s, Minecraft.getMinecraft().player))){
|
||||
|
||||
event.getButtonList().add(new GuiButtonResurrect(event.getButtonList().size(), event.getGui().width / 2 - 100,
|
||||
event.getGui().height / 4 + 120, "spell." + Spells.resurrection.getRegistryName() + ".button"));
|
||||
@@ -65,7 +65,7 @@ public class GuiButtonResurrect extends GuiButton {
|
||||
|
||||
if(event.getGui() instanceof GuiGameOver){
|
||||
|
||||
ItemStack stack = WizardryUtilities.getHotbar(Minecraft.getMinecraft().player).stream()
|
||||
ItemStack stack = InventoryUtils.getHotbar(Minecraft.getMinecraft().player).stream()
|
||||
.filter(s -> Resurrection.canStackResurrect(s, Minecraft.getMinecraft().player)).findFirst().orElse(null);
|
||||
|
||||
if(stack != null){
|
||||
|
||||
@@ -12,9 +12,9 @@ import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.tileentity.TileEntityLectern;
|
||||
import electroblob.wizardry.util.GeometryUtils;
|
||||
import electroblob.wizardry.util.ISpellSortable;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.audio.SoundHandler;
|
||||
@@ -278,9 +278,9 @@ public class GuiLectern extends GuiSpellInfo implements ISpellSortable {
|
||||
|
||||
for(EnumFacing side : EnumFacing.VALUES){
|
||||
ParticleBuilder.create(ParticleBuilder.Type.BLOCK_HIGHLIGHT).pos(
|
||||
WizardryUtilities.getFaceCentre(pos, side)
|
||||
GeometryUtils.getFaceCentre(pos, side)
|
||||
.add(new Vec3d(side.getDirectionVec())
|
||||
.scale(WizardryUtilities.ANTI_Z_FIGHTING_OFFSET)))
|
||||
.scale(GeometryUtils.ANTI_Z_FIGHTING_OFFSET)))
|
||||
.face(side).clr(0.9f, 0.5f, 0.8f).fade(0.7f, 0, 1).spawn(mc.world);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package electroblob.wizardry.client.gui.handbook;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import electroblob.wizardry.client.DrawingUtils;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.JavaUtils;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.JsonUtils;
|
||||
@@ -50,7 +50,7 @@ class Contents {
|
||||
|
||||
/** Returns an unmodifiable, flattened collection of all the buttons in this contents. */
|
||||
Collection<GuiButton> getButtons(){
|
||||
return WizardryUtilities.flatten(buttons);
|
||||
return JavaUtils.flatten(buttons);
|
||||
}
|
||||
|
||||
void addEntry(Section section){
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.client.DrawingUtils;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.JavaUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
@@ -63,7 +63,7 @@ class Section {
|
||||
}
|
||||
|
||||
Collection<GuiButton> getButtons(){
|
||||
return WizardryUtilities.flatten(buttons);
|
||||
return JavaUtils.flatten(buttons);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package electroblob.wizardry.client.particle;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.GeometryUtils;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -24,7 +24,7 @@ public class ParticleBlockHighlight extends ParticleWizardry {
|
||||
this.particleGravity = 0;
|
||||
this.setMaxAge(160);
|
||||
// 5 makes it the exact size of a block face, plus a little bit to account for the anti-z-fighting offset
|
||||
this.particleScale = 5 * (1 + 2 * (float)WizardryUtilities.ANTI_Z_FIGHTING_OFFSET);
|
||||
this.particleScale = 5 * (1 + 2 * (float)GeometryUtils.ANTI_Z_FIGHTING_OFFSET);
|
||||
this.shaded = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package electroblob.wizardry.client.particle;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.client.ClientProxy;
|
||||
import electroblob.wizardry.entity.ICustomHitbox;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
@@ -467,7 +467,7 @@ public abstract class ParticleWizardry extends Particle {
|
||||
|
||||
double searchRadius = 20;
|
||||
|
||||
List<Entity> nearbyEntities = WizardryUtilities.getEntitiesWithinRadius(searchRadius, this.posX,
|
||||
List<Entity> nearbyEntities = EntityUtils.getEntitiesWithinRadius(searchRadius, this.posX,
|
||||
this.posY, this.posZ, world, Entity.class);
|
||||
|
||||
nearbyEntities.removeIf(e -> !(e instanceof ICustomHitbox && ((ICustomHitbox)e).contains(new Vec3d(this.posX, this.posY, this.posZ))));
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package electroblob.wizardry.client.renderer.effect;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.potion.PotionContainment;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.GeometryUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
@@ -42,7 +42,7 @@ public class RenderContainmentField {
|
||||
|
||||
if(player.isPotionActive(WizardryPotions.containment)){
|
||||
|
||||
Vec3d centre = WizardryUtilities.getCentre(NBTUtil.getPosFromTag(player.getEntityData().getCompoundTag(PotionContainment.ENTITY_TAG)));
|
||||
Vec3d centre = GeometryUtils.getCentre(NBTUtil.getPosFromTag(player.getEntityData().getCompoundTag(PotionContainment.ENTITY_TAG)));
|
||||
float r = PotionContainment.getContainmentDistance(player.getActivePotionEffect(WizardryPotions.containment).getAmplifier());
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
@@ -2,7 +2,7 @@ package electroblob.wizardry.client.renderer.effect;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
@@ -32,7 +32,7 @@ public class RenderShadowWard {
|
||||
|
||||
EntityPlayer player = Minecraft.getMinecraft().player;
|
||||
|
||||
if(WizardryUtilities.isCasting(player, Spells.shadow_ward)){
|
||||
if(EntityUtils.isCasting(player, Spells.shadow_ward)){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
@@ -94,7 +94,7 @@ public class RenderShadowWard {
|
||||
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
|
||||
if(WizardryUtilities.isCasting(player, Spells.shadow_ward)){
|
||||
if(EntityUtils.isCasting(player, Spells.shadow_ward)){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.data.WizardData;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.spell.Shield;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
@@ -34,7 +34,7 @@ public class RenderShield {
|
||||
|
||||
EntityPlayer player = Minecraft.getMinecraft().player;
|
||||
|
||||
if(WizardData.get(player).getVariable(Shield.SHIELD_KEY) != null && WizardryUtilities.isCasting(player, Spells.shield)){
|
||||
if(WizardData.get(player).getVariable(Shield.SHIELD_KEY) != null && EntityUtils.isCasting(player, Spells.shield)){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
@@ -76,7 +76,7 @@ public class RenderShield {
|
||||
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
|
||||
if(WizardData.get(player).getVariable(Shield.SHIELD_KEY) != null && WizardryUtilities.isCasting(player, Spells.shield)){
|
||||
if(WizardData.get(player).getVariable(Shield.SHIELD_KEY) != null && EntityUtils.isCasting(player, Spells.shield)){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package electroblob.wizardry.client.renderer.effect;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
@@ -32,7 +32,7 @@ public class RenderWings {
|
||||
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
|
||||
if(WizardryUtilities.isCasting(player, Spells.flight)){
|
||||
if(EntityUtils.isCasting(player, Spells.flight)){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package electroblob.wizardry.client.renderer.entity;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.client.DrawingUtils;
|
||||
import electroblob.wizardry.client.renderer.RayHelper;
|
||||
import electroblob.wizardry.entity.construct.EntityBlackHole;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
@@ -50,7 +50,7 @@ public class RenderBlackHole extends Render<EntityBlackHole> {
|
||||
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
float s = WizardryUtilities.smoothScaleFactor(entity.lifetime, entity.ticksExisted, partialTicks, 10, 10);
|
||||
float s = DrawingUtils.smoothScaleFactor(entity.lifetime, entity.ticksExisted, partialTicks, 10, 10);
|
||||
GlStateManager.scale(s, s, s);
|
||||
|
||||
this.bindTexture(RAY_TEXTURE);
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package electroblob.wizardry.client.renderer.entity;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.client.DrawingUtils;
|
||||
import electroblob.wizardry.entity.construct.EntityBubble;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
@@ -33,7 +34,7 @@ public class RenderBubble extends Render<EntityBubble> {
|
||||
|
||||
float yOffset = 0;
|
||||
|
||||
Entity rider = WizardryUtilities.getRider(entity);
|
||||
Entity rider = EntityUtils.getRider(entity);
|
||||
|
||||
if(rider != null){
|
||||
yOffset = rider.height / 2;
|
||||
@@ -66,7 +67,7 @@ public class RenderBubble extends Render<EntityBubble> {
|
||||
GlStateManager.rotate(yaw, 1.0F, 0.0F, 0.0F);
|
||||
|
||||
// Bubble 'bursts' so doesn't shrink when is disappears
|
||||
float s = 3 * WizardryUtilities.smoothScaleFactor(entity.isDarkOrb ? entity.lifetime : -1, entity.ticksExisted, partialTicks, 10, 10);
|
||||
float s = 3 * DrawingUtils.smoothScaleFactor(entity.isDarkOrb ? entity.lifetime : -1, entity.ticksExisted, partialTicks, 10, 10);
|
||||
GlStateManager.scale(s, s, s);
|
||||
|
||||
double pixelwidth = (1.0d / 128);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package electroblob.wizardry.client.renderer.entity;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.client.DrawingUtils;
|
||||
import electroblob.wizardry.entity.construct.EntityDecay;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
@@ -44,7 +44,7 @@ public class RenderDecay extends Render<EntityDecay> {
|
||||
|
||||
GlStateManager.rotate(-90, 1, 0, 0);
|
||||
|
||||
float s = 2 * WizardryUtilities.smoothScaleFactor(entity.lifetime, entity.ticksExisted, partialTicks, 10, 50);
|
||||
float s = 2 * DrawingUtils.smoothScaleFactor(entity.lifetime, entity.ticksExisted, partialTicks, 10, 50);
|
||||
GlStateManager.scale(s, s, s);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package electroblob.wizardry.client.renderer.entity;
|
||||
|
||||
import electroblob.wizardry.client.DrawingUtils;
|
||||
import electroblob.wizardry.entity.construct.EntityFireRing;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
@@ -47,7 +47,7 @@ public class RenderFireRing extends Render<EntityFireRing> {
|
||||
|
||||
GlStateManager.rotate(-90, 1, 0, 0);
|
||||
|
||||
float s = WizardryUtilities.smoothScaleFactor(entity.lifetime, entity.ticksExisted, partialTicks, 10, 10);
|
||||
float s = DrawingUtils.smoothScaleFactor(entity.lifetime, entity.ticksExisted, partialTicks, 10, 10);
|
||||
GlStateManager.scale(scale * s, scale * s, scale * s);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package electroblob.wizardry.client.renderer.entity;
|
||||
|
||||
import electroblob.wizardry.client.DrawingUtils;
|
||||
import electroblob.wizardry.entity.construct.EntityHealAura;
|
||||
import electroblob.wizardry.entity.construct.EntityMagicConstruct;
|
||||
import electroblob.wizardry.util.AllyDesignationSystem;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
@@ -61,7 +61,7 @@ public class RenderSigil extends Render<EntityMagicConstruct> {
|
||||
// Healing aura rotates slowly
|
||||
if(entity instanceof EntityHealAura) GlStateManager.rotate(entity.ticksExisted / 3.0f, 0, 0, 1);
|
||||
|
||||
float s = WizardryUtilities.smoothScaleFactor(entity.lifetime, entity.ticksExisted, partialTicks, 10, 10);
|
||||
float s = DrawingUtils.smoothScaleFactor(entity.lifetime, entity.ticksExisted, partialTicks, 10, 10);
|
||||
GlStateManager.scale(scale * s, scale * s, scale * s);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package electroblob.wizardry.client.renderer.entity;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.client.DrawingUtils;
|
||||
import electroblob.wizardry.entity.construct.EntityZombieSpawner;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.GeometryUtils;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
@@ -19,7 +20,7 @@ public class RenderZombieSpawner extends Render<EntityZombieSpawner> {
|
||||
|
||||
private static final ResourceLocation TEXTURE = new ResourceLocation(Wizardry.MODID, "textures/entity/zombie_spawner.png");
|
||||
|
||||
private static final Vec3d[] HIDDEN_BOX = WizardryUtilities.getVertices(new AxisAlignedBB(-1, 0, -1, 1, 2.5, 1));
|
||||
private static final Vec3d[] HIDDEN_BOX = GeometryUtils.getVertices(new AxisAlignedBB(-1, 0, -1, 1, 2.5, 1));
|
||||
|
||||
public RenderZombieSpawner(RenderManager renderManager){
|
||||
super(renderManager);
|
||||
@@ -42,14 +43,14 @@ public class RenderZombieSpawner extends Render<EntityZombieSpawner> {
|
||||
// The visible bit
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
float s = WizardryUtilities.smoothScaleFactor(entity.lifetime, entity.ticksExisted, partialTicks, 10, 10);
|
||||
float s = DrawingUtils.smoothScaleFactor(entity.lifetime, entity.ticksExisted, partialTicks, 10, 10);
|
||||
GlStateManager.scale(s, s, s);
|
||||
|
||||
GlStateManager.rotate((entity.ticksExisted + partialTicks) * 2, 0, 1, 0);
|
||||
|
||||
this.bindTexture(TEXTURE);
|
||||
|
||||
Vec3d[] vertices = WizardryUtilities.getVertices(entity.getEntityBoundingBox().offset(entity.getPositionVector().scale(-1)));
|
||||
Vec3d[] vertices = GeometryUtils.getVertices(entity.getEntityBoundingBox().offset(entity.getPositionVector().scale(-1)));
|
||||
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
drawFace(buffer, vertices[0], vertices[1], vertices[3], vertices[2], 0, 0, 1, 1); // Bottom
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@ package electroblob.wizardry.client.renderer.overlay;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.data.WizardData;
|
||||
import electroblob.wizardry.item.ISpellCastingItem;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.RayTracer;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
@@ -42,7 +42,7 @@ public class RenderTargetPointers {
|
||||
}
|
||||
|
||||
// Target selection pointer
|
||||
if(mc.player.isSneaking() && wand.getItem() instanceof ISpellCastingItem && WizardryUtilities.isLiving(event.getEntity())
|
||||
if(mc.player.isSneaking() && wand.getItem() instanceof ISpellCastingItem && EntityUtils.isLiving(event.getEntity())
|
||||
&& data != null && data.selectedMinion != null){
|
||||
|
||||
// -> Moved this in here so it isn't called every tick
|
||||
|
||||
+2
-2
@@ -7,8 +7,8 @@ import electroblob.wizardry.item.ItemArtefact;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.spell.Transportation;
|
||||
import electroblob.wizardry.util.GeometryUtils;
|
||||
import electroblob.wizardry.util.Location;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
@@ -84,7 +84,7 @@ public class RenderTransportationUI {
|
||||
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
|
||||
Vec3d position = WizardryUtilities.getCentre(location.pos).subtract(origin);
|
||||
Vec3d position = GeometryUtils.getCentre(location.pos).subtract(origin);
|
||||
double distance = position.length();
|
||||
// The icon lines up perfectly if you render it at actual distance, otherwise view bobbing messes things up
|
||||
// However, if that's outside the render distance it won't render at all! To fudge our way around this
|
||||
|
||||
@@ -2,7 +2,7 @@ package electroblob.wizardry.client.renderer.tileentity;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.spell.ArcaneLock;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.GeometryUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
@@ -74,7 +74,7 @@ public class RenderArcaneLock {
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
}
|
||||
|
||||
Vec3d[] vertices = WizardryUtilities.getVertices(world.getBlockState(tileentity.getPos()).getBoundingBox(world, tileentity.getPos()).grow(0.05).offset(tileentity.getPos()));
|
||||
Vec3d[] vertices = GeometryUtils.getVertices(world.getBlockState(tileentity.getPos()).getBoundingBox(world, tileentity.getPos()).grow(0.05).offset(tileentity.getPos()));
|
||||
|
||||
drawFace(buffer, vertices[0], vertices[1], vertices[3], vertices[2], 0, 0, 1, 1); // Bottom
|
||||
drawFace(buffer, vertices[6], vertices[7], vertices[2], vertices[3], 0, 0, 1, 1); // South
|
||||
|
||||
@@ -2,11 +2,11 @@ package electroblob.wizardry.client.renderer.tileentity;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.block.BlockMagicLight;
|
||||
import electroblob.wizardry.client.DrawingUtils;
|
||||
import electroblob.wizardry.item.ISpellCastingItem;
|
||||
import electroblob.wizardry.item.ItemArtefact;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.tileentity.TileEntityMagicLight;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
@@ -43,7 +43,7 @@ public class RenderMagicLight extends TileEntitySpecialRenderer<TileEntityMagicL
|
||||
|
||||
GlStateManager.translate(x + 0.5, y + 0.5, z + 0.5);
|
||||
|
||||
float s = WizardryUtilities.smoothScaleFactor(tileentity.getLifetime(), tileentity.timer, partialTicks, 10, 10);
|
||||
float s = DrawingUtils.smoothScaleFactor(tileentity.getLifetime(), tileentity.timer, partialTicks, 10, 10);
|
||||
GlStateManager.scale(s, s, s);
|
||||
|
||||
// Renders the aura effect
|
||||
|
||||
@@ -2,7 +2,7 @@ package electroblob.wizardry.command;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.data.WizardData;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import net.minecraft.command.*;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -78,7 +78,7 @@ public class CommandSetAlly extends CommandBase {
|
||||
// Don't want to catch the exception here either, because there can be no other second argument.
|
||||
|
||||
if(allyOf != sender && sender instanceof EntityPlayer
|
||||
&& !WizardryUtilities.isPlayerOp((EntityPlayer)sender, server)){
|
||||
&& !EntityUtils.isPlayerOp((EntityPlayer)sender, server)){
|
||||
// Displays a chat message if a non-op tries to modify another player's allies.
|
||||
if(server.sendCommandFeedback()){
|
||||
TextComponentTranslation TextComponentTranslation2 = new TextComponentTranslation(
|
||||
|
||||
@@ -2,7 +2,7 @@ package electroblob.wizardry.command;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.data.WizardData;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
@@ -72,7 +72,7 @@ public class CommandViewAllies extends CommandBase {
|
||||
// Don't want to catch the exception here either, because there can be no other first argument.
|
||||
|
||||
if(player != sender && sender instanceof EntityPlayer
|
||||
&& !WizardryUtilities.isPlayerOp((EntityPlayer)sender, server)){
|
||||
&& !EntityUtils.isPlayerOp((EntityPlayer)sender, server)){
|
||||
// Displays a chat message if a non-op tries to view another player's allies.
|
||||
if(server.sendCommandFeedback()){
|
||||
TextComponentTranslation TextComponentTranslation2 = new TextComponentTranslation(
|
||||
|
||||
@@ -3,10 +3,7 @@ package electroblob.wizardry.entity;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.AllyDesignationSystem;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.NBTExtras;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.*;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFalling;
|
||||
@@ -81,7 +78,7 @@ public class EntityLevitatingBlock extends EntityFallingBlock implements IEntity
|
||||
}
|
||||
|
||||
if(this.getCaster() == null && this.casterUUID != null){
|
||||
Entity entity = WizardryUtilities.getEntityByUUID(world, casterUUID);
|
||||
Entity entity = EntityUtils.getEntityByUUID(world, casterUUID);
|
||||
if(entity instanceof EntityLivingBase){
|
||||
this.caster = new WeakReference<>((EntityLivingBase)entity);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryBlocks;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Meteor;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.MoverType;
|
||||
import net.minecraft.entity.item.EntityFallingBlock;
|
||||
@@ -76,7 +76,7 @@ public class EntityMeteor extends EntityFallingBlock {
|
||||
this.setDead();
|
||||
|
||||
}else{
|
||||
WizardryUtilities.getEntitiesWithinRadius(15, posX, posY, posZ, world, EntityPlayer.class)
|
||||
EntityUtils.getEntitiesWithinRadius(15, posX, posY, posZ, world, EntityPlayer.class)
|
||||
.forEach(p -> Wizardry.proxy.shakeScreen(p, 10));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,10 @@ import electroblob.wizardry.entity.EntityLevitatingBlock;
|
||||
import electroblob.wizardry.item.ItemArtefact;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.util.BlockUtils;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -92,12 +93,12 @@ public class EntityBlackHole extends EntityMagicConstruct {
|
||||
|
||||
double radius = 6; // TODO: Support for spell properties and modifiers
|
||||
|
||||
boolean suckInBlocks = getCaster() instanceof EntityPlayer && WizardryUtilities.canDamageBlocks(getCaster(), world)
|
||||
boolean suckInBlocks = getCaster() instanceof EntityPlayer && EntityUtils.canDamageBlocks(getCaster(), world)
|
||||
&& ItemArtefact.isArtefactActive((EntityPlayer)getCaster(), WizardryItems.charm_black_hole);
|
||||
|
||||
if(suckInBlocks){
|
||||
|
||||
List<BlockPos> sphere = WizardryUtilities.getBlockSphere(new BlockPos(this), radius);
|
||||
List<BlockPos> sphere = BlockUtils.getBlockSphere(new BlockPos(this), radius);
|
||||
|
||||
int blocksUnhooked = 0;
|
||||
|
||||
@@ -105,7 +106,7 @@ public class EntityBlackHole extends EntityMagicConstruct {
|
||||
|
||||
if(rand.nextInt(Math.max(1, (int)this.getDistanceSq(pos) * 3)) == 0){
|
||||
|
||||
if(!WizardryUtilities.isBlockUnbreakable(world, pos) && !world.isAirBlock(pos)
|
||||
if(!BlockUtils.isBlockUnbreakable(world, pos) && !world.isAirBlock(pos)
|
||||
&& world.isBlockNormalCube(pos, false)){
|
||||
// Checks that the block above is not solid, since this causes the falling block to vanish.
|
||||
// && !world.isBlockNormalCube(pos.up(), false)){
|
||||
@@ -124,7 +125,7 @@ public class EntityBlackHole extends EntityMagicConstruct {
|
||||
|
||||
}
|
||||
|
||||
List<Entity> targets = WizardryUtilities.getEntitiesWithinRadius(radius, this.posX, this.posY,
|
||||
List<Entity> targets = EntityUtils.getEntitiesWithinRadius(radius, this.posX, this.posY,
|
||||
this.posZ, this.world, Entity.class);
|
||||
|
||||
targets.removeIf(t -> !(t instanceof EntityLivingBase || (suckInBlocks && t instanceof EntityFallingBlock)));
|
||||
@@ -137,7 +138,7 @@ public class EntityBlackHole extends EntityMagicConstruct {
|
||||
if(!(target instanceof EntityPlayer && ((getCaster() instanceof EntityPlayer && !Wizardry.settings.playersMoveEachOther)
|
||||
|| ItemArtefact.isArtefactActive((EntityPlayer)target, WizardryItems.amulet_anchoring)))){
|
||||
|
||||
WizardryUtilities.undoGravity(target);
|
||||
EntityUtils.undoGravity(target);
|
||||
if(target instanceof EntityLevitatingBlock) ((EntityLevitatingBlock)target).suspend();
|
||||
|
||||
// Sucks the target in
|
||||
|
||||
@@ -4,11 +4,11 @@ import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
@@ -38,7 +38,7 @@ public class EntityBlizzard extends EntityMagicConstruct {
|
||||
|
||||
if(!this.world.isRemote){
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(radius, this.posX, this.posY,
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(radius, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
@@ -46,11 +46,11 @@ public class EntityBlizzard extends EntityMagicConstruct {
|
||||
if(this.isValidTarget(target)){
|
||||
|
||||
if(this.getCaster() != null){
|
||||
WizardryUtilities.attackEntityWithoutKnockback(target,
|
||||
EntityUtils.attackEntityWithoutKnockback(target,
|
||||
MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.FROST),
|
||||
1 * damageMultiplier);
|
||||
}else{
|
||||
WizardryUtilities.attackEntityWithoutKnockback(target, DamageSource.MAGIC,
|
||||
EntityUtils.attackEntityWithoutKnockback(target, DamageSource.MAGIC,
|
||||
1 * damageMultiplier);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@ package electroblob.wizardry.entity.construct;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Entrapment;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.MoverType;
|
||||
@@ -46,32 +46,32 @@ public class EntityBubble extends EntityMagicConstruct {
|
||||
|
||||
// Synchronises the rider field
|
||||
if((this.rider == null || this.rider.get() == null)
|
||||
&& WizardryUtilities.getRider(this) instanceof EntityLivingBase
|
||||
&& !WizardryUtilities.getRider(this).isDead){
|
||||
this.rider = new WeakReference<>((EntityLivingBase)WizardryUtilities.getRider(this));
|
||||
&& EntityUtils.getRider(this) instanceof EntityLivingBase
|
||||
&& !EntityUtils.getRider(this).isDead){
|
||||
this.rider = new WeakReference<>((EntityLivingBase)EntityUtils.getRider(this));
|
||||
}
|
||||
|
||||
// Prevents dismounting
|
||||
if(WizardryUtilities.getRider(this) == null && this.rider != null && this.rider.get() != null
|
||||
if(EntityUtils.getRider(this) == null && this.rider != null && this.rider.get() != null
|
||||
&& !this.rider.get().isDead){
|
||||
this.rider.get().startRiding(this);
|
||||
}
|
||||
|
||||
// Stops the bubble bursting instantly.
|
||||
if(this.ticksExisted < 1 && !isDarkOrb) ((EntityLivingBase)WizardryUtilities.getRider(this)).hurtTime = 0;
|
||||
if(this.ticksExisted < 1 && !isDarkOrb) ((EntityLivingBase)EntityUtils.getRider(this)).hurtTime = 0;
|
||||
|
||||
this.move(MoverType.SELF, 0, 0.03, 0);
|
||||
|
||||
if(isDarkOrb){
|
||||
|
||||
if(WizardryUtilities.getRider(this) != null
|
||||
&& WizardryUtilities.getRider(this).ticksExisted % Spells.entrapment.getProperty(Entrapment.DAMAGE_INTERVAL).intValue() == 0){
|
||||
if(EntityUtils.getRider(this) != null
|
||||
&& EntityUtils.getRider(this).ticksExisted % Spells.entrapment.getProperty(Entrapment.DAMAGE_INTERVAL).intValue() == 0){
|
||||
if(this.getCaster() != null){
|
||||
WizardryUtilities.getRider(this).attackEntityFrom(
|
||||
EntityUtils.getRider(this).attackEntityFrom(
|
||||
MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.MAGIC),
|
||||
1 * damageMultiplier);
|
||||
}else{
|
||||
WizardryUtilities.getRider(this).attackEntityFrom(DamageSource.MAGIC, 1 * damageMultiplier);
|
||||
EntityUtils.getRider(this).attackEntityFrom(DamageSource.MAGIC, 1 * damageMultiplier);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public class EntityBubble extends EntityMagicConstruct {
|
||||
|
||||
// Bubble bursts if the entity is hurt (see event handler) or killed, or if the bubble has existed for more than
|
||||
// 10 seconds.
|
||||
if(WizardryUtilities.getRider(this) == null && this.ticksExisted > 1){
|
||||
if(EntityUtils.getRider(this) == null && this.ticksExisted > 1){
|
||||
if(!this.isDarkOrb) this.playSound(WizardrySounds.ENTITY_BUBBLE_POP, 1.5f, 1.0f);
|
||||
this.setDead();
|
||||
}
|
||||
@@ -100,8 +100,8 @@ public class EntityBubble extends EntityMagicConstruct {
|
||||
|
||||
@Override
|
||||
public void despawn(){
|
||||
if(WizardryUtilities.getRider(this) != null){
|
||||
((EntityLivingBase)WizardryUtilities.getRider(this)).dismountEntity(this);
|
||||
if(EntityUtils.getRider(this) != null){
|
||||
((EntityLivingBase)EntityUtils.getRider(this)).dismountEntity(this);
|
||||
}
|
||||
if(!this.isDarkOrb) this.playSound(WizardrySounds.ENTITY_BUBBLE_POP, 1.5f, 1.0f);
|
||||
super.despawn();
|
||||
|
||||
@@ -2,7 +2,7 @@ package electroblob.wizardry.entity.construct;
|
||||
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
@@ -25,7 +25,7 @@ public class EntityCombustionRune extends EntityMagicConstruct {
|
||||
|
||||
if(!this.world.isRemote){
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(width/2, posX, posY, posZ, world);
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(width/2, posX, posY, posZ, world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
@@ -34,7 +34,7 @@ public class EntityCombustionRune extends EntityMagicConstruct {
|
||||
float strength = Spells.combustion_rune.getProperty(Spell.BLAST_RADIUS).floatValue();
|
||||
|
||||
world.newExplosion(this.getCaster(), this.posX, this.posY, this.posZ, strength, true,
|
||||
getCaster() != null && WizardryUtilities.canDamageBlocks(getCaster(), world));
|
||||
getCaster() != null && EntityUtils.canDamageBlocks(getCaster(), world));
|
||||
|
||||
// The trap is destroyed once triggered.
|
||||
this.setDead();
|
||||
|
||||
@@ -4,9 +4,9 @@ import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
@@ -36,7 +36,7 @@ public class EntityDecay extends EntityMagicConstruct {
|
||||
0.6F + rand.nextFloat() * 0.15F);
|
||||
|
||||
if(!this.world.isRemote){
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(1.0d, this.posX, this.posY,
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(1.0d, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
for(EntityLivingBase target : targets){
|
||||
if(target != this.getCaster()){
|
||||
|
||||
@@ -2,9 +2,10 @@ package electroblob.wizardry.entity.construct;
|
||||
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.spell.Earthquake;
|
||||
import electroblob.wizardry.util.BlockUtils;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityFallingBlock;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -46,7 +47,7 @@ public class EntityEarthquake extends EntityMagicConstruct {
|
||||
|
||||
BlockPos pos = new BlockPos(x, y, z);
|
||||
|
||||
if(!WizardryUtilities.isBlockUnbreakable(world, pos) && !world.isAirBlock(pos)
|
||||
if(!BlockUtils.isBlockUnbreakable(world, pos) && !world.isAirBlock(pos)
|
||||
&& world.isBlockNormalCube(pos, false)
|
||||
// Checks that the block above is not solid, since this causes the falling sand to vanish.
|
||||
&& !world.isBlockNormalCube(pos.up(), false)){
|
||||
@@ -61,7 +62,7 @@ public class EntityEarthquake extends EntityMagicConstruct {
|
||||
|
||||
}
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities
|
||||
List<EntityLivingBase> targets = EntityUtils
|
||||
.getEntitiesWithinRadius((this.ticksExisted * speed) + 1.5, this.posX, this.posY, this.posZ, world);
|
||||
|
||||
// In this particular instance, the caster is completely unaffected because they will always be in the
|
||||
|
||||
@@ -3,9 +3,9 @@ package electroblob.wizardry.entity.construct;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
@@ -32,7 +32,7 @@ public class EntityFireRing extends EntityMagicConstruct {
|
||||
|
||||
if(!this.world.isRemote){
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(2.5d, this.posX, this.posY,
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(2.5d, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
@@ -3,9 +3,9 @@ package electroblob.wizardry.entity.construct;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
@@ -29,7 +29,7 @@ public class EntityFireSigil extends EntityMagicConstruct {
|
||||
|
||||
if(!this.world.isRemote){
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(width/2, posX, posY, posZ, world);
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(width/2, posX, posY, posZ, world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
|
||||
@@ -6,10 +6,8 @@ import electroblob.wizardry.entity.projectile.EntityMagicArrow;
|
||||
import electroblob.wizardry.item.ItemArtefact;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.*;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -100,7 +98,7 @@ public class EntityForcefield extends EntityMagicConstruct implements ICustomHit
|
||||
// If they will be inside the forcefield next tick, sets their position and velocity such that they appear to
|
||||
// bounce off the forcefield and creates impact particle effects and sounds where they hit it
|
||||
|
||||
List<Entity> targets = WizardryUtilities.getEntitiesWithinRadius(radius + SEARCH_BORDER_SIZE, posX, posY, posZ, world, Entity.class);
|
||||
List<Entity> targets = EntityUtils.getEntitiesWithinRadius(radius + SEARCH_BORDER_SIZE, posX, posY, posZ, world, Entity.class);
|
||||
|
||||
targets.remove(this);
|
||||
targets.removeIf(t -> t instanceof EntityXPOrb); // Gets annoying since they're attracted to the player
|
||||
@@ -117,7 +115,7 @@ public class EntityForcefield extends EntityMagicConstruct implements ICustomHit
|
||||
|
||||
if(this.isValidTarget(target)){
|
||||
|
||||
Vec3d currentPos = Arrays.stream(WizardryUtilities.getVertices(target.getEntityBoundingBox()))
|
||||
Vec3d currentPos = Arrays.stream(GeometryUtils.getVertices(target.getEntityBoundingBox()))
|
||||
.min(Comparator.comparingDouble(v -> v.distanceTo(this.getPositionVector())))
|
||||
.orElse(target.getPositionVector()); // This will never happen, it's just here to make the compiler happy
|
||||
|
||||
@@ -130,7 +128,7 @@ public class EntityForcefield extends EntityMagicConstruct implements ICustomHit
|
||||
|
||||
boolean flag;
|
||||
|
||||
if(WizardryUtilities.isLiving(target)){
|
||||
if(EntityUtils.isLiving(target)){
|
||||
// Non-allied living entities shouldn't be inside at all
|
||||
flag = nextTickDistance <= radius;
|
||||
}else{
|
||||
@@ -143,7 +141,7 @@ public class EntityForcefield extends EntityMagicConstruct implements ICustomHit
|
||||
|
||||
// Ring of interdiction
|
||||
if(getCaster() instanceof EntityPlayer && ItemArtefact.isArtefactActive((EntityPlayer)getCaster(),
|
||||
WizardryItems.ring_interdiction) && WizardryUtilities.isLiving(target)){
|
||||
WizardryItems.ring_interdiction) && EntityUtils.isLiving(target)){
|
||||
target.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, getCaster(),
|
||||
MagicDamage.DamageType.MAGIC), 1);
|
||||
}
|
||||
@@ -151,7 +149,7 @@ public class EntityForcefield extends EntityMagicConstruct implements ICustomHit
|
||||
Vec3d targetRelativePos = currentPos.subtract(this.getPositionVector());
|
||||
|
||||
double nudgeVelocity = this.contains(target) ? -0.1 : 0.1;
|
||||
if(WizardryUtilities.isLiving(target)) nudgeVelocity = 0.25;
|
||||
if(EntityUtils.isLiving(target)) nudgeVelocity = 0.25;
|
||||
Vec3d extraVelocity = targetRelativePos.normalize().scale(nudgeVelocity);
|
||||
|
||||
// ...make it bounce off!
|
||||
@@ -216,7 +214,7 @@ public class EntityForcefield extends EntityMagicConstruct implements ICustomHit
|
||||
|
||||
/** Returns true if the given bounding box is completely inside this forcefield (the surface counts as outside). */
|
||||
public boolean contains(AxisAlignedBB box){
|
||||
return Arrays.stream(WizardryUtilities.getVertices(box)).allMatch(this::contains);
|
||||
return Arrays.stream(GeometryUtils.getVertices(box)).allMatch(this::contains);
|
||||
}
|
||||
|
||||
/** Returns true if the given entity is completely inside this forcefield (the surface counts as outside). */
|
||||
@@ -303,7 +301,7 @@ public class EntityForcefield extends EntityMagicConstruct implements ICustomHit
|
||||
|
||||
double searchRadius = 20;
|
||||
|
||||
List<EntityForcefield> forcefields = WizardryUtilities.getEntitiesWithinRadius(searchRadius, vec.x,
|
||||
List<EntityForcefield> forcefields = EntityUtils.getEntitiesWithinRadius(searchRadius, vec.x,
|
||||
vec.y, vec.z, world, EntityForcefield.class);
|
||||
|
||||
forcefields.removeIf(f -> !f.contains(vec));
|
||||
@@ -317,7 +315,7 @@ public class EntityForcefield extends EntityMagicConstruct implements ICustomHit
|
||||
|
||||
double searchRadius = 20;
|
||||
|
||||
List<EntityForcefield> forcefields = WizardryUtilities.getEntitiesWithinRadius(searchRadius, vec.x,
|
||||
List<EntityForcefield> forcefields = EntityUtils.getEntitiesWithinRadius(searchRadius, vec.x,
|
||||
vec.y, vec.z, world, EntityForcefield.class);
|
||||
|
||||
forcefields.removeIf(f -> !f.contains(box));
|
||||
@@ -348,7 +346,7 @@ public class EntityForcefield extends EntityMagicConstruct implements ICustomHit
|
||||
|
||||
// If the player is trying to interact across a forcefield boundary, cancel the event
|
||||
// The most pragmatic solution here is to use the centres - it's not perfect, but it's simple!
|
||||
if(getSurroundingForcefield(event.getWorld(), WizardryUtilities.getCentre(box))
|
||||
if(getSurroundingForcefield(event.getWorld(), GeometryUtils.getCentre(box))
|
||||
!= getSurroundingForcefield(event.getWorld(), event.getEntityPlayer().getPositionVector())){
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@ import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
@@ -32,14 +32,14 @@ public class EntityFrostSigil extends EntityMagicConstruct {
|
||||
|
||||
if(!this.world.isRemote){
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(1.0d, this.posX, this.posY,
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(1.0d, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
if(this.isValidTarget(target)){
|
||||
|
||||
WizardryUtilities.attackEntityWithoutKnockback(target, this.getCaster() != null
|
||||
EntityUtils.attackEntityWithoutKnockback(target, this.getCaster() != null
|
||||
? MagicDamage.causeIndirectMagicDamage(this, this.getCaster(), DamageType.FROST)
|
||||
: DamageSource.MAGIC, Spells.frost_sigil.getProperty(Spell.DAMAGE).floatValue()
|
||||
* damageMultiplier);
|
||||
|
||||
@@ -8,11 +8,11 @@ import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.LightningHammer;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -105,7 +105,7 @@ public class EntityHammer extends EntityMagicConstruct {
|
||||
|
||||
double seekerRange = Spells.lightning_hammer.getProperty(Spell.EFFECT_RADIUS).doubleValue();
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(seekerRange, this.posX,
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(seekerRange, this.posX,
|
||||
this.posY + 1, this.posZ, world);
|
||||
|
||||
int maxTargets = Spells.lightning_hammer.getProperty(LightningHammer.SECONDARY_MAX_TARGETS).intValue();
|
||||
@@ -113,7 +113,7 @@ public class EntityHammer extends EntityMagicConstruct {
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
if(WizardryUtilities.isLiving(target) && this.isValidTarget(target)
|
||||
if(EntityUtils.isLiving(target) && this.isValidTarget(target)
|
||||
&& target.ticksExisted % Spells.lightning_hammer.getProperty(LightningHammer.ATTACK_INTERVAL).floatValue() == 0){
|
||||
|
||||
if(world.isRemote){
|
||||
@@ -129,9 +129,9 @@ public class EntityHammer extends EntityMagicConstruct {
|
||||
float damage = Spells.lightning_hammer.getProperty(Spell.SPLASH_DAMAGE).floatValue() * damageMultiplier;
|
||||
|
||||
if(this.getCaster() != null){
|
||||
WizardryUtilities.attackEntityWithoutKnockback(target, MagicDamage.causeIndirectMagicDamage(
|
||||
EntityUtils.attackEntityWithoutKnockback(target, MagicDamage.causeIndirectMagicDamage(
|
||||
this, getCaster(), DamageType.SHOCK), damage);
|
||||
WizardryUtilities.applyStandardKnockback(this, target);
|
||||
EntityUtils.applyStandardKnockback(this, target);
|
||||
}else{
|
||||
target.attackEntityFrom(DamageSource.MAGIC, damage);
|
||||
}
|
||||
@@ -183,7 +183,7 @@ public class EntityHammer extends EntityMagicConstruct {
|
||||
}
|
||||
|
||||
if(this.fallDistance > 10){
|
||||
WizardryUtilities.getEntitiesWithinRadius(10, posX, posY, posZ, world, EntityPlayer.class)
|
||||
EntityUtils.getEntitiesWithinRadius(10, posX, posY, posZ, world, EntityPlayer.class)
|
||||
.forEach(p -> Wizardry.proxy.shakeScreen(p, 6));
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@ package electroblob.wizardry.entity.construct;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
@@ -36,7 +36,7 @@ public class EntityHealAura extends EntityMagicConstruct {
|
||||
|
||||
if(!this.world.isRemote){
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(2.5, posX, posY, posZ, world);
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(2.5, posX, posY, posZ, world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.GeometryUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.MoverType;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
@@ -27,9 +27,9 @@ public class EntityIceSpike extends EntityMagicConstruct {
|
||||
|
||||
public void setFacing(EnumFacing facing){
|
||||
this.facing = facing;
|
||||
this.setRotation(-facing.getHorizontalAngle(), WizardryUtilities.getPitch(facing));
|
||||
this.setRotation(-facing.getHorizontalAngle(), GeometryUtils.getPitch(facing));
|
||||
float yaw = (-facing.getHorizontalAngle()) * (float)Math.PI/180;
|
||||
float pitch = (WizardryUtilities.getPitch(facing) - 90) * (float)Math.PI/180;
|
||||
float pitch = (GeometryUtils.getPitch(facing) - 90) * (float)Math.PI/180;
|
||||
Vec3d min = this.getPositionVector().add(new Vec3d(-width/2, 0, -width/2).rotatePitch(pitch).rotateYaw(yaw));
|
||||
Vec3d max = this.getPositionVector().add(new Vec3d(width/2, height, width/2).rotatePitch(pitch).rotateYaw(yaw));
|
||||
this.setEntityBoundingBox(new AxisAlignedBB(min.x, min.y, min.z, max.x, max.y, max.z));
|
||||
|
||||
@@ -3,11 +3,11 @@ package electroblob.wizardry.entity.construct;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
@@ -34,7 +34,7 @@ public class EntityLightningSigil extends EntityMagicConstruct {
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(1.0d, this.posX, this.posY,
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(1.0d, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
@@ -60,7 +60,7 @@ public class EntityLightningSigil extends EntityMagicConstruct {
|
||||
// Secondary chaining effect
|
||||
double seekerRange = Spells.lightning_sigil.getProperty(Spell.EFFECT_RADIUS).doubleValue();
|
||||
|
||||
List<EntityLivingBase> secondaryTargets = WizardryUtilities.getEntitiesWithinRadius(seekerRange,
|
||||
List<EntityLivingBase> secondaryTargets = EntityUtils.getEntitiesWithinRadius(seekerRange,
|
||||
target.posX, target.posY + target.height / 2, target.posZ, world);
|
||||
|
||||
for(int j = 0; j < Math.min(secondaryTargets.size(),
|
||||
|
||||
@@ -4,7 +4,7 @@ import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.item.ISpellCastingItem;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.util.AllyDesignationSystem;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -147,7 +147,7 @@ public abstract class EntityMagicConstruct extends Entity implements IEntityOwna
|
||||
@Nullable
|
||||
public EntityLivingBase getCaster(){ // Kept despite the above method because it returns an EntityLivingBase
|
||||
|
||||
Entity entity = WizardryUtilities.getEntityByUUID(world, getOwnerId());
|
||||
Entity entity = EntityUtils.getEntityByUUID(world, getOwnerId());
|
||||
|
||||
if(entity != null && !(entity instanceof EntityLivingBase)){ // Should never happen
|
||||
Wizardry.logger.warn("{} has a non-living owner!", this);
|
||||
|
||||
@@ -4,10 +4,10 @@ import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -69,7 +69,7 @@ public class EntityStormcloud extends EntityMagicConstruct {
|
||||
if(target.ticksExisted % 150 == 0){ // Use target's lifetime so they don't all get hit at once, looks better
|
||||
|
||||
if(!this.world.isRemote){
|
||||
WizardryUtilities.attackEntityWithoutKnockback(target, MagicDamage.causeIndirectMagicDamage(
|
||||
EntityUtils.attackEntityWithoutKnockback(target, MagicDamage.causeIndirectMagicDamage(
|
||||
this, this.getCaster(), MagicDamage.DamageType.SHOCK), damage);
|
||||
}else{
|
||||
ParticleBuilder.create(Type.LIGHTNING).pos(target.posX, posY + height/2, target.posZ)
|
||||
|
||||
@@ -7,11 +7,9 @@ import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.spell.Tornado;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.*;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -60,7 +58,7 @@ public class EntityTornado extends EntityMagicConstruct {
|
||||
this.move(MoverType.SELF, velX, motionY, velZ);
|
||||
|
||||
BlockPos pos = new BlockPos(this);
|
||||
Integer y = WizardryUtilities.getNearestSurface(world, pos.up(3), EnumFacing.UP, 5, true, WizardryUtilities.SurfaceCriteria.NOT_AIR_TO_AIR);
|
||||
Integer y = BlockUtils.getNearestSurface(world, pos.up(3), EnumFacing.UP, 5, true, BlockUtils.SurfaceCriteria.NOT_AIR_TO_AIR);
|
||||
|
||||
if(y != null){
|
||||
|
||||
@@ -74,7 +72,7 @@ public class EntityTornado extends EntityMagicConstruct {
|
||||
|
||||
if(!this.world.isRemote){
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(radius, this.posX, this.posY,
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(radius, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
@@ -125,7 +123,7 @@ public class EntityTornado extends EntityMagicConstruct {
|
||||
|
||||
BlockPos pos1 = new BlockPos(blockX, this.posY + 3, blockZ);
|
||||
|
||||
Integer blockY = WizardryUtilities.getNearestSurface(world, pos1, EnumFacing.UP, 5, true, WizardryUtilities.SurfaceCriteria.NOT_AIR_TO_AIR);
|
||||
Integer blockY = BlockUtils.getNearestSurface(world, pos1, EnumFacing.UP, 5, true, BlockUtils.SurfaceCriteria.NOT_AIR_TO_AIR);
|
||||
|
||||
if(blockY != null){
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.SpellMinion;
|
||||
import electroblob.wizardry.spell.ZombieApocalypse;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities.Operations;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.ai.attributes.IAttributeInstance;
|
||||
@@ -49,7 +49,7 @@ public class EntityZombieSpawner extends EntityMagicConstruct {
|
||||
zombie.setLifetime(Spells.zombie_apocalypse.getProperty(SpellMinion.MINION_LIFETIME).intValue());
|
||||
IAttributeInstance attribute = zombie.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE);
|
||||
attribute.applyModifier(new AttributeModifier(SpellMinion.POTENCY_ATTRIBUTE_MODIFIER,
|
||||
damageMultiplier - 1, Operations.MULTIPLY_CUMULATIVE));
|
||||
damageMultiplier - 1, EntityUtils.Operations.MULTIPLY_CUMULATIVE));
|
||||
zombie.setHealth(zombie.getMaxHealth()); // Need to set this because we may have just modified the value
|
||||
zombie.hurtResistantTime = 30; // Prevent fall damage
|
||||
zombie.hideParticles(); // Hide spawn particles or they pop out the top of the hidden box
|
||||
|
||||
@@ -369,7 +369,7 @@ public class EntityEvilWizard extends EntityMob implements ISpellCaster, IEntity
|
||||
Element element = this.getElement();
|
||||
|
||||
// Adds armour.
|
||||
for(EntityEquipmentSlot slot : WizardryUtilities.ARMOUR_SLOTS){
|
||||
for(EntityEquipmentSlot slot : InventoryUtils.ARMOUR_SLOTS){
|
||||
this.setItemStackToSlot(slot, new ItemStack(WizardryItems.getArmour(element, slot)));
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ import electroblob.wizardry.client.DrawingUtils;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.BlockUtils;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.EntityAIHurtByTarget;
|
||||
@@ -161,7 +161,7 @@ public class EntityPhoenix extends EntitySummonedCreature implements ISpellCaste
|
||||
public void onLivingUpdate(){
|
||||
|
||||
// Makes the phoenix hover.
|
||||
Integer floorLevel = WizardryUtilities.getNearestFloor(world, new BlockPos(this), 4);
|
||||
Integer floorLevel = BlockUtils.getNearestFloor(world, new BlockPos(this), 4);
|
||||
|
||||
if(floorLevel == null || this.posY - floorLevel > 3){
|
||||
this.motionY = -0.1;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package electroblob.wizardry.entity.living;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.util.WizardryUtilities.Operations;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import net.minecraft.entity.EntityFlying;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.IEntityLivingData;
|
||||
@@ -73,7 +73,7 @@ public class EntitySkeletonMinion extends AbstractSkeleton implements ISummonedC
|
||||
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata){
|
||||
// Can't call super, so the code from the next level up (EntityLiving) had to be copied as well.
|
||||
this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE)
|
||||
.applyModifier(new AttributeModifier("Random spawn bonus", this.rand.nextGaussian() * 0.05D, Operations.MULTIPLY_FLAT));
|
||||
.applyModifier(new AttributeModifier("Random spawn bonus", this.rand.nextGaussian() * 0.05D, EntityUtils.Operations.MULTIPLY_FLAT));
|
||||
|
||||
if(this.rand.nextFloat() < 0.05F){
|
||||
this.setLeftHanded(true);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package electroblob.wizardry.entity.living;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities.Operations;
|
||||
import net.minecraft.entity.EntityFlying;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.IEntityLivingData;
|
||||
@@ -67,7 +67,7 @@ public class EntitySpiderMinion extends EntityCaveSpider implements ISummonedCre
|
||||
|
||||
// Can't call super, so the code from the next level up (EntityLiving) had to be copied as well.
|
||||
this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE)
|
||||
.applyModifier(new AttributeModifier("Random spawn bonus", this.rand.nextGaussian() * 0.05D, Operations.MULTIPLY_FLAT));
|
||||
.applyModifier(new AttributeModifier("Random spawn bonus", this.rand.nextGaussian() * 0.05D, EntityUtils.Operations.MULTIPLY_FLAT));
|
||||
|
||||
if(this.rand.nextFloat() < 0.05F){
|
||||
this.setLeftHanded(true);
|
||||
|
||||
@@ -3,9 +3,9 @@ package electroblob.wizardry.entity.living;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.item.ISpellCastingItem;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.IEntityLivingData;
|
||||
@@ -124,7 +124,7 @@ public class EntitySpiritHorse extends EntityHorse {
|
||||
private EntityLivingBase getOwner(){
|
||||
|
||||
// I think the DataManager stores any objects, so it now stores the UUID instead of its string representation.
|
||||
Entity owner = WizardryUtilities.getEntityByUUID(world, this.getOwnerUniqueId());
|
||||
Entity owner = EntityUtils.getEntityByUUID(world, this.getOwnerUniqueId());
|
||||
|
||||
if(owner instanceof EntityLivingBase){
|
||||
return (EntityLivingBase)owner;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package electroblob.wizardry.entity.living;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.util.WizardryUtilities.Operations;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import net.minecraft.entity.EntityFlying;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.IEntityLivingData;
|
||||
@@ -75,7 +75,7 @@ public class EntityWitherSkeletonMinion extends EntityWitherSkeleton implements
|
||||
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata){
|
||||
// Can't call super, so the code from the next level up (EntityLiving) had to be copied as well.
|
||||
this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE)
|
||||
.applyModifier(new AttributeModifier("Random spawn bonus", this.rand.nextGaussian() * 0.05D, Operations.MULTIPLY_FLAT));
|
||||
.applyModifier(new AttributeModifier("Random spawn bonus", this.rand.nextGaussian() * 0.05D, EntityUtils.Operations.MULTIPLY_FLAT));
|
||||
|
||||
if(this.rand.nextFloat() < 0.05F){
|
||||
this.setLeftHanded(true);
|
||||
|
||||
@@ -469,7 +469,7 @@ public class EntityWizard extends EntityCreature implements INpc, IMerchant, ISp
|
||||
|
||||
if(!world.isRemote && !this.getCustomer().isCreative() && Wizardry.settings.discoveryMode){
|
||||
// Sound and text only happen server-side, in survival, with discovery mode on
|
||||
WizardryUtilities.playSoundAtPlayer(this.getCustomer(), WizardrySounds.MISC_DISCOVER_SPELL, 1.25f, 1);
|
||||
EntityUtils.playSoundAtPlayer(this.getCustomer(), WizardrySounds.MISC_DISCOVER_SPELL, 1.25f, 1);
|
||||
this.getCustomer().sendMessage(new TextComponentTranslation("spell.discover",
|
||||
spell.getNameForTranslationFormatted()));
|
||||
}
|
||||
@@ -673,7 +673,7 @@ public class EntityWizard extends EntityCreature implements INpc, IMerchant, ISp
|
||||
}else if(randomiser < 8){
|
||||
return new ItemStack(WizardryItems.arcane_tome, 1, 1);
|
||||
}else if(randomiser < 10){
|
||||
EntityEquipmentSlot slot = WizardryUtilities.ARMOUR_SLOTS[rand.nextInt(WizardryUtilities.ARMOUR_SLOTS.length)];
|
||||
EntityEquipmentSlot slot = InventoryUtils.ARMOUR_SLOTS[rand.nextInt(InventoryUtils.ARMOUR_SLOTS.length)];
|
||||
if(this.getElement() != Element.MAGIC && rand.nextInt(4) > 0){
|
||||
// This means it is more likely for armour sold to be of the same element as the wizard if the
|
||||
// wizard has an element.
|
||||
@@ -755,7 +755,7 @@ public class EntityWizard extends EntityCreature implements INpc, IMerchant, ISp
|
||||
Element element = this.getElement();
|
||||
|
||||
// Adds armour.
|
||||
for(EntityEquipmentSlot slot : WizardryUtilities.ARMOUR_SLOTS){
|
||||
for(EntityEquipmentSlot slot : InventoryUtils.ARMOUR_SLOTS){
|
||||
this.setItemStackToSlot(slot, new ItemStack(WizardryItems.getArmour(element, slot)));
|
||||
}
|
||||
|
||||
@@ -888,7 +888,7 @@ public class EntityWizard extends EntityCreature implements INpc, IMerchant, ISp
|
||||
// Makes wizards angry if a player breaks a block in their tower
|
||||
if(!(event.getPlayer() instanceof FakePlayer)){
|
||||
|
||||
List<EntityWizard> wizards = WizardryUtilities.getEntitiesWithinRadius(64, event.getPos().getX(),
|
||||
List<EntityWizard> wizards = EntityUtils.getEntitiesWithinRadius(64, event.getPos().getX(),
|
||||
event.getPos().getY(), event.getPos().getZ(), event.getWorld(), EntityWizard.class);
|
||||
|
||||
if(!wizards.isEmpty()){
|
||||
|
||||
@@ -2,8 +2,8 @@ package electroblob.wizardry.entity.living;
|
||||
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.world.EnumDifficulty;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -91,6 +91,6 @@ public interface ISpellCaster {
|
||||
* skeletons, which are: Easy - 10, Normal - 6, Hard - 2, Peaceful - 10 (rarely used).
|
||||
*/
|
||||
default int getAimingError(EnumDifficulty difficulty) {
|
||||
return WizardryUtilities.getDefaultAimingError(difficulty);
|
||||
return EntityUtils.getDefaultAimingError(difficulty);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public interface ISummonedCreature extends IEntityAdditionalSpawnData, IEntityOw
|
||||
|
||||
if(this instanceof Entity){ // Bit of a cheat but it saves having yet another method just to get the world
|
||||
|
||||
Entity entity = WizardryUtilities.getEntityByUUID(((Entity)this).world, getOwnerId());
|
||||
Entity entity = EntityUtils.getEntityByUUID(((Entity)this).world, getOwnerId());
|
||||
|
||||
if(entity != null && !(entity instanceof EntityLivingBase)){ // Should never happen
|
||||
Wizardry.logger.warn("{} has a non-living owner!", this);
|
||||
@@ -395,7 +395,7 @@ public interface ISummonedCreature extends IEntityAdditionalSpawnData, IEntityOw
|
||||
// no summoner.
|
||||
if(DamageSafetyChecker.attackEntitySafely(event.getEntity(), newSource, event.getAmount(), event.getSource(), false)){
|
||||
// Uses event.getSource().getTrueSource() as this means the target is knocked back from the minion
|
||||
WizardryUtilities.applyStandardKnockback(event.getSource().getTrueSource(), event.getEntityLiving());
|
||||
EntityUtils.applyStandardKnockback(event.getSource().getTrueSource(), event.getEntityLiving());
|
||||
((ISummonedCreature)event.getSource().getTrueSource()).onSuccessfulAttack(event.getEntityLiving());
|
||||
// If the target revenge-targeted the summoner, make it revenge-target the minion instead
|
||||
// (if it didn't revenge-target, do nothing)
|
||||
|
||||
@@ -3,11 +3,11 @@ package electroblob.wizardry.entity.projectile;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
@@ -69,7 +69,7 @@ public class EntityFirebomb extends EntityBomb {
|
||||
|
||||
double range = Spells.firebomb.getProperty(Spell.BLAST_RADIUS).floatValue() * blastMultiplier;
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(range, this.posX, this.posY,
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(range, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
@@ -7,10 +7,10 @@ import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.InventoryUtils;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -65,7 +65,7 @@ public class EntityForceArrow extends EntityMagicArrow {
|
||||
|
||||
if(!player.capabilities.isCreativeMode && ItemArtefact.isArtefactActive(player, WizardryItems.ring_mana_return)){
|
||||
|
||||
for(ItemStack stack : WizardryUtilities.getPrioritisedHotbarAndOffhand(player)){
|
||||
for(ItemStack stack : InventoryUtils.getPrioritisedHotbarAndOffhand(player)){
|
||||
if(stack.getItem() instanceof ISpellCastingItem && stack.getItem() instanceof IManaStoringItem
|
||||
&& Arrays.asList(((ISpellCastingItem)stack.getItem()).getSpells(stack)).contains(Spells.force_arrow)){
|
||||
((IManaStoringItem)stack.getItem()).rechargeMana(stack, mana);
|
||||
|
||||
@@ -3,11 +3,11 @@ package electroblob.wizardry.entity.projectile;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
@@ -53,7 +53,7 @@ public class EntityForceOrb extends EntityBomb {
|
||||
|
||||
double blastRadius = Spells.force_orb.getProperty(Spell.BLAST_RADIUS).floatValue() * blastMultiplier;
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(blastRadius, this.posX,
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(blastRadius, this.posX,
|
||||
this.posY, this.posZ, this.world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
@@ -4,11 +4,9 @@ import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.*;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -74,7 +72,7 @@ public class EntityIceCharge extends EntityBomb {
|
||||
|
||||
double radius = Spells.ice_charge.getProperty(Spell.EFFECT_RADIUS).floatValue() * blastMultiplier;
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(radius, this.posX, this.posY,
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(radius, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
// Slows targets
|
||||
@@ -93,8 +91,8 @@ public class EntityIceCharge extends EntityBomb {
|
||||
|
||||
BlockPos pos = new BlockPos(this.posX + i, this.posY, this.posZ + j);
|
||||
|
||||
Integer y = WizardryUtilities.getNearestSurface(world, pos, EnumFacing.UP, 7, true,
|
||||
WizardryUtilities.SurfaceCriteria.SOLID_LIQUID_TO_AIR);
|
||||
Integer y = BlockUtils.getNearestSurface(world, pos, EnumFacing.UP, 7, true,
|
||||
BlockUtils.SurfaceCriteria.SOLID_LIQUID_TO_AIR);
|
||||
|
||||
if(y != null){
|
||||
|
||||
|
||||
@@ -4,10 +4,8 @@ import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.*;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -47,12 +45,12 @@ public class EntityIceball extends EntityMagicProjectile {
|
||||
|
||||
}else{
|
||||
|
||||
if(this.getThrower() == null || WizardryUtilities.canDamageBlocks(this.getThrower(), world)){
|
||||
if(this.getThrower() == null || EntityUtils.canDamageBlocks(this.getThrower(), world)){
|
||||
|
||||
BlockPos pos = rayTrace.getBlockPos();
|
||||
|
||||
if(rayTrace.sideHit == EnumFacing.UP && !world.isRemote && world.isSideSolid(pos, EnumFacing.UP)
|
||||
&& WizardryUtilities.canBlockBeReplaced(world, pos.up())){
|
||||
&& BlockUtils.canBlockBeReplaced(world, pos.up())){
|
||||
world.setBlockState(pos.up(), Blocks.SNOW_LAYER.getDefaultState());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package electroblob.wizardry.entity.projectile;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.projectile.EntityLargeFireball;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -51,7 +51,7 @@ public class EntityLargeMagicFireball extends EntityMagicFireball {
|
||||
protected void onImpact(RayTraceResult rayTrace){
|
||||
|
||||
if(!world.isRemote){
|
||||
boolean flag = this.getThrower() == null || WizardryUtilities.canDamageBlocks(this.getThrower(), world);
|
||||
boolean flag = this.getThrower() == null || EntityUtils.canDamageBlocks(this.getThrower(), world);
|
||||
this.world.newExplosion(null, this.posX, this.posY, this.posZ, getExplosionPower() * blastMultiplier, flag, flag);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,8 @@ package electroblob.wizardry.entity.projectile;
|
||||
import electroblob.wizardry.item.ItemArtefact;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.util.AllyDesignationSystem;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.*;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.RayTracer;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -237,7 +234,7 @@ public abstract class EntityMagicArrow extends Entity implements IProjectile, IE
|
||||
}
|
||||
|
||||
if(this.getCaster() == null && this.casterUUID != null){
|
||||
Entity entity = WizardryUtilities.getEntityByUUID(world, casterUUID);
|
||||
Entity entity = EntityUtils.getEntityByUUID(world, casterUUID);
|
||||
if(entity instanceof EntityLivingBase){
|
||||
this.caster = new WeakReference<>((EntityLivingBase)entity);
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@ package electroblob.wizardry.entity.projectile;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -84,7 +84,7 @@ public class EntityMagicFireball extends EntityMagicProjectile {
|
||||
|
||||
}else{
|
||||
|
||||
if(this.getThrower() == null || WizardryUtilities.canDamageBlocks(this.getThrower(), world)){
|
||||
if(this.getThrower() == null || EntityUtils.canDamageBlocks(this.getThrower(), world)){
|
||||
|
||||
BlockPos blockpos = rayTrace.getBlockPos().offset(rayTrace.sideHit);
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@ package electroblob.wizardry.entity.projectile;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.MobEffects;
|
||||
@@ -74,7 +74,7 @@ public class EntityPoisonBomb extends EntityBomb {
|
||||
|
||||
double range = Spells.poison_bomb.getProperty(Spell.EFFECT_RADIUS).floatValue() * blastMultiplier;
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(range, this.posX, this.posY,
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(range, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
@@ -4,9 +4,9 @@ import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.MobEffects;
|
||||
@@ -57,7 +57,7 @@ public class EntitySmokeBomb extends EntityBomb {
|
||||
|
||||
double range = Spells.smoke_bomb.getProperty(Spell.BLAST_RADIUS).floatValue() * blastMultiplier;
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(range, this.posX, this.posY,
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(range, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
int duration = Spells.smoke_bomb.getProperty(Spell.EFFECT_DURATION).intValue();
|
||||
|
||||
@@ -3,11 +3,11 @@ package electroblob.wizardry.entity.projectile;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -55,7 +55,7 @@ public class EntitySparkBomb extends EntityBomb {
|
||||
|
||||
double seekerRange = Spells.spark_bomb.getProperty(Spell.EFFECT_RADIUS).doubleValue() * blastMultiplier;
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(seekerRange, this.posX, this.posY,
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(seekerRange, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
for(int i = 0; i < Math.min(targets.size(), Spells.spark_bomb.getProperty(SECONDARY_MAX_TARGETS).intValue()); i++){
|
||||
|
||||
@@ -2,7 +2,7 @@ package electroblob.wizardry.integration;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
@@ -58,7 +58,7 @@ public final class DamageSafetyChecker {
|
||||
* @param fallback The fallback damage source for when excessive looping is detected. This <b>must not</b> be the
|
||||
* same as the re-applied source, or this method is pointless! Usually it will be more general.
|
||||
* @param knockback True to apply knockback as normal, false to use the knockback-free methods in WizardryUtilities
|
||||
* (see {@link WizardryUtilities#attackEntityWithoutKnockback(Entity, DamageSource, float)}).
|
||||
* (see {@link EntityUtils#attackEntityWithoutKnockback(Entity, DamageSource, float)}).
|
||||
*/
|
||||
public static boolean attackEntitySafely(Entity target, DamageSource source, float damage,
|
||||
String originalSourceName, DamageSource fallback, boolean knockback){
|
||||
@@ -70,7 +70,7 @@ public final class DamageSafetyChecker {
|
||||
// No harm in still incrementing the counter
|
||||
attacksThisTick++;
|
||||
return knockback ? target.attackEntityFrom(fallback, damage)
|
||||
: WizardryUtilities.attackEntityWithoutKnockback(target, fallback, damage);
|
||||
: EntityUtils.attackEntityWithoutKnockback(target, fallback, damage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,13 +88,13 @@ public final class DamageSafetyChecker {
|
||||
// Fallback behaviour
|
||||
attacksThisTick++;
|
||||
return knockback ? target.attackEntityFrom(fallback, damage)
|
||||
: WizardryUtilities.attackEntityWithoutKnockback(target, fallback, damage);
|
||||
: EntityUtils.attackEntityWithoutKnockback(target, fallback, damage);
|
||||
|
||||
}else{
|
||||
// Normal behaviour
|
||||
attacksThisTick++;
|
||||
return knockback ? target.attackEntityFrom(source, damage)
|
||||
: WizardryUtilities.attackEntityWithoutKnockback(target, source, damage);
|
||||
: EntityUtils.attackEntityWithoutKnockback(target, source, damage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.tileentity.TileEntityArcaneWorkbench;
|
||||
import electroblob.wizardry.util.ISpellSortable;
|
||||
import electroblob.wizardry.util.InventoryUtils;
|
||||
import electroblob.wizardry.util.WandHelper;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.ClickType;
|
||||
@@ -371,10 +371,10 @@ public class ContainerArcaneWorkbench extends Container implements ISpellSortabl
|
||||
Set<VirtualSlot> slots = new LinkedHashSet<>(bookshelfSlots.size());
|
||||
|
||||
// Add all slots that currently contain a matching stack - collect to list to retain order
|
||||
slots.addAll(bookshelfSlots.stream().filter(s -> WizardryUtilities.canMerge(stack, s.getStack())).collect(Collectors.toList()));
|
||||
slots.addAll(bookshelfSlots.stream().filter(s -> InventoryUtils.canMerge(stack, s.getStack())).collect(Collectors.toList()));
|
||||
// Then add all empty slots that previously contained a matching stack, if they weren't already added
|
||||
// No need to actually check if they're empty since inserting a new stack overwrites prevStack anyway
|
||||
slots.addAll(bookshelfSlots.stream().filter(s -> WizardryUtilities.canMerge(stack, s.getPrevStack())).collect(Collectors.toList()));
|
||||
slots.addAll(bookshelfSlots.stream().filter(s -> InventoryUtils.canMerge(stack, s.getPrevStack())).collect(Collectors.toList()));
|
||||
// Then add all slots that did not previously contain anything
|
||||
slots.addAll(bookshelfSlots.stream().filter(s -> s.getPrevStack().isEmpty()).collect(Collectors.toList()));
|
||||
// Finally add all other empty slots (these will be the ones that used to contain something else)
|
||||
|
||||
@@ -2,6 +2,7 @@ package electroblob.wizardry.item;
|
||||
|
||||
import electroblob.wizardry.data.WizardData;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -18,7 +19,7 @@ import javax.annotation.Nonnull;
|
||||
* this interface if appropriate.</i>
|
||||
* <p></p>
|
||||
* This interface is used for the following:<br>
|
||||
* - General-purpose detection of continuous spell casting (see {@link electroblob.wizardry.util.WizardryUtilities#isCasting(EntityLivingBase, Spell)})<br>
|
||||
* - General-purpose detection of continuous spell casting (see {@link EntityUtils#isCasting(EntityLivingBase, Spell)})<br>
|
||||
* - Display of the arcane workbench tooltip (in conjunction with {@link IManaStoringItem})<br>
|
||||
* - Spell HUD visibility<br>
|
||||
* - Spell switching controls (they won't do anything unless the player is holding an {@code ISpellCastingItem})<br>
|
||||
|
||||
@@ -179,7 +179,7 @@ public class ItemArtefact extends Item {
|
||||
}else{
|
||||
// To find out if the given artefact is one of the first n on the player's hotbar (where n is the maximum
|
||||
// number of that kind of artefact that can be active at once):
|
||||
return WizardryUtilities.getPrioritisedHotbarAndOffhand(player).stream() // Retrieve the stacks in question
|
||||
return InventoryUtils.getPrioritisedHotbarAndOffhand(player).stream() // Retrieve the stacks in question
|
||||
// Filter out all except artefacts of the same type as the given one (preserving order)
|
||||
.filter(s -> s.getItem() instanceof ItemArtefact && ((ItemArtefact)s.getItem()).type == ((ItemArtefact)artefact).type)
|
||||
.limit(((ItemArtefact)artefact).type.maxAtOnce) // Ignore all but the first n
|
||||
@@ -213,7 +213,7 @@ public class ItemArtefact extends Item {
|
||||
List<ItemArtefact> artefacts = new ArrayList<>();
|
||||
|
||||
for(Type type : types){
|
||||
artefacts.addAll(WizardryUtilities.getPrioritisedHotbarAndOffhand(player).stream()
|
||||
artefacts.addAll(InventoryUtils.getPrioritisedHotbarAndOffhand(player).stream()
|
||||
.filter(s -> s.getItem() instanceof ItemArtefact)
|
||||
.map(s -> (ItemArtefact)s.getItem())
|
||||
.filter(i -> type == i.type && i.enabled)
|
||||
@@ -237,7 +237,7 @@ public class ItemArtefact extends Item {
|
||||
*/
|
||||
public static boolean findMatchingWandAndExecute(EntityPlayer player, Spell spell, Consumer<? super ItemStack> action){
|
||||
|
||||
List<ItemStack> hotbar = WizardryUtilities.getPrioritisedHotbarAndOffhand(player);
|
||||
List<ItemStack> hotbar = InventoryUtils.getPrioritisedHotbarAndOffhand(player);
|
||||
|
||||
Optional<ItemStack> stack = hotbar.stream().filter(s -> s.getItem() instanceof ISpellCastingItem
|
||||
&& Arrays.asList(((ISpellCastingItem)s.getItem()).getSpells(s)).contains(spell)).findFirst();
|
||||
@@ -281,7 +281,7 @@ public class ItemArtefact extends Item {
|
||||
if(artefact == WizardryItems.ring_condensing){
|
||||
|
||||
if(player.ticksExisted % 150 == 0){
|
||||
for(ItemStack stack : WizardryUtilities.getHotbar(player)){
|
||||
for(ItemStack stack : InventoryUtils.getHotbar(player)){
|
||||
// Needs to be both of these interfaces because this ring only recharges wands
|
||||
// (or more accurately, chargeable spellcasting items)
|
||||
if(stack.getItem() instanceof ISpellCastingItem && stack.getItem() instanceof IManaStoringItem)
|
||||
@@ -342,7 +342,7 @@ public class ItemArtefact extends Item {
|
||||
|
||||
findMatchingWandAndExecute(player, Spells.shield, wand -> {
|
||||
|
||||
List<Entity> projectiles = WizardryUtilities.getEntitiesWithinRadius(5, player.posX, player.posY, player.posZ, world, Entity.class);
|
||||
List<Entity> projectiles = EntityUtils.getEntitiesWithinRadius(5, player.posX, player.posY, player.posZ, world, Entity.class);
|
||||
projectiles.removeIf(e -> !(e instanceof IProjectile));
|
||||
Vec3d look = player.getLookVec();
|
||||
Vec3d playerPos = player.getPositionVector().add(0, player.height/2, 0);
|
||||
@@ -480,7 +480,7 @@ public class ItemArtefact extends Item {
|
||||
// Spell properties allow all three of the above spells to be dealt with the same way - neat!
|
||||
float healthGained = event.getSpell().getProperty(Spell.HEALTH).floatValue() * event.getModifiers().get(SpellModifiers.POTENCY);
|
||||
|
||||
List<EntityLivingBase> nearby = WizardryUtilities.getEntitiesWithinRadius(4, player.posX, player.posY, player.posZ, event.getWorld());
|
||||
List<EntityLivingBase> nearby = EntityUtils.getEntitiesWithinRadius(4, player.posX, player.posY, player.posZ, event.getWorld());
|
||||
|
||||
for(EntityLivingBase entity : nearby){
|
||||
if(AllyDesignationSystem.isAllied(player, entity) && entity.getHealth() > 0 && entity.getHealth() < entity.getMaxHealth()){
|
||||
@@ -505,13 +505,13 @@ public class ItemArtefact extends Item {
|
||||
|
||||
if(entityNBT.hasUniqueId(MindControl.NBT_KEY)){
|
||||
|
||||
Entity caster = WizardryUtilities.getEntityByUUID(entity.world, entityNBT.getUniqueId(MindControl.NBT_KEY));
|
||||
Entity caster = EntityUtils.getEntityByUUID(entity.world, entityNBT.getUniqueId(MindControl.NBT_KEY));
|
||||
|
||||
if(caster instanceof EntityPlayer){
|
||||
|
||||
if(isArtefactActive((EntityPlayer)caster, WizardryItems.ring_mind_control)){
|
||||
|
||||
WizardryUtilities.getEntitiesWithinRadius(3, entity.posX, entity.posY, entity.posZ, entity.world, EntityLiving.class).stream()
|
||||
EntityUtils.getEntitiesWithinRadius(3, entity.posX, entity.posY, entity.posZ, entity.world, EntityLiving.class).stream()
|
||||
.filter(e -> e.world.rand.nextInt(10) == 0)
|
||||
.filter(MindControl::canControl)
|
||||
.filter(e -> AllyDesignationSystem.isValidTarget(caster, e))
|
||||
@@ -573,7 +573,7 @@ public class ItemArtefact extends Item {
|
||||
|
||||
}else if(artefact == WizardryItems.amulet_potential){
|
||||
|
||||
if(player.world.rand.nextFloat() < 0.2f && WizardryUtilities.isMeleeDamage(event.getSource())
|
||||
if(player.world.rand.nextFloat() < 0.2f && EntityUtils.isMeleeDamage(event.getSource())
|
||||
&& event.getSource().getTrueSource() instanceof EntityLivingBase){
|
||||
|
||||
EntityLivingBase target = (EntityLivingBase)event.getSource().getTrueSource();
|
||||
@@ -597,7 +597,7 @@ public class ItemArtefact extends Item {
|
||||
|
||||
if(!event.getSource().isUnblockable() && player.world.rand.nextFloat() < 0.15f){
|
||||
|
||||
List<EntityLiving> nearbyMobs = WizardryUtilities.getEntitiesWithinRadius(5, player.posX, player.posY, player.posZ, player.world, EntityLiving.class);
|
||||
List<EntityLiving> nearbyMobs = EntityUtils.getEntitiesWithinRadius(5, player.posX, player.posY, player.posZ, player.world, EntityLiving.class);
|
||||
nearbyMobs.removeIf(e -> !(e instanceof ISummonedCreature && ((ISummonedCreature)e).getCaster() == player));
|
||||
|
||||
if(!nearbyMobs.isEmpty()){
|
||||
@@ -611,7 +611,7 @@ public class ItemArtefact extends Item {
|
||||
|
||||
}else if(artefact == WizardryItems.amulet_banishing){
|
||||
|
||||
if(player.world.rand.nextFloat() < 0.2f && WizardryUtilities.isMeleeDamage(event.getSource())
|
||||
if(player.world.rand.nextFloat() < 0.2f && EntityUtils.isMeleeDamage(event.getSource())
|
||||
&& event.getSource().getTrueSource() instanceof EntityLivingBase){
|
||||
|
||||
EntityLivingBase target = (EntityLivingBase)event.getSource().getTrueSource();
|
||||
@@ -639,25 +639,25 @@ public class ItemArtefact extends Item {
|
||||
if(artefact == WizardryItems.ring_fire_melee){
|
||||
// Used ItemWand intentionally because we need the element
|
||||
// Other mods can always make their own events if they want their own spellcasting items to do this
|
||||
if(WizardryUtilities.isMeleeDamage(event.getSource()) && mainhandItem.getItem() instanceof ItemWand
|
||||
if(EntityUtils.isMeleeDamage(event.getSource()) && mainhandItem.getItem() instanceof ItemWand
|
||||
&& ((ItemWand)mainhandItem.getItem()).element == Element.FIRE){
|
||||
event.getEntity().setFire(5);
|
||||
}
|
||||
|
||||
}else if(artefact == WizardryItems.ring_ice_melee){
|
||||
|
||||
if(WizardryUtilities.isMeleeDamage(event.getSource()) && mainhandItem.getItem() instanceof ItemWand
|
||||
if(EntityUtils.isMeleeDamage(event.getSource()) && mainhandItem.getItem() instanceof ItemWand
|
||||
&& ((ItemWand)mainhandItem.getItem()).element == Element.ICE){
|
||||
event.getEntityLiving().addPotionEffect(new PotionEffect(WizardryPotions.frost, 200, 0));
|
||||
}
|
||||
|
||||
}else if(artefact == WizardryItems.ring_lightning_melee){
|
||||
|
||||
if(WizardryUtilities.isMeleeDamage(event.getSource()) && mainhandItem.getItem() instanceof ItemWand
|
||||
if(EntityUtils.isMeleeDamage(event.getSource()) && mainhandItem.getItem() instanceof ItemWand
|
||||
&& ((ItemWand)mainhandItem.getItem()).element == Element.LIGHTNING){
|
||||
|
||||
WizardryUtilities.getEntitiesWithinRadius(3, player.posX, player.posY, player.posZ, world).stream()
|
||||
.filter(WizardryUtilities::isLiving)
|
||||
EntityUtils.getEntitiesWithinRadius(3, player.posX, player.posY, player.posZ, world).stream()
|
||||
.filter(EntityUtils::isLiving)
|
||||
.filter(e -> e != player)
|
||||
.min(Comparator.comparingDouble(player::getDistanceSq))
|
||||
.ifPresent(target -> {
|
||||
@@ -679,14 +679,14 @@ public class ItemArtefact extends Item {
|
||||
|
||||
}else if(artefact == WizardryItems.ring_necromancy_melee){
|
||||
|
||||
if(WizardryUtilities.isMeleeDamage(event.getSource()) && mainhandItem.getItem() instanceof ItemWand
|
||||
if(EntityUtils.isMeleeDamage(event.getSource()) && mainhandItem.getItem() instanceof ItemWand
|
||||
&& ((ItemWand)mainhandItem.getItem()).element == Element.NECROMANCY){
|
||||
event.getEntityLiving().addPotionEffect(new PotionEffect(MobEffects.WITHER, 200, 0));
|
||||
}
|
||||
|
||||
}else if(artefact == WizardryItems.ring_earth_melee){
|
||||
|
||||
if(WizardryUtilities.isMeleeDamage(event.getSource()) && mainhandItem.getItem() instanceof ItemWand
|
||||
if(EntityUtils.isMeleeDamage(event.getSource()) && mainhandItem.getItem() instanceof ItemWand
|
||||
&& ((ItemWand)mainhandItem.getItem()).element == Element.EARTH){
|
||||
event.getEntityLiving().addPotionEffect(new PotionEffect(MobEffects.POISON, 200, 0));
|
||||
}
|
||||
@@ -696,7 +696,7 @@ public class ItemArtefact extends Item {
|
||||
if(!player.world.isRemote && player.world.rand.nextFloat() < 0.15f
|
||||
&& event.getEntityLiving().getHealth() < 12f // Otherwise it's a bit overpowered!
|
||||
&& event.getEntityLiving().isPotionActive(WizardryPotions.frost)
|
||||
&& WizardryUtilities.isMeleeDamage(event.getSource())){
|
||||
&& EntityUtils.isMeleeDamage(event.getSource())){
|
||||
|
||||
event.setAmount(12f);
|
||||
|
||||
@@ -722,7 +722,7 @@ public class ItemArtefact extends Item {
|
||||
if((event.getSource() instanceof IElementalDamage
|
||||
&& (((IElementalDamage)event.getSource()).getType() == MagicDamage.DamageType.WITHER))
|
||||
// or it's direct, non-melee damage and the player is holding a wand with a necromancy spell selected
|
||||
|| (event.getSource().getImmediateSource() == player && !WizardryUtilities.isMeleeDamage(event.getSource())
|
||||
|| (event.getSource().getImmediateSource() == player && !EntityUtils.isMeleeDamage(event.getSource())
|
||||
&& Streams.stream(player.getHeldEquipment()).anyMatch(s -> s.getItem() instanceof ISpellCastingItem
|
||||
&& ((ISpellCastingItem)s.getItem()).getCurrentSpell(s).getElement() == Element.NECROMANCY))){
|
||||
|
||||
@@ -735,7 +735,7 @@ public class ItemArtefact extends Item {
|
||||
if(player.world.rand.nextFloat() < 0.3f && ((event.getSource() instanceof IElementalDamage
|
||||
&& (((IElementalDamage)event.getSource()).getType() == MagicDamage.DamageType.WITHER))
|
||||
// ...or it's direct, non-melee damage and the player is holding a wand with a necromancy spell selected
|
||||
|| (event.getSource().getImmediateSource() == player && !WizardryUtilities.isMeleeDamage(event.getSource())
|
||||
|| (event.getSource().getImmediateSource() == player && !EntityUtils.isMeleeDamage(event.getSource())
|
||||
&& Streams.stream(player.getHeldEquipment()).anyMatch(s -> s.getItem() instanceof ISpellCastingItem
|
||||
&& ((ISpellCastingItem)s.getItem()).getCurrentSpell(s).getElement() == Element.NECROMANCY
|
||||
&& ((ISpellCastingItem)s.getItem()).getCurrentSpell(s) != Spells.life_drain)))){
|
||||
@@ -753,7 +753,7 @@ public class ItemArtefact extends Item {
|
||||
// ...or it was from a dart...
|
||||
|| event.getSource().getImmediateSource() instanceof EntityDart
|
||||
// ...or it's direct, non-melee damage and the player is holding a wand with an earth spell selected
|
||||
|| (event.getSource().getImmediateSource() == player && !WizardryUtilities.isMeleeDamage(event.getSource())
|
||||
|| (event.getSource().getImmediateSource() == player && !EntityUtils.isMeleeDamage(event.getSource())
|
||||
&& Streams.stream(player.getHeldEquipment()).anyMatch(s -> s.getItem() instanceof ISpellCastingItem
|
||||
&& ((ISpellCastingItem)s.getItem()).getCurrentSpell(s).getElement() == Element.EARTH))){
|
||||
|
||||
@@ -768,11 +768,11 @@ public class ItemArtefact extends Item {
|
||||
// ...or it was from a force orb...
|
||||
|| event.getSource().getImmediateSource() instanceof EntityForceOrb
|
||||
// ...or it's direct, non-melee damage and the player is holding a wand with a sorcery spell selected
|
||||
|| (event.getSource().getImmediateSource() == player && !WizardryUtilities.isMeleeDamage(event.getSource())
|
||||
|| (event.getSource().getImmediateSource() == player && !EntityUtils.isMeleeDamage(event.getSource())
|
||||
&& Streams.stream(player.getHeldEquipment()).anyMatch(s -> s.getItem() instanceof ISpellCastingItem
|
||||
&& ((ISpellCastingItem)s.getItem()).getCurrentSpell(s).getElement() == Element.SORCERY))){
|
||||
|
||||
WizardryUtilities.getPrioritisedHotbarAndOffhand(player).stream()
|
||||
InventoryUtils.getPrioritisedHotbarAndOffhand(player).stream()
|
||||
.filter(s -> s.getItem() instanceof ISpellCastingItem && s.getItem() instanceof IManaStoringItem
|
||||
&& !((IManaStoringItem)s.getItem()).isManaFull(s))
|
||||
.findFirst()
|
||||
@@ -845,7 +845,7 @@ public class ItemArtefact extends Item {
|
||||
.findFirst().orElse(null);
|
||||
|
||||
if(item == null) return; // The player didn't have a wand with resurrection on it
|
||||
if(!WizardryUtilities.getHotbar(event.getEntityPlayer()).contains(ItemStack.EMPTY)) return; // No space on hotbar
|
||||
if(!InventoryUtils.getHotbar(event.getEntityPlayer()).contains(ItemStack.EMPTY)) return; // No space on hotbar
|
||||
|
||||
event.getDrops().remove(item);
|
||||
// At this point the player probably has nothing in their hand, but if not just find a free space somewhere
|
||||
|
||||
@@ -3,9 +3,9 @@ package electroblob.wizardry.item;
|
||||
import com.google.common.collect.Multimap;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
@@ -39,7 +39,7 @@ public class ItemFlamingAxe extends ItemAxe implements IConjuredItem {
|
||||
|
||||
if(slot == EntityEquipmentSlot.MAINHAND){
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(POTENCY_MODIFIER,
|
||||
"Potency modifier", IConjuredItem.getDamageMultiplier(stack) - 1, WizardryUtilities.Operations.MULTIPLY_CUMULATIVE));
|
||||
"Potency modifier", IConjuredItem.getDamageMultiplier(stack) - 1, EntityUtils.Operations.MULTIPLY_CUMULATIVE));
|
||||
}
|
||||
|
||||
return multimap;
|
||||
|
||||
@@ -4,9 +4,9 @@ import com.google.common.collect.Multimap;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
@@ -41,7 +41,7 @@ public class ItemFrostAxe extends ItemAxe implements IConjuredItem {
|
||||
|
||||
if(slot == EntityEquipmentSlot.MAINHAND){
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(POTENCY_MODIFIER,
|
||||
"Potency modifier", IConjuredItem.getDamageMultiplier(stack) - 1, WizardryUtilities.Operations.MULTIPLY_CUMULATIVE));
|
||||
"Potency modifier", IConjuredItem.getDamageMultiplier(stack) - 1, EntityUtils.Operations.MULTIPLY_CUMULATIVE));
|
||||
}
|
||||
|
||||
return multimap;
|
||||
|
||||
@@ -6,7 +6,7 @@ import electroblob.wizardry.event.DiscoverSpellEvent;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.registry.WizardryTabs;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.InventoryUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -56,7 +56,7 @@ public class ItemIdentificationScroll extends Item {
|
||||
|
||||
WizardData data = WizardData.get(player);
|
||||
|
||||
for(ItemStack stack1 : WizardryUtilities.getPrioritisedHotbarAndOffhand(player)){
|
||||
for(ItemStack stack1 : InventoryUtils.getPrioritisedHotbarAndOffhand(player)){
|
||||
|
||||
if(!stack1.isEmpty()){
|
||||
Spell spell = Spell.byMetadata(stack1.getItemDamage());
|
||||
|
||||
@@ -6,11 +6,11 @@ import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.LightningHammer;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
@@ -83,9 +83,9 @@ public class ItemLightningHammer extends Item implements IConjuredItem {
|
||||
if(slot == EntityEquipmentSlot.MAINHAND){
|
||||
float attackDamage = Spells.lightning_hammer.arePropertiesInitialised() ?
|
||||
Spells.lightning_hammer.getProperty(Spell.DIRECT_DAMAGE).floatValue() : 10; // Fallback for search tree init, value doesn't really matter
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", attackDamage, WizardryUtilities.Operations.ADD));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", ATTACK_SPEED, WizardryUtilities.Operations.ADD));
|
||||
multimap.put(SharedMonsterAttributes.MOVEMENT_SPEED.getName(), new AttributeModifier(MOVEMENT_SPEED_MODIFIER, "Weapon modifier", MOVEMENT_SPEED_REDUCTION, WizardryUtilities.Operations.MULTIPLY_FLAT));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", attackDamage, EntityUtils.Operations.ADD));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", ATTACK_SPEED, EntityUtils.Operations.ADD));
|
||||
multimap.put(SharedMonsterAttributes.MOVEMENT_SPEED.getName(), new AttributeModifier(MOVEMENT_SPEED_MODIFIER, "Weapon modifier", MOVEMENT_SPEED_REDUCTION, EntityUtils.Operations.MULTIPLY_FLAT));
|
||||
}
|
||||
|
||||
return multimap;
|
||||
@@ -135,7 +135,7 @@ public class ItemLightningHammer extends Item implements IConjuredItem {
|
||||
world.spawnEntity(hammer);
|
||||
}
|
||||
|
||||
WizardryUtilities.playSoundAtPlayer(player, WizardrySounds.ENTITY_HAMMER_THROW, 1.0F, 0.8f);
|
||||
EntityUtils.playSoundAtPlayer(player, WizardrySounds.ENTITY_HAMMER_THROW, 1.0F, 0.8f);
|
||||
|
||||
//player.swingArm(hand);
|
||||
|
||||
@@ -195,7 +195,7 @@ public class ItemLightningHammer extends Item implements IConjuredItem {
|
||||
|
||||
if(attackStrength == 1){ // Only chains when the attack meter is full
|
||||
|
||||
List<EntityLivingBase> nearby = WizardryUtilities.getEntitiesWithinRadius(CHAINING_RANGE, hit.posX, hit.posY, hit.posZ, hit.world);
|
||||
List<EntityLivingBase> nearby = EntityUtils.getEntitiesWithinRadius(CHAINING_RANGE, hit.posX, hit.posY, hit.posZ, hit.world);
|
||||
|
||||
nearby.remove(hit);
|
||||
nearby.remove(wielder);
|
||||
|
||||
@@ -3,7 +3,8 @@ package electroblob.wizardry.item;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.registry.WizardryTabs;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.InventoryUtils;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
@@ -61,7 +62,7 @@ public class ItemManaFlask extends Item {
|
||||
|
||||
ItemStack flask = player.getHeldItem(hand);
|
||||
|
||||
List<ItemStack> stacks = WizardryUtilities.getPrioritisedHotbarAndOffhand(player);
|
||||
List<ItemStack> stacks = InventoryUtils.getPrioritisedHotbarAndOffhand(player);
|
||||
stacks.addAll(player.inventory.armorInventory); // player#getArmorInventoryList() only returns an Iterable
|
||||
|
||||
// Find the chargeable item with the least mana
|
||||
@@ -73,8 +74,8 @@ public class ItemManaFlask extends Item {
|
||||
|
||||
((IManaStoringItem)toCharge.getItem()).rechargeMana(toCharge, size.capacity);
|
||||
|
||||
WizardryUtilities.playSoundAtPlayer(player, WizardrySounds.ITEM_MANA_FLASK_USE, 1, 1);
|
||||
WizardryUtilities.playSoundAtPlayer(player, WizardrySounds.ITEM_MANA_FLASK_RECHARGE, 0.7f, 1.1f);
|
||||
EntityUtils.playSoundAtPlayer(player, WizardrySounds.ITEM_MANA_FLASK_USE, 1, 1);
|
||||
EntityUtils.playSoundAtPlayer(player, WizardrySounds.ITEM_MANA_FLASK_RECHARGE, 0.7f, 1.1f);
|
||||
|
||||
if(!player.isCreative()) flask.shrink(1);
|
||||
player.getCooldownTracker().setCooldown(this, 20);
|
||||
|
||||
@@ -2,7 +2,7 @@ package electroblob.wizardry.item;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
@@ -35,7 +35,7 @@ public class ItemSpectralSword extends ItemSword implements IConjuredItem {
|
||||
|
||||
if(slot == EntityEquipmentSlot.MAINHAND){
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(POTENCY_MODIFIER,
|
||||
"Potency modifier", IConjuredItem.getDamageMultiplier(stack) - 1, WizardryUtilities.Operations.MULTIPLY_CUMULATIVE));
|
||||
"Potency modifier", IConjuredItem.getDamageMultiplier(stack) - 1, EntityUtils.Operations.MULTIPLY_CUMULATIVE));
|
||||
}
|
||||
|
||||
return multimap;
|
||||
|
||||
@@ -632,7 +632,7 @@ public class ItemWand extends Item implements IWorkbenchItem, ISpellCastingItem,
|
||||
|
||||
RayTraceResult rayTrace = RayTracer.standardEntityRayTrace(world, player, 16, false);
|
||||
|
||||
if(rayTrace != null && WizardryUtilities.isLiving(rayTrace.entityHit)){
|
||||
if(rayTrace != null && EntityUtils.isLiving(rayTrace.entityHit)){
|
||||
|
||||
EntityLivingBase entity = (EntityLivingBase)rayTrace.entityHit;
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ import electroblob.wizardry.registry.WizardryAdvancementTriggers;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardryRecipes;
|
||||
import electroblob.wizardry.registry.WizardryTabs;
|
||||
import electroblob.wizardry.util.InventoryUtils;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentMending;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -271,13 +271,13 @@ public class ItemWizardArmour extends ItemArmor implements IWorkbenchItem, IMana
|
||||
if(event.getCaster() == null) return;
|
||||
int armourPieces = getMatchingArmourCount(event.getCaster(), event.getSpell().getElement());
|
||||
float multiplier = 1f - armourPieces * Constants.COST_REDUCTION_PER_ARMOUR;
|
||||
if(armourPieces == WizardryUtilities.ARMOUR_SLOTS.length) multiplier -= Constants.FULL_ARMOUR_SET_BONUS;
|
||||
if(armourPieces == InventoryUtils.ARMOUR_SLOTS.length) multiplier -= Constants.FULL_ARMOUR_SET_BONUS;
|
||||
event.getModifiers().set(SpellModifiers.COST, event.getModifiers().get(SpellModifiers.COST) * multiplier, false);
|
||||
}
|
||||
|
||||
/** Counts the number of armour pieces the given entity is wearing that match the given element. */
|
||||
public static int getMatchingArmourCount(EntityLivingBase entity, Element element){
|
||||
return (int)Arrays.stream(WizardryUtilities.ARMOUR_SLOTS)
|
||||
return (int)Arrays.stream(InventoryUtils.ARMOUR_SLOTS)
|
||||
.map(s -> entity.getItemStackFromSlot(s).getItem())
|
||||
.filter(i -> i instanceof ItemWizardArmour && ((ItemWizardArmour)i).element == element)
|
||||
.count();
|
||||
|
||||
@@ -15,7 +15,8 @@ import electroblob.wizardry.event.SpellCastEvent;
|
||||
import electroblob.wizardry.item.ItemArtefact;
|
||||
import electroblob.wizardry.registry.*;
|
||||
import electroblob.wizardry.spell.Banish;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.BlockUtils;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.item.EntityFallingBlock;
|
||||
import net.minecraft.entity.passive.EntitySquid;
|
||||
@@ -173,7 +174,7 @@ public abstract class Forfeit {
|
||||
|
||||
WizardryAdvancementTriggers.spell_failure.triggerFor(player);
|
||||
|
||||
WizardryUtilities.playSoundAtPlayer(player, forfeit.getSound(), WizardrySounds.SPELLS, 1, 1);
|
||||
EntityUtils.playSoundAtPlayer(player, forfeit.getSound(), WizardrySounds.SPELLS, 1, 1);
|
||||
|
||||
if(!event.getWorld().isRemote) player.sendMessage(
|
||||
event.getSource() == SpellCastEvent.Source.WAND ? forfeit.getMessageForWand() : forfeit.getMessageForScroll());
|
||||
@@ -209,7 +210,7 @@ public abstract class Forfeit {
|
||||
add(Tier.ADVANCED, Element.FIRE, create("blazes", (w, p) -> {
|
||||
if(!w.isRemote){
|
||||
for(int i = 0; i < 3; i++){
|
||||
BlockPos pos = WizardryUtilities.findNearbyFloorSpace(p, 4, 2);
|
||||
BlockPos pos = BlockUtils.findNearbyFloorSpace(p, 4, 2);
|
||||
if(pos == null) break;
|
||||
EntityBlazeMinion blaze = new EntityBlazeMinion(w);
|
||||
blaze.setPosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
|
||||
@@ -220,7 +221,7 @@ public abstract class Forfeit {
|
||||
|
||||
add(Tier.MASTER, Element.FIRE, create("burn_surroundings", (w, p) -> {
|
||||
if(!w.isRemote){
|
||||
List<BlockPos> sphere = WizardryUtilities.getBlockSphere(p.getPosition(), 6);
|
||||
List<BlockPos> sphere = BlockUtils.getBlockSphere(p.getPosition(), 6);
|
||||
for(BlockPos pos : sphere){
|
||||
if(w.rand.nextBoolean() && w.isAirBlock(pos)) w.setBlockState(pos, Blocks.FIRE.getDefaultState());
|
||||
}
|
||||
@@ -230,7 +231,7 @@ public abstract class Forfeit {
|
||||
add(Tier.MASTER, Element.FIRE, create("meteors", (w, p) -> {
|
||||
if(!w.isRemote) for(int i=0; i<5; i++) w.spawnEntity(new EntityMeteor(w, p.posX + w.rand.nextDouble() * 16 - 8,
|
||||
p.posY + 40 + w.rand.nextDouble() * 30, p.posZ + w.rand.nextDouble() * 16 - 8,
|
||||
1, WizardryUtilities.canDamageBlocks(p, w)));
|
||||
1, EntityUtils.canDamageBlocks(p, w)));
|
||||
}));
|
||||
|
||||
add(Tier.NOVICE, Element.ICE, create("freeze_self", (w, p) -> p.addPotionEffect(new PotionEffect(WizardryPotions.frost, 200))));
|
||||
@@ -243,8 +244,8 @@ public abstract class Forfeit {
|
||||
EntityIceSpike iceSpike = new EntityIceSpike(w);
|
||||
double x = p.posX + 2 - w.rand.nextFloat() * 4;
|
||||
double z = p.posZ + 2 - w.rand.nextFloat() * 4;
|
||||
Integer y = WizardryUtilities.getNearestSurface(w, new BlockPos(x, p.posY, z), EnumFacing.UP, 2, true,
|
||||
WizardryUtilities.SurfaceCriteria.basedOn(World::isBlockFullCube));
|
||||
Integer y = BlockUtils.getNearestSurface(w, new BlockPos(x, p.posY, z), EnumFacing.UP, 2, true,
|
||||
BlockUtils.SurfaceCriteria.basedOn(World::isBlockFullCube));
|
||||
if(y == null) break;
|
||||
iceSpike.setFacing(EnumFacing.UP);
|
||||
iceSpike.setPosition(x, y, z);
|
||||
@@ -264,7 +265,7 @@ public abstract class Forfeit {
|
||||
add(Tier.ADVANCED, Element.ICE, create("ice_wraiths", (w, p) -> {
|
||||
if(!w.isRemote){
|
||||
for(int i = 0; i < 3; i++){
|
||||
BlockPos pos = WizardryUtilities.findNearbyFloorSpace(p, 4, 2);
|
||||
BlockPos pos = BlockUtils.findNearbyFloorSpace(p, 4, 2);
|
||||
if(pos == null) break;
|
||||
EntityIceWraith iceWraith = new EntityIceWraith(w);
|
||||
iceWraith.setPosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
|
||||
@@ -306,7 +307,7 @@ public abstract class Forfeit {
|
||||
if(!w.isRemote){
|
||||
for(EnumFacing direction : EnumFacing.HORIZONTALS){
|
||||
BlockPos pos = p.getPosition().offset(direction, 2);
|
||||
Integer y = WizardryUtilities.getNearestFloor(w, pos, 2);
|
||||
Integer y = BlockUtils.getNearestFloor(w, pos, 2);
|
||||
if(y == null) continue;
|
||||
EntityLightningSigil sigil = new EntityLightningSigil(w);
|
||||
sigil.setPosition(pos.getX() + 0.5, y, pos.getZ() + 0.5);
|
||||
@@ -322,7 +323,7 @@ public abstract class Forfeit {
|
||||
add(Tier.ADVANCED, Element.LIGHTNING, create("lightning_wraiths", (w, p) -> {
|
||||
if(!w.isRemote){
|
||||
for(int i = 0; i < 3; i++){
|
||||
BlockPos pos = WizardryUtilities.findNearbyFloorSpace(p, 4, 2);
|
||||
BlockPos pos = BlockUtils.findNearbyFloorSpace(p, 4, 2);
|
||||
if(pos == null) break;
|
||||
EntityLightningWraith lightningWraith = new EntityLightningWraith(w);
|
||||
lightningWraith.setPosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
|
||||
@@ -347,7 +348,7 @@ public abstract class Forfeit {
|
||||
add(Tier.APPRENTICE, Element.NECROMANCY, create("zombie_horde", (w, p) -> {
|
||||
if(!w.isRemote){
|
||||
for(int i = 0; i < 3; i++){
|
||||
BlockPos pos = WizardryUtilities.findNearbyFloorSpace(p, 4, 2);
|
||||
BlockPos pos = BlockUtils.findNearbyFloorSpace(p, 4, 2);
|
||||
if(pos == null) break;
|
||||
EntityZombieMinion zombie = new EntityZombieMinion(w);
|
||||
zombie.setPosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
|
||||
@@ -375,7 +376,7 @@ public abstract class Forfeit {
|
||||
if(!w.isRemote){
|
||||
for(EnumFacing direction : EnumFacing.HORIZONTALS){
|
||||
BlockPos pos = p.getPosition().offset(direction);
|
||||
if(WizardryUtilities.canBlockBeReplaced(w, pos)) w.setBlockState(pos, WizardryBlocks.snare.getDefaultState());
|
||||
if(BlockUtils.canBlockBeReplaced(w, pos)) w.setBlockState(pos, WizardryBlocks.snare.getDefaultState());
|
||||
}
|
||||
}
|
||||
}));
|
||||
@@ -390,7 +391,7 @@ public abstract class Forfeit {
|
||||
|
||||
add(Tier.APPRENTICE, Element.EARTH, create("uproot_plants", (w, p) -> {
|
||||
if(!w.isRemote){
|
||||
List<BlockPos> sphere = WizardryUtilities.getBlockSphere(p.getPosition(), 5);
|
||||
List<BlockPos> sphere = BlockUtils.getBlockSphere(p.getPosition(), 5);
|
||||
sphere.removeIf(pos -> !(w.getBlockState(pos).getBlock() instanceof IPlantable));
|
||||
sphere.forEach(pos -> w.destroyBlock(pos, true));
|
||||
}
|
||||
@@ -400,17 +401,17 @@ public abstract class Forfeit {
|
||||
|
||||
add(Tier.ADVANCED, Element.EARTH, create("flood", (w, p) -> {
|
||||
if(!w.isRemote){
|
||||
List<BlockPos> sphere = WizardryUtilities.getBlockSphere(p.getPosition().up(), 2);
|
||||
sphere.removeIf(pos -> !WizardryUtilities.canBlockBeReplaced(w, pos, true));
|
||||
List<BlockPos> sphere = BlockUtils.getBlockSphere(p.getPosition().up(), 2);
|
||||
sphere.removeIf(pos -> !BlockUtils.canBlockBeReplaced(w, pos, true));
|
||||
sphere.forEach(pos -> w.setBlockState(pos, Blocks.WATER.getDefaultState()));
|
||||
}
|
||||
}));
|
||||
|
||||
add(Tier.MASTER, Element.EARTH, create("bury_self", (w, p) -> {
|
||||
if(!w.isRemote){
|
||||
List<BlockPos> sphere = WizardryUtilities.getBlockSphere(p.getPosition(), 4);
|
||||
List<BlockPos> sphere = BlockUtils.getBlockSphere(p.getPosition(), 4);
|
||||
sphere.removeIf(pos -> !w.getBlockState(pos).isFullCube());
|
||||
sphere.removeIf(pos -> WizardryUtilities.isBlockUnbreakable(w, pos));
|
||||
sphere.removeIf(pos -> BlockUtils.isBlockUnbreakable(w, pos));
|
||||
sphere.forEach(pos -> {
|
||||
EntityFallingBlock block = new EntityFallingBlock(w, pos.getX() + 0.5, pos.getY() + 0.5,
|
||||
pos.getZ() + 0.5, w.getBlockState(pos));
|
||||
@@ -437,7 +438,7 @@ public abstract class Forfeit {
|
||||
add(Tier.ADVANCED, Element.SORCERY, create("vex_horde", (w, p) -> {
|
||||
if(!w.isRemote){
|
||||
for(int i = 0; i < 4; i++){
|
||||
BlockPos pos = WizardryUtilities.findNearbyFloorSpace(p, 4, 2);
|
||||
BlockPos pos = BlockUtils.findNearbyFloorSpace(p, 4, 2);
|
||||
if(pos == null) break;
|
||||
EntityVexMinion vex = new EntityVexMinion(w);
|
||||
vex.setPosition(pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package electroblob.wizardry.misc;
|
||||
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.InventoryUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTUtil;
|
||||
@@ -74,18 +74,18 @@ public class WildcardTradeList extends MerchantRecipeList {
|
||||
for(MerchantRecipe merchantrecipe : this){
|
||||
|
||||
ItemStack itemToBuy = merchantrecipe.getItemToBuy();
|
||||
if(itemToBuy.getMetadata() == OreDictionary.WILDCARD_VALUE) itemToBuy = WizardryUtilities.copyWithMeta(itemToBuy, 0);
|
||||
if(itemToBuy.getMetadata() == OreDictionary.WILDCARD_VALUE) itemToBuy = InventoryUtils.copyWithMeta(itemToBuy, 0);
|
||||
buffer.writeItemStack(itemToBuy);
|
||||
|
||||
ItemStack itemToSell = merchantrecipe.getItemToSell();
|
||||
if(itemToSell.getMetadata() == OreDictionary.WILDCARD_VALUE) itemToSell = WizardryUtilities.copyWithMeta(itemToSell, 0);
|
||||
if(itemToSell.getMetadata() == OreDictionary.WILDCARD_VALUE) itemToSell = InventoryUtils.copyWithMeta(itemToSell, 0);
|
||||
buffer.writeItemStack(itemToSell);
|
||||
|
||||
ItemStack secondItemToBuy = merchantrecipe.getSecondItemToBuy();
|
||||
buffer.writeBoolean(!secondItemToBuy.isEmpty());
|
||||
|
||||
if(!secondItemToBuy.isEmpty()){
|
||||
if(secondItemToBuy.getMetadata() == OreDictionary.WILDCARD_VALUE) secondItemToBuy = WizardryUtilities.copyWithMeta(secondItemToBuy, 0);
|
||||
if(secondItemToBuy.getMetadata() == OreDictionary.WILDCARD_VALUE) secondItemToBuy = InventoryUtils.copyWithMeta(secondItemToBuy, 0);
|
||||
buffer.writeItemStack(secondItemToBuy);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ import electroblob.wizardry.packet.PacketControlInput.Message;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.spell.Possession;
|
||||
import electroblob.wizardry.spell.Resurrection;
|
||||
import electroblob.wizardry.util.InventoryUtils;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -75,7 +75,7 @@ public class PacketControlInput implements IMessageHandler<Message, IMessage> {
|
||||
|
||||
if(player.isDead && Resurrection.getRemainingWaitTime(player.deathTime) == 0){
|
||||
|
||||
ItemStack stack = WizardryUtilities.getHotbar(player).stream()
|
||||
ItemStack stack = InventoryUtils.getHotbar(player).stream()
|
||||
.filter(s -> Resurrection.canStackResurrect(s, player)).findFirst().orElse(null);
|
||||
|
||||
if(stack != null){
|
||||
@@ -96,7 +96,7 @@ public class PacketControlInput implements IMessageHandler<Message, IMessage> {
|
||||
|
||||
if(player.isDead){
|
||||
|
||||
ItemStack stack = WizardryUtilities.getHotbar(player).stream()
|
||||
ItemStack stack = InventoryUtils.getHotbar(player).stream()
|
||||
.filter(s -> Resurrection.canStackResurrect(s, player)).findFirst().orElse(null);
|
||||
|
||||
if(stack != null){
|
||||
|
||||
@@ -2,8 +2,9 @@ package electroblob.wizardry.potion;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.GeometryUtils;
|
||||
import electroblob.wizardry.util.NBTExtras;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTUtil;
|
||||
@@ -44,7 +45,7 @@ public class PotionContainment extends PotionMagicEffect {
|
||||
NBTExtras.storeTagSafely(target.getEntityData(), ENTITY_TAG, NBTUtil.createPosTag(new BlockPos(target.getPositionVector().subtract(0.5, 0.5, 0.5))));
|
||||
}
|
||||
|
||||
Vec3d origin = WizardryUtilities.getCentre(NBTUtil.getPosFromTag(target.getEntityData().getCompoundTag(ENTITY_TAG)));
|
||||
Vec3d origin = GeometryUtils.getCentre(NBTUtil.getPosFromTag(target.getEntityData().getCompoundTag(ENTITY_TAG)));
|
||||
|
||||
double x = target.posX, y = target.posY, z = target.posZ;
|
||||
|
||||
@@ -93,7 +94,7 @@ public class PotionContainment extends PotionMagicEffect {
|
||||
// }
|
||||
// }
|
||||
|
||||
WizardryUtilities.undoGravity(target);
|
||||
EntityUtils.undoGravity(target);
|
||||
target.addVelocity(0.35 * Math.signum(x - target.posX), 0.35 * Math.signum(y - target.posY), 0.35 * Math.signum(z - target.posZ));
|
||||
target.setPositionAndUpdate(x, y, z);
|
||||
// Player motion is handled on that player's client so needs packets
|
||||
|
||||
@@ -5,16 +5,14 @@ import electroblob.wizardry.item.ItemArtefact;
|
||||
import electroblob.wizardry.registry.WizardryBlocks;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.util.BlockUtils;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.block.BlockLiquid;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.enchantment.EnchantmentFrostWalker;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -104,7 +102,7 @@ public class PotionFrostStep extends PotionMagicEffect implements ICustomPotionP
|
||||
|
||||
IBlockState state2 = world.getBlockState(pos2);
|
||||
|
||||
if(WizardryUtilities.isLavaSource(state2) && world.mayPlace(WizardryBlocks.obsidian_crust, pos2, false, EnumFacing.DOWN, null)){
|
||||
if(BlockUtils.isLavaSource(state2) && world.mayPlace(WizardryBlocks.obsidian_crust, pos2, false, EnumFacing.DOWN, null)){
|
||||
world.setBlockState(pos2, WizardryBlocks.obsidian_crust.getDefaultState());
|
||||
world.scheduleUpdate(pos2.toImmutable(), WizardryBlocks.obsidian_crust, MathHelper.getInt(living.getRNG(), 60, 120));
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.spell.SlowTime;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.IProjectile;
|
||||
@@ -43,7 +43,7 @@ public class PotionSlowTime extends PotionMagicEffect implements ISyncedPotion {
|
||||
}
|
||||
|
||||
public static void unblockNearbyEntities(EntityLivingBase host){
|
||||
List<Entity> targetsBeyondRange = WizardryUtilities.getEntitiesWithinRadius(getEffectRadius() + 3, host.posX, host.posY, host.posZ, host.world, Entity.class);
|
||||
List<Entity> targetsBeyondRange = EntityUtils.getEntitiesWithinRadius(getEffectRadius() + 3, host.posX, host.posY, host.posZ, host.world, Entity.class);
|
||||
targetsBeyondRange.forEach(e -> e.updateBlocked = false);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class PotionSlowTime extends PotionMagicEffect implements ISyncedPotion {
|
||||
int interval = strength * 4 + 6;
|
||||
|
||||
// Mark all entities within range
|
||||
List<Entity> targetsInRange = WizardryUtilities.getEntitiesWithinRadius(getEffectRadius(), host.posX, host.posY, host.posZ, host.world, Entity.class);
|
||||
List<Entity> targetsInRange = EntityUtils.getEntitiesWithinRadius(getEffectRadius(), host.posX, host.posY, host.posZ, host.world, Entity.class);
|
||||
targetsInRange.remove(host);
|
||||
// Other entities with the slow time effect are unaffected
|
||||
targetsInRange.removeIf(t -> t instanceof EntityLivingBase && ((EntityLivingBase)t).isPotionActive(WizardryPotions.slow_time));
|
||||
@@ -130,7 +130,7 @@ public class PotionSlowTime extends PotionMagicEffect implements ISyncedPotion {
|
||||
}
|
||||
|
||||
// Un-mark all entities that have just left range
|
||||
List<Entity> targetsBeyondRange = WizardryUtilities.getEntitiesWithinRadius(getEffectRadius() + 3, host.posX, host.posY, host.posZ, host.world, Entity.class);
|
||||
List<Entity> targetsBeyondRange = EntityUtils.getEntitiesWithinRadius(getEffectRadius() + 3, host.posX, host.posY, host.posZ, host.world, Entity.class);
|
||||
targetsBeyondRange.removeAll(targetsInRange);
|
||||
targetsBeyondRange.forEach(e -> e.updateBlocked = false);
|
||||
|
||||
@@ -150,7 +150,7 @@ public class PotionSlowTime extends PotionMagicEffect implements ISyncedPotion {
|
||||
for(Entity entity : loadedEntityList){
|
||||
if(entity.getEntityData().getBoolean(NBT_KEY)){
|
||||
// Currently only players can cast slow time, but you could apply the effect to NPCs with commands
|
||||
List<EntityLivingBase> nearby = WizardryUtilities.getEntitiesWithinRadius(getEffectRadius(), entity.posX, entity.posY, entity.posZ, entity.world, EntityLivingBase.class);
|
||||
List<EntityLivingBase> nearby = EntityUtils.getEntitiesWithinRadius(getEffectRadius(), entity.posX, entity.posY, entity.posZ, entity.world, EntityLivingBase.class);
|
||||
if(nearby.stream().noneMatch(e -> e.isPotionActive(WizardryPotions.slow_time))){
|
||||
entity.getEntityData().removeTag(NBT_KEY);
|
||||
entity.updateBlocked = false;
|
||||
|
||||
@@ -4,7 +4,7 @@ import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.enchantment.EnchantmentMagicProtection;
|
||||
import electroblob.wizardry.enchantment.EnchantmentMagicSword;
|
||||
import electroblob.wizardry.enchantment.EnchantmentTimed;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.InventoryUtils;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
@@ -56,9 +56,9 @@ public final class WizardryEnchantments {
|
||||
event.getRegistry().register(new EnchantmentTimed().setRegistryName(Wizardry.MODID, "flaming_weapon"));
|
||||
event.getRegistry().register(new EnchantmentTimed().setRegistryName(Wizardry.MODID, "freezing_weapon"));
|
||||
|
||||
event.getRegistry().register(new EnchantmentMagicProtection(Enchantment.Rarity.UNCOMMON, EnchantmentMagicProtection.Type.MAGIC, WizardryUtilities.ARMOUR_SLOTS).setRegistryName(Wizardry.MODID, "magic_protection"));
|
||||
event.getRegistry().register(new EnchantmentMagicProtection(Enchantment.Rarity.RARE, EnchantmentMagicProtection.Type.FROST, WizardryUtilities.ARMOUR_SLOTS).setRegistryName(Wizardry.MODID, "frost_protection"));
|
||||
event.getRegistry().register(new EnchantmentMagicProtection(Enchantment.Rarity.RARE, EnchantmentMagicProtection.Type.SHOCK, WizardryUtilities.ARMOUR_SLOTS).setRegistryName(Wizardry.MODID, "shock_protection"));
|
||||
event.getRegistry().register(new EnchantmentMagicProtection(Enchantment.Rarity.UNCOMMON, EnchantmentMagicProtection.Type.MAGIC, InventoryUtils.ARMOUR_SLOTS).setRegistryName(Wizardry.MODID, "magic_protection"));
|
||||
event.getRegistry().register(new EnchantmentMagicProtection(Enchantment.Rarity.RARE, EnchantmentMagicProtection.Type.FROST, InventoryUtils.ARMOUR_SLOTS).setRegistryName(Wizardry.MODID, "frost_protection"));
|
||||
event.getRegistry().register(new EnchantmentMagicProtection(Enchantment.Rarity.RARE, EnchantmentMagicProtection.Type.SHOCK, InventoryUtils.ARMOUR_SLOTS).setRegistryName(Wizardry.MODID, "shock_protection"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package electroblob.wizardry.spell;
|
||||
|
||||
import electroblob.wizardry.item.SpellActions;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.*;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -28,7 +25,7 @@ public class Arc extends SpellRay {
|
||||
@Override
|
||||
protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivingBase caster, Vec3d origin, int ticksInUse, SpellModifiers modifiers){
|
||||
|
||||
if(WizardryUtilities.isLiving(target)){
|
||||
if(EntityUtils.isLiving(target)){
|
||||
|
||||
if(world.isRemote){
|
||||
// Rather neatly, the entity can be set here and if it's null nothing will happen.
|
||||
|
||||
@@ -8,10 +8,10 @@ import electroblob.wizardry.item.SpellActions;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.EntitySpellcasterIllager;
|
||||
@@ -54,7 +54,7 @@ public class ArcaneJammer extends SpellRay {
|
||||
@Override
|
||||
protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivingBase caster, Vec3d origin, int ticksInUse, SpellModifiers modifiers){
|
||||
|
||||
if(WizardryUtilities.isLiving(target)){
|
||||
if(EntityUtils.isLiving(target)){
|
||||
if(!world.isRemote){
|
||||
((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.arcane_jammer,
|
||||
(int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)),
|
||||
|
||||
@@ -2,10 +2,7 @@ package electroblob.wizardry.spell;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.item.SpellActions;
|
||||
import electroblob.wizardry.util.AllyDesignationSystem;
|
||||
import electroblob.wizardry.util.NBTExtras;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.*;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -49,7 +46,7 @@ public class ArcaneLock extends SpellRay {
|
||||
if(caster instanceof EntityPlayer){
|
||||
|
||||
if(toggleLock(world, pos, (EntityPlayer)caster)){
|
||||
BlockPos otherHalf = WizardryUtilities.getConnectedChest(world, pos);
|
||||
BlockPos otherHalf = BlockUtils.getConnectedChest(world, pos);
|
||||
if(otherHalf != null) toggleLock(world, otherHalf, (EntityPlayer)caster);
|
||||
return true;
|
||||
}
|
||||
@@ -133,7 +130,7 @@ public class ArcaneLock extends SpellRay {
|
||||
if(!player.isCreative()) return false;
|
||||
if(Wizardry.settings.creativeBypassesArcaneLock) return true;
|
||||
MinecraftServer server = player.world.getMinecraftServer();
|
||||
return server != null && WizardryUtilities.isPlayerOp(player, server);
|
||||
return server != null && EntityUtils.isPlayerOp(player, server);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -3,10 +3,10 @@ package electroblob.wizardry.spell;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.item.SpellActions;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.util.BlockUtils;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -67,7 +67,7 @@ public class Banish extends SpellRay {
|
||||
|
||||
int x = MathHelper.floor(entity.posX + MathHelper.sin(angle) * radius);
|
||||
int z = MathHelper.floor(entity.posZ - MathHelper.cos(angle) * radius);
|
||||
Integer y = WizardryUtilities.getNearestFloor(world,
|
||||
Integer y = BlockUtils.getNearestFloor(world,
|
||||
new BlockPos(x, (int)entity.getEntityBoundingBox().minY, z), (int)radius);
|
||||
|
||||
if(world.isRemote){
|
||||
|
||||
@@ -3,9 +3,9 @@ package electroblob.wizardry.spell;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.item.SpellActions;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.util.BlockUtils;
|
||||
import electroblob.wizardry.util.RayTracer;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -90,7 +90,7 @@ public class Blink extends Spell {
|
||||
|
||||
int x = MathHelper.floor(target.posX + MathHelper.sin(angle) * radius);
|
||||
int z = MathHelper.floor(target.posZ - MathHelper.cos(angle) * radius);
|
||||
Integer y = WizardryUtilities.getNearestFloor(world, new BlockPos(caster), (int)radius);
|
||||
Integer y = BlockUtils.getNearestFloor(world, new BlockPos(caster), (int)radius);
|
||||
|
||||
// It's worth noting that on the client side, the cast() method only gets called if the server side
|
||||
// cast method succeeded, so you need not check any conditions for spawning particles.
|
||||
|
||||
@@ -3,12 +3,9 @@ package electroblob.wizardry.spell;
|
||||
import electroblob.wizardry.entity.construct.EntityBubble;
|
||||
import electroblob.wizardry.item.SpellActions;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.*;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -34,7 +31,7 @@ public class Bubble extends SpellRay {
|
||||
@Override
|
||||
protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivingBase caster, Vec3d origin, int ticksInUse, SpellModifiers modifiers){
|
||||
|
||||
if(WizardryUtilities.isLiving(target)){
|
||||
if(EntityUtils.isLiving(target)){
|
||||
|
||||
if(!world.isRemote){
|
||||
// Deals a small amount damage so the target counts as being hit by the caster
|
||||
|
||||
@@ -40,17 +40,17 @@ public class ChainLightning extends SpellRay {
|
||||
|
||||
// Anything can be attacked with the initial arc, because the player has control over where it goes. If they
|
||||
// hit a minion or an ally, it's their problem!
|
||||
if(WizardryUtilities.isLiving(target)){
|
||||
if(EntityUtils.isLiving(target)){
|
||||
|
||||
electrocute(world, caster, origin, target, getProperty(PRIMARY_DAMAGE).floatValue()
|
||||
* modifiers.get(SpellModifiers.POTENCY));
|
||||
|
||||
// Secondary chaining effect
|
||||
List<EntityLivingBase> secondaryTargets = WizardryUtilities.getEntitiesWithinRadius(
|
||||
List<EntityLivingBase> secondaryTargets = EntityUtils.getEntitiesWithinRadius(
|
||||
getProperty(SECONDARY_RANGE).doubleValue(), target.posX, target.posY + target.height / 2, target.posZ, world);
|
||||
|
||||
secondaryTargets.remove(target);
|
||||
secondaryTargets.removeIf(e -> !WizardryUtilities.isLiving(e));
|
||||
secondaryTargets.removeIf(e -> !EntityUtils.isLiving(e));
|
||||
secondaryTargets.removeIf(e -> !AllyDesignationSystem.isValidTarget(caster, e));
|
||||
if(secondaryTargets.size() > getProperty(SECONDARY_MAX_TARGETS).intValue())
|
||||
secondaryTargets = secondaryTargets.subList(0, getProperty(SECONDARY_MAX_TARGETS).intValue());
|
||||
@@ -62,13 +62,13 @@ public class ChainLightning extends SpellRay {
|
||||
|
||||
// Tertiary chaining effect
|
||||
|
||||
List<EntityLivingBase> tertiaryTargets = WizardryUtilities.getEntitiesWithinRadius(
|
||||
List<EntityLivingBase> tertiaryTargets = EntityUtils.getEntitiesWithinRadius(
|
||||
getProperty(TERTIARY_RANGE).doubleValue(), secondaryTarget.posX,
|
||||
secondaryTarget.posY + secondaryTarget.height / 2, secondaryTarget.posZ, world);
|
||||
|
||||
tertiaryTargets.remove(target);
|
||||
tertiaryTargets.removeAll(secondaryTargets);
|
||||
tertiaryTargets.removeIf(e -> !WizardryUtilities.isLiving(e));
|
||||
tertiaryTargets.removeIf(e -> !EntityUtils.isLiving(e));
|
||||
tertiaryTargets.removeIf(e -> !AllyDesignationSystem.isValidTarget(caster, e));
|
||||
if(tertiaryTargets.size() > getProperty(TERTIARY_MAX_TARGETS).intValue())
|
||||
tertiaryTargets = tertiaryTargets.subList(0, getProperty(TERTIARY_MAX_TARGETS).intValue());
|
||||
|
||||
@@ -6,11 +6,8 @@ import electroblob.wizardry.data.WizardData;
|
||||
import electroblob.wizardry.item.SpellActions;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.*;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
@@ -94,7 +91,7 @@ public class Charge extends Spell {
|
||||
|
||||
if(collided.isEmpty()) chargeTime--;
|
||||
else{
|
||||
WizardryUtilities.playSoundAtPlayer(player, SoundEvents.ENTITY_GENERIC_HURT, 1, 1);
|
||||
EntityUtils.playSoundAtPlayer(player, SoundEvents.ENTITY_GENERIC_HURT, 1, 1);
|
||||
chargeTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ import electroblob.wizardry.item.SpellActions;
|
||||
import electroblob.wizardry.registry.WizardryBlocks;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.tileentity.TileEntityTimer;
|
||||
import electroblob.wizardry.util.BlockUtils;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -42,7 +42,7 @@ public class Cobwebs extends SpellRay {
|
||||
|
||||
float radius = getProperty(EFFECT_RADIUS).floatValue() + 0.73f * blastUpgradeCount;
|
||||
|
||||
List<BlockPos> sphere = WizardryUtilities.getBlockSphere(pos, radius * modifiers.get(WizardryItems.blast_upgrade));
|
||||
List<BlockPos> sphere = BlockUtils.getBlockSphere(pos, radius * modifiers.get(WizardryItems.blast_upgrade));
|
||||
|
||||
for(BlockPos pos1 : sphere){
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@ package electroblob.wizardry.spell;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import electroblob.wizardry.item.IConjuredItem;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.util.InventoryUtils;
|
||||
import electroblob.wizardry.util.NBTExtras;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -33,10 +33,10 @@ public class ConjureArmour extends SpellConjuration {
|
||||
boolean flag = false;
|
||||
|
||||
// Used this rather than getArmorInventoryList because I need to access the slot itself
|
||||
for(EntityEquipmentSlot slot : WizardryUtilities.ARMOUR_SLOTS){
|
||||
for(EntityEquipmentSlot slot : InventoryUtils.ARMOUR_SLOTS){
|
||||
|
||||
if(caster.getItemStackFromSlot(slot).isEmpty() &&
|
||||
!WizardryUtilities.doesPlayerHaveItem(caster, SPECTRAL_ARMOUR_MAP.get(slot))){
|
||||
!InventoryUtils.doesPlayerHaveItem(caster, SPECTRAL_ARMOUR_MAP.get(slot))){
|
||||
|
||||
armour = new ItemStack(SPECTRAL_ARMOUR_MAP.get(slot));
|
||||
IConjuredItem.setDurationMultiplier(armour, modifiers.get(WizardryItems.duration_upgrade));
|
||||
|
||||
@@ -4,10 +4,10 @@ import electroblob.wizardry.item.SpellActions;
|
||||
import electroblob.wizardry.registry.WizardryBlocks;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.tileentity.TileEntityTimer;
|
||||
import electroblob.wizardry.util.BlockUtils;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -53,7 +53,7 @@ public class ConjureBlock extends SpellRay {
|
||||
.clr(0.75f, 1, 0.85f).spawn(world);
|
||||
}
|
||||
|
||||
if(WizardryUtilities.canBlockBeReplaced(world, pos)){
|
||||
if(BlockUtils.canBlockBeReplaced(world, pos)){
|
||||
|
||||
if(!world.isRemote){
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user