Changed formatting to have bracing on a new line
This commit is contained in:
parent
e5eddd6c45
commit
e48eedb874
189 changed files with 6092 additions and 4041 deletions
|
@ -5,23 +5,28 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemSigilAir extends ItemSigilBase {
|
||||
public class ItemSigilAir extends ItemSigilBase
|
||||
{
|
||||
|
||||
public ItemSigilAir() {
|
||||
public ItemSigilAir()
|
||||
{
|
||||
super("air", 50);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (!world.isRemote && !isUnusable(stack)) {
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (!world.isRemote && !isUnusable(stack))
|
||||
{
|
||||
Vec3 vec = player.getLookVec();
|
||||
double wantedVelocity = 1.7;
|
||||
|
||||
// TODO - Revisit after potions
|
||||
// if (player.isPotionActive(ModPotions.customPotionBoost)) {
|
||||
// int amplifier = player.getActivePotionEffect(ModPotions.customPotionBoost).getAmplifier();
|
||||
// wantedVelocity += (1 + amplifier) * (0.35);
|
||||
// }
|
||||
// if (player.isPotionActive(ModPotions.customPotionBoost)) {
|
||||
// int amplifier =
|
||||
// player.getActivePotionEffect(ModPotions.customPotionBoost).getAmplifier();
|
||||
// wantedVelocity += (1 + amplifier) * (0.35);
|
||||
// }
|
||||
|
||||
player.motionX = vec.xCoord * wantedVelocity;
|
||||
player.motionY = vec.yCoord * wantedVelocity;
|
||||
|
|
|
@ -18,13 +18,15 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
public class ItemSigilBase extends ItemBindable implements ISigil {
|
||||
public class ItemSigilBase extends ItemBindable implements ISigil
|
||||
{
|
||||
|
||||
protected final String tooltipBase;
|
||||
private final String name;
|
||||
private boolean toggleable;
|
||||
|
||||
public ItemSigilBase(String name, int lpUsed) {
|
||||
public ItemSigilBase(String name, int lpUsed)
|
||||
{
|
||||
super();
|
||||
|
||||
setUnlocalizedName(Constants.Mod.MODID + ".sigil." + name);
|
||||
|
@ -34,19 +36,22 @@ public class ItemSigilBase extends ItemBindable implements ISigil {
|
|||
this.tooltipBase = "tooltip.BloodMagic.sigil." + name + ".";
|
||||
}
|
||||
|
||||
public ItemSigilBase(String name) {
|
||||
public ItemSigilBase(String name)
|
||||
{
|
||||
this(name, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
super.onItemRightClick(stack, world, player);
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
super.onItemRightClick(stack, world, player);
|
||||
|
||||
return false;
|
||||
|
@ -54,7 +59,8 @@ public class ItemSigilBase extends ItemBindable implements ISigil {
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) {
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
|
||||
{
|
||||
|
||||
if (StatCollector.canTranslate(tooltipBase + "desc"))
|
||||
tooltip.add(TextHelper.localizeEffect(tooltipBase + "desc"));
|
||||
|
@ -62,28 +68,33 @@ public class ItemSigilBase extends ItemBindable implements ISigil {
|
|||
super.addInformation(stack, player, tooltip, advanced);
|
||||
}
|
||||
|
||||
public void setToggleable() {
|
||||
public void setToggleable()
|
||||
{
|
||||
this.toggleable = true;
|
||||
}
|
||||
|
||||
public boolean isUnusable(ItemStack stack) {
|
||||
public boolean isUnusable(ItemStack stack)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
return stack.getTagCompound().getBoolean(Constants.NBT.UNUSABLE);
|
||||
}
|
||||
|
||||
public ItemStack setUnusable(ItemStack stack, boolean unusable) {
|
||||
public ItemStack setUnusable(ItemStack stack, boolean unusable)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
stack.getTagCompound().setBoolean(Constants.NBT.UNUSABLE, unusable);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public boolean getActivated(ItemStack stack) {
|
||||
public boolean getActivated(ItemStack stack)
|
||||
{
|
||||
return stack.getItemDamage() > 0;
|
||||
}
|
||||
|
||||
public ItemStack setActivated(ItemStack stack, boolean activated) {
|
||||
public ItemStack setActivated(ItemStack stack, boolean activated)
|
||||
{
|
||||
if (this.toggleable)
|
||||
stack.setItemDamage(activated ? 1 : 0);
|
||||
|
||||
|
|
|
@ -10,14 +10,17 @@ import net.minecraft.util.BlockPos;
|
|||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemSigilBloodLight extends ItemSigilBase {
|
||||
public class ItemSigilBloodLight extends ItemSigilBase
|
||||
{
|
||||
|
||||
public ItemSigilBloodLight() {
|
||||
public ItemSigilBloodLight()
|
||||
{
|
||||
super("bloodLight", 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (BindableHelper.checkAndSetItemOwner(stack, player) && ItemBindable.syphonBatteries(stack, player, getLPUsed() * 5) && !world.isRemote)
|
||||
world.spawnEntityInWorld(new EntityBloodLight(world, player));
|
||||
|
||||
|
@ -25,13 +28,17 @@ public class ItemSigilBloodLight extends ItemSigilBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote) return false;
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (world.isRemote)
|
||||
return false;
|
||||
|
||||
if (BindableHelper.checkAndSetItemOwner(stack, player) && ItemBindable.syphonBatteries(stack, player, getLPUsed())) {
|
||||
if (BindableHelper.checkAndSetItemOwner(stack, player) && ItemBindable.syphonBatteries(stack, player, getLPUsed()))
|
||||
{
|
||||
BlockPos newPos = blockPos.offset(side);
|
||||
|
||||
if (world.isAirBlock(newPos)) {
|
||||
if (world.isAirBlock(newPos))
|
||||
{
|
||||
world.setBlockState(newPos, ModBlocks.bloodLight.getDefaultState());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,20 +6,24 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemSigilCompression extends ItemSigilToggleable {
|
||||
public class ItemSigilCompression extends ItemSigilToggleable
|
||||
{
|
||||
|
||||
public ItemSigilCompression() {
|
||||
public ItemSigilCompression()
|
||||
{
|
||||
super("compression", 200);
|
||||
}
|
||||
|
||||
//TODO REWRITE all compression stuff if someone has time
|
||||
//TODO for now, there is a semi-working system in place
|
||||
// TODO REWRITE all compression stuff if someone has time
|
||||
// TODO for now, there is a semi-working system in place
|
||||
|
||||
@Override
|
||||
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected) {
|
||||
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
|
||||
{
|
||||
ItemStack compressedStack = CompressionRegistry.compressInventory(player.inventory.mainInventory, world);
|
||||
|
||||
if (compressedStack != null) {
|
||||
if (compressedStack != null)
|
||||
{
|
||||
EntityItem entityItem = new EntityItem(world, player.posX, player.posY, player.posZ, compressedStack);
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
|
|
|
@ -14,33 +14,41 @@ import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
|||
import WayofTime.bloodmagic.util.ChatUtil;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
|
||||
public class ItemSigilDivination extends ItemSigilBase implements IAltarReader {
|
||||
public class ItemSigilDivination extends ItemSigilBase implements IAltarReader
|
||||
{
|
||||
|
||||
public ItemSigilDivination() {
|
||||
public ItemSigilDivination()
|
||||
{
|
||||
super("divination");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return stack;
|
||||
|
||||
super.onItemRightClick(stack, world, player);
|
||||
|
||||
if (!world.isRemote) {
|
||||
if (!world.isRemote)
|
||||
{
|
||||
MovingObjectPosition position = getMovingObjectPositionFromPlayer(world, player, false);
|
||||
int currentEssence = NetworkHelper.getSoulNetwork(BindableHelper.getOwnerUUID(stack), world).getCurrentEssence();
|
||||
|
||||
if (position == null) {
|
||||
if (position == null)
|
||||
{
|
||||
ChatUtil.sendNoSpam(player, new ChatComponentText(TextHelper.localize(tooltipBase + "currentEssence", currentEssence)));
|
||||
return stack;
|
||||
} else {
|
||||
if (position.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
} else
|
||||
{
|
||||
if (position.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
{
|
||||
|
||||
TileEntity tile = world.getTileEntity(position.getBlockPos());
|
||||
|
||||
if (tile != null && tile instanceof IBloodAltar) {
|
||||
if (tile != null && tile instanceof IBloodAltar)
|
||||
{
|
||||
IBloodAltar altar = (IBloodAltar) tile;
|
||||
int tier = altar.getTier().ordinal() + 1;
|
||||
currentEssence = altar.getCurrentBlood();
|
||||
|
@ -48,7 +56,8 @@ public class ItemSigilDivination extends ItemSigilBase implements IAltarReader {
|
|||
altar.checkTier();
|
||||
ChatUtil.sendNoSpam(player, TextHelper.localize(tooltipBase + "currentAltarTier", tier), TextHelper.localize(tooltipBase + "currentEssence", currentEssence), TextHelper.localize(tooltipBase + "currentAltarCapacity", capacity));
|
||||
|
||||
} else {
|
||||
} else
|
||||
{
|
||||
ChatUtil.sendNoSpam(player, TextHelper.localize(tooltipBase + "currentEssence", currentEssence));
|
||||
}
|
||||
|
||||
|
|
|
@ -6,14 +6,17 @@ import net.minecraft.potion.Potion;
|
|||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemSigilElementalAffinity extends ItemSigilToggleable {
|
||||
public class ItemSigilElementalAffinity extends ItemSigilToggleable
|
||||
{
|
||||
|
||||
public ItemSigilElementalAffinity() {
|
||||
public ItemSigilElementalAffinity()
|
||||
{
|
||||
super("elementalAffinity", 200);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected) {
|
||||
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
|
||||
{
|
||||
player.fallDistance = 0;
|
||||
player.extinguish();
|
||||
player.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 2, 1, true, false));
|
||||
|
|
|
@ -11,16 +11,20 @@ import net.minecraft.world.World;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemSigilEnderSeverance extends ItemSigilToggleable {
|
||||
public class ItemSigilEnderSeverance extends ItemSigilToggleable
|
||||
{
|
||||
|
||||
public ItemSigilEnderSeverance() {
|
||||
public ItemSigilEnderSeverance()
|
||||
{
|
||||
super("enderSeverance", 200);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected) {
|
||||
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
|
||||
{
|
||||
List<Entity> entityList = world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(player.posX - 4.5, player.posY - 4.5, player.posZ - 4.5, player.posX + 4.5, player.posY + 4.5, player.posZ + 4.5));
|
||||
for (Entity entity : entityList) {
|
||||
for (Entity entity : entityList)
|
||||
{
|
||||
if (entity instanceof EntityEnderman)
|
||||
((EntityEnderman) entity).addPotionEffect(new PotionEffect(ModPotions.planarBinding.id, 40, 0));
|
||||
}
|
||||
|
|
|
@ -6,14 +6,17 @@ import net.minecraft.potion.Potion;
|
|||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemSigilFastMiner extends ItemSigilToggleable {
|
||||
public class ItemSigilFastMiner extends ItemSigilToggleable
|
||||
{
|
||||
|
||||
public ItemSigilFastMiner() {
|
||||
public ItemSigilFastMiner()
|
||||
{
|
||||
super("fastMiner", 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected) {
|
||||
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 2, 0, true, false));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,15 +10,19 @@ import net.minecraft.util.EnumFacing;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
|
||||
public class ItemSigilGreenGrove extends ItemSigilToggleable {
|
||||
public class ItemSigilGreenGrove extends ItemSigilToggleable
|
||||
{
|
||||
|
||||
public ItemSigilGreenGrove() {
|
||||
public ItemSigilGreenGrove()
|
||||
{
|
||||
super("greenGrove", 150);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSigilUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (applyBonemeal(stack, world, blockPos)) {
|
||||
public boolean onSigilUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (applyBonemeal(stack, world, blockPos))
|
||||
{
|
||||
world.playAuxSFX(2005, blockPos, 0);
|
||||
return true;
|
||||
}
|
||||
|
@ -27,21 +31,27 @@ public class ItemSigilGreenGrove extends ItemSigilToggleable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSigilUpdate(ItemStack stack, World worldIn, EntityPlayer player, int itemSlot, boolean isSelected) {
|
||||
public void onSigilUpdate(ItemStack stack, World worldIn, EntityPlayer player, int itemSlot, boolean isSelected)
|
||||
{
|
||||
int range = 3;
|
||||
int verticalRange = 2;
|
||||
int posX = (int) Math.round(player.posX - 0.5f);
|
||||
int posY = (int) player.posY;
|
||||
int posZ = (int) Math.round(player.posZ - 0.5f);
|
||||
|
||||
for (int ix = posX - range; ix <= posX + range; ix++) {
|
||||
for (int iz = posZ - range; iz <= posZ + range; iz++) {
|
||||
for (int iy = posY - verticalRange; iy <= posY + verticalRange; iy++) {
|
||||
for (int ix = posX - range; ix <= posX + range; ix++)
|
||||
{
|
||||
for (int iz = posZ - range; iz <= posZ + range; iz++)
|
||||
{
|
||||
for (int iy = posY - verticalRange; iy <= posY + verticalRange; iy++)
|
||||
{
|
||||
BlockPos blockPos = new BlockPos(ix, iy, iz);
|
||||
Block block = worldIn.getBlockState(blockPos).getBlock();
|
||||
|
||||
if (block instanceof IPlantable || block instanceof IGrowable) {
|
||||
if (worldIn.rand.nextInt(50) == 0) {
|
||||
if (block instanceof IPlantable || block instanceof IGrowable)
|
||||
{
|
||||
if (worldIn.rand.nextInt(50) == 0)
|
||||
{
|
||||
IBlockState preBlockState = worldIn.getBlockState(blockPos);
|
||||
block.updateTick(worldIn, blockPos, worldIn.getBlockState(blockPos), worldIn.rand);
|
||||
|
||||
|
@ -54,21 +64,27 @@ public class ItemSigilGreenGrove extends ItemSigilToggleable {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target) {
|
||||
private boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target)
|
||||
{
|
||||
return worldIn instanceof net.minecraft.world.WorldServer && applyBonemeal(stack, worldIn, target, net.minecraftforge.common.util.FakePlayerFactory.getMinecraft((net.minecraft.world.WorldServer) worldIn));
|
||||
}
|
||||
|
||||
private boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target, EntityPlayer player) {
|
||||
private boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target, EntityPlayer player)
|
||||
{
|
||||
IBlockState iblockstate = worldIn.getBlockState(target);
|
||||
|
||||
int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, worldIn, target, iblockstate, stack);
|
||||
if (hook != 0) return hook > 0;
|
||||
if (hook != 0)
|
||||
return hook > 0;
|
||||
|
||||
if (iblockstate.getBlock() instanceof IGrowable) {
|
||||
if (iblockstate.getBlock() instanceof IGrowable)
|
||||
{
|
||||
IGrowable igrowable = (IGrowable) iblockstate.getBlock();
|
||||
|
||||
if (igrowable.canGrow(worldIn, target, iblockstate, worldIn.isRemote)) {
|
||||
if (!worldIn.isRemote) {
|
||||
if (igrowable.canGrow(worldIn, target, iblockstate, worldIn.isRemote))
|
||||
{
|
||||
if (!worldIn.isRemote)
|
||||
{
|
||||
if (igrowable.canUseBonemeal(worldIn, worldIn.rand, target, iblockstate))
|
||||
igrowable.grow(worldIn, worldIn.rand, target, iblockstate);
|
||||
}
|
||||
|
|
|
@ -6,14 +6,17 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemSigilHaste extends ItemSigilToggleable {
|
||||
public class ItemSigilHaste extends ItemSigilToggleable
|
||||
{
|
||||
|
||||
public ItemSigilHaste() {
|
||||
public ItemSigilHaste()
|
||||
{
|
||||
super("haste", 250);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected) {
|
||||
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(ModPotions.boost.id, 2, 0, true, false));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,40 +14,50 @@ import net.minecraftforge.fluids.FluidRegistry;
|
|||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
public class ItemSigilLava extends ItemSigilBase {
|
||||
public class ItemSigilLava extends ItemSigilBase
|
||||
{
|
||||
|
||||
public ItemSigilLava() {
|
||||
public ItemSigilLava()
|
||||
{
|
||||
super("lava", 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (!world.isRemote && !isUnusable(stack)) {
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (!world.isRemote && !isUnusable(stack))
|
||||
{
|
||||
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, false);
|
||||
|
||||
if (movingobjectposition != null) {
|
||||
if (movingobjectposition != null)
|
||||
{
|
||||
ItemStack ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(player, world, stack, movingobjectposition);
|
||||
if (ret != null) return ret;
|
||||
if (ret != null)
|
||||
return ret;
|
||||
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
{
|
||||
BlockPos blockpos = movingobjectposition.getBlockPos();
|
||||
|
||||
if (!world.isBlockModifiable(player, blockpos)) {
|
||||
if (!world.isBlockModifiable(player, blockpos))
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (!player.canPlayerEdit(blockpos.offset(movingobjectposition.sideHit), movingobjectposition.sideHit, stack)) {
|
||||
if (!player.canPlayerEdit(blockpos.offset(movingobjectposition.sideHit), movingobjectposition.sideHit, stack))
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
||||
BlockPos blockpos1 = blockpos.offset(movingobjectposition.sideHit);
|
||||
|
||||
if (!player.canPlayerEdit(blockpos1, movingobjectposition.sideHit, stack)) {
|
||||
if (!player.canPlayerEdit(blockpos1, movingobjectposition.sideHit, stack))
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (this.canPlaceLava(world, blockpos1) && syphonBatteries(stack, player, getLPUsed()) && this.tryPlaceLava(world, blockpos1)) {
|
||||
if (this.canPlaceLava(world, blockpos1) && syphonBatteries(stack, player, getLPUsed()) && this.tryPlaceLava(world, blockpos1))
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
@ -61,54 +71,66 @@ public class ItemSigilLava extends ItemSigilBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote || !BindableHelper.checkAndSetItemOwner(stack, player) || player.isSneaking() || isUnusable(stack)) {
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (world.isRemote || !BindableHelper.checkAndSetItemOwner(stack, player) || player.isSneaking() || isUnusable(stack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!world.canMineBlockBody(player, blockPos)) {
|
||||
if (!world.canMineBlockBody(player, blockPos))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
if (tile instanceof IFluidHandler) {
|
||||
if (tile instanceof IFluidHandler)
|
||||
{
|
||||
FluidStack fluid = new FluidStack(FluidRegistry.LAVA, 1000);
|
||||
int amount = ((IFluidHandler) tile).fill(side, fluid, false);
|
||||
|
||||
if (amount > 0 && syphonBatteries(stack, player, getLPUsed())) {
|
||||
if (amount > 0 && syphonBatteries(stack, player, getLPUsed()))
|
||||
{
|
||||
((IFluidHandler) tile).fill(side, fluid, true);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
// else if (tile instanceof TESocket) {
|
||||
// return false;
|
||||
// }
|
||||
// else if (tile instanceof TESocket) {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
BlockPos newPos = blockPos.offset(side);
|
||||
|
||||
if (!player.canPlayerEdit(newPos, side, stack)) {
|
||||
if (!player.canPlayerEdit(newPos, side, stack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.canPlaceLava(world, newPos) && syphonBatteries(stack, player, getLPUsed())) {
|
||||
if (this.canPlaceLava(world, newPos) && syphonBatteries(stack, player, getLPUsed()))
|
||||
{
|
||||
return this.tryPlaceLava(world, newPos);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canPlaceLava(World world, BlockPos blockPos) {
|
||||
if (!world.isAirBlock(blockPos) && world.getBlockState(blockPos).getBlock().getMaterial().isSolid()) {
|
||||
public boolean canPlaceLava(World world, BlockPos blockPos)
|
||||
{
|
||||
if (!world.isAirBlock(blockPos) && world.getBlockState(blockPos).getBlock().getMaterial().isSolid())
|
||||
{
|
||||
return false;
|
||||
} else if ((world.getBlockState(blockPos).getBlock() == Blocks.lava || world.getBlockState(blockPos).getBlock() == Blocks.flowing_lava) && world.getBlockState(blockPos).getBlock().getMetaFromState(world.getBlockState(blockPos)) == 0) {
|
||||
} else if ((world.getBlockState(blockPos).getBlock() == Blocks.lava || world.getBlockState(blockPos).getBlock() == Blocks.flowing_lava) && world.getBlockState(blockPos).getBlock().getMetaFromState(world.getBlockState(blockPos)) == 0)
|
||||
{
|
||||
return false;
|
||||
} else {
|
||||
} else
|
||||
{
|
||||
world.setBlockState(blockPos, Blocks.lava.getBlockState().getBaseState(), 3);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean tryPlaceLava(World worldIn, BlockPos pos) {
|
||||
public boolean tryPlaceLava(World worldIn, BlockPos pos)
|
||||
{
|
||||
Material material = worldIn.getBlockState(pos).getBlock().getMaterial();
|
||||
|
||||
return worldIn.isAirBlock(pos) && !material.isSolid();
|
||||
|
|
|
@ -9,14 +9,17 @@ import net.minecraft.world.World;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemSigilMagnetism extends ItemSigilToggleable {
|
||||
public class ItemSigilMagnetism extends ItemSigilToggleable
|
||||
{
|
||||
|
||||
public ItemSigilMagnetism() {
|
||||
public ItemSigilMagnetism()
|
||||
{
|
||||
super("magnetism", 50);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected) {
|
||||
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
|
||||
{
|
||||
int range = 5;
|
||||
int verticalRange = 5;
|
||||
float posX = Math.round(player.posX);
|
||||
|
@ -25,14 +28,18 @@ public class ItemSigilMagnetism extends ItemSigilToggleable {
|
|||
List<EntityItem> entities = player.worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.fromBounds(posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(range, verticalRange, range));
|
||||
List<EntityXPOrb> xpOrbs = player.worldObj.getEntitiesWithinAABB(EntityXPOrb.class, AxisAlignedBB.fromBounds(posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(range, verticalRange, range));
|
||||
|
||||
for (EntityItem entity : entities) {
|
||||
if (entity != null && !world.isRemote) {
|
||||
for (EntityItem entity : entities)
|
||||
{
|
||||
if (entity != null && !world.isRemote)
|
||||
{
|
||||
entity.onCollideWithPlayer(player);
|
||||
}
|
||||
}
|
||||
|
||||
for (EntityXPOrb xpOrb : xpOrbs) {
|
||||
if (xpOrb != null && !world.isRemote) {
|
||||
for (EntityXPOrb xpOrb : xpOrbs)
|
||||
{
|
||||
if (xpOrb != null && !world.isRemote)
|
||||
{
|
||||
xpOrb.onCollideWithPlayer(player);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,14 +9,17 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemSigilPhantomBridge extends ItemSigilToggleable {
|
||||
public class ItemSigilPhantomBridge extends ItemSigilToggleable
|
||||
{
|
||||
|
||||
public ItemSigilPhantomBridge() {
|
||||
public ItemSigilPhantomBridge()
|
||||
{
|
||||
super("phantomBridge", 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected) {
|
||||
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
|
||||
{
|
||||
if (!player.onGround && !player.isSneaking())
|
||||
return;
|
||||
|
||||
|
@ -33,21 +36,27 @@ public class ItemSigilPhantomBridge extends ItemSigilToggleable {
|
|||
int posY = (int) player.posY;
|
||||
int posZ = (int) Math.round(player.posZ - 0.5f);
|
||||
|
||||
for (int ix = posX - range; ix <= posX + range; ix++) {
|
||||
for (int iz = posZ - range; iz <= posZ + range; iz++) {
|
||||
for (int ix = posX - range; ix <= posX + range; ix++)
|
||||
{
|
||||
for (int iz = posZ - range; iz <= posZ + range; iz++)
|
||||
{
|
||||
BlockPos blockPos = new BlockPos(ix, posY + verticalOffset, iz);
|
||||
Block block = world.getBlockState(blockPos).getBlock();
|
||||
|
||||
if (world.isAirBlock(blockPos)) {
|
||||
if (world.isAirBlock(blockPos))
|
||||
{
|
||||
world.setBlockState(blockPos, ModBlocks.phantomBlock.getDefaultState(), 3);
|
||||
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
if (tile instanceof TilePhantomBlock) {
|
||||
if (tile instanceof TilePhantomBlock)
|
||||
{
|
||||
((TilePhantomBlock) tile).setDuration(100);
|
||||
}
|
||||
} else if (block == ModBlocks.phantomBlock) {
|
||||
} else if (block == ModBlocks.phantomBlock)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
if (tile instanceof TilePhantomBlock) {
|
||||
if (tile instanceof TilePhantomBlock)
|
||||
{
|
||||
((TilePhantomBlock) tile).setDuration(100);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,50 +15,61 @@ import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
|||
import WayofTime.bloodmagic.util.ChatUtil;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
|
||||
public class ItemSigilSeer extends ItemSigilBase implements IAltarReader {
|
||||
public class ItemSigilSeer extends ItemSigilBase implements IAltarReader
|
||||
{
|
||||
|
||||
public ItemSigilSeer() {
|
||||
public ItemSigilSeer()
|
||||
{
|
||||
super("seer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return stack;
|
||||
|
||||
super.onItemRightClick(stack, world, player);
|
||||
|
||||
if (!world.isRemote) {
|
||||
if (!world.isRemote)
|
||||
{
|
||||
MovingObjectPosition position = getMovingObjectPositionFromPlayer(world, player, false);
|
||||
int currentEssence = NetworkHelper.getSoulNetwork(BindableHelper.getOwnerUUID(stack), world).getCurrentEssence();
|
||||
|
||||
if (position == null) {
|
||||
if (position == null)
|
||||
{
|
||||
ChatUtil.sendNoSpam(player, new ChatComponentText(TextHelper.localize(tooltipBase + "currentEssence", currentEssence)));
|
||||
return stack;
|
||||
} else {
|
||||
if (position.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
} else
|
||||
{
|
||||
if (position.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
{
|
||||
|
||||
TileEntity tile = world.getTileEntity(position.getBlockPos());
|
||||
|
||||
if (tile != null && tile instanceof IBloodAltar) {
|
||||
if (tile != null && tile instanceof IBloodAltar)
|
||||
{
|
||||
IBloodAltar altar = (IBloodAltar) tile;
|
||||
int tier = altar.getTier().ordinal() + 1;
|
||||
currentEssence = altar.getCurrentBlood();
|
||||
int capacity = altar.getCapacity();
|
||||
altar.checkTier();
|
||||
if (tile instanceof IInventory) {
|
||||
if (((IInventory) tile).getStackInSlot(0) != null) {
|
||||
if (tile instanceof IInventory)
|
||||
{
|
||||
if (((IInventory) tile).getStackInSlot(0) != null)
|
||||
{
|
||||
int progress = altar.getProgress();
|
||||
int totalLiquidRequired = altar.getLiquidRequired() * ((IInventory) tile).getStackInSlot(0).stackSize;
|
||||
int consumptionRate = (int) (altar.getConsumptionRate() * (altar.getConsumptionMultiplier() + 1));
|
||||
ChatUtil.sendNoSpam(player, TextHelper.localize(tooltipBase + "currentAltarProgress", progress, totalLiquidRequired), TextHelper.localize(tooltipBase + "currentAltarConsumptionRate", consumptionRate), TextHelper.localize(tooltipBase + "currentAltarTier", tier), TextHelper.localize(tooltipBase + "currentEssence", currentEssence), TextHelper.localize(tooltipBase + "currentAltarCapacity", capacity));
|
||||
}
|
||||
else {
|
||||
} else
|
||||
{
|
||||
ChatUtil.sendNoSpam(player, TextHelper.localize(tooltipBase + "currentAltarTier", tier), TextHelper.localize(tooltipBase + "currentEssence", currentEssence), TextHelper.localize(tooltipBase + "currentAltarCapacity", capacity));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else
|
||||
{
|
||||
ChatUtil.sendNoSpam(player, TextHelper.localize(tooltipBase + "currentEssence", currentEssence));
|
||||
}
|
||||
|
||||
|
|
|
@ -9,24 +9,31 @@ import net.minecraft.util.BlockPos;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
|
||||
public class ItemSigilSuppression extends ItemSigilToggleable {
|
||||
public class ItemSigilSuppression extends ItemSigilToggleable
|
||||
{
|
||||
|
||||
public ItemSigilSuppression() {
|
||||
public ItemSigilSuppression()
|
||||
{
|
||||
super("suppression", 400);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected) {
|
||||
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
|
||||
{
|
||||
int x = (int) player.posX;
|
||||
int y = (int) player.posY;
|
||||
int z = (int) player.posZ;
|
||||
final int radius = 5;
|
||||
final int refresh = 100;
|
||||
|
||||
for (int i = -radius; i <= radius; i++) {
|
||||
for (int j = -radius; j <= radius; j++) {
|
||||
for (int k = -radius; k <= radius; k++) {
|
||||
if (i * i + j * j + k * k >= (radius + 0.50f) * (radius + 0.50f)) {
|
||||
for (int i = -radius; i <= radius; i++)
|
||||
{
|
||||
for (int j = -radius; j <= radius; j++)
|
||||
{
|
||||
for (int k = -radius; k <= radius; k++)
|
||||
{
|
||||
if (i * i + j * j + k * k >= (radius + 0.50f) * (radius + 0.50f))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -35,7 +42,8 @@ public class ItemSigilSuppression extends ItemSigilToggleable {
|
|||
|
||||
if (isBlockLiquid(block) && world.getTileEntity(blockPos) == null)
|
||||
TileSpectralBlock.createSpectralBlock(world, blockPos, refresh);
|
||||
else {
|
||||
else
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
if (tile instanceof TileSpectralBlock)
|
||||
((TileSpectralBlock) tile).resetDuration(refresh);
|
||||
|
@ -45,7 +53,8 @@ public class ItemSigilSuppression extends ItemSigilToggleable {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isBlockLiquid(Block block) {
|
||||
private boolean isBlockLiquid(Block block)
|
||||
{
|
||||
return (block instanceof IFluidBlock || block.getMaterial().isLiquid());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,16 +15,19 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemSigilToggleable extends ItemSigilBase {
|
||||
public class ItemSigilToggleable extends ItemSigilBase
|
||||
{
|
||||
|
||||
public ItemSigilToggleable(String name, int lpUsed) {
|
||||
public ItemSigilToggleable(String name, int lpUsed)
|
||||
{
|
||||
super(name, lpUsed);
|
||||
setToggleable();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) {
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
|
||||
{
|
||||
super.addInformation(stack, player, tooltip, advanced);
|
||||
if (getActivated(stack))
|
||||
tooltip.add(TextHelper.localize("tooltip.BloodMagic.activated"));
|
||||
|
@ -33,8 +36,10 @@ public class ItemSigilToggleable extends ItemSigilBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (!world.isRemote && !isUnusable(stack)) {
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (!world.isRemote && !isUnusable(stack))
|
||||
{
|
||||
if (player.isSneaking())
|
||||
setActivated(stack, !getActivated(stack));
|
||||
if (getActivated(stack) && ItemBindable.syphonBatteries(stack, player, getLPUsed()))
|
||||
|
@ -45,22 +50,28 @@ public class ItemSigilToggleable extends ItemSigilBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (BindableHelper.checkAndSetItemOwner(stack, player) && ItemBindable.syphonBatteries(stack, player, getLPUsed()))
|
||||
return onSigilUseFirst(stack, player, world, blockPos, side, hitX, hitY, hitZ);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onSigilUseFirst(ItemStack itemStack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onSigilUseFirst(ItemStack itemStack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
|
||||
if (!worldIn.isRemote && entityIn instanceof EntityPlayerMP && getActivated(stack)) {
|
||||
if (worldIn.getWorldTime() % 100 == 0) {
|
||||
if (!ItemBindable.syphonBatteries(stack, (EntityPlayer) entityIn, getLPUsed())) {
|
||||
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected)
|
||||
{
|
||||
if (!worldIn.isRemote && entityIn instanceof EntityPlayerMP && getActivated(stack))
|
||||
{
|
||||
if (worldIn.getWorldTime() % 100 == 0)
|
||||
{
|
||||
if (!ItemBindable.syphonBatteries(stack, (EntityPlayer) entityIn, getLPUsed()))
|
||||
{
|
||||
setActivated(stack, false);
|
||||
}
|
||||
}
|
||||
|
@ -69,5 +80,7 @@ public class ItemSigilToggleable extends ItemSigilBase {
|
|||
}
|
||||
}
|
||||
|
||||
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected) {}
|
||||
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,42 +12,54 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
public class ItemSigilVoid extends ItemSigilBase {
|
||||
public class ItemSigilVoid extends ItemSigilBase
|
||||
{
|
||||
|
||||
public ItemSigilVoid() {
|
||||
public ItemSigilVoid()
|
||||
{
|
||||
super("void", 50);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (!world.isRemote && !isUnusable(stack)) {
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (!world.isRemote && !isUnusable(stack))
|
||||
{
|
||||
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true);
|
||||
|
||||
if (movingobjectposition != null) {
|
||||
if (movingobjectposition != null)
|
||||
{
|
||||
ItemStack ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(player, world, stack, movingobjectposition);
|
||||
if (ret != null) return ret;
|
||||
if (ret != null)
|
||||
return ret;
|
||||
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
{
|
||||
BlockPos blockpos = movingobjectposition.getBlockPos();
|
||||
|
||||
if (!world.isBlockModifiable(player, blockpos)) {
|
||||
if (!world.isBlockModifiable(player, blockpos))
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (!player.canPlayerEdit(blockpos.offset(movingobjectposition.sideHit), movingobjectposition.sideHit, stack)) {
|
||||
if (!player.canPlayerEdit(blockpos.offset(movingobjectposition.sideHit), movingobjectposition.sideHit, stack))
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (!player.canPlayerEdit(blockpos, movingobjectposition.sideHit, stack)) {
|
||||
if (!player.canPlayerEdit(blockpos, movingobjectposition.sideHit, stack))
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (world.getBlockState(blockpos).getBlock().getMaterial().isLiquid() && syphonBatteries(stack, player, getLPUsed())) {
|
||||
if (world.getBlockState(blockpos).getBlock().getMaterial().isLiquid() && syphonBatteries(stack, player, getLPUsed()))
|
||||
{
|
||||
world.setBlockToAir(blockpos);
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
@ -59,20 +71,25 @@ public class ItemSigilVoid extends ItemSigilBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote || !BindableHelper.checkAndSetItemOwner(stack, player) || player.isSneaking() || isUnusable(stack)) {
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (world.isRemote || !BindableHelper.checkAndSetItemOwner(stack, player) || player.isSneaking() || isUnusable(stack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!world.canMineBlockBody(player, blockPos)) {
|
||||
if (!world.canMineBlockBody(player, blockPos))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
if (tile instanceof IFluidHandler) {
|
||||
if (tile instanceof IFluidHandler)
|
||||
{
|
||||
FluidStack amount = ((IFluidHandler) tile).drain(side, 1000, false);
|
||||
|
||||
if (amount != null && amount.amount > 0 && syphonBatteries(stack, player, getLPUsed())) {
|
||||
if (amount != null && amount.amount > 0 && syphonBatteries(stack, player, getLPUsed()))
|
||||
{
|
||||
((IFluidHandler) tile).drain(side, 1000, true);
|
||||
return true;
|
||||
}
|
||||
|
@ -82,11 +99,13 @@ public class ItemSigilVoid extends ItemSigilBase {
|
|||
|
||||
BlockPos newPos = blockPos.offset(side);
|
||||
|
||||
if (!player.canPlayerEdit(newPos, side, stack)) {
|
||||
if (!player.canPlayerEdit(newPos, side, stack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (world.getBlockState(newPos).getBlock() instanceof IFluidBlock && syphonBatteries(stack, player, getLPUsed())) {
|
||||
if (world.getBlockState(newPos).getBlock() instanceof IFluidBlock && syphonBatteries(stack, player, getLPUsed()))
|
||||
{
|
||||
world.setBlockToAir(newPos);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -15,39 +15,50 @@ import net.minecraftforge.fluids.FluidRegistry;
|
|||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
public class ItemSigilWater extends ItemSigilBase {
|
||||
public class ItemSigilWater extends ItemSigilBase
|
||||
{
|
||||
|
||||
public ItemSigilWater() {
|
||||
public ItemSigilWater()
|
||||
{
|
||||
super("water", 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (!world.isRemote && !isUnusable(stack)) {
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (!world.isRemote && !isUnusable(stack))
|
||||
{
|
||||
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, false);
|
||||
|
||||
if (movingobjectposition != null) {
|
||||
if (movingobjectposition != null)
|
||||
{
|
||||
ItemStack ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(player, world, stack, movingobjectposition);
|
||||
if (ret != null) return ret;
|
||||
if (ret != null)
|
||||
return ret;
|
||||
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
{
|
||||
BlockPos blockpos = movingobjectposition.getBlockPos();
|
||||
|
||||
if (!world.isBlockModifiable(player, blockpos)) {
|
||||
if (!world.isBlockModifiable(player, blockpos))
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (!player.canPlayerEdit(blockpos.offset(movingobjectposition.sideHit), movingobjectposition.sideHit, stack)) {
|
||||
if (!player.canPlayerEdit(blockpos.offset(movingobjectposition.sideHit), movingobjectposition.sideHit, stack))
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
|
||||
BlockPos blockpos1 = blockpos.offset(movingobjectposition.sideHit);
|
||||
|
||||
if (!player.canPlayerEdit(blockpos1, movingobjectposition.sideHit, stack)) {
|
||||
if (!player.canPlayerEdit(blockpos1, movingobjectposition.sideHit, stack))
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (this.canPlaceWater(world, blockpos1) && syphonBatteries(stack, player, getLPUsed()) && this.tryPlaceWater(world, blockpos1)) {
|
||||
if (this.canPlaceWater(world, blockpos1) && syphonBatteries(stack, player, getLPUsed()) && this.tryPlaceWater(world, blockpos1))
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
@ -61,72 +72,90 @@ public class ItemSigilWater extends ItemSigilBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote || !BindableHelper.checkAndSetItemOwner(stack, player) || player.isSneaking() || isUnusable(stack)) {
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (world.isRemote || !BindableHelper.checkAndSetItemOwner(stack, player) || player.isSneaking() || isUnusable(stack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!world.canMineBlockBody(player, blockPos)) {
|
||||
if (!world.canMineBlockBody(player, blockPos))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
if (tile instanceof IFluidHandler) {
|
||||
if (tile instanceof IFluidHandler)
|
||||
{
|
||||
FluidStack fluid = new FluidStack(FluidRegistry.WATER, 1000);
|
||||
int amount = ((IFluidHandler) tile).fill(side, fluid, false);
|
||||
|
||||
if (amount > 0 && syphonBatteries(stack, player, getLPUsed())) {
|
||||
if (amount > 0 && syphonBatteries(stack, player, getLPUsed()))
|
||||
{
|
||||
((IFluidHandler) tile).fill(side, fluid, true);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
// else if (tile instanceof TESocket) {
|
||||
// return false;
|
||||
// }
|
||||
// else if (tile instanceof TESocket) {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
BlockPos newPos = blockPos.offset(side);
|
||||
|
||||
if (!player.canPlayerEdit(newPos, side, stack)) {
|
||||
if (!player.canPlayerEdit(newPos, side, stack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.canPlaceWater(world, newPos) && syphonBatteries(stack, player, getLPUsed())) {
|
||||
if (this.canPlaceWater(world, newPos) && syphonBatteries(stack, player, getLPUsed()))
|
||||
{
|
||||
return this.tryPlaceWater(world, newPos);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canPlaceWater(World world, BlockPos blockPos) {
|
||||
if (!world.isAirBlock(blockPos) && world.getBlockState(blockPos).getBlock().getMaterial().isSolid()) {
|
||||
public boolean canPlaceWater(World world, BlockPos blockPos)
|
||||
{
|
||||
if (!world.isAirBlock(blockPos) && world.getBlockState(blockPos).getBlock().getMaterial().isSolid())
|
||||
{
|
||||
return false;
|
||||
} else if ((world.getBlockState(blockPos).getBlock() == Blocks.water || world.getBlockState(blockPos).getBlock() == Blocks.flowing_water) && world.getBlockState(blockPos).getBlock().getMetaFromState(world.getBlockState(blockPos)) == 0) {
|
||||
} else if ((world.getBlockState(blockPos).getBlock() == Blocks.water || world.getBlockState(blockPos).getBlock() == Blocks.flowing_water) && world.getBlockState(blockPos).getBlock().getMetaFromState(world.getBlockState(blockPos)) == 0)
|
||||
{
|
||||
return false;
|
||||
} else {
|
||||
} else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean tryPlaceWater(World worldIn, BlockPos pos) {
|
||||
public boolean tryPlaceWater(World worldIn, BlockPos pos)
|
||||
{
|
||||
|
||||
Material material = worldIn.getBlockState(pos).getBlock().getMaterial();
|
||||
boolean flag = !material.isSolid();
|
||||
|
||||
if (!worldIn.isAirBlock(pos) && !flag) {
|
||||
if (!worldIn.isAirBlock(pos) && !flag)
|
||||
{
|
||||
return false;
|
||||
} else {
|
||||
if (worldIn.provider.doesWaterVaporize()) {
|
||||
} else
|
||||
{
|
||||
if (worldIn.provider.doesWaterVaporize())
|
||||
{
|
||||
int i = pos.getX();
|
||||
int j = pos.getY();
|
||||
int k = pos.getZ();
|
||||
worldIn.playSoundEffect((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), "random.fizz", 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F);
|
||||
|
||||
for (int l = 0; l < 8; ++l) {
|
||||
for (int l = 0; l < 8; ++l)
|
||||
{
|
||||
worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, (double) i + Math.random(), (double) j + Math.random(), (double) k + Math.random(), 0.0D, 0.0D, 0.0D, 0);
|
||||
}
|
||||
} else {
|
||||
if (!worldIn.isRemote && flag && !material.isLiquid()) {
|
||||
} else
|
||||
{
|
||||
if (!worldIn.isRemote && flag && !material.isLiquid())
|
||||
{
|
||||
worldIn.destroyBlock(pos, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,14 +6,17 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemSigilWhirlwind extends ItemSigilToggleable {
|
||||
public class ItemSigilWhirlwind extends ItemSigilToggleable
|
||||
{
|
||||
|
||||
public ItemSigilWhirlwind() {
|
||||
public ItemSigilWhirlwind()
|
||||
{
|
||||
super("whirlwind", 250);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected) {
|
||||
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(ModPotions.whirlwind.id, 2, 0, true, false));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue